2022-10-20 12:02:32

by Borislav Petkov

[permalink] [raw]
Subject: Re: [PATCH] x86/xen: simplify sysenter and syscall setup

On Thu, Oct 20, 2022 at 01:36:19PM +0200, Juergen Gross wrote:
> xen_enable_sysenter() and xen_enable_syscall() can be simplified a lot.
>
> Signed-off-by: Juergen Gross <[email protected]>
> ---
> arch/x86/xen/setup.c | 23 ++++++-----------------
> 1 file changed, 6 insertions(+), 17 deletions(-)
>
> diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c
> index cfa99e8f054b..0f33ed6d3a7b 100644
> --- a/arch/x86/xen/setup.c
> +++ b/arch/x86/xen/setup.c
> @@ -910,17 +910,9 @@ static int register_callback(unsigned type, const void *func)
>
> void xen_enable_sysenter(void)
> {
> - int ret;
> - unsigned sysenter_feature;
> -
> - sysenter_feature = X86_FEATURE_SYSENTER32;
> -
> - if (!boot_cpu_has(sysenter_feature))
> - return;
> -
> - ret = register_callback(CALLBACKTYPE_sysenter, xen_entry_SYSENTER_compat);
> - if(ret != 0)
> - setup_clear_cpu_cap(sysenter_feature);
> + if (boot_cpu_has(X86_FEATURE_SYSENTER32) &&

Can you switch that and below to cpu_feature_enabled() while at it, pls?

> + if (boot_cpu_has(X86_FEATURE_SYSCALL32) &&
^^^^^^^^^^^^^^^^^^

Thx.

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette


2022-10-20 12:07:09

by Jürgen Groß

[permalink] [raw]
Subject: Re: [PATCH] x86/xen: simplify sysenter and syscall setup

On 20.10.22 13:39, Borislav Petkov wrote:
> On Thu, Oct 20, 2022 at 01:36:19PM +0200, Juergen Gross wrote:
>> xen_enable_sysenter() and xen_enable_syscall() can be simplified a lot.
>>
>> Signed-off-by: Juergen Gross <[email protected]>
>> ---
>> arch/x86/xen/setup.c | 23 ++++++-----------------
>> 1 file changed, 6 insertions(+), 17 deletions(-)
>>
>> diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c
>> index cfa99e8f054b..0f33ed6d3a7b 100644
>> --- a/arch/x86/xen/setup.c
>> +++ b/arch/x86/xen/setup.c
>> @@ -910,17 +910,9 @@ static int register_callback(unsigned type, const void *func)
>>
>> void xen_enable_sysenter(void)
>> {
>> - int ret;
>> - unsigned sysenter_feature;
>> -
>> - sysenter_feature = X86_FEATURE_SYSENTER32;
>> -
>> - if (!boot_cpu_has(sysenter_feature))
>> - return;
>> -
>> - ret = register_callback(CALLBACKTYPE_sysenter, xen_entry_SYSENTER_compat);
>> - if(ret != 0)
>> - setup_clear_cpu_cap(sysenter_feature);
>> + if (boot_cpu_has(X86_FEATURE_SYSENTER32) &&
>
> Can you switch that and below to cpu_feature_enabled() while at it, pls?
>
>> + if (boot_cpu_has(X86_FEATURE_SYSCALL32) &&
> ^^^^^^^^^^^^^^^^^^

Yes, of course.


Juergen


Attachments:
OpenPGP_0xB0DE9DD628BF132F.asc (3.08 kB)
OpenPGP public key
OpenPGP_signature (505.00 B)
OpenPGP digital signature
Download all attachments