From: sashiko-bot@kernel.org
To: "James Hilliard" <james.hilliard1@gmail.com>
Cc: linux-serial@vger.kernel.org, devicetree@vger.kernel.org,
linux-sunxi@lists.linux.dev, robh@kernel.org,
conor+dt@kernel.org
Subject: Re: [PATCH v10 06/11] serial: 8250_dw: derive RX trigger thresholds from the FIFO depth
Date: Fri, 04 Dec 2026 10:52:53 +0000 [thread overview]
Message-ID: <sashiko-outbox-249637@kernel.org> (raw)
In-Reply-To: <20261204-submit-h616-uart-fifo-v1-v10-6-1a9fb4f79635@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] serial: 8250_dw: PM_RUNTIME_ACQUIRE_IF_ENABLED() fails in
dw8250_probe()
--
commit 145c679556b4e6a2b08dcfe78019d88beee1eeb1
Author: James Hilliard <james.hilliard1@gmail.com>
serial: 8250_dw: derive RX trigger thresholds from the FIFO depth
This commit derives per-port RX trigger threshold tables from the
discovered FIFO depth in 8250_dwlib and installs get_rxtrig/set_rxtrig
callbacks for CPR-described FIFOs.
> diff --git a/drivers/tty/serial/8250/8250_dwlib.c b/drivers/tty/serial/8250/8250_dwlib.c
> index 4a06dec6e263b..6cfb7674ac119 100644
> --- a/drivers/tty/serial/8250/8250_dwlib.c
> +++ b/drivers/tty/serial/8250/8250_dwlib.c
[ ... ]
> +static int dw8250_set_rxtrig(struct uart_port *p, u16 bytes)
> +{
> + struct dw8250_port_data *pd = p->private_data;
> + struct uart_8250_port *up = up_to_u8250p(p);
> + int fcr, ret;
> +
> + fcr = serial8250_bytes_to_fcr(pd->rxtrig_bytes, bytes);
> + if (fcr < 0)
> + return fcr;
> +
> + guard(mutex)(&p->state->port.mutex);
> +
> + PM_RUNTIME_ACQUIRE_IF_ENABLED(p->dev, pm);
> + ret = PM_RUNTIME_ACQUIRE_ERR(&pm);
> + if (ret)
> + return ret;
[Severity: Medium]
Can PM_RUNTIME_ACQUIRE_IF_ENABLED() fail with -EACCES during initial
dw8250_probe()?
In dw8250_probe(), pm_runtime_set_active() updates runtime_status to
RPM_ACTIVE while disable_depth stays 1 and last_status remains
RPM_INVALID. The probe path then registers the port and publishes the
rx_trig_bytes sysfs attribute before calling pm_runtime_enable().
CPU0 CPU1
dw8250_probe()
pm_runtime_set_active(dev)
(disable_depth=1,
last_status=RPM_INVALID)
serial8250_register_8250_port()
... (publishes rx_trig_bytes)
rx_trig_bytes_store()
dw8250_set_rxtrig()
PM_RUNTIME_ACQUIRE_IF_ENABLED()
rpm_resume() <-- -EACCES
pm_runtime_enable(dev)
Because PM_RUNTIME_ACQUIRE_IF_ENABLED() does not set RPM_TRANSPARENT,
rpm_resume() rejects the call while disable_depth > 0 and last_status is
not RPM_ACTIVE:
drivers/base/power/runtime.c:rpm_resume() {
...
} else if (dev->power.disable_depth > 0) {
if (dev->power.runtime_status == RPM_ACTIVE &&
dev->power.last_status == RPM_ACTIVE)
retval = 1;
else if (rpmflags & RPM_TRANSPARENT)
goto out;
else
retval = -EACCES;
}
...
}
A udev rule or userspace write to rx_trig_bytes reacting to the KOBJ_ADD
uevent in that window fails with -EACCES even though the UART is already
active and clocked, leaving the trigger threshold unconfigured. Using
PM_RUNTIME_ACQUIRE(p->dev, pm) instead passes RPM_TRANSPARENT while still
holding a usage reference until runtime PM is enabled.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261204-submit-h616-uart-fifo-v1-v10-0-1a9fb4f79635@gmail.com?part=6
next prev parent reply other threads:[~2026-12-04 10:52 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-04 10:28 [PATCH v10 00/11] serial: 8250_dw: share RX trigger setup and describe Allwinner UARTs James Hilliard
2026-12-04 10:28 ` [PATCH v10 01/11] serial: 8250_dw: allow port setup to report errors James Hilliard
2026-12-04 10:28 ` [PATCH v10 02/11] serial: 8250_dw: select port setup through platform data James Hilliard
2026-12-04 10:28 ` [PATCH v10 03/11] serial: 8250: widen RX trigger byte counts to 16 bits James Hilliard
2026-12-04 10:46 ` sashiko-bot
2026-12-04 10:28 ` [PATCH v10 04/11] serial: 8250: share the RX trigger conversion helper James Hilliard
2026-12-04 10:28 ` [PATCH v10 05/11] serial: 8250: expose RX trigger controls for custom callbacks James Hilliard
2026-12-04 10:28 ` [PATCH v10 06/11] serial: 8250_dw: derive RX trigger thresholds from the FIFO depth James Hilliard
2026-12-04 10:52 ` sashiko-bot [this message]
2026-12-04 10:28 ` [PATCH v10 07/11] dt-bindings: serial: snps-dw-apb-uart: add Allwinner H616 James Hilliard
2026-12-04 10:28 ` [PATCH v10 08/11] serial: 8250_dw: configure the Allwinner H616 UART James Hilliard
2026-12-04 10:50 ` sashiko-bot
2026-12-04 10:28 ` [PATCH v10 09/11] dt-bindings: serial: snps-dw-apb-uart: add Allwinner A523 James Hilliard
2026-12-04 10:28 ` [PATCH v10 10/11] serial: 8250_dw: discover Allwinner A523 FIFO depths through FCC James Hilliard
2026-12-04 10:28 ` [PATCH v10 11/11] serial: 8250_dw: configure RX trigger thresholds for Octeon James Hilliard
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-249637@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=james.hilliard1@gmail.com \
--cc=linux-serial@vger.kernel.org \
--cc=linux-sunxi@lists.linux.dev \
--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