[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <BN9PR11MB527626C3064AE35AE93505CA8C48A@BN9PR11MB5276.namprd11.prod.outlook.com>
Date: Thu, 10 Jul 2025 08:03:17 +0000
From: "Tian, Kevin" <kevin.tian@...el.com>
To: Xu Yilun <yilun.xu@...ux.intel.com>, "jgg@...dia.com" <jgg@...dia.com>,
"jgg@...pe.ca" <jgg@...pe.ca>, "will@...nel.org" <will@...nel.org>,
"aneesh.kumar@...nel.org" <aneesh.kumar@...nel.org>
CC: "iommu@...ts.linux.dev" <iommu@...ts.linux.dev>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"joro@...tes.org" <joro@...tes.org>, "robin.murphy@....com"
<robin.murphy@....com>, "shuah@...nel.org" <shuah@...nel.org>,
"nicolinc@...dia.com" <nicolinc@...dia.com>, "aik@....com" <aik@....com>,
"Williams, Dan J" <dan.j.williams@...el.com>, "baolu.lu@...ux.intel.com"
<baolu.lu@...ux.intel.com>, "Xu, Yilun" <yilun.xu@...el.com>
Subject: RE: [PATCH v4 4/7] iommufd: Destroy vdevice on idevice destroy
> From: Xu Yilun <yilun.xu@...ux.intel.com>
> Sent: Wednesday, July 9, 2025 12:03 PM
>
> Destroy iommufd_vdevice (vdev) on iommufd_idevice (idev) destruction so
> that vdev can't outlive idev.
>
> idev represents the physical device bound to iommufd, while the vdev
> represents the virtual instance of the physical device in the VM. The
> lifecycle of the vdev should not be longer than idev. This doesn't
> cause real problem on existing use cases cause vdev doesn't impact the
> physical device, only provides virtualization information. But to
> extend vdev for Confidential Computing (CC), there are needs to do
> secure configuration for the vdev, e.g. TSM Bind/Unbind. These
> configurations should be rolled back on idev destroy, or the external
> driver (VFIO) functionality may be impact.
>
> The idev is created by external driver so its destruction can't fail.
> The idev implements pre_destroy() op to actively remove its associated
> vdev before destroying itself. There are 3 cases on idev pre_destroy():
>
> 1. vdev is already destroyed by userspace. No extra handling needed.
> 2. vdev is still alive. Use iommufd_object_tombstone_user() to
> destroy vdev and tombstone the vdev ID.
> 3. vdev is being destroyed by userspace. The vdev ID is already
> freed, but vdev destroy handler is not completed. This requires
> multi-threads syncing - vdev holds idev's short term users
> reference until vdev destruction completes, idev leverages
> existing wait_shortterm mechanism for syncing.
could also mention the introduction of 'idev->destroying'
>
> Originally-by: Nicolin Chen <nicolinc@...dia.com>
> Suggested-by: Jason Gunthorpe <jgg@...dia.com>
> Reviewed-by: Lu Baolu <baolu.lu@...ux.intel.com>
I'd remove this tag as this version has substantial change compared to
last version.
> Co-developed-by: Aneesh Kumar K.V (Arm) <aneesh.kumar@...nel.org>
> Signed-off-by: Aneesh Kumar K.V (Arm) <aneesh.kumar@...nel.org>
> Signed-off-by: Xu Yilun <yilun.xu@...ux.intel.com>
please also update the description about IOMMUFD_CMD_VDEVICE_ALLOC
in include/uapi/linux/iommufd.h, so the user is aware of the implication.
Reviewed-by: Kevin Tian <kevin.tian@...el.com>
Powered by blists - more mailing lists