lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1e19074b-0f8d-b897-585c-582ff3e63367@linux.intel.com>
Date:   Tue, 14 Jun 2022 15:44:21 +0800
From:   Baolu Lu <baolu.lu@...ux.intel.com>
To:     "Tian, Kevin" <kevin.tian@...el.com>,
        Joerg Roedel <joro@...tes.org>,
        "Raj, Ashok" <ashok.raj@...el.com>,
        Christoph Hellwig <hch@...radead.org>,
        Jason Gunthorpe <jgg@...dia.com>
Cc:     baolu.lu@...ux.intel.com, Will Deacon <will@...nel.org>,
        Robin Murphy <robin.murphy@....com>,
        "Liu, Yi L" <yi.l.liu@...el.com>,
        "Pan, Jacob jun" <jacob.jun.pan@...el.com>,
        "iommu@...ts.linux-foundation.org" <iommu@...ts.linux-foundation.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2 10/12] iommu/vt-d: Fold __dmar_remove_one_dev_info()
 into its caller

On 2022/6/14 15:07, Tian, Kevin wrote:
>> From: Lu Baolu<baolu.lu@...ux.intel.com>
>> Sent: Tuesday, June 14, 2022 10:52 AM
>>
>> Fold __dmar_remove_one_dev_info() into dmar_remove_one_dev_info()
>> which
>> is its only caller. Make the spin lock critical range only cover the
>> device list change code and remove some unnecessary checks.
>>
>> Signed-off-by: Lu Baolu<baolu.lu@...ux.intel.com>
>> ---
>>   drivers/iommu/intel/iommu.c | 34 +++++++++-------------------------
>>   1 file changed, 9 insertions(+), 25 deletions(-)
>>
>> diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c
>> index af22690f44c8..8345e0c0824c 100644
>> --- a/drivers/iommu/intel/iommu.c
>> +++ b/drivers/iommu/intel/iommu.c
>> @@ -295,7 +295,6 @@ static LIST_HEAD(dmar_satc_units);
>>   static int g_num_of_iommus;
>>
>>   static void dmar_remove_one_dev_info(struct device *dev);
>> -static void __dmar_remove_one_dev_info(struct device_domain_info *info);
>>
>>   int dmar_disabled = !IS_ENABLED(CONFIG_INTEL_IOMMU_DEFAULT_ON);
>>   int intel_iommu_sm =
>> IS_ENABLED(CONFIG_INTEL_IOMMU_SCALABLE_MODE_DEFAULT_ON);
>> @@ -4141,20 +4140,14 @@ static void domain_context_clear(struct
>> device_domain_info *info)
>>   			       &domain_context_clear_one_cb, info);
>>   }
>>
>> -static void __dmar_remove_one_dev_info(struct device_domain_info *info)
>> +static void dmar_remove_one_dev_info(struct device *dev)
>>   {
>> -	struct dmar_domain *domain;
>> -	struct intel_iommu *iommu;
>> -
>> -	assert_spin_locked(&device_domain_lock);
>> -
>> -	if (WARN_ON(!info))
>> -		return;
>> -
>> -	iommu = info->iommu;
>> -	domain = info->domain;
>> +	struct device_domain_info *info = dev_iommu_priv_get(dev);
>> +	struct dmar_domain *domain = info->domain;
> this local variable is not required as there is just one reference
> to info->domain.

Yes. It could be removed and use info->domain directly.

> 
> btw I didn't see info->domain is cleared in this path. Is it correct?
> 

It's better to clear here. I will make this change in my in-process
blocking domain series.

But it doesn't cause any real problems because the Intel IOMMU driver
supports default domain, hence the logic here is info->domain is
replaced, but not cleared.

Best regards,
baolu

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ