[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZszgGxZLDQYIEJpX@google.com>
Date: Mon, 26 Aug 2024 13:05:47 -0700
From: Sean Christopherson <seanjc@...gle.com>
To: Sohil Mehta <sohil.mehta@...el.com>
Cc: x86@...nel.org, Borislav Petkov <bp@...en8.de>, Dave Hansen <dave.hansen@...ux.intel.com>,
Thomas Gleixner <tglx@...utronix.de>, Ingo Molnar <mingo@...hat.com>, "H . Peter Anvin" <hpa@...or.com>,
Uros Bizjak <ubizjak@...il.com>, Sandipan Das <sandipan.das@....com>,
Peter Zijlstra <peterz@...radead.org>, Vegard Nossum <vegard.nossum@...cle.com>,
Tony Luck <tony.luck@...el.com>, Pawan Gupta <pawan.kumar.gupta@...ux.intel.com>,
Nikolay Borisov <nik.borisov@...e.com>, Eric Biggers <ebiggers@...gle.com>, Xin Li <xin3.li@...el.com>,
linux-kernel@...r.kernel.org
Subject: Re: [RFC PATCH] x86/cpufeature: Add feature dependency checks
On Fri, Aug 23, 2024, Sohil Mehta wrote:
> On 8/22/2024 4:27 PM, Sean Christopherson wrote:
> > On Thu, Aug 22, 2024, Sohil Mehta wrote:
> >> Arguably, this situation should only happen on broken hardware and it may not
> >> make sense to add such a check to the kernel. OTOH, this can be viewed as a
> >> safety mechanism to make failures more graceful on such configurations in real
> >> or virtual environments.
> >
> > And goofy Kconfigs. But yeah, lack of any meaningful fallout is why my version
> > didn't go anywhere.
> >
>
> By fallout do you mean that the observed behavior when the kernel runs
> into such a misconfiguration
This.
> or just the general lack of such
> misconfigured hardware/guest?
>
> I tried experimenting with the behavior for the last entry on the
> cpuid_deps[] table:
> { X86_FEATURE_FRED, X86_FEATURE_WRMSRNS },
>
> In this case, even if WRMSRNS is not present, the kernel would go ahead
> and enable FRED, which would cause a panic when wrmsrns() is exercised
> in update_task_stack().
>
> I agree to the second part that such conditions are more likely to
> happen in pre-production environments.
And in VMs, e.g. unless the SDM explicitly says FRED implies WRMSRNS, it will be
architecturally legal, if unusual, to advertise FRED with WRMSRNS to a guest.
> But I still feel that for the rare case when something like this seeps
> through it would be better to disable the feature upfront than run in a
> kernel panic or some other unexpected behavior.
Agreed.
> > https://lore.kernel.org/all/20221203003745.1475584-2-seanjc@google.com
> >
>
> The code is very similar to the one I proposed. If we do take this
> forward, would it be fine if I add a Originally-by tag from you?
No need, you came up with the code independently.
Powered by blists - more mailing lists