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: <527a5b65-e7df-1281-beee-208d156bee01@linux.intel.com>
Date:   Sun, 29 Mar 2020 15:35:49 +0800
From:   Lu Baolu <baolu.lu@...ux.intel.com>
To:     Auger Eric <eric.auger@...hat.com>,
        "Tian, Kevin" <kevin.tian@...el.com>,
        Jacob Pan <jacob.jun.pan@...ux.intel.com>,
        "iommu@...ts.linux-foundation.org" <iommu@...ts.linux-foundation.org>,
        LKML <linux-kernel@...r.kernel.org>,
        Joerg Roedel <joro@...tes.org>,
        David Woodhouse <dwmw2@...radead.org>,
        Alex Williamson <alex.williamson@...hat.com>,
        Jean-Philippe Brucker <jean-philippe@...aro.com>
Cc:     baolu.lu@...ux.intel.com, "Liu, Yi L" <yi.l.liu@...el.com>,
        "Raj, Ashok" <ashok.raj@...el.com>,
        Christoph Hellwig <hch@...radead.org>,
        Jonathan Cameron <jic23@...nel.org>
Subject: Re: [PATCH V10 04/11] iommu/vt-d: Use helper function to skip agaw
 for SL

On 2020/3/28 0:05, Auger Eric wrote:
> Hi Jacob,
> 
> On 3/27/20 12:55 PM, Tian, Kevin wrote:
>>> From: Jacob Pan<jacob.jun.pan@...ux.intel.com>
>>> Sent: Saturday, March 21, 2020 7:28 AM
>>>
>>> Signed-off-by: Jacob Pan<jacob.jun.pan@...ux.intel.com>
>>> ---
>>>   drivers/iommu/intel-pasid.c | 14 ++++----------
>>>   1 file changed, 4 insertions(+), 10 deletions(-)
>>>
>>> diff --git a/drivers/iommu/intel-pasid.c b/drivers/iommu/intel-pasid.c
>>> index 191508c7c03e..9bdb7ee228b6 100644
>>> --- a/drivers/iommu/intel-pasid.c
>>> +++ b/drivers/iommu/intel-pasid.c
>>> @@ -544,17 +544,11 @@ int intel_pasid_setup_second_level(struct
>>> intel_iommu *iommu,
>>>   		return -EINVAL;
>>>   	}
>>>
>>> -	/*
>>> -	 * Skip top levels of page tables for iommu which has less agaw
>>> -	 * than default. Unnecessary for PT mode.
>>> -	 */
>>>   	pgd = domain->pgd;
>>> -	for (agaw = domain->agaw; agaw > iommu->agaw; agaw--) {
>>> -		pgd = phys_to_virt(dma_pte_addr(pgd));
>>> -		if (!dma_pte_present(pgd)) {
>>> -			dev_err(dev, "Invalid domain page table\n");
>>> -			return -EINVAL;
>>> -		}
>>> +	agaw = iommu_skip_agaw(domain, iommu, &pgd);
>>> +	if (agaw < 0) {
>>> +		dev_err(dev, "Invalid domain page table\n");
> is the dev_err() really requested. I see in domain_setup_first_level(),
> there is none.
>>> +		return -EINVAL;
>>>   	}
>> ok, I see how it is used. possibly combine last and this one together since
>> it's mostly moving code...
> I tend to agree with Kevin. May be better squash the 2 patches. Also not
> sure the inline of iommu_skip_agaw() is meaningful then. Also Add commit
> messages on the resulting patch.
> 
> Note domain_setup_first_level() also could use the helper while we are
> it (if declaration moved to common helper). Only the error code differs
> in case !dma_pte_present(pgd), ie. -ENOMEM. May be good to align.
> 
> Otherwise those stuff may be done in a fixup patch.

Agreed. Will squash these 2 patches with a meaningful commit message. As
for using this helper in other files, like domain_setup_first_level(),
we need more review and test efforts, hence it's better to put it in a
followup patch.

Best regards,
baolu

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ