Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1632874

Re: [PATCH 1/2] iommu/s390: Fix IOMMU groups

From Gerald Schaefer <gerald.schaefer@de.ibm.com>
Newsgroups linux.kernel
Subject Re: [PATCH 1/2] iommu/s390: Fix IOMMU groups
Date 2017-04-28 15:30 +0200
Message-ID <tBe89-7Rw-7@gated-at.bofh.it> (permalink)
References <tATwJ-2t3-3@gated-at.bofh.it> <tATwJ-2t3-1@gated-at.bofh.it> <tAWbg-4jZ-21@gated-at.bofh.it> <tAYZr-6iG-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thu, 27 Apr 2017 23:12:32 +0200
Joerg Roedel <joro@8bytes.org> wrote:

> On Thu, Apr 27, 2017 at 08:11:42PM +0200, Gerald Schaefer wrote:
> > > +void zpci_destroy_iommu(struct zpci_dev *zdev)
> > > +{
> > > +	iommu_group_put(zdev->group);
> > > +	zdev->group = NULL;
> > > +}  
> > 
> > While the rest of this patch doesn't seem to make much of a difference to
> > the current behavior, I'm wondering where this extra iommu_group_put()
> > comes from. It either was erroneously missing before this patch, or it
> > is erroneously introduced by this patch.  
> 
> This is the way to free an iommu-group. It was missing before probably
> because it was unclear whether the add_device function allocated a group
> or not. So there was no way to know if it needs to be put again in the
> remove_device function.

Hmm, for the reference count it should not matter whether a new group was
allocated or an existing group found with iommu_group_get(). Our add_device
callback always gets one reference either from iommu_group_get or _alloc,
and then another one from iommu_group_add_device(), after which the first
reference is put again. So there should always be one reference more after
a successful add_device.

Now I'm wondering where this one reference is put again, and I thought
that happened in the remove_device callback, where we call
iommu_group_remove_device(). Is this not correct? Just want to make sure
that we don't have a refcount issue in the current code.

Regards,
Gerald

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 1/2] iommu/s390: Fix IOMMU groups Joerg Roedel <joro@8bytes.org> - 2017-04-27 17:30 +0200
  Re: [PATCH 1/2] iommu/s390: Fix IOMMU groups Gerald Schaefer <gerald.schaefer@de.ibm.com> - 2017-04-27 20:20 +0200
    Re: [PATCH 1/2] iommu/s390: Fix IOMMU groups Joerg Roedel <joro@8bytes.org> - 2017-04-27 23:20 +0200
      Re: [PATCH 1/2] iommu/s390: Fix IOMMU groups Gerald Schaefer <gerald.schaefer@de.ibm.com> - 2017-04-28 15:30 +0200
        Re: [PATCH 1/2] iommu/s390: Fix IOMMU groups Joerg Roedel <joro@8bytes.org> - 2017-04-28 16:50 +0200

csiph-web