[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: Jason Andryuk <jason.andryuk@xxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Fri, 29 Aug 2025 08:59:07 +0200
  • Autocrypt: addr=jbeulich@xxxxxxxx; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2XbGWIUrZrd70x1eAP9QE3P79Y2oLrsCgbZJfEwCgvz9JjGmQqQkRiTVzlZVCJYcyGGsD /0tbFCzD2h20ahe8rC1gbb3K3qk+LpBtvjBu1RY9drYk0NymiGbJWZgab6t1jM7sk2vuf0Py O9Hf9XBmK0uE9IgMaiCpc32XV9oASz6UJebwkX+zF2jG5I1BfnO9g7KlotcA/v5ClMjgo6Gl MDY4HxoSRu3i1cqqSDtVlt+AOVBJBACrZcnHAUSuCXBPy0jOlBhxPqRWv6ND4c9PH1xjQ3NP nxJuMBS8rnNg22uyfAgmBKNLpLgAGVRMZGaGoJObGf72s6TeIqKJo/LtggAS9qAUiuKVnygo 3wjfkS9A3DRO+SpU7JqWdsveeIQyeyEJ/8PTowmSQLakF+3fote9ybzd880fSmFuIEJldWxp Y2ggPGpiZXVsaWNoQHN1c2UuY29tPsJgBBMRAgAgBQJZN5xEAhsDBgsJCAcDAgQVAggDBBYC AwECHgECF4AACgkQoDSui/t3IH4J+wCfQ5jHdEjCRHj23O/5ttg9r9OIruwAn3103WUITZee e7Sbg12UgcQ5lv7SzsFNBFk3nEQQCACCuTjCjFOUdi5Nm244F+78kLghRcin/awv+IrTcIWF hUpSs1Y91iQQ7KItirz5uwCPlwejSJDQJLIS+QtJHaXDXeV6NI0Uef1hP20+y8qydDiVkv6l IreXjTb7DvksRgJNvCkWtYnlS3mYvQ9NzS9PhyALWbXnH6sIJd2O9lKS1Mrfq+y0IXCP10eS FFGg+Av3IQeFatkJAyju0PPthyTqxSI4lZYuJVPknzgaeuJv/2NccrPvmeDg6Coe7ZIeQ8Yj t0ARxu2xytAkkLCel1Lz1WLmwLstV30g80nkgZf/wr+/BXJW/oIvRlonUkxv+IbBM3dX2OV8 AmRv1ySWPTP7AAMFB/9PQK/VtlNUJvg8GXj9ootzrteGfVZVVT4XBJkfwBcpC/XcPzldjv+3 HYudvpdNK3lLujXeA5fLOH+Z/G9WBc5pFVSMocI71I8bT8lIAzreg0WvkWg5V2WZsUMlnDL9 mpwIGFhlbM3gfDMs7MPMu8YQRFVdUvtSpaAs8OFfGQ0ia3LGZcjA6Ik2+xcqscEJzNH+qh8V m5jjp28yZgaqTaRbg3M/+MTbMpicpZuqF4rnB0AQD12/3BNWDR6bmh+EkYSMcEIpQmBM51qM EKYTQGybRCjpnKHGOxG0rfFY1085mBDZCH5Kx0cl0HVJuQKC+dV2ZY5AqjcKwAxpE75MLFkr wkkEGBECAAkFAlk3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL
  • 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: Fri, 29 Aug 2025 06:59:26 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 28.08.2025 19:16, Jason Andryuk wrote:
> 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?

a 0x100-0x1ff
b 0x100-0x10f
c 0x110-0x11f

If we inserted an "end" label based on a's size, that would effectively be
c's 2nd end symbol (and there may not be two "end" symbols in a row, unless
we want to further complicate the symbol lookup logic).

Jan



 


Rackspace

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