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

Re: [PATCH v4 05/14] x86/traps: Move traps_init() earlier on boot


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Date: Mon, 2 Mar 2026 15:32:19 +0000
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • 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=fxurID/PMQliVdMIOqTPv+iWoH0RGormiilKlBtxqpo=; b=ss3N2kApwRRv9mBiOQ966o0zTdNDv2sh1KWXAgDbWUEEh5J5i8z0UNo6VwQZjMC2Q+84HVdvFhbdJXYDYKxLDoFpTPALkCCnCzGSm2Vh3AaFazzMiB5Whl81Wyuwn2N/2p6brnSUBST3dE7/FiJDZzzHAJznFVpx6BsWVtkRNmQnz2wxnPI1ClG266b0N8cn+aGmu/ubX4e4PdcMkkys/6/xKdGIABslaKNoo6dMawOv203rbIYAlOncj4F+6J7h3zA6G3eC7SFT7gVDG2kYMOXaI5wzxu5vKLkxy5Qp2Mdf99S6QKBpN0FzloT7FUjzrqeRAIkupxAImvhN4T1dNg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ygBhNx6CZ0JUoXJHLOOj5oSdWIskgbL2/921NrTywXf28Jw5QO25znUzUJ8b5nj4OsfNAmIM6MzQ2myA83Jq5iKhfQPIRqvo6teA1LdWJcmWV+16h/0veX4WW2A5UEkCAzLNziyiEzTBoBTnrD/Ew6iN41uXwqbp2x+ssl5IumKfsPYdDvKI1I6KOpVR9lB5evCMKjVZqJK/8w18HGA8lSyxnLEJes8YZ9iMiZHLdda6LIKCwUnFzMT2dmpFZelosqdUxshHZaMfhm6Fj/zdfDE2hjMxfEQlyyoaSPHu+GhHwlXHK5euPlp/R5ReOk4Z41Ma+Syu5RCMQtTxTRGYaA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Mon, 02 Mar 2026 15:32:49 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 02/03/2026 11:39 am, Jan Beulich wrote:
> On 28.02.2026 00:16, Andrew Cooper wrote:
>> We wish to make use of opt_fred earlier on boot, which involves moving
>> traps_init() earlier, but this comes with several ordering complications.
>>
>> The feature word containing FRED needs collecting in early_cpu_init(), and
>> legacy_syscall_init() cannot be called that early because it relies on the
>> stubs being allocated, yet must be called ahead of cpu_init() so the SYSCALL
>> linkage MSRs are set up before being cached.
>>
>> Delaying legacy_syscall_init() is easy enough based on a system_state check.
>> Reuse bsp_traps_reinit() to cause a call to legacy_syscall_init() to occur at
>> the same point as previously.
>>
>> Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
> Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>

Thanks.

>
> Irrespective ...
>
>> @@ -359,7 +363,13 @@ void __init bsp_traps_reinit(void)
>>   */
>>  void percpu_traps_init(void)
>>  {
>> -    legacy_syscall_init();
>> +    /*
>> +     * Skip legacy_syscall_init() at early boot.  It requires the stubs 
>> being
>> +     * allocated, limiting the placement of the traps_init() call, and gets
>> +     * re-done anyway by bsp_traps_reinit().
>> +     */
>> +    if ( system_state > SYS_STATE_early_boot )
>> +        legacy_syscall_init();
> ... I wonder if simply pulling this out of this function wouldn't be slightly
> neater. To me at least, syscall/sysenter are only a remote from of "trap".

I'm not a massive fan of how we (well, Linux) uses "traps" when it's
different from x86 term of the same name.

But, setting up the syscall stub has always been part of traps_init(),
and for FRED it's combined.


As noted, this changes again as FRED gets plumbed in, so really you need
to look at patch 8.  I'm not a massive fan of how it's ended up, but I
can't think of anything simpler.

~Andrew



 


Rackspace

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