diff mbox series

[1/2] x86/xen: add CPU dependencies for 32-bit build

Message ID 20231204084722.3789473-1-arnd@kernel.org (mailing list archive)
State Accepted
Commit 93cd0597649844a0fe7989839a3202735fb3ae67
Headers show
Series [1/2] x86/xen: add CPU dependencies for 32-bit build | expand

Commit Message

Arnd Bergmann Dec. 4, 2023, 8:47 a.m. UTC
From: Arnd Bergmann <arnd@arndb.de>

Xen only supports modern CPUs even when running a 32-bit kernel, and it now
requires a kernel built for a 64 byte (or larger) cache line:

In file included from <command-line>:
In function 'xen_vcpu_setup',
    inlined from 'xen_vcpu_setup_restore' at arch/x86/xen/enlighten.c:111:3,
    inlined from 'xen_vcpu_restore' at arch/x86/xen/enlighten.c:141:3:
include/linux/compiler_types.h:435:45: error: call to '__compiletime_assert_287' declared with attribute error: BUILD_BUG_ON failed: sizeof(*vcpup) > SMP_CACHE_BYTES
arch/x86/xen/enlighten.c:166:9: note: in expansion of macro 'BUILD_BUG_ON'
  166 |         BUILD_BUG_ON(sizeof(*vcpup) > SMP_CACHE_BYTES);
      |         ^~~~~~~~~~~~

Enforce the dependency with a whitelist of CPU configurations. In normal
distro kernels, CONFIG_X86_GENERIC is enabled, and this works fine. When this
is not set, still allow Xen to be built on kernels that target a 64-bit
capable CPU.

Fixes: db2832309a82 ("x86/xen: fix percpu vcpu_info allocation")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/x86/xen/Kconfig | 1 +
 1 file changed, 1 insertion(+)

Comments

Jürgen Groß Dec. 4, 2023, 12:59 p.m. UTC | #1
On 04.12.23 09:47, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> Xen only supports modern CPUs even when running a 32-bit kernel, and it now
> requires a kernel built for a 64 byte (or larger) cache line:
> 
> In file included from <command-line>:
> In function 'xen_vcpu_setup',
>      inlined from 'xen_vcpu_setup_restore' at arch/x86/xen/enlighten.c:111:3,
>      inlined from 'xen_vcpu_restore' at arch/x86/xen/enlighten.c:141:3:
> include/linux/compiler_types.h:435:45: error: call to '__compiletime_assert_287' declared with attribute error: BUILD_BUG_ON failed: sizeof(*vcpup) > SMP_CACHE_BYTES
> arch/x86/xen/enlighten.c:166:9: note: in expansion of macro 'BUILD_BUG_ON'
>    166 |         BUILD_BUG_ON(sizeof(*vcpup) > SMP_CACHE_BYTES);
>        |         ^~~~~~~~~~~~
> 
> Enforce the dependency with a whitelist of CPU configurations. In normal
> distro kernels, CONFIG_X86_GENERIC is enabled, and this works fine. When this
> is not set, still allow Xen to be built on kernels that target a 64-bit
> capable CPU.
> 
> Fixes: db2832309a82 ("x86/xen: fix percpu vcpu_info allocation")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Reviewed-by: Juergen Gross <jgross@suse.com>


Juergen
Alyssa Ross Dec. 14, 2023, 12:01 p.m. UTC | #2
On Mon, Dec 04, 2023 at 09:47:01AM +0100, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> Xen only supports modern CPUs even when running a 32-bit kernel, and it now
> requires a kernel built for a 64 byte (or larger) cache line:
>
> In file included from <command-line>:
> In function 'xen_vcpu_setup',
>     inlined from 'xen_vcpu_setup_restore' at arch/x86/xen/enlighten.c:111:3,
>     inlined from 'xen_vcpu_restore' at arch/x86/xen/enlighten.c:141:3:
> include/linux/compiler_types.h:435:45: error: call to '__compiletime_assert_287' declared with attribute error: BUILD_BUG_ON failed: sizeof(*vcpup) > SMP_CACHE_BYTES
> arch/x86/xen/enlighten.c:166:9: note: in expansion of macro 'BUILD_BUG_ON'
>   166 |         BUILD_BUG_ON(sizeof(*vcpup) > SMP_CACHE_BYTES);
>       |         ^~~~~~~~~~~~
>
> Enforce the dependency with a whitelist of CPU configurations. In normal
> distro kernels, CONFIG_X86_GENERIC is enabled, and this works fine. When this
> is not set, still allow Xen to be built on kernels that target a 64-bit
> capable CPU.
>
> Fixes: db2832309a82 ("x86/xen: fix percpu vcpu_info allocation")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---

This fixes 32-bit distro kernel builds in Nixpkgs, which regressed
with a recent stable kernel update.  Thanks!

Tested-by: Alyssa Ross <hi@alyssa.is>

>  arch/x86/xen/Kconfig | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/arch/x86/xen/Kconfig b/arch/x86/xen/Kconfig
> index 9b1ec5d8c99c..a65fc2ae15b4 100644
> --- a/arch/x86/xen/Kconfig
> +++ b/arch/x86/xen/Kconfig
> @@ -9,6 +9,7 @@ config XEN
>  	select PARAVIRT_CLOCK
>  	select X86_HV_CALLBACK_VECTOR
>  	depends on X86_64 || (X86_32 && X86_PAE)
> +	depends on X86_64 || (X86_GENERIC || MPENTIUM4 || MCORE2 || MATOM || MK8)
>  	depends on X86_LOCAL_APIC && X86_TSC
>  	help
>  	  This is the Linux Xen port.  Enabling this will allow the
> --
> 2.39.2
>
diff mbox series

Patch

diff --git a/arch/x86/xen/Kconfig b/arch/x86/xen/Kconfig
index 9b1ec5d8c99c..a65fc2ae15b4 100644
--- a/arch/x86/xen/Kconfig
+++ b/arch/x86/xen/Kconfig
@@ -9,6 +9,7 @@  config XEN
 	select PARAVIRT_CLOCK
 	select X86_HV_CALLBACK_VECTOR
 	depends on X86_64 || (X86_32 && X86_PAE)
+	depends on X86_64 || (X86_GENERIC || MPENTIUM4 || MCORE2 || MATOM || MK8)
 	depends on X86_LOCAL_APIC && X86_TSC
 	help
 	  This is the Linux Xen port.  Enabling this will allow the