Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp700670ybx; Tue, 5 Nov 2019 04:16:17 -0800 (PST) X-Google-Smtp-Source: APXvYqxvude9li6zG8+Aa4tJGOWX8G9GGk6wJCbw26vVLA28+pjMNM1pR9j56NAYWH0NwtahbPAy X-Received: by 2002:a05:6402:3042:: with SMTP id bu2mr2584153edb.298.1572956177552; Tue, 05 Nov 2019 04:16:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1572956177; cv=none; d=google.com; s=arc-20160816; b=XuFjFbXqcvahzVJym+1jSY+erjwjVlzhoPGdFtKokbEdrvJ2+/Psr2thMknWB0fskx 2/VO1mTC9jMBW5ixDkod6ugpgdrwLFVYhrxr8O8h3CIyIrqZg2dZ0qrtlUXAP819l3oe BSlHxTj+p6SaQohAhqrXojATbr5SwwKlDNjjoGRgFcsxX55X2hZ3q2u51priGaKrGj9W 2k0rVABDj7SYrdEP5U+H6MkuBxLb2qPOPPe0agnJVLE7NezSukF7UjPp4Qur3Ao+NWyx wvdbY8RfusGoCjH7316c6cb2ap67WEN+Yjw+8qyfT+ZJFiXo2PNHiKpr30VjbSCVuu0w R/Gg== 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; bh=msXcQAabsBbd4L3DIv5X+ZQRGLz6HBIzkzN1sBRJ/50=; b=d15BrzAm4fC9FchG3o/vkea8C8pWf8tvw9KoMmaLODOs5tfkyWM3jchR9gxVyXiPzk oHgpzn4TWXnZvtwUrqoGzzZ1GF1/fmD2BgTHMqzGYfnbnzmGQ1LIDtbzJvA+0BLOIw7M hXTokTVmwajY2xyfEvjosmU4eNjEHtBuUESqKqd5WzwB+BISvyBFc5A04OqN3Iq6ejlq YF/R5Hbpe+NjSZtKr/hFgPj3Msf6O30O7kECdjr0/flSXfaL+6ODScO7UBu29WxeGh2g gpgNh4DPT7GxOVsNdHgcqT38LRzZHMzMJYcVOiUt+/3pd5uc5I+8lcP9xzwCPPv25GhH f85w== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k24si9528526edk.367.2019.11.05.04.15.53; Tue, 05 Nov 2019 04:16:17 -0800 (PST) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730896AbfKEMPR (ORCPT + 99 others); Tue, 5 Nov 2019 07:15:17 -0500 Received: from 8bytes.org ([81.169.241.247]:50602 "EHLO theia.8bytes.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726524AbfKEMPR (ORCPT ); Tue, 5 Nov 2019 07:15:17 -0500 Received: by theia.8bytes.org (Postfix, from userid 1000) id 1DCFD450; Tue, 5 Nov 2019 13:15:15 +0100 (CET) Date: Tue, 5 Nov 2019 13:15:08 +0100 From: Joerg Roedel To: Will Deacon 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: <20191105121508.GA3479@8bytes.org> References: <20191030145112.19738-1-will@kernel.org> <20191030145112.19738-6-will@kernel.org> <20191030193148.GA8432@8bytes.org> <20191031154247.GB28061@willie-the-truck> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191031154247.GB28061@willie-the-truck> 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 Will, On Thu, Oct 31, 2019 at 03:42:47PM +0000, Will Deacon wrote: > 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. Okay, but besides the force-unload case, can we prevent accidential unloading by taking a reference to the module in add_device() and release it in remove_device()? Regards, Joerg