Linux IOMMU Development
 help / color / mirror / Atom feed
From: Yi Liu <yi.l.liu@intel.com>
To: "Duan, Zhenzhong" <zhenzhong.duan@intel.com>,
	"joro@8bytes.org" <joro@8bytes.org>,
	"jgg@nvidia.com" <jgg@nvidia.com>,
	"Tian, Kevin" <kevin.tian@intel.com>,
	"baolu.lu@linux.intel.com" <baolu.lu@linux.intel.com>
Cc: "alex.williamson@redhat.com" <alex.williamson@redhat.com>,
	"robin.murphy@arm.com" <robin.murphy@arm.com>,
	"eric.auger@redhat.com" <eric.auger@redhat.com>,
	"nicolinc@nvidia.com" <nicolinc@nvidia.com>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	"chao.p.peng@linux.intel.com" <chao.p.peng@linux.intel.com>,
	"iommu@lists.linux.dev" <iommu@lists.linux.dev>,
	"Pan, Jacob jun" <jacob.jun.pan@intel.com>
Subject: Re: [PATCH v2 0/2] Two enhancements to iommu_at[de]tach_device_pasid()
Date: Fri, 29 Mar 2024 11:38:10 +0800	[thread overview]
Message-ID: <902e9ca4-51d4-4705-9d60-e03f8d914ef9@intel.com> (raw)
In-Reply-To: <SJ0PR11MB674441C2652047C02276FC25923A2@SJ0PR11MB6744.namprd11.prod.outlook.com>

On 2024/3/29 10:12, Duan, Zhenzhong wrote:
> 
> 
>> -----Original Message-----
>> From: Liu, Yi L <yi.l.liu@intel.com>
>> Subject: [PATCH v2 0/2] Two enhancements to
>> iommu_at[de]tach_device_pasid()
>>
>> There are minor mistakes in the iommu set_dev_pasid() and
>> remove_dev_pasid()
>> paths. The set_dev_pasid() path updates the group->pasid_array first, and
>> then call into remove_dev_pasid() in error handling when there are devices
>> within the group that failed to set_dev_pasid.
> 
> Not related to this patch, just curious in which cases some of the devices
> In same group failed to set_dev_pasid while others succeed?
There are multiple failure reasons. Given to the fact of some devices have 
already succeeded, the most typical error may be no memory. Not sure about
other reasons.

Regards,
Yi Liu

> Thanks
> Zhenzhong
> 
>> The remove_dev_pasid()
>> callbacks of the underlying iommu drivers get the domain for pasid from the
>> group->pasid_array. So the remove_dev_pasid() callback may get a wrong
>> domain
>> in the set_dev_pasid() path. [1] Even if the group is singleton, the existing
>> code logic would have unnecessary warnings in the error handling of the
>> set_dev_pasid() path. e.g. intel iommu driver.
>>
>> The above issue can be fixed by improving the error handling in the
>> set_dev_pasid() path. Also, this reminds that it is not reliable for the
>> underlying iommu driver callback to get the domain from group-
>>> pasid_array.
>> So, the second patch of this series passes the domain to remove_dev_pasid
>> op.
>>
>> [1] https://lore.kernel.org/linux-
>> iommu/20240320123803.GD159172@nvidia.com/
>>
>> Change log:
>>
>> v2:
>> - Make clear that the patch 1/2 of v1 does not fix the problem (Kevin)
>> - Swap the order of patch 1/2 and 2/2 of v1. In this new series, patch 1/2
>>    fixes the real issue, patch 2/2 is to avoid potential issue in the future.
>>
>> v1: https://lore.kernel.org/linux-iommu/20240327125433.248946-1-
>> yi.l.liu@intel.com/
>>
>> Regards,
>> 	Yi Liu
>>
>> Yi Liu (2):
>>   iommu: Undo pasid attachment only for the devices that have succeeded
>>   iommu: Pass domain to remove_dev_pasid() op
>>
>> drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c |  9 ++-----
>> drivers/iommu/intel/iommu.c                 | 11 +++-----
>> drivers/iommu/iommu.c                       | 28 ++++++++++++++-------
>> include/linux/iommu.h                       |  3 ++-
>> 4 files changed, 26 insertions(+), 25 deletions(-)
>>
>> --
>> 2.34.1
> 

-- 
Regards,
Yi Liu

  reply	other threads:[~2024-03-29  3:34 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-28 12:29 [PATCH v2 0/2] Two enhancements to iommu_at[de]tach_device_pasid() Yi Liu
2024-03-28 12:29 ` [PATCH v2 1/2] iommu: Undo pasid attachment only for the devices that have succeeded Yi Liu
2024-04-03  3:08   ` Baolu Lu
2024-03-28 12:29 ` [PATCH v2 2/2] iommu: Pass domain to remove_dev_pasid() op Yi Liu
2024-03-29  3:32   ` Tian, Kevin
2024-04-03  3:04   ` Baolu Lu
2024-04-03  3:25     ` Yi Liu
2024-04-05 18:17       ` Jason Gunthorpe
2024-03-29  2:12 ` [PATCH v2 0/2] Two enhancements to iommu_at[de]tach_device_pasid() Duan, Zhenzhong
2024-03-29  3:38   ` Yi Liu [this message]
2024-03-29  5:31     ` Duan, Zhenzhong
2024-04-03  2:56   ` Baolu Lu
2024-04-03  4:14     ` Duan, Zhenzhong
2024-04-12 10:13 ` Joerg Roedel

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=902e9ca4-51d4-4705-9d60-e03f8d914ef9@intel.com \
    --to=yi.l.liu@intel.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=jgg@nvidia.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=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