Linux Hardware Monitor development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Adam Young" <admiyo@os.amperecomputing.com>
Cc: linux-hwmon@vger.kernel.org
Subject: Re: [ v01] mailbox: pcc: report errors for PCC clients
Date: Fri, 15 May 2026 22:39:33 +0000	[thread overview]
Message-ID: <20260515223934.134C3C2BCB0@smtp.kernel.org> (raw)
In-Reply-To: <20260515221745.714736-1-admiyo@os.amperecomputing.com>

Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [High] The error path fails to clear the `pchan->chan_in_use` flag, leading to state machine corruption and spurious client callbacks.
- [High] The error path fails to acknowledge Slave Subspace notifications, which can permanently hang the channel.
- [High] The interrupt handler incorrectly returns `IRQ_NONE` after successfully handling a mailbox error condition, risking the disablement of the shared IRQ line.
--

commit 8be35a18843a43d39fee5986fb5339b3f4e55c68
Author: Adam Young <admiyo@os.amperecomputing.com>

mailbox: pcc: report errors for PCC clients

This commit updates the PCC mailbox interrupt handler to pass the error code
to the tx_done callback via mbox_chan_txdone() when a channel error is
detected. This allows several clients to accurately report these errors.

> diff --git a/drivers/mailbox/pcc.c b/drivers/mailbox/pcc.c
> --- a/drivers/mailbox/pcc.c
> +++ b/drivers/mailbox/pcc.c
[ ... ]
> @@ -327,8 +328,11 @@ static irqreturn_t pcc_mbox_irq(int irq, void *p)
>  	if (!pcc_mbox_cmd_complete_check(pchan))
>  		return IRQ_NONE;
>  
> -	if (pcc_mbox_error_check_and_clear(pchan))
> +	rc = pcc_mbox_error_check_and_clear(pchan);
> +	if (rc) {
> +		mbox_chan_txdone(chan, rc);
>  		return IRQ_NONE;

Since the early return is taken when an error occurs, does this code need to
clear pchan->chan_in_use? If it remains true while the channel is idle, could
the next interrupt on a shared IRQ line bypass the !pchan->chan_in_use filter,
incorrectly evaluate cmd_complete as true, and spuriously call
mbox_chan_received_data() with phantom data?

Also, for PCC Slave Subspaces, the platform sends asynchronous notifications
that must be acknowledged. By returning early, this path skips calling
pcc_chan_acknowledge(pchan). Can this leave the command unacknowledged and
hang the Slave Subspace if the platform stops sending notifications?

Finally, since pcc_mbox_error_check_and_clear() clears the hardware error
register, it confirms the device legitimately generated the interrupt. Does
returning IRQ_NONE here risk having the kernel's spurious interrupt detector
eventually disable the shared IRQ line if this error path is triggered
repeatedly?

> +	}
>  
>  	/*
>  	 * Clear this flag after updating interrupt ack register and just

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260515221745.714736-1-admiyo@os.amperecomputing.com?part=1

      reply	other threads:[~2026-05-15 22:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-15 22:17 [ v01] mailbox: pcc: report errors for PCC clients Adam Young
2026-05-15 22:39 ` sashiko-bot [this message]

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=20260515223934.134C3C2BCB0@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=admiyo@os.amperecomputing.com \
    --cc=linux-hwmon@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