Messages in this thread | | | From | Thomas Gleixner <> | Subject | Re: [PATCH 6/7] x86/traps: Fix up invalid PASID | Date | Tue, 28 Apr 2020 02:13:11 +0200 |
| |
Fenghua Yu <fenghua.yu@intel.com> writes: > On Sun, Apr 26, 2020 at 05:25:06PM +0200, Thomas Gleixner wrote: >> > @@ -499,6 +510,12 @@ dotraplinkage void do_general_protection(struct pt_regs *regs, long error_code) >> > int ret; >> > >> > RCU_LOCKDEP_WARN(!rcu_is_watching(), "entry code didn't wake RCU"); >> > + >> > + if (user_mode(regs) && fixup_pasid_exception()) { >> > + cond_local_irq_enable(regs); >> >> The point of this conditional irq enable _AFTER_ calling into the fixup >> function is? Also what's the reason for keeping interrupts disabled >> while calling into that function? Comments exist for a reason. > > irq needs to be disabled because the fixup function requires to disable > preempt in order to update the PASID MSR on the faulting CPU.
No, that's just wrong. It's not about the update itself.
> Will add comments here.
Factual ones and not some fairy tales please.
>> > +bool __fixup_pasid_exception(void) >> > +{ >> > + struct mm_struct *mm; >> > + bool ret = true; >> > + u64 pasid_msr; >> > + int pasid; >> > + >> > + mm = get_task_mm(current); >> >> Why do you need a reference to current->mm ? > > The PASID for the address space is per mm and is stored in mm. > To get the PASID, we need to get the mm and the > pasid=mm->context.pasid.
It's obvious that you need to access current-mm in order to check current->mm->context.pasid. Let me rephrase the question:
Why do you need to take a reference on current->mm ?
Thanks,
tglx
| |