[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y+yGzihpAdj7iP2G@Asurada-Nvidia>
Date: Tue, 14 Feb 2023 23:16:30 -0800
From: Nicolin Chen <nicolinc@...dia.com>
To: "Tian, Kevin" <kevin.tian@...el.com>
CC: "jgg@...dia.com" <jgg@...dia.com>,
"joro@...tes.org" <joro@...tes.org>,
"will@...nel.org" <will@...nel.org>,
"robin.murphy@....com" <robin.murphy@....com>,
"alex.williamson@...hat.com" <alex.williamson@...hat.com>,
"shuah@...nel.org" <shuah@...nel.org>,
"Liu, Yi L" <yi.l.liu@...el.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"iommu@...ts.linux.dev" <iommu@...ts.linux.dev>,
"kvm@...r.kernel.org" <kvm@...r.kernel.org>,
"linux-kselftest@...r.kernel.org" <linux-kselftest@...r.kernel.org>,
"baolu.lu@...ux.intel.com" <baolu.lu@...ux.intel.com>
Subject: Re: [PATCH v2 08/10] iommufd/device: Use iommu_group_replace_domain()
On Wed, Feb 15, 2023 at 01:38:32AM +0000, Tian, Kevin wrote:
> External email: Use caution opening links or attachments
>
>
> > From: Nicolin Chen <nicolinc@...dia.com>
> > Sent: Tuesday, February 14, 2023 7:00 PM
> >
> > On Fri, Feb 10, 2023 at 02:11:23AM +0000, Tian, Kevin wrote:
> >
> > > My confusion is that we have different flows between detach/attach
> > > and replace.
> > >
> > > today with separate detach+attach we have following flow:
> > >
> > > Remove device from current hwpt;
> > > if (last_device in hwpt) {
> > > Remove hwpt domain from current iopt;
> > > if (last_device in group)
> > > detach group from hwpt domain;
> > > }
> > >
> > > if (first device in group) {
> > > attach group to new hwpt domain;
> > > if (first_device in hwpt)
> > > Add hwpt domain to new iopt;
> > > Add device to new hwpt;
> > >
> > > but replace flow is different on the detach part:
> > >
> > > if (first device in group) {
> > > replace group's domain from current hwpt to new hwpt;
> > > if (first_device in hwpt)
> > > Add hwpt domain to new iopt;
> > > }
> > >
> > > Remove device from old hwpt;
> > > if (last_device in old hwpt)
> > > Remove hwpt domain from old iopt;
> > >
> > > Add device to new hwpt;
> > >
> > > I'm yet to figure out whether we have sufficient lock protection to
> > > prevent other paths from using old iopt/hwpt to find the device
> > > which is already attached to a different domain.
> >
> > With Jason's new series, the detach() routine is lighter now.
> >
> > I wonder if it'd be safer now to do the detach() call after
> > iommu_group_replace_domain()?
> >
>
> yes, looks so.
Will rebase a v3 once Jason updates his series. Thanks!
Powered by blists - more mailing lists