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 A602BD46942 for ; Wed, 21 Jan 2026 15:11:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type: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=8cq3lPpsU9NuHmxxQ6Gl9R0Ngrgj00dbe7YLgPdsZR0=; b=zafbuGZxPKGxbBxpuxqKWqwe1j HWNftgYfJnhFirFufU1ImivzjSxSrjS/rcRcqR3YzW1e16dDA6Ij5aJlYiL3iE8xjOHij3qXjtzUN 0bBty8EDe9MYWcfnCcbTpq51bjIly1+UnEsZZ5isomK3XkyAxNvjh2Kw2xIUfcGTgkNBnTn93+r6c Gctmc8SPhwyNqAsG36bvqzb+mY3vtkuY3nEQbg7iqriE+daqNYhwlPUaeRNyEEDkcXGDVg7FSUOKS cRsSo3kko9w366bQ9dp45ThSmcH4azMm9U/00DtoJvx+eInoby9LpGB4RDcOcAaGoArDfYUZTduht M23VU8NA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1viZrU-00000005hSd-4ApB; Wed, 21 Jan 2026 15:11:12 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1viZrS-00000005hSD-0v8C for linux-arm-kernel@lists.infradead.org; Wed, 21 Jan 2026 15:11:11 +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 EEF4D1476; Wed, 21 Jan 2026 07:10:59 -0800 (PST) Received: from [10.1.196.85] (e121345-lin.cambridge.arm.com [10.1.196.85]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 897FF3F632; Wed, 21 Jan 2026 07:11:04 -0800 (PST) Message-ID: <56506bb7-89ff-4b7a-9cb3-42f6ecf4dc6a@arm.com> Date: Wed, 21 Jan 2026 15:11:03 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] iommu/arm-smmu-qcom: do not register driver in probe() To: Danilo Krummrich , gregkh@linuxfoundation.org, rafael@kernel.org, broonie@kernel.org, will@kernel.org, joro@8bytes.org, robin.clark@oss.qualcomm.com, hanguidong02@gmail.com, quic_c_gdjako@quicinc.com, dmitry.baryshkov@oss.qualcomm.com Cc: driver-core@lists.linux.dev, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, iommu@lists.linux.dev, linux-arm-msm@vger.kernel.org References: <20260121141215.29658-1-dakr@kernel.org> From: Robin Murphy Content-Language: en-GB In-Reply-To: <20260121141215.29658-1-dakr@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260121_071110_324064_99460F47 X-CRM114-Status: GOOD ( 13.74 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 21/01/2026 2:12 pm, Danilo Krummrich wrote: > Commit 0b4eeee2876f ("iommu/arm-smmu-qcom: Register the TBU driver in > qcom_smmu_impl_init") intended to also probe the TBU driver when > CONFIG_ARM_SMMU_QCOM_DEBUG is disabled, but also moved the corresponding > platform_driver_register() call into qcom_smmu_impl_init() which is > called from arm_smmu_device_probe(). > > However, it neither makes sense to register drivers from probe() > callbacks of other drivers, nor does the driver core allow registering > drivers with a device lock already being held. > > The latter was revealed by commit dc23806a7c47 ("driver core: enforce > device_lock for driver_match_device()") leading to a deadlock condition > described in [1]. > > Additionally, it was noted by Robin that the current approach is > potentially racy with async probe [2]. On third look, the current lack of unregister, when it can end up in a module which (theoretically) supports unloading, is also sketchy :) > Hence, fix this by registering the qcom_smmu_tbu_driver from > module_init(). Unfortunately, due to the vendoring of the driver, this > requires an indirection through arm-smmu-impl.c. > > Reported-by: Mark Brown > Closes: https://lore.kernel.org/lkml/7ae38e31-ef31-43ad-9106-7c76ea0e8596@sirena.org.uk/ > Link: https://lore.kernel.org/lkml/DFU7CEPUSG9A.1KKGVW4HIPMSH@kernel.org/ [1] > Link: https://lore.kernel.org/lkml/0c0d3707-9ea5-44f9-88a1-a65c62e3df8d@arm.com/ [2] > Fixes: dc23806a7c47 ("driver core: enforce device_lock for driver_match_device()") > Fixes: 0b4eeee2876f ("iommu/arm-smmu-qcom: Register the TBU driver in qcom_smmu_impl_init") > Signed-off-by: Danilo Krummrich Looks OK to me, thanks Danilo! Acked-by: Robin Murphy