From: Jacob Pan <jacob.jun.pan@linux.intel.com>
To: Lu Baolu <baolu.lu@linux.intel.com>
Cc: Raj Ashok <ashok.raj@intel.com>,
LKML <linux-kernel@vger.kernel.org>,
iommu@lists.linux-foundation.org,
David Woodhouse <dwmw2@infradead.org>
Subject: Re: [PATCH 1/3] iommu/vt-d: Remove redundant IOTLB flush
Date: Fri, 20 Mar 2020 09:20:47 -0700 [thread overview]
Message-ID: <20200320092047.4a4cf551@jacob-builder> (raw)
In-Reply-To: <26ab1917-f087-aafa-e861-6a2478000a6f@linux.intel.com>
On Fri, 20 Mar 2020 21:45:26 +0800
Lu Baolu <baolu.lu@linux.intel.com> wrote:
> On 2020/3/20 12:32, Jacob Pan wrote:
> > IOTLB flush already included in the PASID tear down process. There
> > is no need to flush again.
>
> It seems that intel_pasid_tear_down_entry() doesn't flush the pasid
> based device TLB?
>
I saw this code in intel_pasid_tear_down_entry(). Isn't the last line
flush the devtlb? Not in guest of course since the passdown tlb flush
is inclusive.
pasid_cache_invalidation_with_pasid(iommu, did, pasid);
iotlb_invalidation_with_pasid(iommu, did, pasid);
/* Device IOTLB doesn't need to be flushed in caching mode. */
if (!cap_caching_mode(iommu->cap))
devtlb_invalidation_with_pasid(iommu, dev, pasid);
> Best regards,
> baolu
>
> >
> > Cc: Lu Baolu <baolu.lu@linux.intel.com>
> > Signed-off-by: Jacob Pan <jacob.jun.pan@linux.intel.com>
> > ---
> > drivers/iommu/intel-svm.c | 6 ++----
> > 1 file changed, 2 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/iommu/intel-svm.c b/drivers/iommu/intel-svm.c
> > index 8f42d717d8d7..1483f1845762 100644
> > --- a/drivers/iommu/intel-svm.c
> > +++ b/drivers/iommu/intel-svm.c
> > @@ -268,10 +268,9 @@ static void intel_mm_release(struct
> > mmu_notifier *mn, struct mm_struct *mm)
> > * *has* to handle gracefully without affecting other
> > processes. */
> > rcu_read_lock();
> > - list_for_each_entry_rcu(sdev, &svm->devs, list) {
> > + list_for_each_entry_rcu(sdev, &svm->devs, list)
> > intel_pasid_tear_down_entry(svm->iommu,
> > sdev->dev, svm->pasid);
> > - intel_flush_svm_range_dev(svm, sdev, 0, -1, 0);
> > - }
> > +
> > rcu_read_unlock();
> >
> > }
> > @@ -731,7 +730,6 @@ int intel_svm_unbind_mm(struct device *dev, int
> > pasid)
> > * large and has to be physically
> > contiguous. So it's
> > * hard to be as defensive as we might
> > like. */ intel_pasid_tear_down_entry(iommu, dev, svm->pasid);
> > - intel_flush_svm_range_dev(svm, sdev, 0,
> > -1, 0); kfree_rcu(sdev, rcu);
> >
> > if (list_empty(&svm->devs)) {
> >
[Jacob Pan]
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
WARNING: multiple messages have this Message-ID (diff)
From: Jacob Pan <jacob.jun.pan@linux.intel.com>
To: Lu Baolu <baolu.lu@linux.intel.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
iommu@lists.linux-foundation.org, Joerg Roedel <joro@8bytes.org>,
David Woodhouse <dwmw2@infradead.org>,
Raj Ashok <ashok.raj@intel.com>, Yi Liu <yi.l.liu@intel.com>,
jacob.jun.pan@linux.intel.com
Subject: Re: [PATCH 1/3] iommu/vt-d: Remove redundant IOTLB flush
Date: Fri, 20 Mar 2020 09:20:47 -0700 [thread overview]
Message-ID: <20200320092047.4a4cf551@jacob-builder> (raw)
In-Reply-To: <26ab1917-f087-aafa-e861-6a2478000a6f@linux.intel.com>
On Fri, 20 Mar 2020 21:45:26 +0800
Lu Baolu <baolu.lu@linux.intel.com> wrote:
> On 2020/3/20 12:32, Jacob Pan wrote:
> > IOTLB flush already included in the PASID tear down process. There
> > is no need to flush again.
>
> It seems that intel_pasid_tear_down_entry() doesn't flush the pasid
> based device TLB?
>
I saw this code in intel_pasid_tear_down_entry(). Isn't the last line
flush the devtlb? Not in guest of course since the passdown tlb flush
is inclusive.
pasid_cache_invalidation_with_pasid(iommu, did, pasid);
iotlb_invalidation_with_pasid(iommu, did, pasid);
/* Device IOTLB doesn't need to be flushed in caching mode. */
if (!cap_caching_mode(iommu->cap))
devtlb_invalidation_with_pasid(iommu, dev, pasid);
> Best regards,
> baolu
>
> >
> > Cc: Lu Baolu <baolu.lu@linux.intel.com>
> > Signed-off-by: Jacob Pan <jacob.jun.pan@linux.intel.com>
> > ---
> > drivers/iommu/intel-svm.c | 6 ++----
> > 1 file changed, 2 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/iommu/intel-svm.c b/drivers/iommu/intel-svm.c
> > index 8f42d717d8d7..1483f1845762 100644
> > --- a/drivers/iommu/intel-svm.c
> > +++ b/drivers/iommu/intel-svm.c
> > @@ -268,10 +268,9 @@ static void intel_mm_release(struct
> > mmu_notifier *mn, struct mm_struct *mm)
> > * *has* to handle gracefully without affecting other
> > processes. */
> > rcu_read_lock();
> > - list_for_each_entry_rcu(sdev, &svm->devs, list) {
> > + list_for_each_entry_rcu(sdev, &svm->devs, list)
> > intel_pasid_tear_down_entry(svm->iommu,
> > sdev->dev, svm->pasid);
> > - intel_flush_svm_range_dev(svm, sdev, 0, -1, 0);
> > - }
> > +
> > rcu_read_unlock();
> >
> > }
> > @@ -731,7 +730,6 @@ int intel_svm_unbind_mm(struct device *dev, int
> > pasid)
> > * large and has to be physically
> > contiguous. So it's
> > * hard to be as defensive as we might
> > like. */ intel_pasid_tear_down_entry(iommu, dev, svm->pasid);
> > - intel_flush_svm_range_dev(svm, sdev, 0,
> > -1, 0); kfree_rcu(sdev, rcu);
> >
> > if (list_empty(&svm->devs)) {
> >
[Jacob Pan]
next prev parent reply other threads:[~2020-03-20 16:15 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-20 4:32 [PATCH 0/3] Misc bug fixes for VT-d SVM Jacob Pan
2020-03-20 4:32 ` Jacob Pan
2020-03-20 4:32 ` [PATCH 1/3] iommu/vt-d: Remove redundant IOTLB flush Jacob Pan
2020-03-20 4:32 ` Jacob Pan
2020-03-20 13:45 ` Lu Baolu
2020-03-20 13:45 ` Lu Baolu
2020-03-20 16:20 ` Jacob Pan [this message]
2020-03-20 16:20 ` Jacob Pan
2020-03-21 1:32 ` Lu Baolu
2020-03-21 1:32 ` Lu Baolu
2020-03-24 15:31 ` Jacob Pan
2020-03-24 15:31 ` Jacob Pan
2020-03-25 0:48 ` Lu Baolu
2020-03-25 0:48 ` Lu Baolu
2020-03-20 4:32 ` [PATCH 2/3] iommu/vt-d: Fix mm reference leak Jacob Pan
2020-03-20 4:32 ` Jacob Pan
2020-03-20 13:49 ` Lu Baolu
2020-03-20 13:49 ` Lu Baolu
2020-03-20 4:32 ` [PATCH 3/3] iommu/vt-d: Add build dependency on IOASID Jacob Pan
2020-03-20 4:32 ` Jacob Pan
2020-03-20 13:57 ` Lu Baolu
2020-03-20 13:57 ` Lu Baolu
2020-03-27 10:04 ` [PATCH 0/3] Misc bug fixes for VT-d SVM Joerg Roedel
2020-03-27 10:04 ` Joerg Roedel
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=20200320092047.4a4cf551@jacob-builder \
--to=jacob.jun.pan@linux.intel.com \
--cc=ashok.raj@intel.com \
--cc=baolu.lu@linux.intel.com \
--cc=dwmw2@infradead.org \
--cc=iommu@lists.linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
/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.