All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lu Baolu <baolu.lu@linux.intel.com>
To: Fenghua Yu <fenghua.yu@intel.com>,
	David Woodhouse <dwmw2@infradead.org>,
	 Jacob Jun Pan <jacob.jun.pan@intel.com>,
	Dave Jiang <dave.jiang@intel.com>,
	Ashok Raj <ashok.raj@intel.com>,
	Ravi V Shankar <ravi.v.shankar@intel.com>
Cc: iommu@lists.linux-foundation.org
Subject: Re: [PATCH 1/2] iommu/vt-d: Fix PASID leak
Date: Fri, 27 Aug 2021 20:24:02 +0800	[thread overview]
Message-ID: <7e1289c9-39d3-6345-9b8d-73596efc5615@linux.intel.com> (raw)
In-Reply-To: <20210826215918.4073446-1-fenghua.yu@intel.com>

Hi Fenghua,

On 2021/8/27 5:59, Fenghua Yu wrote:
> mm->pasid will be used in intel_svm_free_pasid() after load_pasid()
> during unbinding mm. Clearing it in load_pasid() will cause PASID cannot
> be freed in intel_svm_free_pasid().
> 
> Additionally mm->pasid was updated already before load_pasid() during pasid
> allocation. No need to update it again in load_pasid() during binding mm.
> 
> Don't update mm->pasid to avoid the issues in both binding mm and
> unbinding mm.
> 
> Please note that load_pasid() and its called functions will be re-written
> in upcoming re-enabling ENQCMD series. This patch tries to fix the issues
> cleanly before the re-enabling ENQCMD series.

I will remove above paragraph since it's irrelevant to the issue and the
fix itself. This fix is needed not only for ENQCMD case.

> 
> Fixes: 62ef907a045e ("iommu/vt-d: Fix PASID reference leak")

This change actually fix below commit,

Fixes: 404837741416 ("iommu/vt-d: Use iommu_sva_alloc(free)_pasid() 
helpers")

> 
> Reported-and-tested-by: Dave Jiang <dave.jiang@intel.com>
> Co-developed-by: Jacob Pan <jacob.jun.pan@linux.intel.com>
> Signed-off-by: Jacob Pan <jacob.jun.pan@linux.intel.com>
> Signed-off-by: Fenghua Yu <fenghua.yu@intel.com>
> ---
>   drivers/iommu/intel/svm.c | 3 ---
>   1 file changed, 3 deletions(-)
> 
> diff --git a/drivers/iommu/intel/svm.c b/drivers/iommu/intel/svm.c
> index 4b9b3f35ba0e..ceeca633a5f9 100644
> --- a/drivers/iommu/intel/svm.c
> +++ b/drivers/iommu/intel/svm.c
> @@ -516,9 +516,6 @@ static void load_pasid(struct mm_struct *mm, u32 pasid)
>   {
>   	mutex_lock(&mm->context.lock);
>   
> -	/* Synchronize with READ_ONCE in update_pasid(). */
> -	smp_store_release(&mm->pasid, pasid);
> -
>   	/* Update PASID MSR on all CPUs running the mm's tasks. */
>   	on_each_cpu_mask(mm_cpumask(mm), _load_pasid, NULL, true);
>   
> 

I will change the commit title to "iommu/vt-d: Fix PASID leak in
intel_svm_unbind_mm()" and queued it for iommu/fix.

Best regards,
baolu
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

      parent reply	other threads:[~2021-08-27 12:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-26 21:59 [PATCH 1/2] iommu/vt-d: Fix PASID leak Fenghua Yu
2021-08-26 21:59 ` [PATCH 2/2] iommu/vt-d: Fix a deadlock in SVM Fenghua Yu
2021-08-27 12:04   ` Lu Baolu
2021-08-27 12:24 ` Lu Baolu [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7e1289c9-39d3-6345-9b8d-73596efc5615@linux.intel.com \
    --to=baolu.lu@linux.intel.com \
    --cc=ashok.raj@intel.com \
    --cc=dave.jiang@intel.com \
    --cc=dwmw2@infradead.org \
    --cc=fenghua.yu@intel.com \
    --cc=iommu@lists.linux-foundation.org \
    --cc=jacob.jun.pan@intel.com \
    --cc=ravi.v.shankar@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.