Re: [PATCH 4/8] x86/traps: Demand-populate PASID MSR via #GP
From: Peter Zijlstra
Date: Fri Sep 24 2021 - 09:40:43 EST
On Thu, Sep 23, 2021 at 10:14:42AM -0700, Luck, Tony wrote:
> On Wed, Sep 22, 2021 at 11:07:22PM +0200, Peter Zijlstra wrote:
> > On Mon, Sep 20, 2021 at 07:23:45PM +0000, Fenghua Yu wrote:
> > > @@ -538,6 +547,9 @@ DEFINE_IDTENTRY_ERRORCODE(exc_general_protection)
> > >
> > > cond_local_irq_enable(regs);
> > >
> > > + if (user_mode(regs) && fixup_pasid_exception())
> > > + goto exit;
> > > +
>
> > So you're eating any random #GP that might or might not be PASID
> > related. And all that witout a comment... Enlighten?
>
> This is moderately well commented inside the fixup_pasid_exception()
> function. Another copy of the comments here at the call-site seems
> overkill.
+static bool fixup_pasid_exception(void)
+{
+ if (!cpu_feature_enabled(X86_FEATURE_ENQCMD))
+ return false;
+
+ return __fixup_pasid_exception();
+}
/me goes looking for comments in that function, lemme get out the
electron microscope, because I can't seem to spot them with the naked
eye.