Re: [PATCH v11 9/9] x86/cpu: Enable LASS by default during CPU initialization

Dave Hansen
2025-10-31T17:21:31Z

On 10/29/25 14:03, Sohil Mehta wrote:
...
> +static __always_inline void setup_lass(struct cpuinfo_x86 *c)
> +{
> + if (cpu_feature_enabled(X86_FEATURE_LASS)) {
> + /*
> + * Legacy vsyscall page access causes a #GP when LASS is
> + * active. However, vsyscall emulation isn't supported
> + * with #GP. To avoid breaking userspace, disable LASS
> + * if the emulation code is compiled in.
> + */
> + if (IS_ENABLED(CONFIG_X86_VSYSCALL_EMULATION)) {
> + pr_info_once("x86/cpu: Disabling LASS due to CONFIG_X86_VSYSCALL_EMULATION=y\n");
> + setup_clear_cpu_cap(X86_FEATURE_LASS);
> + return;
> + }
> +
> + cr4_set_bits(X86_CR4_LASS);
> + }
> +}
This breaks two rules I have:

1. Indent as little as practical
2. Keep the main code flow at the lowest indentation level

IOW, this should be.

static __always_inline void setup_lass(struct cpuinfo_x86 *c)
{
if (!cpu_feature_enabled(X86_FEATURE_LASS))
return;
...

But I can fix that up when I apply this. I think it's mostly ready.

Reviewed-by: Dave Hansen <dave.hansen@linux.intel.com>