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: <20250116202147.GX5556@nvidia.com>
Date: Thu, 16 Jan 2025 16:21:47 -0400
From: Jason Gunthorpe <jgg@...dia.com>
To: Yury Norov <yury.norov@...il.com>
Cc: Nicolin Chen <nicolinc@...dia.com>, will@...nel.org,
	robin.murphy@....com, kevin.tian@...el.com, tglx@...utronix.de,
	maz@...nel.org, alex.williamson@...hat.com, joro@...tes.org,
	shuah@...nel.org, reinette.chatre@...el.com, eric.auger@...hat.com,
	yebin10@...wei.com, apatel@...tanamicro.com,
	shivamurthy.shastri@...utronix.de, bhelgaas@...gle.com,
	anna-maria@...utronix.de, nipun.gupta@....com,
	iommu@...ts.linux.dev, linux-kernel@...r.kernel.org,
	linux-arm-kernel@...ts.infradead.org, kvm@...r.kernel.org,
	linux-kselftest@...r.kernel.org, patches@...ts.linux.dev,
	jean-philippe@...aro.org, mdf@...nel.org, mshavit@...gle.com,
	shameerali.kolothum.thodi@...wei.com, smostafa@...gle.com,
	ddutile@...hat.com
Subject: Re: [PATCH RFCv2 07/13] iommufd: Implement sw_msi support natively

On Tue, Jan 14, 2025 at 11:21:13PM -0500, Yury Norov wrote:
> > +static int iommufd_sw_msi_install(struct iommufd_ctx *ictx,
> > +				  struct iommufd_hwpt_paging *hwpt_paging,
> > +				  struct iommufd_sw_msi_map *msi_map)
> > +{
> > +	unsigned long iova;
> > +
> > +	lockdep_assert_held(&ictx->sw_msi_lock);
> > +
> > +	iova = msi_map->sw_msi_start + msi_map->pgoff * PAGE_SIZE;
> > +	if (!test_bit(msi_map->id, hwpt_paging->present_sw_msi.bitmap)) {
> > +		int rc;
> > +
> > +		rc = iommu_map(hwpt_paging->common.domain, iova,
> > +			       msi_map->msi_addr, PAGE_SIZE,
> > +			       IOMMU_WRITE | IOMMU_READ | IOMMU_MMIO,
> > +			       GFP_KERNEL_ACCOUNT);
> > +		if (rc)
> > +			return rc;
> > +		set_bit(msi_map->id, hwpt_paging->present_sw_msi.bitmap);
> > +	}
> > +	return 0;
> > +}
> 
> So, does sw_msi_lock protect the present_sw_msi bitmap? If so, you
> should use non-atomic __set_bit().

Yes, that is a good point

Thanks,
Jason

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ