From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 78A18C4332F for ; Wed, 14 Dec 2022 21:27:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To:Subject: MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=hFyfH6R87BsfVrun5k1kjXUB83YqS7rsX8wi1Wb6lNg=; b=KN5o+tx2hPOKbr +1iS7jilca6y1ZPcBPSgOhnv6m14I4kcmpO0Ra6cZkJj0sDHSwwmctTY7fFYUPUd3Iqfh+Fzxj0rv QVTg1DNINU+Z3+d2ip8GlnoGevJ0/iyYLvrOYXxUrT+wW9uuedq5nNx6oKt5YNZYLY0JCNiigvauq CEmZv2r74Ts2iEYqwxkT4aYhJZbVxSKeB2PvMKUWNAbGbkmVHcmNCRvHyruMUjEvXOLjMkyaSJ+vf nJAqab733D2WuO5jMG3YAx9zdeKye1ohr9s7hyaSAj5td1PprImFaeMLpccW8/MmrxumeKF+/qc9e uzX8lEgy1F4ol3O9/Bmw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1p5ZGK-003ACZ-3c; Wed, 14 Dec 2022 21:26:00 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1p5ZGG-003A9h-UZ for linux-arm-kernel@lists.infradead.org; Wed, 14 Dec 2022 21:25:58 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3ECA5FEC; Wed, 14 Dec 2022 13:26:33 -0800 (PST) Received: from [10.57.88.237] (unknown [10.57.88.237]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id F106F3F71E; Wed, 14 Dec 2022 13:25:50 -0800 (PST) Message-ID: Date: Wed, 14 Dec 2022 21:25:45 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:102.0) Gecko/20100101 Thunderbird/102.5.1 Subject: Re: [PATCH] iommu/arm-smmu: don't unregister on shutdown Content-Language: en-GB To: Vladimir Oltean Cc: iommu@lists.linux.dev, Will Deacon , Joerg Roedel , Greg Kroah-Hartman , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Michael Walle , Laurentiu Tudor , Claudiu Manoil , netdev@vger.kernel.org References: <20221208165350.3895136-1-vladimir.oltean@nxp.com> <20221214173418.iwovyxlbogkspjxy@skbuf> From: Robin Murphy In-Reply-To: <20221214173418.iwovyxlbogkspjxy@skbuf> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221214_132557_065594_4CDD6980 X-CRM114-Status: GOOD ( 22.89 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 2022-12-14 17:34, Vladimir Oltean wrote: > On Fri, Dec 09, 2022 at 11:24:32AM +0000, Robin Murphy wrote: >>> Fixes: b06c076ea962 ("Revert "iommu/arm-smmu: Make arm-smmu explicitly non-modular"") >> >> I think that's semantically correct, but I'm pretty sure at that point it >> would have been benign in practice - the observable splat will be a much >> more recent fallout from me changing the iommu_device_unregister() behaviour >> in 57365a04c921 ("iommu: Move bus setup to IOMMU device registration"). The >> assumption therein is that unregister would only happen on probe failure, >> before the IOMMU instance is in use, or on module unload, which would not be >> allowed while active devices still hold module references. I overlooked that >> the SMMU drivers were doing what they do, sorry about that. > > Ok, I'll change the Fixes: tag, I didn't notice that iommu_device_unregister() > changed in behavior only later, I just looked at current trees and tried > to infer what went wrong. > >> The change itself looks sensible. The point of this shutdown hook is simply >> not to leave active translations in place that might confuse future software >> after reboot/kexec; any housekeeping in the current kernel state is a waste >> of time anyway. Fancy doing the same for SMMUv3 as well? > > I can try, but I won't have hardware to test. > > Basically the only thing truly relevant for shutdown from arm_smmu_device_remove() > is arm_smmu_device_disable(), would you agree to a patch which changes > things as below? > > diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c > index 6d5df91c5c46..d4d8bfee9feb 100644 > --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c > +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c > @@ -3854,7 +3854,9 @@ static int arm_smmu_device_remove(struct platform_device *pdev) > > static void arm_smmu_device_shutdown(struct platform_device *pdev) > { > - arm_smmu_device_remove(pdev); > + struct arm_smmu_device *smmu = platform_get_drvdata(pdev); > + > + arm_smmu_device_disable(smmu); > } > > static const struct of_device_id arm_smmu_of_match[] = { Looks fine to me! I'll let Will decide if he'd still prefer to do the full remove-calls-shutdown reversal here as well for complete consistency, but I reckon the minimal diff is no bad thing :) Cheers, Robin. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel