Re: [PATCH 5/8] x86/mmu: Add mm-based PASID refcounting
From: Fenghua Yu
Date: Wed Sep 29 2021 - 20:44:06 EST
Hi, Baolu,
On Thu, Sep 23, 2021 at 01:43:32PM +0800, Lu Baolu wrote:
> On 9/21/21 3:23 AM, Fenghua Yu wrote:
> > +void pasid_put(struct task_struct *tsk, struct mm_struct *mm)
> > +{
> > + if (!cpu_feature_enabled(X86_FEATURE_ENQCMD))
> > + return;
> > +
> > + /*
> > + * Nothing to do if this task doesn't have a reference to the PASID.
> > + */
> > + if (tsk->has_valid_pasid) {
> > + mutex_lock(&pasid_mutex);
> > + /*
> > + * The PASID's reference was taken during fix up. Release it
> > + * now. If the reference count is 0, the PASID is freed.
> > + */
> > + iommu_sva_free_pasid(mm);
> > + mutex_unlock(&pasid_mutex);
> > + }
> > +}
> >
>
> It looks odd that both __fixup_pasid_exception() and pasid_put() are
> defined in the vendor IOMMU driver, but get called in the arch/x86
> code.
>
> Is it feasible to move these two helpers to the files where they are
> called? The IA32_PASID MSR fixup and release are not part of the IOMMU
> implementation.
Sure. The functions will be removed in the next version. And new functions
will not be called in IOMMU driver.
Thanks.
-Fenghua