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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 77530C636D3 for ; Mon, 6 Feb 2023 08:09:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229500AbjBFIJY (ORCPT ); Mon, 6 Feb 2023 03:09:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229448AbjBFIJX (ORCPT ); Mon, 6 Feb 2023 03:09:23 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8445665A6; Mon, 6 Feb 2023 00:09:22 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2756460C7C; Mon, 6 Feb 2023 08:09:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7556AC433D2; Mon, 6 Feb 2023 08:09:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1675670961; bh=7To9ndX5DYRSorrgvB+E9BrgmwiQP7ZmPzgErIA/JBQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ZOJtPm65eUnxYkUD5jLv1uB5b/01sUtZzEarQIEi7aGVKwKW5sVJzFx4gA5+Fcti5 XnJxEGioz4FgaUudU65hpYsgK3r7nmxeshNS+cPH/NqSy9rEJ0BYaNxN8L9tiv7Qhq NyyGeHEdTmj0eZcGJh56PD0t8qEtnMq1rvYHs6E0DSgABHxx2jCy8Pm1evruHzLAxU KPFRyXJfysD4ylCP41hK2gswWzUNFFu5hhVQSiJ7pQkzuLSiFZVGuCQpt6BsYyePD5 5/NSMzktrd9WAHwEE+57F/JK0rA7sGck2aKAP5Wot9u5ZDTOjQ8SU8Y/f3DRW6qz1d uXK6K+1CQK4CQ== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1pOwZS-0003cC-Sy; Mon, 06 Feb 2023 09:09:50 +0100 Date: Mon, 6 Feb 2023 09:09:50 +0100 From: Johan Hovold To: Luca Ceresoli Cc: Johan Hovold , Georgi Djakov , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Andy Gross , Bjorn Andersson , Konrad Dybcio , Sylwester Nawrocki , Artur =?utf-8?B?xZp3aWdvxYQ=?= , Krzysztof Kozlowski , Alim Akhtar , Thierry Reding , Jonathan Hunter , linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, Leonard Crestez , Alexandre Bailon Subject: Re: [PATCH 04/23] interconnect: imx: fix registration race Message-ID: References: <20230201101559.15529-1-johan+linaro@kernel.org> <20230201101559.15529-5-johan+linaro@kernel.org> <20230203170121.187108bd@booty> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230203170121.187108bd@booty> Precedence: bulk List-ID: X-Mailing-List: linux-tegra@vger.kernel.org On Fri, Feb 03, 2023 at 05:01:21PM +0100, Luca Ceresoli wrote: > Hello Johan, > > On Wed, 1 Feb 2023 11:15:40 +0100 > Johan Hovold wrote: > > > The current interconnect provider registration interface is inherently > > racy as nodes are not added until the after adding the provider. This > > can specifically cause racing DT lookups to fail. > > > > Switch to using the new API where the provider is not registered until > > after it has been fully initialised. > > > > Fixes: f0d8048525d7 ("interconnect: Add imx core driver") > > Cc: stable@vger.kernel.org # 5.8 > > Cc: Leonard Crestez > > Cc: Alexandre Bailon > > Signed-off-by: Johan Hovold > > Georgi pointed me to this series after I reported a bug yesterday [0], > that I found on iMX8MP. So I ran some tests with my original, failing > tree, minus one patch with my debugging code to hunt for the bug, plus > patches 1-4 of this series. > > The original code was failing approx 5~10% of the times. With your 4 > patches applied it ran 139 times with zero errors, which looks great! I > won't be able to do more testing until next Monday to be extra sure. Thanks for testing. It indeed looks like you're hitting the same race, and as the imx interconnect driver also initialises the provider data num_nodes count before adding the nodes it results in that NULL-deref (where the qcom driver failed a bit more gracefully). Johan > [0] > https://lore.kernel.org/linux-arm-kernel/20230202175525.3dba79a7@booty/T/#u 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 D2E67C05027 for ; Mon, 6 Feb 2023 08:10:30 +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-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=KzjkA8AbHZAAqH0cbzAobP7SebX2uFlX4Wfbsi9Hz+8=; b=qAYg2IC7UuEpyy IDrjNQeBu44m3jMfVRA867bECszWoi8VP8gWm9aQroAdxIo0i7xn+98wYg8oEty5Bc/vKO/mdD3vS Sa6yXetuOikr53l9DBjk6K/amaW8wjhRnF1e1nScw1gw3vvJlYi9ygUhTyJCG0abN32Chonl+zDyO C4JxDvOo6+SlhaDv4bP17NyUukfN7pIpRY/xNJfivZg84UWG2Y3Wo5jNTB72bZSYEpgnERMzp0SwM ppuPA1ugtthE7+lqRwUrHIBo8YQ/WAIidoJrbhsUE+Mtd1fwDXnuoJPmvShmlYZcSo4dhZGzWoo2f VPY25UT9BqadlLya2S9A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pOwZ7-007f6f-DA; Mon, 06 Feb 2023 08:09:29 +0000 Received: from ams.source.kernel.org ([145.40.68.75]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pOwZ3-007f6C-1U for linux-arm-kernel@lists.infradead.org; Mon, 06 Feb 2023 08:09:26 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D7716B80D86; Mon, 6 Feb 2023 08:09:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7556AC433D2; Mon, 6 Feb 2023 08:09:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1675670961; bh=7To9ndX5DYRSorrgvB+E9BrgmwiQP7ZmPzgErIA/JBQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ZOJtPm65eUnxYkUD5jLv1uB5b/01sUtZzEarQIEi7aGVKwKW5sVJzFx4gA5+Fcti5 XnJxEGioz4FgaUudU65hpYsgK3r7nmxeshNS+cPH/NqSy9rEJ0BYaNxN8L9tiv7Qhq NyyGeHEdTmj0eZcGJh56PD0t8qEtnMq1rvYHs6E0DSgABHxx2jCy8Pm1evruHzLAxU KPFRyXJfysD4ylCP41hK2gswWzUNFFu5hhVQSiJ7pQkzuLSiFZVGuCQpt6BsYyePD5 5/NSMzktrd9WAHwEE+57F/JK0rA7sGck2aKAP5Wot9u5ZDTOjQ8SU8Y/f3DRW6qz1d uXK6K+1CQK4CQ== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1pOwZS-0003cC-Sy; Mon, 06 Feb 2023 09:09:50 +0100 Date: Mon, 6 Feb 2023 09:09:50 +0100 From: Johan Hovold To: Luca Ceresoli Cc: Johan Hovold , Georgi Djakov , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Andy Gross , Bjorn Andersson , Konrad Dybcio , Sylwester Nawrocki , Artur =?utf-8?B?xZp3aWdvxYQ=?= , Krzysztof Kozlowski , Alim Akhtar , Thierry Reding , Jonathan Hunter , linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, Leonard Crestez , Alexandre Bailon Subject: Re: [PATCH 04/23] interconnect: imx: fix registration race Message-ID: References: <20230201101559.15529-1-johan+linaro@kernel.org> <20230201101559.15529-5-johan+linaro@kernel.org> <20230203170121.187108bd@booty> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230203170121.187108bd@booty> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230206_000925_422010_FC138B08 X-CRM114-Status: GOOD ( 22.58 ) 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-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, Feb 03, 2023 at 05:01:21PM +0100, Luca Ceresoli wrote: > Hello Johan, > > On Wed, 1 Feb 2023 11:15:40 +0100 > Johan Hovold wrote: > > > The current interconnect provider registration interface is inherently > > racy as nodes are not added until the after adding the provider. This > > can specifically cause racing DT lookups to fail. > > > > Switch to using the new API where the provider is not registered until > > after it has been fully initialised. > > > > Fixes: f0d8048525d7 ("interconnect: Add imx core driver") > > Cc: stable@vger.kernel.org # 5.8 > > Cc: Leonard Crestez > > Cc: Alexandre Bailon > > Signed-off-by: Johan Hovold > > Georgi pointed me to this series after I reported a bug yesterday [0], > that I found on iMX8MP. So I ran some tests with my original, failing > tree, minus one patch with my debugging code to hunt for the bug, plus > patches 1-4 of this series. > > The original code was failing approx 5~10% of the times. With your 4 > patches applied it ran 139 times with zero errors, which looks great! I > won't be able to do more testing until next Monday to be extra sure. Thanks for testing. It indeed looks like you're hitting the same race, and as the imx interconnect driver also initialises the provider data num_nodes count before adding the nodes it results in that NULL-deref (where the qcom driver failed a bit more gracefully). Johan > [0] > https://lore.kernel.org/linux-arm-kernel/20230202175525.3dba79a7@booty/T/#u _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel