Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Sasha Finkelstein" <k@chaosmail.tech>
Cc: conor+dt@kernel.org, devicetree@vger.kernel.org, robh@kernel.org
Subject: Re: [PATCH 5/7] spmi: apple: lock around FIFOs
Date: Sat, 25 Jul 2026 14:01:31 +0000	[thread overview]
Message-ID: <20260725140132.40BBC1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260725-t603x-spmi-v1-5-e1a29fcd2d38@chaosmail.tech>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Using an interruptible mutex for a fast hardware bus lock introduces unexpected I/O failures.
--

--- Patch [5]: [PATCH 5/7] spmi: apple: lock around FIFOs ---
commit c446ad8ec5411cb7c1e85b2172699c9fc3a53edd
Author: Alba Mendez <me@alba.sh>

spmi: apple: lock around FIFOs

The driver was missing locking around register interactions.

> diff --git a/drivers/spmi/spmi-apple-controller.c b/drivers/spmi/spmi-apple-controller.c
> index d69d16665ce85..d8509f027df69 100644
> --- a/drivers/spmi/spmi-apple-controller.c
> +++ b/drivers/spmi/spmi-apple-controller.c
[ ... ]
> @@ -73,6 +75,10 @@ static int spmi_raw_cmd(struct spmi_controller *ctrl, u8 opc, u8 sid,
>  	size_t i = 0, j;
>  	int ret;
>  
> +	ret = mutex_lock_interruptible(&spmi->fifo_lock);
> +	if (ret)
> +		return ret;

[Severity: High]
Can using an interruptible lock here cause unexpected I/O failures?

If an SPMI read or write blocks on this lock while another transaction is 
ongoing, and the blocking process receives a signal, the lock acquisition 
fails and returns -EINTR.

Higher-level frameworks like regulators or PMIC subsystems generally do not 
expect or retry hardware bus operations failing with -EINTR. This could 
cause critical operations, such as CPU voltage changes during cpufreq scaling, 
to fail randomly if a signal is pending.

Would it be safer to use a standard uninterruptible mutex_lock() to serialize 
this fast hardware bus I/O and prevent these systemic side effects?

> +
>  	writel(spmi_cmd, spmi->regs + SPMI_CMD_REG);
>  
>  	while (i < len) {

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260725-t603x-spmi-v1-0-e1a29fcd2d38@chaosmail.tech?part=5

  reply	other threads:[~2026-07-25 14:01 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-25 13:47 [PATCH 0/7] spmi: apple: Additional commands and interrupt support Sasha Finkelstein
2026-07-25 13:47 ` [PATCH 1/7] dt-bindings: spmi: apple,spmi: Add t603x Sasha Finkelstein
2026-07-25 13:52   ` sashiko-bot
2026-07-25 13:47 ` [PATCH 2/7] spmi: apple: Validate FIFO state Sasha Finkelstein
2026-07-25 14:00   ` sashiko-bot
2026-07-25 13:48 ` [PATCH 3/7] spmi: apple: check transaction status Sasha Finkelstein
2026-07-25 14:02   ` sashiko-bot
2026-07-25 13:48 ` [PATCH 4/7] spmi: apple: Implement remaining commands Sasha Finkelstein
2026-07-25 14:02   ` sashiko-bot
2026-07-25 13:48 ` [PATCH 5/7] spmi: apple: lock around FIFOs Sasha Finkelstein
2026-07-25 14:01   ` sashiko-bot [this message]
2026-07-25 13:48 ` [PATCH 6/7] spmi: apple: use IRQ for RX FIFO if possible Sasha Finkelstein
2026-07-25 14:00   ` sashiko-bot
2026-07-25 13:48 ` [PATCH 7/7] spmi: apple: interrupt controller functionality Sasha Finkelstein
2026-07-25 13:59   ` sashiko-bot

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=20260725140132.40BBC1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=k@chaosmail.tech \
    --cc=robh@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