From: sashiko-bot@kernel.org
To: "David Vornholt" <dv@etik.com>
Cc: linux-usb@vger.kernel.org
Subject: Re: [PATCH] usb: typec: ucsi: Stop a power level change notification storm
Date: Sat, 10 Oct 2026 12:22:28 +0000 [thread overview]
Message-ID: <sashiko-outbox-166517@kernel.org> (raw)
In-Reply-To: <20261010121026.84844-1-dv@etik.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] usb: typec: ucsi: workaround breaks power level notifications globally
- [High] usb: typec: ucsi: state desync on ucsi->ntfy causes infinite interrupt storm
--
commit 77aa902efb14b4a8b70e32dbfbe471a17454a00e
Author: David Vornholt <david@vornholt.online>
Subject: usb: typec: ucsi: Stop a power level change notification storm
This patch attempts to work around a bug on Lenovo ThinkPad X1 Carbon Gen 13
where the controller continuously signals a negotiated power level change
without an actual contract change. It stops the resulting interrupt storm by
disabling the power level change notification globally if it triggers 10 times
in a row without a new contract.
> diff --git a/drivers/usb/typec/ucsi/ucsi.c b/drivers/usb/typec/ucsi/ucsi.c
> index c1450639c7956..f2677875ad1e8 100644
> --- a/drivers/usb/typec/ucsi/ucsi.c
> +++ b/drivers/usb/typec/ucsi/ucsi.c
[ ... ]
> +static void ucsi_pwr_level_change(struct ucsi_connector *con)
> +{
> + struct ucsi *ucsi = con->ucsi;
> + u64 ntfy;
[ ... ]
> + ntfy = ucsi->ntfy & ~UCSI_ENABLE_NTFY_PWR_LEVEL_CHANGE;
> + if (ucsi_send_command(ucsi, UCSI_SET_NOTIFICATION_ENABLE | ntfy, NULL, 0) < 0)
> + return;
> +
> + ucsi->ntfy = ntfy;
[Severity: High]
Does this disable power level change notifications globally for all ports on
the system?
The notification command configures the mask for the entire controller,
affecting all connectors.
If this flag is cleared, will legitimate power level changes on other ports
(like a charger reducing power capability due to dynamic sharing) also be
missed?
Additionally, it appears this notification is never re-enabled even after
the buggy partner disconnects.
[Severity: High]
Is there a race condition here that can lead to an infinite interrupt storm?
This code performs a read-modify-write on ucsi->ntfy and sends a hardware
command without holding a lock (like ppm_lock) to serialize against other
readers.
If a concurrent path like ucsi_role_cmd() reads the old ucsi->ntfy:
c = UCSI_SET_NOTIFICATION_ENABLE | con->ucsi->ntfy;
ucsi_send_command(con->ucsi, c, NULL, 0);
and writes it back after ucsi_pwr_level_change() has updated the mask to
disabled, the hardware will have notifications enabled again.
However, the software check earlier in ucsi_pwr_level_change() will ignore
subsequent events:
if (!(ucsi->ntfy & UCSI_ENABLE_NTFY_PWR_LEVEL_CHANGE))
return;
Will this result in an infinite interrupt storm that permanently ties up the
processor with hardware transactions, since the controller keeps asserting
the interrupt but software ignores it?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261010121026.84844-1-dv@etik.com?part=1
prev parent reply other threads:[~2026-10-10 12:22 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-10 12:10 [PATCH] usb: typec: ucsi: Stop a power level change notification storm David Vornholt
2026-10-10 12:22 ` 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=sashiko-outbox-166517@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dv@etik.com \
--cc=linux-usb@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