From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932739AbbA3M3Z (ORCPT ); Fri, 30 Jan 2015 07:29:25 -0500 Received: from 8bytes.org ([81.169.241.247]:57706 "EHLO theia.8bytes.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751528AbbA3M3U (ORCPT ); Fri, 30 Jan 2015 07:29:20 -0500 Date: Fri, 30 Jan 2015 13:29:19 +0100 From: Joerg Roedel To: Will Deacon Cc: "iommu@lists.linux-foundation.org" , Kukjin Kim , David Woodhouse , Heiko Stuebner , Hiroshi Doyu , Thierry Reding , Alex Williamson , Arnd Bergmann , "linux-kernel@vger.kernel.org" , Robin Murphy , Laurent Pinchart , "jroedel@suse.de" Subject: Re: [PATCH 4/5] iommu: Make sure a device is always attached to a domain Message-ID: <20150130122919.GD3702@8bytes.org> References: <1422317339-22620-1-git-send-email-joro@8bytes.org> <1422317339-22620-5-git-send-email-joro@8bytes.org> <20150128143852.GS1569@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150128143852.GS1569@arm.com> 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 On Wed, Jan 28, 2015 at 02:38:52PM +0000, Will Deacon wrote: > On Tue, Jan 27, 2015 at 12:08:58AM +0000, Joerg Roedel wrote: > > - return iommu_group_for_each_dev(group, domain, > > - iommu_group_do_attach_device); > > + int ret; > > + > > + if (group->default_domain && group->domain != group->default_domain) > > + return -EBUSY; > > I think this is now racy with itself and detach, whereas before we always > held the group->mutex by virtue of iommu_group_for_each_dev. You are right, thanks. I will update the code with correct locking. Joerg