Re: [PATCH] x86: Add Kconfig option to require NX bit support

2023-06-02 Thread Andrew Cooper
On 02/06/2023 5:08 pm, Alejandro Vallejo wrote: > On Fri, Jun 02, 2023 at 03:22:20PM +0100, Andrew Cooper wrote: >> Linux deals with this in verify_cpu() (early asm) along with a FMS check >> protecting the access to MSR_MISC_ENABLE, rather than using rdmsr_safe() >> and catching the #GP. > On a

Re: [PATCH] x86: Add Kconfig option to require NX bit support

2023-06-02 Thread Alejandro Vallejo
On Fri, Jun 02, 2023 at 03:22:20PM +0100, Andrew Cooper wrote: > On 01/06/2023 6:43 pm, Alejandro Vallejo wrote: > > diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S > > index 09bebf8635..8414266281 100644 > > --- a/xen/arch/x86/boot/head.S > > +++ b/xen/arch/x86/boot/head.S > > @@

Re: [PATCH] x86: Add Kconfig option to require NX bit support

2023-06-02 Thread Andrew Cooper
On 01/06/2023 6:43 pm, Alejandro Vallejo wrote: > diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S > index 09bebf8635..8414266281 100644 > --- a/xen/arch/x86/boot/head.S > +++ b/xen/arch/x86/boot/head.S > @@ -647,11 +653,18 @@ trampoline_setup: > cpuid > 1: mov

Re: [PATCH] x86: Add Kconfig option to require NX bit support

2023-06-02 Thread Jan Beulich
On 02.06.2023 14:05, Andrew Cooper wrote: > On 01/06/2023 6:43 pm, Alejandro Vallejo wrote: >> @@ -151,6 +152,11 @@ not_multiboot: >> .Lnot_aligned: >> add $sym_offs(.Lbag_alg_msg),%esi # Error message >> jmp .Lget_vtb >> +#if IS_ENABLED(CONFIG_REQUIRE_NX_BIT) > >

Re: [PATCH] x86: Add Kconfig option to require NX bit support

2023-06-02 Thread Andrew Cooper
On 01/06/2023 6:43 pm, Alejandro Vallejo wrote: > This allows replacing many instances of runtime checks with folded > constants. The patch asserts support for the NX bit in PTEs at boot time > and if so short-circuits cpu_has_nx to 1. This has several knock-on effects > that improve codegen: >

Re: [PATCH] x86: Add Kconfig option to require NX bit support

2023-06-02 Thread Alejandro Vallejo
Hi, Sure to everything. A couple of notes: On Fri, Jun 02, 2023 at 10:31:08AM +0200, Jan Beulich wrote: > > + def_bool n > > + prompt "Require NX bit support" > > Just > > bool "Require NX bit support" > > please. I didn't realize Kconfig defaulted to 'n'. That's neat, thanks. > >

Re: [PATCH] x86: Add Kconfig option to require NX bit support

2023-06-02 Thread Andrew Cooper
On 02/06/2023 9:31 am, Jan Beulich wrote: > On 01.06.2023 19:43, Alejandro Vallejo wrote: >> This allows replacing many instances of runtime checks with folded >> constants. The patch asserts support for the NX bit in PTEs at boot time >> and if so short-circuits cpu_has_nx to 1. This has several

Re: [PATCH] x86: Add Kconfig option to require NX bit support

2023-06-02 Thread Jan Beulich
On 01.06.2023 19:43, Alejandro Vallejo wrote: > This allows replacing many instances of runtime checks with folded > constants. The patch asserts support for the NX bit in PTEs at boot time > and if so short-circuits cpu_has_nx to 1. This has several knock-on effects > that improve codegen: > *

[PATCH] x86: Add Kconfig option to require NX bit support

2023-06-01 Thread Alejandro Vallejo
This allows replacing many instances of runtime checks with folded constants. The patch asserts support for the NX bit in PTEs at boot time and if so short-circuits cpu_has_nx to 1. This has several knock-on effects that improve codegen: * _PAGE_NX matches _PAGE_NX_BIT, optimising the macro to a