lkml.org 
[lkml]   [2023]   [Feb]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    From
    SubjectRE: [PATCH v1 7/8] iommufd/device: Use iommu_group_replace_domain()
    Date
    > From: Nicolin Chen <nicolinc@nvidia.com>
    > Sent: Tuesday, February 7, 2023 3:18 AM
    >
    > On Mon, Feb 06, 2023 at 08:46:04AM +0000, Tian, Kevin wrote:
    > > > From: Nicolin Chen <nicolinc@nvidia.com>
    > > > Sent: Thursday, February 2, 2023 3:05 PM
    > > >
    > > > @@ -246,6 +249,18 @@ static int iommufd_device_do_attach(struct
    > > > iommufd_device *idev,
    > > > }
    > > > }
    > > >
    > > > + if (cur_hwpt) {
    > > > + /* Replace the cur_hwpt */
    > > > + mutex_lock(&cur_hwpt->devices_lock);
    > > > + if (cur_hwpt->ioas != hwpt->ioas)
    > > > + iopt_remove_reserved_iova(&cur_hwpt->ioas->iopt,
    > > > + idev->dev);
    > > > + list_del(&cur_hwpt->hwpt_item);
    > >
    > > emmm shouldn't this be done only when the device is the last
    > > one attached to the hwpt? and if it's the last one you should
    > > also iopt_table_remove_domain() together with list_del, i.e.
    > > similar housekeeping as done in iommufd_device_detach().
    >
    > You are right. I had another patch on top of this series,
    > moving this list_del() and iopt_table_remove_domain() to
    > the destroy() callback, so I overlooked.
    >
    > And I just found that the list_add_del(hwpt_item) in the
    > IOMMUFD_OBJ_HW_PAGETABLE case doesn't seem to call at the
    > first device's attachment. So, I think that we might need
    > my previous "symmetric" patch in this series too.
    >

    Yes, that makes sense.

    \
     
     \ /
      Last update: 2023-03-27 00:11    [W:2.665 / U:0.904 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site