From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796242131; b=hNvEXW+0A4KqfYXSYm2E2EU3Z6XHaPktvSUy2lD2PDWOON2qfF9k4GICGVyAPMZZgbPx Hscm8Z97W047pd7GpubEJFTWfWNc8PviZmJDpl8hfenP4ZRLEG06MLJZ6c6g7DyxlKeN9 31Pk83TZ1OruTCzCPGC5YTZdSBZf7Em4EouHUAUTsBTcuHHfd4FTYmvkUw090v7e2Vjc6 rrqraLiuZeCbUxPkLYaAe/woUlwfsAUeEFlNtg71m9M5iXpHOPw7AXajT47TUg2s3+1ug ny+CKMBCq6wSw3MoLGXElz+dygPcdslr42lOf8bVsmJjcJt+Dc83lkQTJsy1Ajxd8UA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796242131; h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=FPqKzTGrizueEzjivBIbcOs0FzepCFWpQaEkoAfZm5A=; b=wSGWZeJ+D/4w/hfWDILCm6/PPWYnyuq2GVp+gmbn/eAQqLuB4gnJA02A6aYfeZH4OXZV /cB1s928gguDGA8IW5w2zizZm3Pj4d0lXtgxBZi9krzCCKo4nep67X8VPLbCRT7m4Rvo/ 0IG/zNAqy9X7amsN78SB2han1dgcJI20RQv+0r/LgN+NUMNJCIEr2RnYEDWNVhFf1Q4Zv ZDfc9D3TjYC4dUfPi6rNQuDF0ZC3QCg+09yLc84/5cYTUumJ/4+ex4Cr/C4Ia9T9hgZ5e z0i2sFPQtGD/Nx10MnRTPaucw+ajMPwvjEbnehy5c9pmPiJKu/wOXkfei64wZZktVOg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=XQ2r19Ge; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 936F2606A322; Wed, 2 Dec 2026 20:08:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=XQ2r19Ge Received: by smtp.kernel.org (Postfix) with ESMTPSA id 160D61F00893; Wed, 2 Dec 2026 20:08:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796242131; bh=FPqKzTGrizueEzjivBIbcOs0FzepCFWpQaEkoAfZm5A=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=XQ2r19Ge9erPrNlZyyocplfRBefrMfd+rtBM3WEN+KABmHaI0lrHMpIB0UcYp5kMP tzCXbGOsBkN7dLMmdAv8p0RYrtYqJxaim+M8ZtSfcsnU1ZGSSSIFGT+M+wP3HCfDgZ sqyd5+t9NZfBFpiqtErl5kQuQpop6eGJgTVOU5prJc+0GY41gpr3lXPUFtCh4gCLXh vAbnC044/OABCU9RDO0OBdNYnChp0HnJs+CXSCOHhRHXI9TGlR41hJt746/FqmNOka vZttJGQqhI1CMpE6CMVTTpcj8cAtiMZMhiYKW3aIl83qCQHt83LN+Xzv8N4+n2JomG cBlD7yQzBK22g== Date: Wed, 2 Dec 2026 20:08:44 +0000 From: Lee Jones To: Frank Li Cc: Dong Aisheng , Fabio Estevam , Frank Li , Jacky Bai , Pengutronix Kernel Team , NXP S32 Linux Team , Linus Walleij , Sascha Hauer , Mehmet Fide , Bartosz Golaszewski , Haibo Chen , Takashi Sakamoto , Danilo Krummrich , Bjorn Helgaas , Uwe =?iso-8859-1?Q?Kleine-K=F6nig_=28The_Capable_Hub=29?= , Shawn Guo , linux-gpio@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH 06/12] pinctrl: imx: Serialise MMIO register updates with a spinlock Message-ID: <20261202200844.GE98551@kernel.org> References: X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: > On Wed, Dec 02, 2026 at 09:30:00AM +0000, Lee Jones wrote: > > The pinctrl core does not serialise .set_mux() and .pin_config_set() > > callbacks against one another or against concurrent .set_mux() calls. > > On i.MX platforms that share mux and configuration registers via > > SHARE_MUX_CONF_REG or share general-purpose select-input registers, > > concurrent read-modify-write sequences in imx_pmx_set_one_pin_mmio(), > > imx_pinconf_set_mmio(), and the GPIO direction callbacks can race and > > overwrite each other's updates. > > > > Add a raw_spinlock_t to struct imx_pinctrl and hold it across MMIO > > why choose raw_spinlock_t instead of spinlock_t? Thanks for the interest and the question, Frank. A regular 'spinlock_t' becomes a sleeping rt_mutex under PREEMPT_RT. Whilst standard pinctrl state transitions like pinctrl_select_state() occur in process context, the '.gpio_set_direction' callback is also wired into the pinctrl ops and shares this lock. Moreover, pinctrl state switches can be invoked from low-level PM and idle paths where sleeping is not allowed and 'raw_spinlock_t' is the standard choice across pinctrl drivers for short MMIO register read-modify-write. If someone can confirm that none of the i.MX call paths can ever be reached from atomic or non-sleepable contexts (even under PREEMPT_RT), we could downgrade this to 'spinlock_t', otherwise 'raw_spinlock_t' is the safer option for a few-instruction MMIO critical section. -- Lee Jones