Linux clock framework development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "John Crispin" <john@phrozen.org>
Cc: linux-clk@vger.kernel.org
Subject: Re: [PATCH 1/2] clk: en7523: do not sleep in the EN7581 PCIe clock disable
Date: Wed, 11 Nov 2026 09:03:15 +0000	[thread overview]
Message-ID: <sashiko-outbox-208651@kernel.org> (raw)
In-Reply-To: <20261111085650.632025-2-john@phrozen.org>

Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [High] clk: en7523: data race in en7523_reset_update() [1]
--

commit 1564f332e9a1734f7c62abce0ffb9fd4c355e412
Author: John Crispin <john@phrozen.org>

clk: en7523: do not sleep in the EN7581 PCIe clock disable

This commit removes the usleep_range() call from en7581_pci_disable() to
avoid sleeping in atomic context when the clock core disables the PCIe
clock under the enable spinlock.

> diff --git a/drivers/clk/clk-en7523.c b/drivers/clk/clk-en7523.c
> index 24fdec2e6198c..8f63482cbb7ba 100644
> --- a/drivers/clk/clk-en7523.c
> +++ b/drivers/clk/clk-en7523.c
> @@ -689,7 +689,6 @@ static void en7581_pci_disable(struct clk_hw *hw)
>  	mask = REG_PCI_CONTROL_REFCLK_EN0 | REG_PCI_CONTROL_REFCLK_EN1;
>  	val = readl(np_base + REG_PCI_CONTROL);
>  	writel(val & ~mask, np_base + REG_PCI_CONTROL);
> -	usleep_range(1000, 2000);
>  }

[Severity: High]
This problem wasn't introduced by this patch, but can concurrent accesses
to REG_PCI_CONTROL and the reset bank registers race [1] and lose bit
updates?

en7581_pci_disable(), en7581_pci_enable(), and en7523_reset_update() perform
read-modify-write sequences on shared NP SCU registers (including
REG_PCI_CONTROL on EN7581) without a driver-level spinlock.  Because the
reset controller framework does not serialize .assert and .deassert
callbacks, two callers updating bits in the same register bank, or a PCIe
clock toggle running alongside a reset update on REG_PCI_CONTROL, can
interleave:

CPU0                              CPU1
en7523_reset_update()             en7523_reset_update()
  val = readl(addr);
                                    val = readl(addr);
  val |= BIT(id1);
  writel(val, addr);
                                    val &= ~BIT(id2);
                                    writel(val, addr);  <-- id1 update lost

This overwrites hardware state and can leave peripherals stuck in reset or
corrupt PCIe clock/reset bits.

[1] https://sashiko.dev/#/bug/linux-ef84cdb6-0114-41fc-b76f-33e8bdd47a6f

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261111085650.632025-1-john@phrozen.org?part=1

  reply	other threads:[~2026-11-11  9:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-11  8:56 [PATCH 0/2] clk: en7523: two fixes for the EN7581 clock and reset driver John Crispin
2026-11-11  8:56 ` [PATCH 1/2] clk: en7523: do not sleep in the EN7581 PCIe clock disable John Crispin
2026-11-11  9:03   ` sashiko-bot [this message]
2026-11-11  8:56 ` [PATCH 2/2] clk: en7523: add a reset operation John Crispin
2026-11-11  9:49   ` Philipp Zabel
2026-11-11 10:31     ` John Crispin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-208651@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=john@phrozen.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox