Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1513073
| From | Alex Williamson <alex.williamson@redhat.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v10 01/19] vfio: Mediated device Core driver |
| Date | 2016-11-01 04:50 +0100 |
| Message-ID | <syyff-3cx-7@gated-at.bofh.it> (permalink) |
| References | <swDVL-UP-7@gated-at.bofh.it> <swDVM-UP-39@gated-at.bofh.it> <syxMd-32I-7@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Tue, 01 Nov 2016 11:08:15 +0800
Jike Song <jike.song@intel.com> wrote:
> On 10/27/2016 05:29 AM, Kirti Wankhede wrote:
> > +static int mdev_attach_iommu(struct mdev_device *mdev)
> > +{
> > + int ret;
> > + struct iommu_group *group;
> > +
> > + group = iommu_group_alloc();
> > + if (IS_ERR(group))
> > + return PTR_ERR(group);
>
> Maybe I overthought, but where the iommu_group is released? On successful
> return you already have a ref, I didn't find an iommu_group_put after that.
...
> > +
> > + ret = iommu_group_add_device(group, &mdev->dev);
> > + if (ret)
> > + goto attach_fail;
> > +
> > + dev_info(&mdev->dev, "MDEV: group_id = %d\n",
> > + iommu_group_id(group));
> > +attach_fail:
> > + iommu_group_put(group);
> > + return ret;
> > +}
> > +
> > +static void mdev_detach_iommu(struct mdev_device *mdev)
> > +{
> > + iommu_group_remove_device(&mdev->dev);
Here. Adding a device to the group takes a group reference so we can
'put' the group to release the reference from the alloc as soon as a
device is added. When we remove the device, that reference is removed
and this should result in a release of the group if all other
references are balanced. Thanks,
Alex
> > + dev_info(&mdev->dev, "MDEV: detaching iommu\n");
> > +}
> > +
>
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: [PATCH v10 01/19] vfio: Mediated device Core driver Jike Song <jike.song@intel.com> - 2016-11-01 04:20 +0100
Re: [PATCH v10 01/19] vfio: Mediated device Core driver Alex Williamson <alex.williamson@redhat.com> - 2016-11-01 04:50 +0100
Re: [PATCH v10 01/19] vfio: Mediated device Core driver Jike Song <jike.song@intel.com> - 2016-11-01 06:40 +0100
csiph-web