• Sebastian Andrzej Siewior's avatar
    net: softnet_data: Make xmit per task. · ecefbc09
    Sebastian Andrzej Siewior authored
    Softirq is preemptible on PREEMPT_RT. Without a per-CPU lock in
    local_bh_disable() there is no guarantee that only one device is
    transmitting at a time.
    With preemption and multiple senders it is possible that the per-CPU
    `recursion' counter gets incremented by different threads and exceeds
    XMIT_RECURSION_LIMIT leading to a false positive recursion alert.
    The `more' member is subject to similar problems if set by one thread
    for one driver and wrongly used by another driver within another thread.
    
    Instead of adding a lock to protect the per-CPU variable it is simpler
    to make xmit per-task. Sending and receiving skbs happens always
    in thread context anyway.
    
    Having a lock to protected the per-CPU counter would block/ serialize two
    sending threads needlessly. It would also require a recursive lock to
    ensure that the owner can increment the counter further.
    
    Make the softnet_data.xmit a task_struct member on PREEMPT_RT. Add
    needed wrapper.
    
    Cc: Ben Segall <bsegall@google.com>
    Cc: Daniel Bristot de Oliveira <bristot@redhat.com>
    Cc: Dietmar Eggemann <dietmar.eggemann@arm.com>
    Cc: Juri Lelli <juri.lelli@redhat.com>
    Cc: Mel Gorman <mgorman@suse.de>
    Cc: Steven Rostedt <rostedt@goodmis.org>
    Cc: Valentin Schneider <vschneid@redhat.com>
    Cc: Vincent Guittot <vincent.guittot@linaro.org>
    Signed-off-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
    Link: https://patch.msgid.link/20240620132727.660738-9-bigeasy@linutronix.deSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
    ecefbc09
dev.h 5.43 KB