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] [day] [month] [year] [list]
Message-ID: <DS0PR11MB637371E03056B47148533BDDDC8AA@DS0PR11MB6373.namprd11.prod.outlook.com>
Date: Fri, 9 May 2025 11:39:16 +0000
From: "Wang, Wei W" <wei.w.wang@...el.com>
To: "Liu, Yi L" <yi.l.liu@...el.com>, "dwmw2@...radead.org"
	<dwmw2@...radead.org>, "baolu.lu@...ux.intel.com" <baolu.lu@...ux.intel.com>,
	"Tian, Kevin" <kevin.tian@...el.com>, "jroedel@...e.de" <jroedel@...e.de>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"iommu@...ts.linux.dev" <iommu@...ts.linux.dev>
Subject: RE: [PATCH v1 1/3] iommu/vt-d: Eliminate pci_physfn() in
 dmar_find_matched_satc_unit()

On Friday, May 9, 2025 5:16 PM, Liu, Yi L wrote:
> On 2025/5/9 22:00, Wei Wang wrote:
> > The function dmar_find_matched_satc_unit() contains a duplicate call
> > to pci_physfn(). This call is unnecessary as pci_physfn() has already
> > been invoked by the caller. Removing the redundant call simplifies the
> > code and improves efficiency a bit.
> >
> > Signed-off-by: Wei Wang <wei.w.wang@...el.com>
> > ---
> >   drivers/iommu/intel/iommu.c | 1 -
> >   1 file changed, 1 deletion(-)
> >
> > diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c
> > index cb0b993bebb4..d8aa71305509 100644
> > --- a/drivers/iommu/intel/iommu.c
> > +++ b/drivers/iommu/intel/iommu.c
> > @@ -2744,7 +2744,6 @@ static struct dmar_satc_unit
> *dmar_find_matched_satc_unit(struct pci_dev *dev)
> >   	struct device *tmp;
> >   	int i;
> >
> > -	dev = pci_physfn(dev);
> 
> better have a comment to highlight the input dev should be PF. also, can add a
> WARN_ON(dev->is_virtfn);

How about changing the input to "struct pci_dev *pf_pdev " (like the one used
in device_lookup_iommu())?
This way, we probably don't need extra comments, and WARN_ON() might not be
necessary IMHO, as this is a static function with only one caller currently (already
clear that the input is a pf_dev)


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ