* RCU stall warnings even with rcu_nocbs and rcu_nocb_poll @ 2022-10-05 16:01 Florent Carli 2022-10-05 16:03 ` Daniel Bristot de Oliveira 0 siblings, 1 reply; 6+ messages in thread From: Florent Carli @ 2022-10-05 16:01 UTC (permalink / raw) To: linux-rt-users Hello, I'm trying to isolate some cores to run a CPU-bound real-time task and even though I'm using rcu_nocbs and rcu_nocb_poll, I can see the rcuc threads wake up, and I get RCU stall warnings on the isolated core. As per the documentation, if I use rcutree.kthread_prio with a priority > my RT task, then the rcu stall does not happen. However I find it confusing: why are the rcuc threads woken up on the isolated cores despite using rcu_nocbs and rcu_nocb_poll? In my (very likely erroneous) understanding, I shouldn't have to fiddle with rcu priority... In other words, how come I get rcu stalls on cores that have no rcu callbacks? Thanks. ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: RCU stall warnings even with rcu_nocbs and rcu_nocb_poll 2022-10-05 16:01 RCU stall warnings even with rcu_nocbs and rcu_nocb_poll Florent Carli @ 2022-10-05 16:03 ` Daniel Bristot de Oliveira 2022-10-06 6:57 ` Sebastian Andrzej Siewior 2022-10-06 13:31 ` Joel Fernandes 0 siblings, 2 replies; 6+ messages in thread From: Daniel Bristot de Oliveira @ 2022-10-05 16:03 UTC (permalink / raw) To: Florent Carli, linux-rt-users; +Cc: Joel Fernandes (Google) On 10/5/22 18:01, Florent Carli wrote: > Hello, > > I'm trying to isolate some cores to run a CPU-bound real-time task and > even though I'm using rcu_nocbs and rcu_nocb_poll, I can see the rcuc > threads wake up, and I get RCU stall warnings on the isolated core. > As per the documentation, if I use rcutree.kthread_prio with a > priority > my RT task, then the rcu stall does not happen. > > However I find it confusing: why are the rcuc threads woken up on the > isolated cores despite using rcu_nocbs and rcu_nocb_poll? In my (very > likely erroneous) understanding, I shouldn't have to fiddle with rcu > priority... In other words, how come I get rcu stalls on cores that > have no rcu callbacks? Adding Joel because we had a chat about it during lpc... > Thanks. > -- Daniel ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: RCU stall warnings even with rcu_nocbs and rcu_nocb_poll 2022-10-05 16:03 ` Daniel Bristot de Oliveira @ 2022-10-06 6:57 ` Sebastian Andrzej Siewior 2022-10-06 13:31 ` Joel Fernandes 1 sibling, 0 replies; 6+ messages in thread From: Sebastian Andrzej Siewior @ 2022-10-06 6:57 UTC (permalink / raw) To: Daniel Bristot de Oliveira Cc: Florent Carli, linux-rt-users, Joel Fernandes (Google) On 2022-10-05 18:03:39 [+0200], Daniel Bristot de Oliveira wrote: > On 10/5/22 18:01, Florent Carli wrote: > > Hello, > > > > I'm trying to isolate some cores to run a CPU-bound real-time task and > > even though I'm using rcu_nocbs and rcu_nocb_poll, I can see the rcuc > > threads wake up, and I get RCU stall warnings on the isolated core. > > As per the documentation, if I use rcutree.kthread_prio with a > > priority > my RT task, then the rcu stall does not happen. > > > > However I find it confusing: why are the rcuc threads woken up on the > > isolated cores despite using rcu_nocbs and rcu_nocb_poll? In my (very > > likely erroneous) understanding, I shouldn't have to fiddle with rcu > > priority... In other words, how come I get rcu stalls on cores that > > have no rcu callbacks? There are different things: - with CONFIG_RCU_NOCB_CPU you get addition threads and can move the rcuo* theads away from the isolated CPU. That means the callbacks will be handled on a different CPU. - you still need to track/ follow the grace period. This still happens in the rcuc thread. To get around this you need to use NO_HZ_FULL with isolcpus/rcu_nocbs. > Adding Joel because we had a chat about it during lpc... > > > Thanks. > > > -- Daniel Sebastian ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: RCU stall warnings even with rcu_nocbs and rcu_nocb_poll 2022-10-05 16:03 ` Daniel Bristot de Oliveira 2022-10-06 6:57 ` Sebastian Andrzej Siewior @ 2022-10-06 13:31 ` Joel Fernandes 2022-10-06 14:13 ` Paul E. McKenney 1 sibling, 1 reply; 6+ messages in thread From: Joel Fernandes @ 2022-10-06 13:31 UTC (permalink / raw) To: Daniel Bristot de Oliveira, rcu, paulmck, frederic Cc: Florent Carli, linux-rt-users On Wed, Oct 05, 2022 at 06:03:39PM +0200, Daniel Bristot de Oliveira wrote: > On 10/5/22 18:01, Florent Carli wrote: > > Hello, > > > > I'm trying to isolate some cores to run a CPU-bound real-time task and > > even though I'm using rcu_nocbs and rcu_nocb_poll, I can see the rcuc > > threads wake up, and I get RCU stall warnings on the isolated core. Isolating a CPU does not mean that RCU activity is forbidden on it, even with nohz_full, if the CPU enters the kernel (say syscall or interrupt), then it may enter a read-side critical section so RCU will be watching it, and such CPU will have to report quiescent state. > > As per the documentation, if I use rcutree.kthread_prio with a > > priority > my RT task, then the rcu stall does not happen. Yes, it sounds like the main RCU GP thread (mostly called rcu_preempt thread) in your system is competing with your RT task. Increase kthread_prio is standard procedure to resolve this issue, as you did. > > However I find it confusing: why are the rcuc threads woken up on the > > isolated cores despite using rcu_nocbs and rcu_nocb_poll? In my (very > > likely erroneous) understanding, I shouldn't have to fiddle with rcu > > priority... In other words, how come I get rcu stalls on cores that > > have no rcu callbacks? It is not possible to provide further help without more info, in particular are you using nohz_full and isolcpus options? Can you provide kernel and #CPU configuration? Happy to look further! Also adding some more folks who know a lot about this stuff and +rcu list for archives. thanks, - Joel > > Adding Joel because we had a chat about it during lpc... > > > Thanks. > > > -- Daniel > ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: RCU stall warnings even with rcu_nocbs and rcu_nocb_poll 2022-10-06 13:31 ` Joel Fernandes @ 2022-10-06 14:13 ` Paul E. McKenney 2022-10-07 15:06 ` Florent Carli 0 siblings, 1 reply; 6+ messages in thread From: Paul E. McKenney @ 2022-10-06 14:13 UTC (permalink / raw) To: Joel Fernandes Cc: Daniel Bristot de Oliveira, rcu, frederic, Florent Carli, linux-rt-users On Thu, Oct 06, 2022 at 01:31:43PM +0000, Joel Fernandes wrote: > On Wed, Oct 05, 2022 at 06:03:39PM +0200, Daniel Bristot de Oliveira wrote: > > On 10/5/22 18:01, Florent Carli wrote: > > > Hello, > > > > > > I'm trying to isolate some cores to run a CPU-bound real-time task and > > > even though I'm using rcu_nocbs and rcu_nocb_poll, I can see the rcuc > > > threads wake up, and I get RCU stall warnings on the isolated core. > > Isolating a CPU does not mean that RCU activity is forbidden on it, even with > nohz_full, if the CPU enters the kernel (say syscall or interrupt), then it > may enter a read-side critical section so RCU will be watching it, and such > CPU will have to report quiescent state. What Joel said! Plus, if you keep that CPU out of the kernel (including avoiding it ever taking any interrupts), you won't see rcuc activity on that CPU. > > > As per the documentation, if I use rcutree.kthread_prio with a > > > priority > my RT task, then the rcu stall does not happen. > > Yes, it sounds like the main RCU GP thread (mostly called rcu_preempt thread) > in your system is competing with your RT task. Increase kthread_prio is > standard procedure to resolve this issue, as you did. Or affinity the rcu_preempt kthread elsewhere so that it is not competing with your real-time workload. > > > However I find it confusing: why are the rcuc threads woken up on the > > > isolated cores despite using rcu_nocbs and rcu_nocb_poll? In my (very > > > likely erroneous) understanding, I shouldn't have to fiddle with rcu > > > priority... In other words, how come I get rcu stalls on cores that > > > have no rcu callbacks? > > It is not possible to provide further help without more info, in particular > are you using nohz_full and isolcpus options? Can you provide kernel > and #CPU configuration? > > Happy to look further! Also adding some more folks who know a lot about this > stuff and +rcu list for archives. The rcuc kthreads communicate between the corresponding CPU and the rcu_preempt kthread (AKA RCU GP kthread). They wake up only when there is something for them to do, and letting your nohz_full/rcu_nocbs CPUs execute in the kernel is an excellent way to give them something to do. In particular, if that CPU runs in the kernel, it might have executed an RCU read-side critical section. Because RCU grace periods are not permitted to complete until all pre-existing RCU read-side critical sections finish, communication is required. So, yes, that rcuc kthread will need to execute if its CPU queues an RCU callback. But it might also need to execute if some other CPU queues an RCU callback -and- its CPU spends significant time in the kernel. Thanx, Paul > thanks, > > - Joel > > > > > Adding Joel because we had a chat about it during lpc... > > > > > Thanks. > > > > > -- Daniel > > ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: RCU stall warnings even with rcu_nocbs and rcu_nocb_poll 2022-10-06 14:13 ` Paul E. McKenney @ 2022-10-07 15:06 ` Florent Carli 0 siblings, 0 replies; 6+ messages in thread From: Florent Carli @ 2022-10-07 15:06 UTC (permalink / raw) To: paulmck Cc: Joel Fernandes, Daniel Bristot de Oliveira, rcu, frederic, linux-rt-users Thank you all. I make sure the rcu_preempt kthread affinity was set on a non-isolated core (as well as all unbounded rcu* threads) so I guess it is not a competing issue. What I’m running on those isolated cores are qemu/kvm vcpu tasks, and I guess they might spend some time in the kernel… in which case I understand it’s completely normal to see some rcuc activity. And so I conclude that using isolcpus + nohz_full (which includes rcu_nocbs) + rcu_nocb_poll + rcutree.kthread_prio is the way to go. Thanks everyone. On Thu, Oct 6, 2022 at 4:13 PM Paul E. McKenney <paulmck@kernel.org> wrote: > > On Thu, Oct 06, 2022 at 01:31:43PM +0000, Joel Fernandes wrote: > > On Wed, Oct 05, 2022 at 06:03:39PM +0200, Daniel Bristot de Oliveira wrote: > > > On 10/5/22 18:01, Florent Carli wrote: > > > > Hello, > > > > > > > > I'm trying to isolate some cores to run a CPU-bound real-time task and > > > > even though I'm using rcu_nocbs and rcu_nocb_poll, I can see the rcuc > > > > threads wake up, and I get RCU stall warnings on the isolated core. > > > > Isolating a CPU does not mean that RCU activity is forbidden on it, even with > > nohz_full, if the CPU enters the kernel (say syscall or interrupt), then it > > may enter a read-side critical section so RCU will be watching it, and such > > CPU will have to report quiescent state. > > What Joel said! > > Plus, if you keep that CPU out of the kernel (including avoiding it ever > taking any interrupts), you won't see rcuc activity on that CPU. > > > > > As per the documentation, if I use rcutree.kthread_prio with a > > > > priority > my RT task, then the rcu stall does not happen. > > > > Yes, it sounds like the main RCU GP thread (mostly called rcu_preempt thread) > > in your system is competing with your RT task. Increase kthread_prio is > > standard procedure to resolve this issue, as you did. > > Or affinity the rcu_preempt kthread elsewhere so that it is not competing > with your real-time workload. > > > > > However I find it confusing: why are the rcuc threads woken up on the > > > > isolated cores despite using rcu_nocbs and rcu_nocb_poll? In my (very > > > > likely erroneous) understanding, I shouldn't have to fiddle with rcu > > > > priority... In other words, how come I get rcu stalls on cores that > > > > have no rcu callbacks? > > > > It is not possible to provide further help without more info, in particular > > are you using nohz_full and isolcpus options? Can you provide kernel > > and #CPU configuration? > > > > Happy to look further! Also adding some more folks who know a lot about this > > stuff and +rcu list for archives. > > The rcuc kthreads communicate between the corresponding CPU and the > rcu_preempt kthread (AKA RCU GP kthread). They wake up only when there > is something for them to do, and letting your nohz_full/rcu_nocbs CPUs > execute in the kernel is an excellent way to give them something to do. > > In particular, if that CPU runs in the kernel, it might have executed > an RCU read-side critical section. Because RCU grace periods are not > permitted to complete until all pre-existing RCU read-side critical > sections finish, communication is required. > > So, yes, that rcuc kthread will need to execute if its CPU queues an > RCU callback. But it might also need to execute if some other CPU queues > an RCU callback -and- its CPU spends significant time in the kernel. > > Thanx, Paul > > > thanks, > > > > - Joel > > > > > > > > Adding Joel because we had a chat about it during lpc... > > > > > > > Thanks. > > > > > > > -- Daniel > > > ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-10-07 15:06 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2022-10-05 16:01 RCU stall warnings even with rcu_nocbs and rcu_nocb_poll Florent Carli 2022-10-05 16:03 ` Daniel Bristot de Oliveira 2022-10-06 6:57 ` Sebastian Andrzej Siewior 2022-10-06 13:31 ` Joel Fernandes 2022-10-06 14:13 ` Paul E. McKenney 2022-10-07 15:06 ` Florent Carli
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox