diff options
| author | Vivian Wang <wangruikang@iscas.ac.cn> | 2025-09-19 20:04:33 +0800 |
|---|---|---|
| committer | Jakub Kicinski <kuba@kernel.org> | 2025-09-22 11:50:40 -0700 |
| commit | 35626012877b80436e0627feb16520db4f0ba53e (patch) | |
| tree | 0483c1c4153121cce8305ee5299cbb54d240a9ee /rust/helpers | |
| parent | 4b1eb8337e6bc1a8831e4ba8feff5927a8fb9a34 (diff) | |
net: spacemit: Make stats_lock softirq-safe
While most of the statistics functions (emac_get_stats64() and such) are
called with softirqs enabled, emac_stats_timer() is, as its name
suggests, also called from a timer, i.e. called in softirq context.
All of these take stats_lock. Therefore, make stats_lock softirq-safe by
changing spin_lock() into spin_lock_bh() for the functions that get
statistics.
Also, instead of directly calling emac_stats_timer() in emac_up() and
emac_resume(), set the timer to trigger instead, so that
emac_stats_timer() is only called from the timer. It will keep using
spin_lock().
This fixes a lockdep warning, and potential deadlock when stats_timer is
triggered in the middle of getting statistics.
Fixes: bfec6d7f2001 ("net: spacemit: Add K1 Ethernet MAC")
Reported-by: Marek Szyprowski <m.szyprowski@samsung.com>
Closes: https://lore.kernel.org/all/a52c0cf5-0444-41aa-b061-a0a1d72b02fe@samsung.com/
Signed-off-by: Vivian Wang <wangruikang@iscas.ac.cn>
Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Link: https://patch.msgid.link/20250919-k1-ethernet-fix-lock-v1-1-c8b700aa4954@iscas.ac.cn
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'rust/helpers')
0 files changed, 0 insertions, 0 deletions
