Re: [PATCH net-next] net: macb: move printk() calls out of bp->lock critical section
From: Nicolai Buchwitz
Date: Fri Oct 02 2026 - 05:55:32 EST
Hi Théo
On 30.9.2026 20:35, Théo Lebrun wrote:
printk() call while bp->lock is acquired might be a bad idea:
- It grows the spinlock atomic section.
- If netconsole is active on the same interface (and we run on the
queue's CPU), we risk a deadlock because macb_poll_controller()
calls macb_interrupt() which grab bp->lock if an IRQ is pending.
Three messages are changed:
- In macb_tx_error_task(), defer netdev_err("halt tx timed out") call
to after the critical section. Update the message to highlight it
occurred in the past. Inherit the buffer exhaustion boolean variable
name from the old code comment.
- In macb_tx_error_task(), defer the netdev_err("TX buffers exhausted
mid-frame") call out of the loop. This also means it goes from
1-per-error to 1-per-task-invocation.
- In IRQ handling, move HRESP error printing out of
macb_interrupt_misc() into macb_interrupt(). Again, it means we
dedup error reporting if status is read multiple times in a row with
HRESP bit set. This is fine as from past instances I've seen, this
message spams our log if it occurs.
Notice we *ignore* debug printks; if you are debugging MACB maybe don't
use netconsole...
The netconsole deadlock is theoretical & never reproduced.
Signed-off-by: Théo Lebrun <theo.lebrun@xxxxxxxxxxx>
---
This patch used to be part of context swapping V9.
It got moved out as there aren't any dependency or relationship.
Technically it is a fix, in practice I'm happy for it to go through
net-next/main for more testing and it is a theoretical bugfix (as usual
nowadays). Decided after seeing Jakub taking a similar patch into
net-next this morning:
Since Linus is pushing back on our number of Fixes let's go forhttps://lore.kernel.org/netdev/20260929184531.36ac3dc3@xxxxxxxxxx/
net-next with similar fixes until the merge window
Changes since context swapping v9:
- Rebase onto latest net-next/main (47a144672573).
- Send patch standalone.
- Simplify the commit message (it was a long and partially wrong
rambling before). Also mention that it is a theoretical bugfix.
- Link to v9: https://patch.msgid.link/20260812-macb-context-v9-0-7ddbf5f715e0@xxxxxxxxxxx
---
[...]
Reviewed-by: Nicolai Buchwitz <nb@xxxxxxxxxxx>
Thanks,
Nicolai