Thread (8 messages) 8 messages, 2 authors, 2023-02-17

Re: [RFC v2] net/core: add optional threading for rps backlog processing

From: Eric Dumazet <edumazet@google.com>
Date: 2023-02-17 15:54:29
Also in: lkml
Subsystem: networking [general], the rest · Maintainers: "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Linus Torvalds

On Fri, Feb 17, 2023 at 4:26 PM Felix Fietkau [off-list ref] wrote:
quoted
Then, process_backlog() has been designed to run only from the cpu
tied to the per-cpu data (softnet_data)
There are multiple comments about this assumption, and various things
that would need to be changed
(eg sd_has_rps_ipi_waiting() would be wrong in its current implementation)
That's why I added the NAPI_STATE_THREADED check in napi_schedule_rps,
so that sd_has_rps_ipi_waiting would always return false.
Or are you worried about a race when enabling threading?
Please look at all uses of sd->process_queue, without locking. They do
not care about NAPI_STATE_THREADED

flush_backlog() is one instance, but process_backlog() is also using
__skb_dequeue(&sd->process_queue)

I suspect the following patch would work today, and would show
process_queue lock is not used.
diff --git a/net/core/dev.c b/net/core/dev.c
index 5687b528d4c18ef2960edb6bf3161bbad666aece..bed540b417a1b4cd3e384611a4681b8e2a43fd30
100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -11396,7 +11396,7 @@ static int __init net_dev_init(void)
                INIT_WORK(flush, flush_backlog);

                skb_queue_head_init(&sd->input_pkt_queue);
-               skb_queue_head_init(&sd->process_queue);
+               __skb_queue_head_init(&sd->process_queue);
 #ifdef CONFIG_XFRM_OFFLOAD
                skb_queue_head_init(&sd->xfrm_backlog);
 #endif
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help