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=1796339651; b=PastUBpc68+jUM6/dsIs+Oi+cSTZWh15kf6PYIFkl/4O/H5+kOpHb+7omu4CuinGfieB CMRB4WHktX7Z+XMoKGRL/s3lYPkKAEk/V9fg1oDhSWRnj2n68y1ORCbL35SlpPYuMhitX G/Hi6zSDetzFRsKlhB6QMy1oEluQw7e5NtfNdzibsJ9ZgR1BlFYc0YW3Ew52tbf8kYR/s 1Qezz1w1+5ZJRydvxBroZKp1Sq6p6Vw2/3sfwOGqil1phZpDBRgGoiYWJF6zZL/eBmY/r SOo46LQ0JRaK9lhLwd9hY9sbNbfswL6ybV7xGxYk9t5Z4MbERbjHd/Z9BVJrVorkGDg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796339651; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=jSpa5nx5uaQiOczmX+8PGvtXOhMdPeKXRSOdckio7Bk=; b=SbI3qAqlvs/Fyv15R6NkTu01IOevwiKsKUCn+JxD7LR98H7itDiyJ3c/+AxUnEhMwRtF ZBdsIVGFIgSrn3DJMMJN/XlgIWlCAE8oIHoUvbMf7oxG7xOhRa4pvW0+U1BNz2ecvUNFy pQIrM+2Uogytxwd82pEhYy+fVtdoxI4ZhouvlNCMwfkhD9Lev0cN8+/KIEYMRleY+a8BW YmInXncRgP97FtKFKHoKbqKQj2vfD5Zo0FnugvW+MdofKrlTvQGe4zoSLYwXebxf8dh8U 7/P81JGwbLsKb1lzxCG4OUldKrdNor3G6pKofaQT5tZnUresyWaZjOtPIwxUk1hhWRA== 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=lBcsQQ8I; 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 15B49606A32C; Thu, 3 Dec 2026 23:14:11 +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=lBcsQQ8I Received: by smtp.kernel.org (Postfix) with ESMTPSA id C49D51F000C2; Thu, 3 Dec 2026 23:14:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796339650; bh=jSpa5nx5uaQiOczmX+8PGvtXOhMdPeKXRSOdckio7Bk=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=lBcsQQ8IOBAzhCsJt3uu/IHmbE4QspZSuj9SubiFx5g1UMlY3bEeHVclW9049Qf/Q Ciayki2+IKOn5GOGGQI0f5lJMen0oeNOvftN4NfOs3kb9KW21RrEb7IZlWYQ0eiRoy pbkwydPo3Jq5VUvyh7PdsWcDSjUmigMaSN12b6B3LG4vrSQSqdLrMaKkc0I/9mr4Bb 2JDWChbttXBHurPvIHV+y+bffqzcJ7DBOBMqnbwUQpK96DHYwlhvhE5rGzB8Abm0JN Wy+CwMRv7EJ2+LellP3W91GnqGBObrN/0f3MLXACosc08Mcybw+0YPw//cVCFG3eFG 9+VKkoloFARhQ== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH 1/2] gpio: mvebu: restore suspend-time irq masks under gc->lock Reply-To: sashiko-reviews@lists.linux.dev To: "Rosen Penev" Cc: linux-gpio@vger.kernel.org, linux-rt-devel@lists.linux.dev, linux-kernel@vger.kernel.org In-Reply-To: <20261203225820.83277-2-rosenp@gmail.com> References: <20261203225820.83277-1-rosenp@gmail.com> <20261203225820.83277-2-rosenp@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Thu, 03 Dec 2026 23:14:10 +0000 X-Mailing-List: linux-rt-devel@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Medium] gpio: mvebu: mvebu_gpio_resume() nests spinlock_t under raw gc->lock It also noticed 1 related pre-existing issue this patch does not introduce: - [High] gpio: mvebu: dropped unmasked IRQs in mvebu_gpio_resume() [1] -- commit 2b335edf3e9a01fe8cd24e622c3bca3a7c7c7760 Author: Rosen Penev gpio: mvebu: restore suspend-time irq masks under gc->lock This commit moves the suspend-time IRQ mask register restoration in mvebu_gpio_resume() into a helper called under gc->lock so it cannot race with concurrent mask or unmask handlers. > diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c > index 6c2bcc5d749cc..c202b946f595e 100644 > --- a/drivers/gpio/gpio-mvebu.c > +++ b/drivers/gpio/gpio-mvebu.c > @@ -996,6 +996,45 @@ static const struct of_device_id mvebu_gpio_of_match= [] =3D { > }, > }; > =20 > +static void > +mvebu_gpio_restore_irq_masks(struct mvebu_gpio_chip *mvchip, u32 level_c= ache, > + u32 edge_cache) > +{ > + int i; > + > + switch (mvchip->soc_variant) { > + case MVEBU_GPIO_SOC_VARIANT_ORION: > + case MVEBU_GPIO_SOC_VARIANT_A8K: > + regmap_write(mvchip->regs, GPIO_EDGE_MASK_OFF + mvchip->offset, > + mvchip->edge_mask_regs[0] & edge_cache); > + regmap_write(mvchip->regs, GPIO_LEVEL_MASK_OFF + mvchip->offset, > + mvchip->level_mask_regs[0] & level_cache); > + break; [Severity: High] This problem wasn't introduced by this patch, but can bitwise-ANDing with the suspend-time snapshot in [1] silently re-mask an IRQ that was enabled during early resume? If a driver disables its IRQ before suspend, the saved mask register records 0. If it then calls enable_irq() during resume_noirq, the line is unmasked and set to 1 in the cache, but mvebu_gpio_resume() later writes 0 & 1 to hardware and silently drops subsequent interrupts. [ ... ] > @@ -1069,50 +1105,18 @@ static int mvebu_gpio_resume(struct platform_devi= ce *pdev) > * unmasking one behind its back leaves an asserted level line that > * nobody masks. Restore only bits the irqchip cache still has set. > * > - * Snapshot the caches under the raw spinlock, but release it before > - * the regmap writes below: regmap_write() takes a sleepable lock on > - * PREEMPT_RT. > + * Hold gc->lock across the writes so the restore cannot race the > + * mask/unmask handlers, which update the cache and write the mask > + * registers under the same lock. > */ > if (mvchip->domain) { > struct irq_chip_generic *gc; > =20 > gc =3D irq_get_domain_generic_chip(mvchip->domain, 0); [ ... ] > + guard(raw_spinlock_irqsave)(&gc->lock); > + mvebu_gpio_restore_irq_masks(mvchip, > + gc->chip_types[0].mask_cache_priv, > + gc->chip_types[1].mask_cache_priv); > } [Severity: Medium] Can calling regmap_write() under gc->lock sleep on CONFIG_PREEMPT_RT or trigger a lockdep invalid wait context splat on Armada 7K/8K? At this commit, mvebu_gpio_probe_syscon() still uses the parent syscon regmap, whose syscon_regmap_config does not set use_raw_spinlock. mvebu_gpio_resume() -> mvebu_gpio_restore_irq_masks() -> regmap_write() therefore acquires a regular spinlock_t inside raw_spinlock_t gc->lock. Because commit "gpio: mvebu: use a raw-locked regmap on Armada 7K/8K too" later in the series switches Armada 7K/8K to a raw-locked MMIO regmap, ordering that commit before this one would avoid the intermediate bisection regression. [1] https://sashiko.dev/#/bug/linux-21cc7884-41c0-4b66-ad75-b626faddba53 --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261203225820.8327= 7-1-rosenp@gmail.com?part=3D1