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]
Date: Wed, 21 Feb 2024 16:39:34 +0800
From: Zhangfei Gao <zhangfei.gao@...aro.org>
To: "Zhang, Tina" <tina.zhang@...el.com>
Cc: Joerg Roedel <joro@...tes.org>, Will Deacon <will@...nel.org>, 
	jean-philippe <jean-philippe@...aro.org>, Jason Gunthorpe <jgg@...dia.com>, 
	"baolu.lu@...ux.intel.com" <baolu.lu@...ux.intel.com>, "iommu@...ts.linux.dev" <iommu@...ts.linux.dev>, 
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] iommu: Fix iommu_sva_bind_device to the same domain

On Wed, 21 Feb 2024 at 15:59, Zhang, Tina <tina.zhang@...el.com> wrote:
>
> Hi,
>
> > -----Original Message-----
> > From: Zhangfei Gao <zhangfei.gao@...aro.org>
> > Sent: Wednesday, February 21, 2024 2:19 PM
> > To: Joerg Roedel <joro@...tes.org>; Will Deacon <will@...nel.org>; jean-
> > philippe <jean-philippe@...aro.org>; Jason Gunthorpe <jgg@...dia.com>;
> > baolu.lu@...ux.intel.com; Zhang, Tina <tina.zhang@...el.com>
> > Cc: iommu@...ts.linux.dev; linux-kernel@...r.kernel.org; Zhangfei Gao
> > <zhangfei.gao@...aro.org>
> > Subject: [PATCH] iommu: Fix iommu_sva_bind_device to the same domain
> >
> > The accelerator dev can provide multi-queue and bind to the same domain in
> > multi-thread for better performance, and domain refcount takes care of it.
> >
> > 'commit 092edaddb660 ("iommu: Support mm PASID 1:n with sva domains")'
> > removes the possibility, so fix it
> >
> > Fixs: '092edaddb660 ("iommu: Support mm PASID 1:n with sva domains")'
> > Signed-off-by: Zhangfei Gao <zhangfei.gao@...aro.org>
> > ---
> >  drivers/iommu/iommu-sva.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/iommu/iommu-sva.c b/drivers/iommu/iommu-sva.c index
> > c3fc9201d0be..a95c8f3a5407 100644
> > --- a/drivers/iommu/iommu-sva.c
> > +++ b/drivers/iommu/iommu-sva.c
> > @@ -91,7 +91,7 @@ struct iommu_sva *iommu_sva_bind_device(struct
> > device *dev, struct mm_struct *mm
> >       /* Search for an existing domain. */
> >       list_for_each_entry(domain, &mm->iommu_mm->sva_domains, next)
> > {
> >               ret = iommu_attach_device_pasid(domain, dev, iommu_mm-
> > >pasid);
> > -             if (!ret) {
> > +             if (!ret || ret == -EBUSY) {
> If rebinding is allowed, how could IOMMU core know if this invocation is intended (like the multi-thread case mentioned in the commit message) or is mistakenly invoked?

I think it is the purpose of refcount, it should be no difference
whether same device or not.
Even different dev, IOMMU core can not make sure it is intended or
mistakenly invoked.

Add the limitation does not make sense.

Thanks

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ