[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87a72wpiw8.fsf@nanos.tec.linutronix.de>
Date: Tue, 28 Apr 2020 02:13:11 +0200
From: Thomas Gleixner <tglx@...utronix.de>
To: Fenghua Yu <fenghua.yu@...el.com>
Cc: Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
H Peter Anvin <hpa@...or.com>,
David Woodhouse <dwmw2@...radead.org>,
Lu Baolu <baolu.lu@...ux.intel.com>,
Dave Hansen <dave.hansen@...el.com>,
Tony Luck <tony.luck@...el.com>,
Ashok Raj <ashok.raj@...el.com>,
Jacob Jun Pan <jacob.jun.pan@...el.com>,
Dave Jiang <dave.jiang@...el.com>,
Sohil Mehta <sohil.mehta@...el.com>,
Ravi V Shankar <ravi.v.shankar@...el.com>,
linux-kernel <linux-kernel@...r.kernel.org>,
x86 <x86@...nel.org>, iommu@...ts.linux-foundation.org
Subject: Re: [PATCH 6/7] x86/traps: Fix up invalid PASID
Fenghua Yu <fenghua.yu@...el.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
Powered by blists - more mailing lists