Linux IOMMU Development
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@nvidia.com>
To: Zhangfei Gao <zhangfei.gao@linaro.org>
Cc: iommu@lists.linux.dev, Joerg Roedel <joro@8bytes.org>,
	Robin Murphy <robin.murphy@arm.com>,
	Will Deacon <will@kernel.org>,
	Lu Baolu <baolu.lu@linux.intel.com>,
	Joerg Roedel <jroedel@suse.de>,
	Nicolin Chen <nicolinc@nvidia.com>,
	patches@lists.linux.dev, Tina Zhang <tina.zhang@intel.com>,
	Vasant Hegde <vasant.hegde@amd.com>
Subject: Re: [PATCH rc] iommu/sva: Restore SVA handle sharing
Date: Mon, 26 Feb 2024 09:07:53 -0400	[thread overview]
Message-ID: <20240226130753.GK13330@nvidia.com> (raw)
In-Reply-To: <CABQgh9GTnT+ieqQiNFjc=CLeG0J01Rf3RdLxZatdkKJgNLqXsA@mail.gmail.com>

On Mon, Feb 26, 2024 at 04:38:52PM +0800, Zhangfei Gao wrote:
> Hi, Jason
> 
> I am testing on 6.8-rc6 with more test and found one issue, sorry about this.
> When test openssl rsa, it will use two devices, one is sec, the other is hpre.
> I found the second handle can not be shared since bind_dev directly
> goto out but not add_list.
> 
> So still need a minor fix like this
> 
>     iommu/sva: Fix SVA handle sharing in multi device case
> 
> 
>     iommu_sva_bind_device will directly goto out in multi-device
>     case when found existing domain, ignoring list_add handle,
>     which causes the handle to fail to be shared.
> 
>     Fixs: 65d4418c5002 (iommu/sva: Restore SVA handle sharing)
>     Signed-off-by: Zhangfei Gao <zhangfei.gao@linaro.org>
> 
> diff --git a/drivers/iommu/iommu-sva.c b/drivers/iommu/iommu-sva.c
> index 7f91c8d0064b..b1f3a864e124 100644
> --- a/drivers/iommu/iommu-sva.c
> +++ b/drivers/iommu/iommu-sva.c
> @@ -117,11 +117,10 @@ struct iommu_sva *iommu_sva_bind_device(struct
> device *dev, struct mm_struct *mm
>         if (ret)
>                 goto out_free_domain;
>         domain->users = 1;
> -       refcount_set(&handle->users, 1);
>         list_add(&domain->next, &mm->iommu_mm->sva_domains);
> -       list_add(&handle->handle_item, &mm->iommu_mm->sva_handles);
> 
>  out:
> +       refcount_set(&handle->users, 1);
> +       list_add(&handle->handle_item, &mm->iommu_mm->sva_handles);
>         mutex_unlock(&iommu_sva_lock);
>         handle->dev = dev;
>         handle->domain = domain;
> 
> What do you think.

Yes, please send a patch

Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>

Jason

      reply	other threads:[~2024-02-26 13:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-22 14:07 [PATCH rc] iommu/sva: Restore SVA handle sharing Jason Gunthorpe
2024-02-22 14:39 ` Zhangfei Gao
2024-02-23  5:06 ` Baolu Lu
2024-02-23 15:45 ` Joerg Roedel
2024-02-26  8:38 ` Zhangfei Gao
2024-02-26 13:07   ` Jason Gunthorpe [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240226130753.GK13330@nvidia.com \
    --to=jgg@nvidia.com \
    --cc=baolu.lu@linux.intel.com \
    --cc=iommu@lists.linux.dev \
    --cc=joro@8bytes.org \
    --cc=jroedel@suse.de \
    --cc=nicolinc@nvidia.com \
    --cc=patches@lists.linux.dev \
    --cc=robin.murphy@arm.com \
    --cc=tina.zhang@intel.com \
    --cc=vasant.hegde@amd.com \
    --cc=will@kernel.org \
    --cc=zhangfei.gao@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox