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

Re: [PATCH v5 2/8] x86: annotate entry points with type and size


  • To: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Fri, 19 Jan 2024 09:06:45 +0100
  • 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: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>
  • Delivery-date: Fri, 19 Jan 2024 08:07:06 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 18.01.2024 18:45, Roger Pau Monné wrote:
> On Mon, Jan 15, 2024 at 03:34:56PM +0100, Jan Beulich wrote:
>> @@ -625,7 +627,7 @@ ENTRY(dom_crash_sync_extable)
>>  
>>  /* No special register assumptions. */
>>  #ifdef CONFIG_PV
>> -ENTRY(continue_pv_domain)
>> +FUNC(continue_pv_domain)
>>          ENDBR64
>>          call  check_wakeup_from_wait
>>  ret_from_intr:
>> @@ -640,26 +642,28 @@ ret_from_intr:
>>  #else
>>          jmp   test_all_events
>>  #endif
>> +END(continue_pv_domain)
>>  #else
>> -ret_from_intr:
>> +FUNC_LOCAL(ret_from_intr, 0)
> 
> Why does this need to have an alignment of 0? There's no fallthrough
> of previous code AFAICT.

It doesn't have to, but see the description for where I thought it would
make sense to newly introduce alignment; I simply didn't want to go too
far with such changes leading to generated code being altered. This (and
the other cases below) weren't in that group. Without ...

>>          ASSERT_CONTEXT_IS_XEN

... this I would be strongly inclined to switch ...

>>          jmp   restore_all_xen

... to

#define ret_from_intr restore_all_xen

anyway. And perhaps we ought to change the "#else" above to
"#elif !defined(NDEBUG)", at which point I'd say alignment isn't required
here at all.

>> @@ -713,12 +718,14 @@ ENTRY(common_interrupt)
>>          mov   %r15, STACK_CPUINFO_FIELD(xen_cr3)(%r14)
>>          mov   %bl, STACK_CPUINFO_FIELD(use_pv_cr3)(%r14)
>>          jmp ret_from_intr
>> +END(common_interrupt)
>>  
>> -ENTRY(entry_PF)
>> +FUNC(entry_PF)
>>          ENDBR64
>>          movl  $X86_EXC_PF, 4(%rsp)
>> +END(entry_PF)
>>  /* No special register assumptions. */
>> -GLOBAL(handle_exception)
>> +FUNC(handle_exception, 0)
> 
> Given patch 8/8 that enables support for placing FUNC() into separate
> sections, the fallthrough arrangement here with entry_PF is no longer
> guaranteed, as the linker could re-order the sections and thus
> entry_PF could fallthrough into another text section?
> 
> IOW: entry_PF needs a "jmp handle_exception", and then
> handle_exception itself can be padded as required by the default
> alignment?

Oh, yes, very much so. Thanks for noticing. I'll do that in the later
patch, though.

>> @@ -1149,7 +1176,7 @@ GLOBAL(autogen_entrypoints)
>>          .endm
>>  
>>          .popsection
>> -autogen_stubs: /* Automatically generated stubs. */
>> +FUNC_LOCAL(autogen_stubs, 0) /* Automatically generated stubs. */
> 
> Won't it be good to align the stubs?  As that's possible to make them
> faster?

Well. If I used default alignment here, it would be the 1st stub only
which gains alignment. I'd view that as simply inconsistent. You'll
find there already is an ALIGN inside the .rept below. That covers
only certain cases, but intentionally so, I believe: it's only entry
points which shouldn't be reached anyway which get no alignment. So
yes, in this case I clearly think there wants to explicitly be no
alignment here.

Jan



 


Rackspace

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