* [PATCH] x86/xen: Fix __xen_hypercall_setfunc
@ 2025-04-10 19:31 Jason Andryuk
2025-04-11 7:46 ` Juergen Gross
2025-04-11 10:01 ` [tip: x86/urgent] x86/xen: Fix __xen_hypercall_setfunc() tip-bot2 for Jason Andryuk
0 siblings, 2 replies; 6+ messages in thread
From: Jason Andryuk @ 2025-04-10 19:31 UTC (permalink / raw)
To: Juergen Gross, Boris Ostrovsky, Thomas Gleixner, Ingo Molnar,
Borislav Petkov, Dave Hansen, x86, H. Peter Anvin, Xin Li (Intel)
Cc: Jason Andryuk, Ingo Molnar, xen-devel, linux-kernel
Hypercall detection is failing with xen_hypercall_intel() chosen even on
an AMD processor. Looking at the disassembly, the call to
xen_get_vendor() was removed.
The check for boot_cpu_has(X86_FEATURE_CPUID) was used as a proxy for
the x86_vendor having been set. When
CONFIG_X86_REQUIRED_FEATURE_CPUID=y (the default value), DCE eliminates
the call to xen_get_vendor(). An uninitialized value 0 means
X86_VENDOR_INTEL, so the Intel function is always returned.
Remove the if and always call xen_get_vendor() to avoid this issue.
Fixes: 3d37d9396eb3 ("x86/cpufeatures: Add {REQUIRED,DISABLED} feature configs")
Suggested-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Jason Andryuk <jason.andryuk@amd.com>
---
I think the Fixes is correct in that it default enables requiring the
feature. There were a lot of other changes to how headers were
generated as well.
---
arch/x86/xen/enlighten.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index 43dcd8c7badc..6a5cae915eb1 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -100,10 +100,6 @@ noinstr void *__xen_hypercall_setfunc(void)
void (*func)(void);
/*
- * Xen is supported only on CPUs with CPUID, so testing for
- * X86_FEATURE_CPUID is a test for early_cpu_init() having been
- * run.
- *
* Note that __xen_hypercall_setfunc() is noinstr only due to a nasty
* dependency chain: it is being called via the xen_hypercall static
* call when running as a PVH or HVM guest. Hypercalls need to be
@@ -115,8 +111,7 @@ noinstr void *__xen_hypercall_setfunc(void)
*/
instrumentation_begin();
- if (!boot_cpu_has(X86_FEATURE_CPUID))
- xen_get_vendor();
+ xen_get_vendor();
if ((boot_cpu_data.x86_vendor == X86_VENDOR_AMD ||
boot_cpu_data.x86_vendor == X86_VENDOR_HYGON))
--
2.34.1
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH] x86/xen: Fix __xen_hypercall_setfunc
2025-04-10 19:31 [PATCH] x86/xen: Fix __xen_hypercall_setfunc Jason Andryuk
@ 2025-04-11 7:46 ` Juergen Gross
2025-04-11 9:27 ` Ingo Molnar
2025-04-11 10:01 ` [tip: x86/urgent] x86/xen: Fix __xen_hypercall_setfunc() tip-bot2 for Jason Andryuk
1 sibling, 1 reply; 6+ messages in thread
From: Juergen Gross @ 2025-04-11 7:46 UTC (permalink / raw)
To: Jason Andryuk, Boris Ostrovsky, Thomas Gleixner, Ingo Molnar,
Borislav Petkov, Dave Hansen, x86, H. Peter Anvin, Xin Li (Intel)
Cc: Ingo Molnar, xen-devel, linux-kernel
[-- Attachment #1.1.1: Type: text/plain, Size: 862 bytes --]
On 10.04.25 21:31, Jason Andryuk wrote:
> Hypercall detection is failing with xen_hypercall_intel() chosen even on
> an AMD processor. Looking at the disassembly, the call to
> xen_get_vendor() was removed.
>
> The check for boot_cpu_has(X86_FEATURE_CPUID) was used as a proxy for
> the x86_vendor having been set. When
> CONFIG_X86_REQUIRED_FEATURE_CPUID=y (the default value), DCE eliminates
> the call to xen_get_vendor(). An uninitialized value 0 means
> X86_VENDOR_INTEL, so the Intel function is always returned.
>
> Remove the if and always call xen_get_vendor() to avoid this issue.
>
> Fixes: 3d37d9396eb3 ("x86/cpufeatures: Add {REQUIRED,DISABLED} feature configs")
> Suggested-by: Juergen Gross <jgross@suse.com>
> Signed-off-by: Jason Andryuk <jason.andryuk@amd.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Juergen
[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 3743 bytes --]
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 495 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH] x86/xen: Fix __xen_hypercall_setfunc
2025-04-11 7:46 ` Juergen Gross
@ 2025-04-11 9:27 ` Ingo Molnar
2025-04-11 9:29 ` Jürgen Groß
0 siblings, 1 reply; 6+ messages in thread
From: Ingo Molnar @ 2025-04-11 9:27 UTC (permalink / raw)
To: Juergen Gross
Cc: Jason Andryuk, Boris Ostrovsky, Thomas Gleixner, Ingo Molnar,
Borislav Petkov, Dave Hansen, x86, H. Peter Anvin, Xin Li (Intel),
xen-devel, linux-kernel
* Juergen Gross <jgross@suse.com> wrote:
> On 10.04.25 21:31, Jason Andryuk wrote:
> > Hypercall detection is failing with xen_hypercall_intel() chosen even on
> > an AMD processor. Looking at the disassembly, the call to
> > xen_get_vendor() was removed.
> >
> > The check for boot_cpu_has(X86_FEATURE_CPUID) was used as a proxy for
> > the x86_vendor having been set. When
> > CONFIG_X86_REQUIRED_FEATURE_CPUID=y (the default value), DCE eliminates
> > the call to xen_get_vendor(). An uninitialized value 0 means
> > X86_VENDOR_INTEL, so the Intel function is always returned.
> >
> > Remove the if and always call xen_get_vendor() to avoid this issue.
> >
> > Fixes: 3d37d9396eb3 ("x86/cpufeatures: Add {REQUIRED,DISABLED} feature configs")
> > Suggested-by: Juergen Gross <jgross@suse.com>
> > Signed-off-by: Jason Andryuk <jason.andryuk@amd.com>
>
> Reviewed-by: Juergen Gross <jgross@suse.com>
Wanna merge this via the Xen tree, or should it go to x86/urgent?
The bug was *caused* by the x86 tree so we'd be glad to merge,
but your call.
If you'll merge it:
Acked-by: Ingo Molnar <mingo@kernel.org>
Thanks,
Ingo
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH] x86/xen: Fix __xen_hypercall_setfunc
2025-04-11 9:27 ` Ingo Molnar
@ 2025-04-11 9:29 ` Jürgen Groß
2025-04-11 9:44 ` Ingo Molnar
0 siblings, 1 reply; 6+ messages in thread
From: Jürgen Groß @ 2025-04-11 9:29 UTC (permalink / raw)
To: Ingo Molnar
Cc: Jason Andryuk, Boris Ostrovsky, Thomas Gleixner, Ingo Molnar,
Borislav Petkov, Dave Hansen, x86, H. Peter Anvin, Xin Li (Intel),
xen-devel, linux-kernel
[-- Attachment #1.1.1: Type: text/plain, Size: 1179 bytes --]
On 11.04.25 11:27, Ingo Molnar wrote:
>
> * Juergen Gross <jgross@suse.com> wrote:
>
>> On 10.04.25 21:31, Jason Andryuk wrote:
>>> Hypercall detection is failing with xen_hypercall_intel() chosen even on
>>> an AMD processor. Looking at the disassembly, the call to
>>> xen_get_vendor() was removed.
>>>
>>> The check for boot_cpu_has(X86_FEATURE_CPUID) was used as a proxy for
>>> the x86_vendor having been set. When
>>> CONFIG_X86_REQUIRED_FEATURE_CPUID=y (the default value), DCE eliminates
>>> the call to xen_get_vendor(). An uninitialized value 0 means
>>> X86_VENDOR_INTEL, so the Intel function is always returned.
>>>
>>> Remove the if and always call xen_get_vendor() to avoid this issue.
>>>
>>> Fixes: 3d37d9396eb3 ("x86/cpufeatures: Add {REQUIRED,DISABLED} feature configs")
>>> Suggested-by: Juergen Gross <jgross@suse.com>
>>> Signed-off-by: Jason Andryuk <jason.andryuk@amd.com>
>>
>> Reviewed-by: Juergen Gross <jgross@suse.com>
>
> Wanna merge this via the Xen tree, or should it go to x86/urgent?
>
> The bug was *caused* by the x86 tree so we'd be glad to merge,
> but your call.
x86/urgent is fine for me.
Juergen
[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 3743 bytes --]
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 495 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH] x86/xen: Fix __xen_hypercall_setfunc
2025-04-11 9:29 ` Jürgen Groß
@ 2025-04-11 9:44 ` Ingo Molnar
0 siblings, 0 replies; 6+ messages in thread
From: Ingo Molnar @ 2025-04-11 9:44 UTC (permalink / raw)
To: Jürgen Groß
Cc: Jason Andryuk, Boris Ostrovsky, Thomas Gleixner, Ingo Molnar,
Borislav Petkov, Dave Hansen, x86, H. Peter Anvin, Xin Li (Intel),
xen-devel, linux-kernel
* Jürgen Groß <jgross@suse.com> wrote:
> On 11.04.25 11:27, Ingo Molnar wrote:
> >
> > * Juergen Gross <jgross@suse.com> wrote:
> >
> > > On 10.04.25 21:31, Jason Andryuk wrote:
> > > > Hypercall detection is failing with xen_hypercall_intel() chosen even on
> > > > an AMD processor. Looking at the disassembly, the call to
> > > > xen_get_vendor() was removed.
> > > >
> > > > The check for boot_cpu_has(X86_FEATURE_CPUID) was used as a proxy for
> > > > the x86_vendor having been set. When
> > > > CONFIG_X86_REQUIRED_FEATURE_CPUID=y (the default value), DCE eliminates
> > > > the call to xen_get_vendor(). An uninitialized value 0 means
> > > > X86_VENDOR_INTEL, so the Intel function is always returned.
> > > >
> > > > Remove the if and always call xen_get_vendor() to avoid this issue.
> > > >
> > > > Fixes: 3d37d9396eb3 ("x86/cpufeatures: Add {REQUIRED,DISABLED} feature configs")
> > > > Suggested-by: Juergen Gross <jgross@suse.com>
> > > > Signed-off-by: Jason Andryuk <jason.andryuk@amd.com>
> > >
> > > Reviewed-by: Juergen Gross <jgross@suse.com>
> >
> > Wanna merge this via the Xen tree, or should it go to x86/urgent?
> >
> > The bug was *caused* by the x86 tree so we'd be glad to merge,
> > but your call.
>
> x86/urgent is fine for me.
Applied, thanks!
Ingo
^ permalink raw reply [flat|nested] 6+ messages in thread
* [tip: x86/urgent] x86/xen: Fix __xen_hypercall_setfunc()
2025-04-10 19:31 [PATCH] x86/xen: Fix __xen_hypercall_setfunc Jason Andryuk
2025-04-11 7:46 ` Juergen Gross
@ 2025-04-11 10:01 ` tip-bot2 for Jason Andryuk
1 sibling, 0 replies; 6+ messages in thread
From: tip-bot2 for Jason Andryuk @ 2025-04-11 10:01 UTC (permalink / raw)
To: linux-tip-commits
Cc: Juergen Gross, Jason Andryuk, Ingo Molnar, Boris Ostrovsky,
H. Peter Anvin, Xin Li (Intel), x86, linux-kernel
The following commit has been merged into the x86/urgent branch of tip:
Commit-ID: 164a9f712fa53e4c92b2a435bb071a5be0c31dbc
Gitweb: https://git.kernel.org/tip/164a9f712fa53e4c92b2a435bb071a5be0c31dbc
Author: Jason Andryuk <jason.andryuk@amd.com>
AuthorDate: Thu, 10 Apr 2025 15:31:05 -04:00
Committer: Ingo Molnar <mingo@kernel.org>
CommitterDate: Fri, 11 Apr 2025 11:39:50 +02:00
x86/xen: Fix __xen_hypercall_setfunc()
Hypercall detection is failing with xen_hypercall_intel() chosen even on
an AMD processor. Looking at the disassembly, the call to
xen_get_vendor() was removed.
The check for boot_cpu_has(X86_FEATURE_CPUID) was used as a proxy for
the x86_vendor having been set.
When CONFIG_X86_REQUIRED_FEATURE_CPUID=y (the default value), DCE eliminates
the call to xen_get_vendor(). An uninitialized value 0 means
X86_VENDOR_INTEL, so the Intel function is always returned.
Remove the if and always call xen_get_vendor() to avoid this issue.
Fixes: 3d37d9396eb3 ("x86/cpufeatures: Add {REQUIRED,DISABLED} feature configs")
Suggested-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Jason Andryuk <jason.andryuk@amd.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Reviewed-by: Juergen Gross <jgross@suse.com>
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: "Xin Li (Intel)" <xin@zytor.com>
Link: https://lore.kernel.org/r/20250410193106.16353-1-jason.andryuk@amd.com
---
arch/x86/xen/enlighten.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index 1b7710b..53282dc 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -103,10 +103,6 @@ noinstr void *__xen_hypercall_setfunc(void)
void (*func)(void);
/*
- * Xen is supported only on CPUs with CPUID, so testing for
- * X86_FEATURE_CPUID is a test for early_cpu_init() having been
- * run.
- *
* Note that __xen_hypercall_setfunc() is noinstr only due to a nasty
* dependency chain: it is being called via the xen_hypercall static
* call when running as a PVH or HVM guest. Hypercalls need to be
@@ -118,8 +114,7 @@ noinstr void *__xen_hypercall_setfunc(void)
*/
instrumentation_begin();
- if (!boot_cpu_has(X86_FEATURE_CPUID))
- xen_get_vendor();
+ xen_get_vendor();
if ((boot_cpu_data.x86_vendor == X86_VENDOR_AMD ||
boot_cpu_data.x86_vendor == X86_VENDOR_HYGON))
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-04-11 10:01 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-10 19:31 [PATCH] x86/xen: Fix __xen_hypercall_setfunc Jason Andryuk
2025-04-11 7:46 ` Juergen Gross
2025-04-11 9:27 ` Ingo Molnar
2025-04-11 9:29 ` Jürgen Groß
2025-04-11 9:44 ` Ingo Molnar
2025-04-11 10:01 ` [tip: x86/urgent] x86/xen: Fix __xen_hypercall_setfunc() tip-bot2 for Jason Andryuk
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.