public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: Lu Baolu <baolu.lu@linux.intel.com>
To: Nadav Amit <nadav.amit@gmail.com>, iommu@lists.linux-foundation.org
Cc: baolu.lu@linux.intel.com, linux-kernel@vger.kernel.org,
	Nadav Amit <namit@vmware.com>,
	David Woodhouse <dwmw2@infradead.org>,
	Joerg Roedel <joro@8bytes.org>, Will Deacon <will@kernel.org>,
	stable@vger.kernel.org
Subject: Re: [PATCH] iommu/vt-d: do not use flush-queue when caching-mode is on
Date: Wed, 27 Jan 2021 08:29:37 +0800	[thread overview]
Message-ID: <72cab17b-7b2f-1e4d-3bd5-3041b7edc724@linux.intel.com> (raw)
In-Reply-To: <cf693fca-4f5a-a6a6-cc58-3f4e3cd882b6@linux.intel.com>

On 1/27/21 8:26 AM, Lu Baolu wrote:
>> +{
>> +    struct dmar_domain *dmar_domain = to_dmar_domain(domain);
>> +    struct intel_iommu *iommu = domain_get_iommu(dmar_domain);
>> +
>> +    if (intel_iommu_strict)
>> +        return 0;
>> +
>> +    /*
>> +     * The flush queue implementation does not perform page-selective
>> +     * invalidations that are required for efficient TLB flushes in 
>> virtual
>> +     * environments. The benefit of batching is likely to be much 
>> lower than
>> +     * the overhead of synchronizing the virtual and physical IOMMU
>> +     * page-tables.
>> +     */
>> +    if (iommu && cap_caching_mode(iommu->cap)) {
>> +        pr_warn_once("IOMMU batching is partially disabled due to 
>> virtualization");
>> +        return 0;
>> +    }
> 
> domain_get_iommu() only returns the first iommu, and could return NULL
> when this is called before domain attaching to any device. A better
> choice could be check caching mode globally and return false if caching
> mode is supported on any iommu.
> 
>         struct dmar_drhd_unit *drhd;
>         struct intel_iommu *iommu;
> 
>         rcu_read_lock();
>         for_each_active_iommu(iommu, drhd) {
>                  if (cap_caching_mode(iommu->cap))
>                          return false;

We should unlock rcu before return here. Sorry!

>          }
>          rcu_read_unlock();

Best regards,
baolu

  reply	other threads:[~2021-01-27  7:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-26 20:38 [PATCH] iommu/vt-d: do not use flush-queue when caching-mode is on Nadav Amit
2021-01-27  0:26 ` Lu Baolu
2021-01-27  0:29   ` Lu Baolu [this message]
2021-01-27  5:44   ` Nadav Amit

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=72cab17b-7b2f-1e4d-3bd5-3041b7edc724@linux.intel.com \
    --to=baolu.lu@linux.intel.com \
    --cc=dwmw2@infradead.org \
    --cc=iommu@lists.linux-foundation.org \
    --cc=joro@8bytes.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nadav.amit@gmail.com \
    --cc=namit@vmware.com \
    --cc=stable@vger.kernel.org \
    --cc=will@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox