[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <72cab17b-7b2f-1e4d-3bd5-3041b7edc724@linux.intel.com>
Date: Wed, 27 Jan 2021 08:29:37 +0800
From: Lu Baolu <baolu.lu@...ux.intel.com>
To: Nadav Amit <nadav.amit@...il.com>, iommu@...ts.linux-foundation.org
Cc: baolu.lu@...ux.intel.com, linux-kernel@...r.kernel.org,
Nadav Amit <namit@...are.com>,
David Woodhouse <dwmw2@...radead.org>,
Joerg Roedel <joro@...tes.org>, Will Deacon <will@...nel.org>,
stable@...r.kernel.org
Subject: Re: [PATCH] iommu/vt-d: do not use flush-queue when caching-mode is
on
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
Powered by blists - more mailing lists