Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755453AbdD0VMk (ORCPT ); Thu, 27 Apr 2017 17:12:40 -0400 Received: from 8bytes.org ([81.169.241.247]:36139 "EHLO theia.8bytes.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755386AbdD0VMd (ORCPT ); Thu, 27 Apr 2017 17:12:33 -0400 Date: Thu, 27 Apr 2017 23:12:32 +0200 From: Joerg Roedel To: Gerald Schaefer Cc: Sebastian Ott , iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, Joerg Roedel Subject: Re: [PATCH 1/2] iommu/s390: Fix IOMMU groups Message-ID: <20170427211232.GF1332@8bytes.org> References: <1493306905-32334-1-git-send-email-joro@8bytes.org> <1493306905-32334-2-git-send-email-joro@8bytes.org> <20170427201142.18d467a3@thinkpad> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170427201142.18d467a3@thinkpad> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 825 Lines: 22 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. With this patch the iommu-group is explicitly allocated when the zpci_dev is created and destroyed again with it. Joerg