Re: [PATCH] net: raise RCU qs after each threaded NAPI poll

2024-03-07 Thread Paul E. McKenney
On Thu, Mar 07, 2024 at 01:52:15PM -0500, Steven Rostedt wrote: > On Thu, 7 Mar 2024 16:57:33 + > Mark Rutland wrote: > > > * Use rcu_tasks_trace to synchronize updates? > > Yes. I think I wanted both. The above to make sure it covers all cases > where something could be preempted, and a

Re: [PATCH] net: raise RCU qs after each threaded NAPI poll

2024-03-07 Thread Steven Rostedt
On Thu, 7 Mar 2024 16:57:33 + Mark Rutland wrote: > * Use rcu_tasks_trace to synchronize updates? Yes. I think I wanted both. The above to make sure it covers all cases where something could be preempted, and a case for those covered when RCU isn't watching (which always has preemption

Re: [PATCH] net: raise RCU qs after each threaded NAPI poll

2024-03-07 Thread Mark Rutland
On Thu, Mar 07, 2024 at 04:57:33PM +, Mark Rutland wrote: > On Mon, Mar 04, 2024 at 04:16:01AM -0500, Joel Fernandes wrote: > > On 3/2/2024 8:01 PM, Joel Fernandes wrote: > > Case 1: For !CONFIG_DYNAMIC_FTRACE update of ftrace_trace_function > > > > This config is itself expected to be slow.

Re: [PATCH] net: raise RCU qs after each threaded NAPI poll

2024-03-07 Thread Mark Rutland
Hi Joel, Paul, Steve, On Mon, Mar 04, 2024 at 04:16:01AM -0500, Joel Fernandes wrote: > Hi Paul, > > On 3/2/2024 8:01 PM, Joel Fernandes wrote: > >> As you noted, one thing that Ankur's series changes is that preemption > >> can occur anywhere that it is not specifically disabled in kernels > >>

Re: [PATCH] net: raise RCU qs after each threaded NAPI poll

2024-03-06 Thread Steven Rostedt
On Tue, 5 Mar 2024 09:53:42 -0800 "Paul E. McKenney" wrote: > > Case 1: For !CONFIG_DYNAMIC_FTRACE update of ftrace_trace_function > > > > This config is itself expected to be slow. However seeing what it does, it > > is > > trying to make sure the global function pointer

Re: [PATCH] net: raise RCU qs after each threaded NAPI poll

2024-03-05 Thread Paul E. McKenney
On Tue, Mar 05, 2024 at 07:57:40PM +, Mark Rutland wrote: > On Tue, Mar 05, 2024 at 09:53:42AM -0800, Paul E. McKenney wrote: > > On Mon, Mar 04, 2024 at 04:16:01AM -0500, Joel Fernandes wrote: > > > Hi Paul, > > > > Thank you, Joel! > > > > > On 3/2/2024 8:01 PM, Joel Fernandes wrote: > > >

Re: [PATCH] net: raise RCU qs after each threaded NAPI poll

2024-03-05 Thread Mark Rutland
On Tue, Mar 05, 2024 at 09:53:42AM -0800, Paul E. McKenney wrote: > On Mon, Mar 04, 2024 at 04:16:01AM -0500, Joel Fernandes wrote: > > Hi Paul, > > Thank you, Joel! > > > On 3/2/2024 8:01 PM, Joel Fernandes wrote: > > >> As you noted, one thing that Ankur's series changes is that preemption > >

Re: [PATCH] net: raise RCU qs after each threaded NAPI poll

2024-03-05 Thread Paul E. McKenney
On Mon, Mar 04, 2024 at 04:16:01AM -0500, Joel Fernandes wrote: > Hi Paul, Thank you, Joel! > On 3/2/2024 8:01 PM, Joel Fernandes wrote: > >> As you noted, one thing that Ankur's series changes is that preemption > >> can occur anywhere that it is not specifically disabled in kernels > >> built

Re: [PATCH] net: raise RCU qs after each threaded NAPI poll

2024-03-04 Thread Joel Fernandes
Hi Paul, On 3/2/2024 8:01 PM, Joel Fernandes wrote: >> As you noted, one thing that Ankur's series changes is that preemption >> can occur anywhere that it is not specifically disabled in kernels >> built with CONFIG_PREEMPT_NONE=y or CONFIG_PREEMPT_VOLUNTARY=y. This in >> turn changes Tasks

Re: [PATCH] net: raise RCU qs after each threaded NAPI poll

2024-03-04 Thread Joel Fernandes
Hi Paul, On 3/2/2024 8:01 PM, Joel Fernandes wrote: >> As you noted, one thing that Ankur's series changes is that preemption >> can occur anywhere that it is not specifically disabled in kernels >> built with CONFIG_PREEMPT_NONE=y or CONFIG_PREEMPT_VOLUNTARY=y. This in >> turn changes Tasks

Re: [PATCH] net: raise RCU qs after each threaded NAPI poll

2024-03-02 Thread Joel Fernandes
On Sat, Mar 2, 2024 at 7:25 PM Paul E. McKenney wrote: > > On Fri, Mar 01, 2024 at 09:24:15PM -0500, Joel Fernandes wrote: > > (Shrinking CC a bit) > > > > On Thu, Feb 29, 2024 at 1:29 PM Paul E. McKenney wrote: > > > > > > On Thu, Feb 29, 2024 at 12:41:55PM -0500, Joel Fernandes wrote: > > > >

Re: [PATCH] net: raise RCU qs after each threaded NAPI poll

2024-03-02 Thread Paul E. McKenney
On Fri, Mar 01, 2024 at 09:24:15PM -0500, Joel Fernandes wrote: > (Shrinking CC a bit) > > On Thu, Feb 29, 2024 at 1:29 PM Paul E. McKenney wrote: > > > > On Thu, Feb 29, 2024 at 12:41:55PM -0500, Joel Fernandes wrote: > > > > On Feb 29, 2024, at 11:57 AM, Paul E. McKenney > > > > wrote: > > >

Re: [PATCH] net: raise RCU qs after each threaded NAPI poll

2024-03-01 Thread Joel Fernandes
(Shrinking CC a bit) On Thu, Feb 29, 2024 at 1:29 PM Paul E. McKenney wrote: > > On Thu, Feb 29, 2024 at 12:41:55PM -0500, Joel Fernandes wrote: > > > On Feb 29, 2024, at 11:57 AM, Paul E. McKenney wrote: > > > On Thu, Feb 29, 2024 at 09:21:48AM -0500, Joel Fernandes wrote: > > >>> On

Re: [PATCH] net: raise RCU qs after each threaded NAPI poll

2024-02-29 Thread Paul E. McKenney
On Thu, Feb 29, 2024 at 12:41:55PM -0500, Joel Fernandes wrote: > > On Feb 29, 2024, at 11:57 AM, Paul E. McKenney wrote: > > On Thu, Feb 29, 2024 at 09:21:48AM -0500, Joel Fernandes wrote: > >>> On 2/28/2024 5:58 PM, Paul E. McKenney wrote: > >>> On Wed, Feb 28, 2024 at 02:48:44PM -0800, Alexei

Re: [PATCH] net: raise RCU qs after each threaded NAPI poll

2024-02-29 Thread Joel Fernandes
> On Feb 29, 2024, at 11:57 AM, Paul E. McKenney wrote: > > On Thu, Feb 29, 2024 at 09:21:48AM -0500, Joel Fernandes wrote: >> >> >>> On 2/28/2024 5:58 PM, Paul E. McKenney wrote: >>> On Wed, Feb 28, 2024 at 02:48:44PM -0800, Alexei Starovoitov wrote: On Wed, Feb 28, 2024 at 2:31 PM

Re: [PATCH] net: raise RCU qs after each threaded NAPI poll

2024-02-29 Thread Paul E. McKenney
On Thu, Feb 29, 2024 at 09:21:48AM -0500, Joel Fernandes wrote: > > > On 2/28/2024 5:58 PM, Paul E. McKenney wrote: > > On Wed, Feb 28, 2024 at 02:48:44PM -0800, Alexei Starovoitov wrote: > >> On Wed, Feb 28, 2024 at 2:31 PM Steven Rostedt wrote: > >>> > >>> On Wed, 28 Feb 2024 14:19:11 -0800 >

Re: [PATCH] net: raise RCU qs after each threaded NAPI poll

2024-02-29 Thread Joel Fernandes
On 2/28/2024 5:58 PM, Paul E. McKenney wrote: > On Wed, Feb 28, 2024 at 02:48:44PM -0800, Alexei Starovoitov wrote: >> On Wed, Feb 28, 2024 at 2:31 PM Steven Rostedt wrote: >>> >>> On Wed, 28 Feb 2024 14:19:11 -0800 >>> "Paul E. McKenney" wrote: >>> >> >> Well, to your initial point,

Re: [PATCH] net: raise RCU qs after each threaded NAPI poll

2024-02-28 Thread Yan Zhai
Hi Eric, On Tue, Feb 27, 2024 at 10:44 AM Eric Dumazet wrote: > > Hmm > Why napi_busy_loop() does not have a similar problem ? > I just tried and can reproduce similar behavior on sk busy poll. However, the interesting thing is, this can happen if I set a super high polling interval but just

Re: [PATCH] net: raise RCU qs after each threaded NAPI poll

2024-02-28 Thread Paul E. McKenney
On Wed, Feb 28, 2024 at 02:48:44PM -0800, Alexei Starovoitov wrote: > On Wed, Feb 28, 2024 at 2:31 PM Steven Rostedt wrote: > > > > On Wed, 28 Feb 2024 14:19:11 -0800 > > "Paul E. McKenney" wrote: > > > > > > > > > > > > Well, to your initial point, cond_resched() does eventually invoke > > > >

Re: [PATCH] net: raise RCU qs after each threaded NAPI poll

2024-02-28 Thread Paul E. McKenney
On Wed, Feb 28, 2024 at 05:33:07PM -0500, Steven Rostedt wrote: > On Wed, 28 Feb 2024 14:19:11 -0800 > "Paul E. McKenney" wrote: > > > > > > > > > Well, to your initial point, cond_resched() does eventually invoke > > > > preempt_schedule_common(), so you are quite correct that as far as > > >

Re: [PATCH] net: raise RCU qs after each threaded NAPI poll

2024-02-28 Thread Alexei Starovoitov
On Wed, Feb 28, 2024 at 2:31 PM Steven Rostedt wrote: > > On Wed, 28 Feb 2024 14:19:11 -0800 > "Paul E. McKenney" wrote: > > > > > > > > > Well, to your initial point, cond_resched() does eventually invoke > > > > preempt_schedule_common(), so you are quite correct that as far as > > > > Tasks

Re: [PATCH] net: raise RCU qs after each threaded NAPI poll

2024-02-28 Thread Steven Rostedt
On Wed, 28 Feb 2024 14:19:11 -0800 "Paul E. McKenney" wrote: > > > > > > Well, to your initial point, cond_resched() does eventually invoke > > > preempt_schedule_common(), so you are quite correct that as far as > > > Tasks RCU is concerned, cond_resched() is not a quiescent state. > > > >

Re: [PATCH] net: raise RCU qs after each threaded NAPI poll

2024-02-28 Thread Paul E. McKenney
On Wed, Feb 28, 2024 at 05:10:43PM -0500, Joel Fernandes wrote: > > > > On Feb 28, 2024, at 4:52 PM, Paul E. McKenney wrote: > > > > On Wed, Feb 28, 2024 at 04:27:47PM -0500, Joel Fernandes wrote: > >> > >> > On Feb 28, 2024, at 4:13 PM, Paul E. McKenney wrote: > >>> > >>> On Wed,

Re: [PATCH] net: raise RCU qs after each threaded NAPI poll

2024-02-28 Thread Joel Fernandes
> On Feb 28, 2024, at 4:52 PM, Paul E. McKenney wrote: > > On Wed, Feb 28, 2024 at 04:27:47PM -0500, Joel Fernandes wrote: >> >> On Feb 28, 2024, at 4:13 PM, Paul E. McKenney wrote: >>> >>> On Wed, Feb 28, 2024 at 03:14:34PM -0500, Joel Fernandes wrote: > On Wed, Feb 28, 2024

Re: [PATCH] net: raise RCU qs after each threaded NAPI poll

2024-02-28 Thread Paul E. McKenney
On Wed, Feb 28, 2024 at 04:27:47PM -0500, Joel Fernandes wrote: > > > > On Feb 28, 2024, at 4:13 PM, Paul E. McKenney wrote: > > > > On Wed, Feb 28, 2024 at 03:14:34PM -0500, Joel Fernandes wrote: > >>> On Wed, Feb 28, 2024 at 12:18 PM Paul E. McKenney > >>> wrote: > >>> > >>> On Wed, Feb

Re: [PATCH] net: raise RCU qs after each threaded NAPI poll

2024-02-28 Thread Joel Fernandes
> On Feb 28, 2024, at 4:13 PM, Paul E. McKenney wrote: > > On Wed, Feb 28, 2024 at 03:14:34PM -0500, Joel Fernandes wrote: >>> On Wed, Feb 28, 2024 at 12:18 PM Paul E. McKenney >>> wrote: >>> >>> On Wed, Feb 28, 2024 at 10:37:51AM -0600, Yan Zhai wrote: On Wed, Feb 28, 2024 at 9:37 

Re: [PATCH] net: raise RCU qs after each threaded NAPI poll

2024-02-28 Thread Paul E. McKenney
On Wed, Feb 28, 2024 at 03:14:34PM -0500, Joel Fernandes wrote: > On Wed, Feb 28, 2024 at 12:18 PM Paul E. McKenney wrote: > > > > On Wed, Feb 28, 2024 at 10:37:51AM -0600, Yan Zhai wrote: > > > On Wed, Feb 28, 2024 at 9:37 AM Joel Fernandes > > > wrote: > > > > Also optionally, I wonder if

Re: [PATCH] net: raise RCU qs after each threaded NAPI poll

2024-02-28 Thread Joel Fernandes
On Wed, Feb 28, 2024 at 12:18 PM Paul E. McKenney wrote: > > On Wed, Feb 28, 2024 at 10:37:51AM -0600, Yan Zhai wrote: > > On Wed, Feb 28, 2024 at 9:37 AM Joel Fernandes > > wrote: > > > Also optionally, I wonder if calling rcu_tasks_qs() directly is better > > > (for documentation if anything)

Re: [PATCH] net: raise RCU qs after each threaded NAPI poll

2024-02-28 Thread Paul E. McKenney
On Wed, Feb 28, 2024 at 09:48:42AM -0600, Yan Zhai wrote: > On Wed, Feb 28, 2024 at 9:10 AM Paul E. McKenney wrote: > > > > On Wed, Feb 28, 2024 at 12:50:53PM +0100, Toke Høiland-Jørgensen wrote: > > > "Paul E. McKenney" writes: > > > > > > > On Tue, Feb 27, 2024 at 05:44:17PM +0100, Eric

Re: [PATCH] net: raise RCU qs after each threaded NAPI poll

2024-02-28 Thread Paul E. McKenney
On Wed, Feb 28, 2024 at 10:37:51AM -0600, Yan Zhai wrote: > On Wed, Feb 28, 2024 at 9:37 AM Joel Fernandes wrote: > > Also optionally, I wonder if calling rcu_tasks_qs() directly is better > > (for documentation if anything) since the issue is Tasks RCU specific. Also > > code comment above the

Re: [PATCH] net: raise RCU qs after each threaded NAPI poll

2024-02-28 Thread Yan Zhai
On Wed, Feb 28, 2024 at 9:37 AM Joel Fernandes wrote: > Also optionally, I wonder if calling rcu_tasks_qs() directly is better > (for documentation if anything) since the issue is Tasks RCU specific. Also > code comment above the rcu_softirq_qs() call about cond_resched() not taking > care of

Re: [PATCH] net: raise RCU qs after each threaded NAPI poll

2024-02-28 Thread Yan Zhai
On Wed, Feb 28, 2024 at 9:35 AM Jakub Kicinski wrote: > > On Wed, 28 Feb 2024 07:15:42 -0800 Paul E. McKenney wrote: > > > > Another complication is that although CONFIG_PREEMPT_RT kernels are > > > > built with CONFIG_PREEMPT_RCU, the reverse is not always the case. > > > > And if we are not

Re: [PATCH] net: raise RCU qs after each threaded NAPI poll

2024-02-28 Thread Yan Zhai
On Wed, Feb 28, 2024 at 9:10 AM Paul E. McKenney wrote: > > On Wed, Feb 28, 2024 at 12:50:53PM +0100, Toke Høiland-Jørgensen wrote: > > "Paul E. McKenney" writes: > > > > > On Tue, Feb 27, 2024 at 05:44:17PM +0100, Eric Dumazet wrote: > > >> On Tue, Feb 27, 2024 at 4:44 PM Yan Zhai wrote: > >

Re: [PATCH] net: raise RCU qs after each threaded NAPI poll

2024-02-28 Thread Joel Fernandes
On 2/27/2024 1:32 PM, Paul E. McKenney wrote: > On Tue, Feb 27, 2024 at 05:44:17PM +0100, Eric Dumazet wrote: >> On Tue, Feb 27, 2024 at 4:44 PM Yan Zhai wrote: >>> We noticed task RCUs being blocked when threaded NAPIs are very busy in >>> production: detaching any BPF tracing programs, i.e.

Re: [PATCH] net: raise RCU qs after each threaded NAPI poll

2024-02-28 Thread Jakub Kicinski
On Wed, 28 Feb 2024 07:15:42 -0800 Paul E. McKenney wrote: > > > Another complication is that although CONFIG_PREEMPT_RT kernels are > > > built with CONFIG_PREEMPT_RCU, the reverse is not always the case. > > > And if we are not repolling, don't we have a high probability of doing > > > a

Re: [PATCH] net: raise RCU qs after each threaded NAPI poll

2024-02-28 Thread Paul E. McKenney
On Wed, Feb 28, 2024 at 06:43:43AM -0800, Jakub Kicinski wrote: > On Tue, 27 Feb 2024 20:42:24 -0800 Paul E. McKenney wrote: > > On Tue, Feb 27, 2024 at 07:10:01PM -0800, Jakub Kicinski wrote: > > > On Tue, 27 Feb 2024 10:32:22 -0800 Paul E. McKenney wrote: > > > > The theory is that PREEMPT_RCU

Re: [PATCH] net: raise RCU qs after each threaded NAPI poll

2024-02-28 Thread Paul E. McKenney
On Wed, Feb 28, 2024 at 12:50:53PM +0100, Toke Høiland-Jørgensen wrote: > "Paul E. McKenney" writes: > > > On Tue, Feb 27, 2024 at 05:44:17PM +0100, Eric Dumazet wrote: > >> On Tue, Feb 27, 2024 at 4:44 PM Yan Zhai wrote: > >> > > >> > We noticed task RCUs being blocked when threaded NAPIs are

Re: [PATCH] net: raise RCU qs after each threaded NAPI poll

2024-02-28 Thread Jakub Kicinski
On Tue, 27 Feb 2024 20:42:24 -0800 Paul E. McKenney wrote: > On Tue, Feb 27, 2024 at 07:10:01PM -0800, Jakub Kicinski wrote: > > On Tue, 27 Feb 2024 10:32:22 -0800 Paul E. McKenney wrote: > > > The theory is that PREEMPT_RCU kernels have preemption, and get their > > > quiescent states that way.

Re: [PATCH] net: raise RCU qs after each threaded NAPI poll

2024-02-28 Thread Toke Høiland-Jørgensen
"Paul E. McKenney" writes: > On Tue, Feb 27, 2024 at 05:44:17PM +0100, Eric Dumazet wrote: >> On Tue, Feb 27, 2024 at 4:44 PM Yan Zhai wrote: >> > >> > We noticed task RCUs being blocked when threaded NAPIs are very busy in >> > production: detaching any BPF tracing programs, i.e. removing a

Re: [PATCH] net: raise RCU qs after each threaded NAPI poll

2024-02-27 Thread Paul E. McKenney
On Tue, Feb 27, 2024 at 07:10:01PM -0800, Jakub Kicinski wrote: > On Tue, 27 Feb 2024 10:32:22 -0800 Paul E. McKenney wrote: > > > > + if (!IS_ENABLED(CONFIG_PREEMPT_RT)) > > > > + rcu_softirq_qs(); > > > > + > > > >

Re: [PATCH] net: raise RCU qs after each threaded NAPI poll

2024-02-27 Thread Jakub Kicinski
On Tue, 27 Feb 2024 10:32:22 -0800 Paul E. McKenney wrote: > > > + if (!IS_ENABLED(CONFIG_PREEMPT_RT)) > > > + rcu_softirq_qs(); > > > + > > > local_bh_enable(); > > > > > > if (!repoll) > > > >

Re: [PATCH] net: raise RCU qs after each threaded NAPI poll

2024-02-27 Thread Paul E. McKenney
On Tue, Feb 27, 2024 at 03:22:57PM -0600, Yan Zhai wrote: > On Tue, Feb 27, 2024 at 12:32 PM Paul E. McKenney wrote: > > > > On Tue, Feb 27, 2024 at 05:44:17PM +0100, Eric Dumazet wrote: > > > On Tue, Feb 27, 2024 at 4:44 PM Yan Zhai wrote: > > > > > > > > We noticed task RCUs being blocked when

Re: [PATCH] net: raise RCU qs after each threaded NAPI poll

2024-02-27 Thread Yan Zhai
On Tue, Feb 27, 2024 at 12:32 PM Paul E. McKenney wrote: > > On Tue, Feb 27, 2024 at 05:44:17PM +0100, Eric Dumazet wrote: > > On Tue, Feb 27, 2024 at 4:44 PM Yan Zhai wrote: > > > > > > We noticed task RCUs being blocked when threaded NAPIs are very busy in > > > production: detaching any BPF

Re: [PATCH] net: raise RCU qs after each threaded NAPI poll

2024-02-27 Thread Yan Zhai
On Tue, Feb 27, 2024 at 10:44 AM Eric Dumazet wrote: > > Hmm > Why napi_busy_loop() does not have a similar problem ? > That's a good question. Let me try if I can repro this on a busy loop as well, since the structure seems very alike. > It is unclear why rcu_all_qs() in __cond_resched() is

Re: [PATCH] net: raise RCU qs after each threaded NAPI poll

2024-02-27 Thread Paul E. McKenney
On Tue, Feb 27, 2024 at 05:44:17PM +0100, Eric Dumazet wrote: > On Tue, Feb 27, 2024 at 4:44 PM Yan Zhai wrote: > > > > We noticed task RCUs being blocked when threaded NAPIs are very busy in > > production: detaching any BPF tracing programs, i.e. removing a ftrace > > trampoline, will simply

Re: [PATCH] net: raise RCU qs after each threaded NAPI poll

2024-02-27 Thread Eric Dumazet
On Tue, Feb 27, 2024 at 4:44 PM Yan Zhai wrote: > > We noticed task RCUs being blocked when threaded NAPIs are very busy in > production: detaching any BPF tracing programs, i.e. removing a ftrace > trampoline, will simply block for very long in rcu_tasks_wait_gp. This > ranges from hundreds of

[PATCH] net: raise RCU qs after each threaded NAPI poll

2024-02-27 Thread Yan Zhai
We noticed task RCUs being blocked when threaded NAPIs are very busy in production: detaching any BPF tracing programs, i.e. removing a ftrace trampoline, will simply block for very long in rcu_tasks_wait_gp. This ranges from hundreds of seconds to even an hour, severely harming any observability