Thread View: linux.kernel.netdev
7 messages
7 total messages
Started by Wentao Liang
Tue, 03 Nov 2026 10:05
[PATCH] net: mvpp2: free pending TX timestamp skbs when the port is stopped
Author: Wentao Liang
Date: Tue, 03 Nov 2026 10:05
Date: Tue, 03 Nov 2026 10:05
56 lines
10100 bytes
10100 bytes
mvpp2_tx_hw_tstamp() takes an extra reference on skbs that need a TX
timestamp and stores them in port->tx_hwtstamp_queue[]. The reference is
dropped by mvpp2_isr_handle_ptp_queue() when the hardware reports the
timestamp. Nothing drains the queues when the port is stopped, so skbs
still waiting for a timestamp keep their reference until their queue
slot is reused, and are leaked for good when the port is removed.
Free the queued skbs in mvpp2_stop(), after the interrupts have been
released.
Fixes: f5015a594c50 ("net: mvpp2: ptp: add support for transmit timestamping")
Cc: stable@vger.kernel.org
Assisted-by: DeepSeek-V4.1-Flash and OpenAI Codex
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
index 317af54369cf..fc020b8c8830 100644
--- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
+++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
@@ -3419,6 +3419,22 @@ static void mvpp2_isr_handle_ptp(struct mvpp2_port *port)
mvpp2_isr_handle_ptp_queue(port, 1);
}
+static void mvpp2_tx_hwtstamp_flush(struct mvpp2_port *port)
+{
+ struct mvpp2_hwtstamp_queue *queue;
+ int nq, i;
+
+ for (nq = 0; nq < ARRAY_SIZE(port->tx_hwtstamp_queue); nq++) {
+ queue = &port->tx_hwtstamp_queue[nq];
+ for (i = 0; i < ARRAY_SIZE(queue->skb); i++) {
+ if (!queue->skb[i])
+ continue;
+ dev_kfree_skb_any(queue->skb[i]);
+ queue->skb[i] = NULL;
+ }
+ }
+}
+
static void mvpp2_isr_handle_link(struct mvpp2_port *port,
struct phylink_pcs *pcs, bool link)
{
@@ -4914,6 +4930,7 @@ static int mvpp2_stop(struct net_device *dev)
free_irq(port->port_irq, port);
mvpp2_irqs_deinit(port);
+ mvpp2_tx_hwtstamp_flush(port);
if (!port->has_tx_irqs) {
for (thread = 0; thread < port->priv->nthreads; thread++) {
port_pcpu = per_cpu_ptr(port->pcpu, thread);
--
2.34.1
Re: [PATCH] net: mvpp2: free pending TX timestamp skbs when the port is stopped
Author: netdev-bot+sinfo
Date: Tue, 03 Nov 2026 10:10
Date: Tue, 03 Nov 2026 10:10
26 lines
8955 bytes
8955 bytes
Hi! This is an automated message. This series looks like a fix, but its commit messages seem to be missing some information: - How the issue was discovered, e.g. hit in production, hit during development, syzbot report, manual code inspection, LLM or static analysis tool scan. - Whether the issue was actually triggered, or is only theoretical (e.g. found by code inspection). If it was triggered please include the symptoms, like the stack trace or error messages. - What hardware the change was tested on. For driver fixes please mention the device (and if relevant firmware version) used for testing, or say that the change was not tested on real hardware. Please do not repost the series just to address the above. Instead, reply to this email with the missing information, so that reviewers can take it into account. If the series needs another revision for other reasons, please include the information in the commit messages then. The evaluation is done by an LLM so it may be wrong, if you think that is the case please reply and explain.
Re: [PATCH] net: mvpp2: free pending TX timestamp skbs when the port is stopped
Author: Krzysztof Kozlowski
Date: Tue, 03 Nov 2026 10:25
Date: Tue, 03 Nov 2026 10:25
61 lines
10238 bytes
10238 bytes
On Tue, 03 Nov 2026 10:05:35 +0000, Wentao Liang wrote:
> mvpp2_tx_hw_tstamp() takes an extra reference on skbs that need a TX
> timestamp and stores them in port->tx_hwtstamp_queue[]. The reference is
> dropped by mvpp2_isr_handle_ptp_queue() when the hardware reports the
> timestamp. Nothing drains the queues when the port is stopped, so skbs
> still waiting for a timestamp keep their reference until their queue
> slot is reused, and are leaked for good when the port is removed.
>
> Free the queued skbs in mvpp2_stop(), after the interrupts have been
> released.
>
> Fixes: f5015a594c50 ("net: mvpp2: ptp: add support for transmit timestamping")
> Cc: stable@vger.kernel.org
> Assisted-by: DeepSeek-V4.1-Flash and OpenAI Codex
> Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
> ---
> drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 17 +++++++++++++++++
> 1 file changed, 17 insertions(+)
>
Multiple things here:
1. Your team ignored completely previous feedback. Multiple times.
2. You use multiple identities with this email address, thus I doubt that we
speak with an actual person.
3. Your bot does not even bother running checkpatch, right?
4. Nothing of this was reproduced nor tested.
5. Finally, the same feedback:
You sent multiple independent patches, to multiple independent
subsystems. The amount of these patches clearly suggest this was
AI generated and most likely not tested.
More importantly, you sent all this work without properly organizing
relevant patches into patchsets. This makes reviewing difficult
and might cause multiple reviewers to address the same issue.
Replying to the entire set is impossible and requires handling each
patch independently, instead of applying or discarding the set.
Maintainers also won't see the bigger picture of your work. Quite
worrying.
This is on the verge of hostile patch: bomb us with so many
contributions, we won't be able to handle them in efficient manner,
like responding ONCE to ask you to slow down. Considering all this
is untested and LLM generated, I have even more doubts whether this
should be considered for review.
Please read kernel documentation BEFORE posting more work. It will
explain you how to identify subsystems, how to organize your work per
subsystem (so a patchset grouping multiple patches with a short cover
letter), how to document the issue discovery method and what was
or was not tested.
Best regards,
Krzysztof
Re: [PATCH] net: mvpp2: free pending TX timestamp skbs when the port is stopped
Author: netdev-bot+sashiko
Date: Sat, 07 Nov 2026 12:00
Date: Sat, 07 Nov 2026 12:00
173 lines
14159 bytes
14159 bytes
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.
Critical: 0 · High: 1 (1) · Medium: 0 · Low: 0 (1)
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [High] The new mvpp2_tx_hwtstamp_flush()
(drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c:3422-3436) checks,…
Pre-existing issues:
- [High] This problem wasn't introduced by this patch, but it is a
serious race on the same data.
- [Low] Baseline decision: not a valid finding against this patch.
--
net: mvpp2: free pending TX timestamp skbs when the port is stopped
This commit adds mvpp2_tx_hwtstamp_flush(). It frees any skbs still held
in port->tx_hwtstamp_queue[] that are waiting for a hardware TX timestamp.
It is called from mvpp2_stop() after the port interrupts have been
released, so the extra references taken by mvpp2_tx_hw_tstamp() are not
leaked.
> diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
> index 317af54369cfe..fc020b8c88301 100644
> --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
> +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
> @@ -3419,6 +3419,22 @@ static void mvpp2_isr_handle_ptp(struct mvpp2_port *port)
> mvpp2_isr_handle_ptp_queue(port, 1);
> }
>
> +static void mvpp2_tx_hwtstamp_flush(struct mvpp2_port *port)
> +{
> + struct mvpp2_hwtstamp_queue *queue;
> + int nq, i;
> +
> + for (nq = 0; nq < ARRAY_SIZE(port->tx_hwtstamp_queue); nq++) {
> + queue = &port->tx_hwtstamp_queue[nq];
> + for (i = 0; i < ARRAY_SIZE(queue->skb); i++) {
> + if (!queue->skb[i])
> + continue;
> + dev_kfree_skb_any(queue->skb[i]);
> + queue->skb[i] = NULL;
[Severity: High]
Can this race with mvpp2_tx_hw_tstamp() on another CPU and free the same
skb twice?
mvpp2_stop() is not only reached through ndo_stop, where
__dev_close_many() has already quiesced TX. It is also called directly
on running devices:
mvpp2_xdp_setup():
if (running && reset)
mvpp2_stop(port->dev);
mvpp2_change_mtu()->mvpp2_bm_switch_buffers():
for (i = 0; i < priv->port_count; i++) {
port = priv->port_list[i];
status[i] = netif_running(port->dev);
if (status[i])
mvpp2_stop(port->dev);
}
The second path stops every running port on the controller, including
ports whose MTU did not change.
mvpp2_stop_dev() does set_bit(0, &port->state), which mvpp2_tx() never
checks. It also disables interrupts and NAPI and calls phylink_stop().
The only TX gating is netif_tx_stop_all_queues() in mvpp2_mac_link_down().
It does not wait for an mvpp2_tx() that is already running on another
CPU. On ports without phylink, the TX queues are not stopped at all.
Meanwhile the xmit path works on the same array:
mvpp2_tx_hw_tstamp():
i = queue->next;
queue->next = (i + 1) & 31;
if (queue->skb[i])
dev_kfree_skb_any(queue->skb[i]);
queue->skb[i] = skb_get(skb);
Suppose the flush and an in-flight xmit both see the same skb in skb[i].
Both would then call dev_kfree_skb_any() on it. TX completion has already
dropped the stack's reference, so that skb only holds the skb_get()
reference.
On phylink ports the window is limited to an xmit that started before
netif_tx_stop_all_queues(). That window is not bounded on PREEMPT_RT.
mvpp2_cleanup_txqs() already has the same missing TX quiescence on these
paths, but the flush adds a new unsynchronized writer.
Should TX be quiesced before mvpp2_tx_hwtstamp_flush() runs on these
paths?
[Severity: High]
This isn't a bug introduced by this patch, but concurrent transmits also
do not appear to protect this per-port array.
port->tx_hwtstamp_queue[] and its next index are per-port. mvpp2 is not
LLTX, so the core holds only the per-txq lock. XPS maps each CPU to its
own txq, so mvpp2_tx() can run on several CPUs at once.
The only driver lock in mvpp2_tx() is conditional and per-thread:
if (test_bit(thread, &port->priv->lock_map))
spin_lock_irqsave(&port->tx_lock[thread], flags);
That lock does not serialize two threads in mvpp2_tx_hw_tstamp().
If two CPUs read the same queue->next value while skb[i] holds a pending
skb, could both call dev_kfree_skb_any() on it? If skb[i] is NULL, one
skb_get() reference would be overwritten, and that skb and its socket
write memory would be leaked.
The slot-reuse free in mvpp2_tx_hw_tstamp() also looks like it can race
with the consumer in mvpp2_isr_handle_ptp_queue():
skb = queue->skb[id];
queue->skb[id] = NULL;
if (skb) {
Once TX HW timestamping is enabled on the port, a process without any
capability can set SO_TIMESTAMPING with SOF_TIMESTAMPING_TX_HARDWARE and
send PTP frames from several CPUs.
The new flush adds another unlocked accessor to this array.
> + }
> + }
> +}
> +
[ ... ]
> @@ -4914,6 +4930,7 @@ static int mvpp2_stop(struct net_device *dev)
> free_irq(port->port_irq, port);
>
> mvpp2_irqs_deinit(port);
> + mvpp2_tx_hwtstamp_flush(port);
[Severity: Low]
This is a pre-existing issue, but the stop path does not touch the
hardware PTP TX result FIFOs (MVPP22_PTP_TX_Q0_R0..R2 and the Q1
equivalents). It also does not reset queue->next.
A stale record for a reused slot could be matched to a new skb after
reopen. That happens the same way with or without this patch. In
practice, mvpp2_open() normally drains latched PTP causes before TX
restarts.
The effect specific to this patch is smaller. Some timestamps have
already been captured by the hardware but not yet read when the port
stops. Those records now find a NULL slot in mvpp2_isr_handle_ptp_queue()
and are dropped, instead of being delivered to the original skb.
Would it make sense to drain both hardware queues with
mvpp2_isr_handle_ptp_queue() before freeing the remaining skbs here?
> if (!port->has_tx_irqs) {
> for (thread = 0; thread < port->priv->nthreads; thread++) {
> port_pcpu = per_cpu_ptr(port->pcpu, thread);
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261103100535.1310088-1-vulab%40iscas.ac.cn
Re: [PATCH] net: mvpp2: free pending TX timestamp skbs when the port is stopped
Author: Simon Horman
Date: Sun, 08 Nov 2026 17:28
Date: Sun, 08 Nov 2026 17:28
27 lines
8957 bytes
8957 bytes
On Sat, Nov 07, 2026 at 12:00:58PM +0000, netdev-bot+sashiko@kernel.org wrote: > Thank you for your contribution! Sashiko AI review found 1 potential > issue(s) to consider. > > Critical: 0 · High: 1 (1) · Medium: 0 · Low: 0 (1) > > If you believe none of the issues are legitimate, please reply to each > issue of Medium severity or higher and explain why the AI is wrong. > If any of them are legitimate and you plan to respin, please let patchwork > know by including "pw-bot: cr" as a separate line at the end of your reply > (one such reply per series is enough). > > - [High] The new mvpp2_tx_hwtstamp_flush() > (drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c:3422-3436) checks,… I lean towards this being a pre-existing issue that can be handled separately from this patch. But I do note that taken at face-value it severely impacts the reliability of the teardown path and the usefulness of this patch in practice. > Pre-existing issues: > - [High] This problem wasn't introduced by this patch, but it is a > serious race on the same data. > - [Low] Baseline decision: not a valid finding against this patch. ...
Re: [PATCH] net: mvpp2: free pending TX timestamp skbs when the port is stopped
Author: Simon Horman
Date: Sun, 08 Nov 2026 17:34
Date: Sun, 08 Nov 2026 17:34
37 lines
9432 bytes
9432 bytes
On Tue, Nov 03, 2026 at 10:10:28AM +0000, netdev-bot+sinfo@kernel.org wrote: > Hi! > > This is an automated message. This series looks like a fix, but its > commit messages seem to be missing some information: > > - How the issue was discovered, e.g. hit in production, hit during > development, syzbot report, manual code inspection, LLM or static > analysis tool scan. > > - Whether the issue was actually triggered, or is only theoretical > (e.g. found by code inspection). If it was triggered please include > the symptoms, like the stack trace or error messages. > > - What hardware the change was tested on. For driver fixes please > mention the device (and if relevant firmware version) used for > testing, or say that the change was not tested on real hardware. > > Please do not repost the series just to address the above. Instead, > reply to this email with the missing information, so that reviewers > can take it into account. If the series needs another revision for > other reasons, please include the information in the commit messages > then. > > The evaluation is done by an LLM so it may be wrong, if you think > that is the case please reply and explain. Hi Wentao, In my inbox, I count 39 emails of the form above from netdev-bot+sinfo to you in the past week or so. And zero responses from you. If I miscounted then I apologise. But in case it is not clear, a response to these messages is required. I would appreciate it if you could provided responses to all such messages for patches which are still active on patchwork.
Re: [PATCH] net: mvpp2: free pending TX timestamp skbs when the port is stopped
Author: patchwork-bot+netdevbpf
Date: Tue, 10 Nov 2026 18:23
Date: Tue, 10 Nov 2026 18:23
24 lines
8741 bytes
8741 bytes
Hello:
This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Tue, 3 Nov 2026 10:05:35 +0000 you wrote:
> mvpp2_tx_hw_tstamp() takes an extra reference on skbs that need a TX
> timestamp and stores them in port->tx_hwtstamp_queue[]. The reference is
> dropped by mvpp2_isr_handle_ptp_queue() when the hardware reports the
> timestamp. Nothing drains the queues when the port is stopped, so skbs
> still waiting for a timestamp keep their reference until their queue
> slot is reused, and are leaked for good when the port is removed.
>
> [...]
Here is the summary with links:
- net: mvpp2: free pending TX timestamp skbs when the port is stopped
https://git.kernel.org/netdev/net-next/c/6c4f0baee69e
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads