Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@nvidia.com>
To: Yi Liu <yi.l.liu@intel.com>
Cc: joro@8bytes.org, kevin.tian@intel.com, baolu.lu@linux.intel.com,
	alex.williamson@redhat.com, robin.murphy@arm.com,
	eric.auger@redhat.com, nicolinc@nvidia.com, kvm@vger.kernel.org,
	chao.p.peng@linux.intel.com, iommu@lists.linux.dev,
	zhenzhong.duan@intel.com, jacob.jun.pan@intel.com
Subject: Re: [PATCH 1/2] iommu: Pass domain to remove_dev_pasid() op
Date: Wed, 27 Mar 2024 10:02:34 -0300	[thread overview]
Message-ID: <20240327130234.GE946323@nvidia.com> (raw)
In-Reply-To: <20240327125433.248946-2-yi.l.liu@intel.com>

On Wed, Mar 27, 2024 at 05:54:32AM -0700, Yi Liu wrote:
> Existing remove_dev_pasid() callbacks of the underlying iommu drivers get
> the attached domain from the group->pasid_array. However, the domains
> stored in group->pasid_array are not always correct. For example, the
> set_dev_pasid() path updates group->pasid_array first and then invoke
> remove_dev_pasid() callback when error happened. The remove_dev_pasid()
> callback would get the updated domain. This is not correct for the
> devices that are still attached with an old domain or just no attached
> domain.
> 
> To avoid the above problem, passing the attached domain to the
> remove_dev_pasid() callback is more reliable.

I've relaized we have the same issue with set_dev_pasid, there is no
way for the driver to get the old domain since the xarray was updated
before calling set_dev_pasid. This is unlike the RID path. Meaning
drivers can't implement PASID replace.

So we need another patch to pass the old domain into set_dev_pasid
too...

This looks fine

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

Jason

  reply	other threads:[~2024-03-27 13:02 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-27 12:54 [PATCH 0/2] Two enhancements to iommu_at[de]tach_device_pasid() Yi Liu
2024-03-27 12:54 ` [PATCH 1/2] iommu: Pass domain to remove_dev_pasid() op Yi Liu
2024-03-27 13:02   ` Jason Gunthorpe [this message]
2024-03-27 13:10     ` Yi Liu
2024-03-28 12:38     ` Yi Liu
2024-03-28  3:12   ` Tian, Kevin
2024-03-28  6:28     ` Yi Liu
2024-03-27 12:54 ` [PATCH 2/2] iommu: Undo pasid attachment only for the devices that have succeeded Yi Liu
2024-03-27 13:05   ` Jason Gunthorpe
2024-03-27 13:12     ` Yi Liu
2024-03-28  3:15   ` Tian, Kevin
2024-03-28  6:29     ` Yi Liu

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=20240327130234.GE946323@nvidia.com \
    --to=jgg@nvidia.com \
    --cc=alex.williamson@redhat.com \
    --cc=baolu.lu@linux.intel.com \
    --cc=chao.p.peng@linux.intel.com \
    --cc=eric.auger@redhat.com \
    --cc=iommu@lists.linux.dev \
    --cc=jacob.jun.pan@intel.com \
    --cc=joro@8bytes.org \
    --cc=kevin.tian@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=nicolinc@nvidia.com \
    --cc=robin.murphy@arm.com \
    --cc=yi.l.liu@intel.com \
    --cc=zhenzhong.duan@intel.com \
    /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