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

Re: [PATCH v3 07/22] x86/traps: Alter switch_stack_and_jump() for FRED mode


  • To: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Fri, 13 Feb 2026 19:25:15 +0100
  • 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=PEfukp+hq7IEkNLnwMdr9XX3LAeR8fYU3ZvuXEU0c+U=; b=jAtZfo2i71qsdLGDYM56GS9+51txIAbA/yyen2fA/xmFR6cPW3v0oBXYv/QlsEWw4Idf5s7TRS5DRvZ/w7cuq3TgDyozPvhVOe76BnLGmWWe/3EdwzKuHaSzlIHH7d0kkebl/XiS5Tn0zMJisb66rbemO/IjazC7CdZt/jcvsaWRpHZxbL8Ximhr7E1zgj1LQZOWC57qvVKSQ1U4O3Uv5aTWHYopy1nYgCB8h9KdijlhTBB9dfGuTQ9IEd5GjJ4SmcUjd+oHHVeEtf2hf7Dw+Q+pH4+4c04Iw5XfvT36snWMKeo3ypeaOe3zJ6e6oJY4UdSnupYFHgSyhUmwZYoo4A==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ESkHy/kA4dwouDG14Cfe/ENKfCfiLv5tBW1ymckjOWajTDWVShTqYQr0mBsb0pm89QHCn6tIZck6DTWbCcRY7oNUfl4Hc2bZHPCgf13+Ff6hldVbM8vuwaWVcCN5zo5BWSvU1I2uxl0VEqqMOfKWJIpY7xH4PPo4n+N5eixHjaUnCsFuAlypEYOKHaRrt/HpA8Ym/zhfnExZQSEzf+PQ8+5n36V+QB/bKblQp2+d7LWJzkxcc+nLGf1U1T+TSiom87rBI+ETdtO6fAoD8YiCGeHn0geM/HUYthQcKPJJAiCvHGJnRA2RbWjifEQqdXZ0rD4/jUYrA5RkKolL9LWq9w==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>
  • Delivery-date: Fri, 13 Feb 2026 18:25:41 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Fri, Oct 03, 2025 at 11:53:19PM +0100, Andrew Cooper wrote:
> FRED and IDT differ by a Supervisor Token on the base of the shstk.  This
> means that switch_stack_and_jump() needs to discard one extra word when FRED
> is active.
> 
> Fix a typo in the parameter name, which should be shstk_base.
> 
> Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
> Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>

Reviewed-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>

> ---
> CC: Jan Beulich <JBeulich@xxxxxxxx>
> CC: Roger Pau Monné <roger.pau@xxxxxxxxxx>
> 
> Leave as $%c.  Otherwise it doesn't assemble correctly presented with $$24568
> to parse as an instruction immediate.
> 
> v3:
>  * Fix a typo in the parameter name.
> v2:
>  * Use X86_FEATURE_XEN_FRED
> ---
>  xen/arch/x86/include/asm/current.h | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/xen/arch/x86/include/asm/current.h 
> b/xen/arch/x86/include/asm/current.h
> index c1eb27b1c4c2..62817e8476ec 100644
> --- a/xen/arch/x86/include/asm/current.h
> +++ b/xen/arch/x86/include/asm/current.h
> @@ -154,7 +154,9 @@ unsigned long get_stack_dump_bottom (unsigned long sp);
>      "rdsspd %[ssp];"                                            \
>      "cmp $1, %[ssp];"                                           \
>      "je .L_shstk_done.%=;" /* CET not active?  Skip. */         \
> -    "mov $%c[skstk_base], %[val];"                              \
> +    ALTERNATIVE("mov $%c[shstk_base], %[val];",                 \
> +                "mov $%c[shstk_base] + 8, %[val];",             \

I would also be fine with using the more simple '%' if that yields the
same result.  But seeing existing code is already using this
formatter, I think it makes more sense for this commit to not change
it.  It can always be adjusted in a followup commit if there's a
pressing need to change this.

I wouldn't have used %c myself unless it was already present, simply
because I'm not that proficient in inline assembly.

Thanks, Roger.



 


Rackspace

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