Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp1312760ybx; Thu, 31 Oct 2019 08:44:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqyfEk4xM3WQ0XWAJZ/UNCHlqpY0+RRDpkiIWxXRTk03eC4Rn2MXM3p53K4vU07uk7EWMuvY X-Received: by 2002:a17:906:bceb:: with SMTP id op11mr4847333ejb.197.1572536693237; Thu, 31 Oct 2019 08:44:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572536693; cv=none; d=google.com; s=arc-20160816; b=zjeJLpbdW0S+PPckZKhk+ZU2Ps9edbj9nCKyDCUuqh/Mf8qF5g4sd+H8ahxqDBKh0V HDMmqze+dPAiM/95kns8xZOsTcYfCGndRc++i1xCWviY4GU8a1Yw+hkLIyU/O7hCAW98 9cP1tIDNfDh23YfAzmU4xo15FeX1NzEof83hYuW9rjlGcfjPy5Egki/BKbi7v8q+QcQW yy4Wlh2/5c4p5WdZ8oYjwBAieSKHt5NjuXeUqoGemw9RhSxQ2tBcGd7bqE+r+fwXera9 Y+xDgN2OOtsGQk5ysptMgSEsAuC5N+3scumJRHD4l4yJNacfudEAxiKvfbUnnUJYrFdH QNbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=MfaC9E8O2nx/yD7Dpne/keo3edKzML/05GMbA5fFw8Y=; b=Ka5c/lV4eiE7KiOHwM1cRPnt/Cno91+vYs+CP6DkdTIZwQz81txizIIlyxDVQyrmqO jNNLMgdcJdBzH2qIu+itNK2zd024dyUqIzqvUo7Aj1Y653vEAiCBA8UbF3L0mPJWadd4 NTE8+mkSKNBSpe2ZnedAXOr6NUfbXDM2BdS0ToMPNoRZgfIXv45b0TyYvBk8OgVfhDxO +3C3qX3zOO21LR52G8x7Z5O+2f8VJf5RwTxCaPrVA4WfdzBaBK5bkfsjPSdCfykdc5Gx Vk+Z4dmWZlFyfx09iQgY4jvlc8OroEuaGXABwQK5wvQ/MwP0jrinraAWwMWVE/9Y4c5t H31A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=qaAJ8XcW; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d25si4381459edb.19.2019.10.31.08.44.29; Thu, 31 Oct 2019 08:44:53 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=qaAJ8XcW; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728442AbfJaPm4 (ORCPT + 99 others); Thu, 31 Oct 2019 11:42:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:50140 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727579AbfJaPmw (ORCPT ); Thu, 31 Oct 2019 11:42:52 -0400 Received: from willie-the-truck (236.31.169.217.in-addr.arpa [217.169.31.236]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id DECD82086D; Thu, 31 Oct 2019 15:42:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572536572; bh=GRreUt5vILq8iwJLnTWSsnpWtfLL+f+wCy2zYdNxf6o=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=qaAJ8XcWGfT4LUOvU811aRsvOWAxezJATr7Uk9nzN23oXUvKxtHZVcY0AqzVTOyjZ Epk2/3n2IWDhuOaWcOoDQDWApaqgYgldCxMrpckQEgKjPXnL2Tv96+pJVdwc1WPwcm ftKHIyiFmV9Fi/cSBRpiXvhFrSLJm+8Fm2Mkj3Fg= Date: Thu, 31 Oct 2019 15:42:47 +0000 From: Will Deacon To: Joerg Roedel Cc: iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, Robin Murphy , Bjorn Helgaas , Lorenzo Pieralisi Subject: Re: [PATCH 5/7] iommu/arm-smmu-v3: Allow building as a module Message-ID: <20191031154247.GB28061@willie-the-truck> References: <20191030145112.19738-1-will@kernel.org> <20191030145112.19738-6-will@kernel.org> <20191030193148.GA8432@8bytes.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191030193148.GA8432@8bytes.org> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Joerg, On Wed, Oct 30, 2019 at 08:31:48PM +0100, Joerg Roedel wrote: > On Wed, Oct 30, 2019 at 02:51:10PM +0000, Will Deacon wrote: > > By removing the redundant call to 'pci_request_acs()' we can allow the > > ARM SMMUv3 driver to be built as a module. > > > > Signed-off-by: Will Deacon > > --- > > drivers/iommu/Kconfig | 2 +- > > drivers/iommu/arm-smmu-v3.c | 1 - > > 2 files changed, 1 insertion(+), 2 deletions(-) > > > > diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig > > index e3842eabcfdd..7583d47fc4d5 100644 > > --- a/drivers/iommu/Kconfig > > +++ b/drivers/iommu/Kconfig > > @@ -388,7 +388,7 @@ config ARM_SMMU_DISABLE_BYPASS_BY_DEFAULT > > config. > > > > config ARM_SMMU_V3 > > - bool "ARM Ltd. System MMU Version 3 (SMMUv3) Support" > > + tristate "ARM Ltd. System MMU Version 3 (SMMUv3) Support" > > depends on ARM64 > > select IOMMU_API > > select IOMMU_IO_PGTABLE_LPAEa > > Sorry for the stupid question, but what prevents the iommu module from > being unloaded when there are active users? There are no symbol > dependencies to endpoint device drivers, because the interface is only > exposed through the iommu-api, right? Is some sort of manual module > reference counting needed? Generally, I think unloading the IOMMU driver module while there are active users is a pretty bad idea, much like unbinding the driver via /sys in the same situation would also be fairly daft. However, I *think* the code in __device_release_driver() tries to deal with this by iterating over the active consumers and ->remove()ing them first. I'm without hardware access at the moment, so I haven't been able to test this myself. We could nobble the module_exit() hook, but there's still the "force unload" option depending on the .config. Will