netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 net-next 00/15] locking: Introduce nested-BH locking.
@ 2024-05-03 18:25 Sebastian Andrzej Siewior
  2024-05-03 18:25 ` [PATCH net-next 01/15] locking/local_lock: Introduce guard definition for local_lock Sebastian Andrzej Siewior
                   ` (15 more replies)
  0 siblings, 16 replies; 38+ messages in thread
From: Sebastian Andrzej Siewior @ 2024-05-03 18:25 UTC (permalink / raw)
  To: linux-kernel, netdev
  Cc: David S. Miller, Boqun Feng, Daniel Borkmann, Eric Dumazet,
	Frederic Weisbecker, Ingo Molnar, Jakub Kicinski, Paolo Abeni,
	Peter Zijlstra, Thomas Gleixner, Waiman Long, Will Deacon

Disabling bottoms halves acts as per-CPU BKL. On PREEMPT_RT code within
local_bh_disable() section remains preemtible. As a result high prior
tasks (or threaded interrupts) will be blocked by lower-prio task (or
threaded interrupts) which are long running which includes softirq
sections.

The proposed way out is to introduce explicit per-CPU locks for
resources which are protected by local_bh_disable() and use those only
on PREEMPT_RT so there is no additional overhead for !PREEMPT_RT builds.

The series introduces the infrastructure and converts large parts of
networking which is largest stake holder here. Once this done the
per-CPU lock from local_bh_disable() on PREEMPT_RT can be lifted.

v1…v2 https://lore.kernel.org/all/20231215171020.687342-1-bigeasy@linutronix.de/:
- Jakub complained about touching networking drivers to make the
  additional locking work. Alexei complained about the additional
  locking within the XDP/eBFP case.
  This led to a change in how the per-CPU variables are accessed for the
  XDP/eBPF case. On PREEMPT_RT the variables are now stored on stack and
  the task pointer to the structure is saved in the task_struct while
  keeping every for !RT unchanged. This was proposed as a RFC in
  	v1: https://lore.kernel.org/all/20240213145923.2552753-1-bigeasy@linutronix.de/

  and then updated

        v2: https://lore.kernel.org/all/20240229183109.646865-1-bigeasy@linutronix.de/
	  - Renamed the container struct from xdp_storage to bpf_net_context.
            Suggested by Toke Høiland-Jørgensen.
	  - Use the container struct also on !PREEMPT_RT builds. Store the
	    pointer to the on-stack struct in a per-CPU variable. Suggested by
            Toke Høiland-Jørgensen.

  This reduces the initial queue from 24 to 15 patches.

- There were complains about the scoped_guard() which shifts the whole
  block and makes it harder to review because the whole gets removed and
  added again. The usage has been replaced with local_lock_nested_bh()+
  its unlock counterpart.

Sebastian


^ permalink raw reply	[flat|nested] 38+ messages in thread

end of thread, other threads:[~2024-05-24 14:00 UTC | newest]

Thread overview: 38+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-03 18:25 [PATCH v2 net-next 00/15] locking: Introduce nested-BH locking Sebastian Andrzej Siewior
2024-05-03 18:25 ` [PATCH net-next 01/15] locking/local_lock: Introduce guard definition for local_lock Sebastian Andrzej Siewior
2024-05-03 18:25 ` [PATCH net-next 02/15] locking/local_lock: Add local nested BH locking infrastructure Sebastian Andrzej Siewior
2024-05-03 18:25 ` [PATCH net-next 03/15] net: Use __napi_alloc_frag_align() instead of open coding it Sebastian Andrzej Siewior
2024-05-03 18:25 ` [PATCH net-next 04/15] net: Use nested-BH locking for napi_alloc_cache Sebastian Andrzej Siewior
2024-05-03 18:25 ` [PATCH net-next 05/15] net/tcp_sigpool: Use nested-BH locking for sigpool_scratch Sebastian Andrzej Siewior
2024-05-03 18:25 ` [PATCH net-next 06/15] net/ipv4: Use nested-BH locking for ipv4_tcp_sk Sebastian Andrzej Siewior
2024-05-03 18:25 ` [PATCH net-next 07/15] netfilter: br_netfilter: Use nested-BH locking for brnf_frag_data_storage Sebastian Andrzej Siewior
2024-05-03 18:25 ` [PATCH net-next 08/15] net: softnet_data: Make xmit.recursion per task Sebastian Andrzej Siewior
2024-05-03 18:25 ` [PATCH net-next 09/15] dev: Remove PREEMPT_RT ifdefs from backlog_lock.*() Sebastian Andrzej Siewior
2024-05-03 18:25 ` [PATCH net-next 10/15] dev: Use nested-BH locking for softnet_data.process_queue Sebastian Andrzej Siewior
2024-05-03 18:25 ` [PATCH net-next 11/15] lwt: Don't disable migration prio invoking BPF Sebastian Andrzej Siewior
2024-05-03 18:25 ` [PATCH net-next 12/15] seg6: Use nested-BH locking for seg6_bpf_srh_states Sebastian Andrzej Siewior
2024-05-03 18:25 ` [PATCH net-next 13/15] net: Use nested-BH locking for bpf_scratchpad Sebastian Andrzej Siewior
2024-05-03 18:25 ` [PATCH net-next 14/15] net: Reference bpf_redirect_info via task_struct on PREEMPT_RT Sebastian Andrzej Siewior
2024-05-06 19:41   ` Toke Høiland-Jørgensen
2024-05-06 23:09     ` Alexei Starovoitov
2024-05-07 12:36       ` Sebastian Andrzej Siewior
2024-05-07 13:27         ` Jesper Dangaard Brouer
2024-05-10 16:21           ` [PATCH net-next 14/15 v2] " Sebastian Andrzej Siewior
2024-05-10 16:22             ` Sebastian Andrzej Siewior
2024-05-14  5:07               ` Jesper Dangaard Brouer
2024-05-14  5:43                 ` Sebastian Andrzej Siewior
2024-05-14 12:20                   ` Jesper Dangaard Brouer
2024-05-17 16:15                     ` Sebastian Andrzej Siewior
2024-05-22  7:09                       ` Jesper Dangaard Brouer
2024-05-24  7:54                         ` Sebastian Andrzej Siewior
2024-05-24 13:59                         ` Sebastian Andrzej Siewior
2024-05-14 11:54             ` Toke Høiland-Jørgensen
2024-05-15 13:43               ` Sebastian Andrzej Siewior
2024-05-21  1:52                 ` Alexei Starovoitov
2024-05-07 10:57     ` [PATCH net-next 14/15] " Sebastian Andrzej Siewior
2024-05-07 13:50       ` Toke Høiland-Jørgensen
2024-05-03 18:25 ` [PATCH net-next 15/15] net: Move per-CPU flush-lists to bpf_net_context " Sebastian Andrzej Siewior
2024-05-06  8:43 ` [PATCH v2 net-next 00/15] locking: Introduce nested-BH locking Paolo Abeni
2024-05-06  9:38   ` Sebastian Andrzej Siewior
2024-05-06 14:12     ` Paolo Abeni
2024-05-06 14:43       ` Sebastian Andrzej Siewior

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).