[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 3/5] symbols: arrange to know where functions end


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Jason Andryuk <jason.andryuk@xxxxxxx>
  • Date: Thu, 28 Aug 2025 13:16:25 -0400
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=suse.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=BW4cJHaShagW13xBVGHYT6aHXe8PZHmg3np/hi9J5TA=; b=R4eZArnSc0lHcYraeVy/O1sdSlxED8jMea34h1GWw7zdCLHY34W1BfW8pGtOTIZ9baE+k4rrlLCHwSZHpgX0d2P3Bde//TH+0KBdFsBF/fqVNT9rnn3gzNkTu5a63lnakrdC2YxUTSYnXmuJENDXEEA+1IL/J6hanxZL2JLa4tcM0VsDntIDwkTLxQGD4YxBqlJwed0NrmcdY0bYVmi+mYhxQrjLYJFDxz3DIMyXJSWcRLSRMIkBeCYtPQwFwp8iRywsiWj9rJQYnQkATTdWXY65N2fHIZ2bKzcZ/NcSR8FQBm+w98zssqGkyLB8PhTEawqtMvfnQ64YZfHSdf2FXA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=oiW6Gt8nLbHF91SiMLbv+ybUihk7i6sMupfXnZ02lXGoGPTiDtXyNxflSQuJjY1/96nXuZzkV+kIuSBBKcf0ud9gc9CK/0NkVmkeb4oxLjt1BACdfTVR0nPWuQIC/Q5JHKZfbC5P2h88lM1jK7WujiAYZzhf1QF5QtzrKERH0zPzrXrwh/FqImKawz2919YZgoiu+B+Nb0zOiyhIzbuYzRt5lUsnO9A/hBMRaowfwz1XAsx7B9bsCx3yhXkwrKX/fRiGgwwIm2BiiwaBnQ+vQKNkywDTPRGBArq6fndiD9bvJpywhZBwe+7AVymLZD+EBmBxe3a9xUn1kQSwMctk1w==
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Thu, 28 Aug 2025 17:16:43 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 2025-08-28 12:11, Jan Beulich wrote:
On 28.08.2025 09:28, Jan Beulich wrote:
On 28.08.2025 03:03, Jason Andryuk wrote:
On 2025-04-02 09:58, Jan Beulich wrote:
--- a/xen/tools/symbols.c
+++ b/xen/tools/symbols.c

@@ -318,24 +334,42 @@ static void write_src(void)
        printf("#else\n");
        output_label("symbols_offsets");
        printf("#endif\n");
-       for (i = 0; i < table_cnt; i++) {
+       for (i = 0, ends = 0; i < table_cnt; i++) {
                printf("\tPTR\t%#llx - SYMBOLS_ORIGIN\n", table[i].addr);
+
+               table[i].addr_idx = i + ends;
+
+               if (!want_symbol_end(i)) {
+                       /* If there's another symbol at the same address,
+                        * propagate this symbol's size if the next one has
+                        * no size, or if the next one's size is larger. */

Why do we want to shrink the next symbol's size?

First (see related post-commit-message remarks): In principle section symbols
could come with a size, too. That would break everything as long as we don't
strip those.

The main reason though is that imo smallest granularity is what we want here,
together with predictability. One symbol with a huge size could cover
multiple other symbols with smaller sizes. We could omit that part of the
change here, but then the processing in the hypervisor would need to change,
to fish out the "best suitable" symbol when dealing with multiple ones at the
same address. Other changes may then also be needed to the tool, to have such
symbols come in a well-defined order (to keep the then-new code in the
hypervisor as simple as possible). Look for "aliased symbol" in
common/symbols.c to see how simplistic respective code is right now.

Furthermore remember that we can't record sizes, but instead we insert fake
symbols. Obviously there can be only one (at least in the present scheme).
If we used too large a size, chances would increase that the end symbol (in
the sorted table) would have to live past some other symbol, thus becoming
that one's "end".

The scenario I thought about is something like:

a 0x100-0x10f
b 0x100-0x1ff
c 0x200-0x2ff

If you shrink b, you are creating a hole that would otherwise be assigned to b.

But I agree avoiding huge sizes covering multiple small variables would better be avoided.

Do you have concrete examples to help illustrate the problem?

Regards,
Jason



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.