netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] configs/debug: run and debug PREEMPT
@ 2025-04-02 17:23 Stanislav Fomichev
  2025-04-04  9:32 ` Simon Horman
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Stanislav Fomichev @ 2025-04-02 17:23 UTC (permalink / raw)
  To: netdev
  Cc: davem, edumazet, kuba, pabeni, paulmck, joel, steven.price, akpm,
	matttbe, anshuman.khandual, sdf, linux-kernel

Recent change [0] resulted in a "BUG: using __this_cpu_read() in
preemptible" splat [1]. PREEMPT kernels have additional requirements
on what can and can not run with/without preemption enabled.
Expose those constrains in the debug kernels.

0: https://lore.kernel.org/netdev/20250314120048.12569-2-justin.iurman@uliege.be/
1: https://lore.kernel.org/netdev/20250402094458.006ba2a7@kernel.org/T/#mbf72641e9d7d274daee9003ef5edf6833201f1bc

Signed-off-by: Stanislav Fomichev <sdf@fomichev.me>
---
 kernel/configs/debug.config | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/kernel/configs/debug.config b/kernel/configs/debug.config
index 8aafd050b754..e81327d2cd63 100644
--- a/kernel/configs/debug.config
+++ b/kernel/configs/debug.config
@@ -112,3 +112,8 @@ CONFIG_BRANCH_PROFILE_NONE=y
 CONFIG_DYNAMIC_FTRACE=y
 CONFIG_FTRACE=y
 CONFIG_FUNCTION_TRACER=y
+#
+# Preemption
+#
+CONFIG_DEBUG_PREEMPT=y
+CONFIG_PREEMPT=y
-- 
2.49.0


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

* Re: [PATCH net-next] configs/debug: run and debug PREEMPT
  2025-04-02 17:23 [PATCH net-next] configs/debug: run and debug PREEMPT Stanislav Fomichev
@ 2025-04-04  9:32 ` Simon Horman
  2025-04-08 18:18 ` Matthieu Baerts
  2025-04-10  1:00 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 7+ messages in thread
From: Simon Horman @ 2025-04-04  9:32 UTC (permalink / raw)
  To: Stanislav Fomichev
  Cc: netdev, davem, edumazet, kuba, pabeni, paulmck, joel,
	steven.price, akpm, matttbe, anshuman.khandual, linux-kernel

On Wed, Apr 02, 2025 at 10:23:05AM -0700, Stanislav Fomichev wrote:
> Recent change [0] resulted in a "BUG: using __this_cpu_read() in
> preemptible" splat [1]. PREEMPT kernels have additional requirements
> on what can and can not run with/without preemption enabled.
> Expose those constrains in the debug kernels.
> 
> 0: https://lore.kernel.org/netdev/20250314120048.12569-2-justin.iurman@uliege.be/
> 1: https://lore.kernel.org/netdev/20250402094458.006ba2a7@kernel.org/T/#mbf72641e9d7d274daee9003ef5edf6833201f1bc
> 
> Signed-off-by: Stanislav Fomichev <sdf@fomichev.me>

Reviewed-by: Simon Horman <horms@kernel.org>

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

* Re: [PATCH net-next] configs/debug: run and debug PREEMPT
  2025-04-02 17:23 [PATCH net-next] configs/debug: run and debug PREEMPT Stanislav Fomichev
  2025-04-04  9:32 ` Simon Horman
@ 2025-04-08 18:18 ` Matthieu Baerts
  2025-04-08 19:03   ` Jakub Kicinski
  2025-04-10  1:00 ` patchwork-bot+netdevbpf
  2 siblings, 1 reply; 7+ messages in thread
From: Matthieu Baerts @ 2025-04-08 18:18 UTC (permalink / raw)
  To: Stanislav Fomichev, netdev
  Cc: davem, edumazet, kuba, pabeni, paulmck, joel, steven.price, akpm,
	anshuman.khandual, linux-kernel

Hi Stanislav,

On 02/04/2025 19:23, Stanislav Fomichev wrote:
> Recent change [0] resulted in a "BUG: using __this_cpu_read() in
> preemptible" splat [1]. PREEMPT kernels have additional requirements
> on what can and can not run with/without preemption enabled.
> Expose those constrains in the debug kernels.

Good idea to suggest this to find more bugs!

I did some quick tests on my side with our CI, and the MPTCP selftests
seem to take a bit more time, but without impacting the results.
Hopefully, there will be no impact in slower/busy environments :)

Acked-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>

Cheers,
Matt
-- 
Sponsored by the NGI0 Core fund.


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

* Re: [PATCH net-next] configs/debug: run and debug PREEMPT
  2025-04-08 18:18 ` Matthieu Baerts
@ 2025-04-08 19:03   ` Jakub Kicinski
  2025-04-09 11:58     ` Matthieu Baerts
  0 siblings, 1 reply; 7+ messages in thread
From: Jakub Kicinski @ 2025-04-08 19:03 UTC (permalink / raw)
  To: Matthieu Baerts
  Cc: Stanislav Fomichev, netdev, davem, edumazet, pabeni, paulmck,
	joel, steven.price, akpm, anshuman.khandual, linux-kernel,
	linux-kselftest

On Tue, 8 Apr 2025 20:18:26 +0200 Matthieu Baerts wrote:
> On 02/04/2025 19:23, Stanislav Fomichev wrote:
> > Recent change [0] resulted in a "BUG: using __this_cpu_read() in
> > preemptible" splat [1]. PREEMPT kernels have additional requirements
> > on what can and can not run with/without preemption enabled.
> > Expose those constrains in the debug kernels.  
> 
> Good idea to suggest this to find more bugs!
> 
> I did some quick tests on my side with our CI, and the MPTCP selftests
> seem to take a bit more time, but without impacting the results.
> Hopefully, there will be no impact in slower/busy environments :)

What kind of slow down do you see? I think we get up to 50% more time
spent in the longer tests. Not sure how bad is too bad.. I'm leaning
towards applying this to net-next and we can see if people running
on linux-next complain?

Let me CC kselftests, patch in question:
https://lore.kernel.org/all/20250402172305.1775226-1-sdf@fomichev.me/

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

* Re: [PATCH net-next] configs/debug: run and debug PREEMPT
  2025-04-08 19:03   ` Jakub Kicinski
@ 2025-04-09 11:58     ` Matthieu Baerts
  2025-04-09 15:55       ` Jakub Kicinski
  0 siblings, 1 reply; 7+ messages in thread
From: Matthieu Baerts @ 2025-04-09 11:58 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: Stanislav Fomichev, netdev, davem, edumazet, pabeni, paulmck,
	joel, steven.price, akpm, anshuman.khandual, linux-kernel,
	linux-kselftest

Hi Jakub,

On 08/04/2025 21:03, Jakub Kicinski wrote:
> On Tue, 8 Apr 2025 20:18:26 +0200 Matthieu Baerts wrote:
>> On 02/04/2025 19:23, Stanislav Fomichev wrote:
>>> Recent change [0] resulted in a "BUG: using __this_cpu_read() in
>>> preemptible" splat [1]. PREEMPT kernels have additional requirements
>>> on what can and can not run with/without preemption enabled.
>>> Expose those constrains in the debug kernels.  
>>
>> Good idea to suggest this to find more bugs!
>>
>> I did some quick tests on my side with our CI, and the MPTCP selftests
>> seem to take a bit more time, but without impacting the results.
>> Hopefully, there will be no impact in slower/busy environments :)
> 
> What kind of slow down do you see? I think we get up to 50% more time
> spent in the longer tests.

That's difficult to measure in our CI because we have a majority of
tests either creating test envs with random parameters (latency, losses,
etc.), or waiting for a transfer at a limited speed to finish. Plus, we
don't control the host running our tests. But if we omit that, our
packetdrill tests take ~20% longer on the CI, and our 2 mini KUnit tests
took ~10% longer (275ms -> 305ms). Globally, our test suite took maybe
~10-20% longer, and that's acceptable.

So not 50%. Is this difference acceptable for NIPA? Even when some tests
are restarted automatically in case of instabilities?

One last thing, Stanislav's patch has been shared during Linus' merge
window: perhaps something else could also impact the time?

> Not sure how bad is too bad..

Did you observe more instabilities? Maybe the individual results should
be omitted, and only debug specific issues (calltraces, kmemleak, etc.)
should be looked at?

> I'm leaning
> towards applying this to net-next and we can see if people running
> on linux-next complain?

Good idea! But I do wonder how run **and monitor** the selftests in
linux-next with a debug kernel :)

Cheers,
Matt
-- 
Sponsored by the NGI0 Core fund.


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

* Re: [PATCH net-next] configs/debug: run and debug PREEMPT
  2025-04-09 11:58     ` Matthieu Baerts
@ 2025-04-09 15:55       ` Jakub Kicinski
  0 siblings, 0 replies; 7+ messages in thread
From: Jakub Kicinski @ 2025-04-09 15:55 UTC (permalink / raw)
  To: Matthieu Baerts
  Cc: Stanislav Fomichev, netdev, davem, edumazet, pabeni, paulmck,
	joel, steven.price, akpm, anshuman.khandual, linux-kernel,
	linux-kselftest

On Wed, 9 Apr 2025 13:58:13 +0200 Matthieu Baerts wrote:
> On 08/04/2025 21:03, Jakub Kicinski wrote:
> > On Tue, 8 Apr 2025 20:18:26 +0200 Matthieu Baerts wrote:  
> >> On 02/04/2025 19:23, Stanislav Fomichev wrote:  
> >>> Recent change [0] resulted in a "BUG: using __this_cpu_read() in
> >>> preemptible" splat [1]. PREEMPT kernels have additional requirements
> >>> on what can and can not run with/without preemption enabled.
> >>> Expose those constrains in the debug kernels.    
> >>
> >> Good idea to suggest this to find more bugs!
> >>
> >> I did some quick tests on my side with our CI, and the MPTCP selftests
> >> seem to take a bit more time, but without impacting the results.
> >> Hopefully, there will be no impact in slower/busy environments :)  
> > 
> > What kind of slow down do you see? I think we get up to 50% more time
> > spent in the longer tests.  
> 
> That's difficult to measure in our CI because we have a majority of
> tests either creating test envs with random parameters (latency, losses,
> etc.), or waiting for a transfer at a limited speed to finish. Plus, we
> don't control the host running our tests. But if we omit that, our
> packetdrill tests take ~20% longer on the CI, and our 2 mini KUnit tests
> took ~10% longer (275ms -> 305ms). Globally, our test suite took maybe
> ~10-20% longer, and that's acceptable.
> 
> So not 50%. Is this difference acceptable for NIPA? Even when some tests
> are restarted automatically in case of instabilities?

We also see 10%+ on most cases, the 50% was the worst one I glanced.
The worst offenders in terms of runtime only increased by 10% so still
within the guidelines.

> One last thing, Stanislav's patch has been shared during Linus' merge
> window: perhaps something else could also impact the time?
> 
> > Not sure how bad is too bad..  
> 
> Did you observe more instabilities? Maybe the individual results should
> be omitted, and only debug specific issues (calltraces, kmemleak, etc.)
> should be looked at?

A couple but unclear at this stage whether that was just the merge
window or enabling preempt debug. Now patchwork is super unstable
so again, hard to judge the source of the problems :(

> > I'm leaning
> > towards applying this to net-next and we can see if people running
> > on linux-next complain?  
> 
> Good idea! But I do wonder how run **and monitor** the selftests in
> linux-next with a debug kernel :)

One way to find out :)

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

* Re: [PATCH net-next] configs/debug: run and debug PREEMPT
  2025-04-02 17:23 [PATCH net-next] configs/debug: run and debug PREEMPT Stanislav Fomichev
  2025-04-04  9:32 ` Simon Horman
  2025-04-08 18:18 ` Matthieu Baerts
@ 2025-04-10  1:00 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 7+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-04-10  1:00 UTC (permalink / raw)
  To: Stanislav Fomichev
  Cc: netdev, davem, edumazet, kuba, pabeni, paulmck, joel,
	steven.price, akpm, matttbe, anshuman.khandual, linux-kernel

Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Wed,  2 Apr 2025 10:23:05 -0700 you wrote:
> Recent change [0] resulted in a "BUG: using __this_cpu_read() in
> preemptible" splat [1]. PREEMPT kernels have additional requirements
> on what can and can not run with/without preemption enabled.
> Expose those constrains in the debug kernels.
> 
> 0: https://lore.kernel.org/netdev/20250314120048.12569-2-justin.iurman@uliege.be/
> 1: https://lore.kernel.org/netdev/20250402094458.006ba2a7@kernel.org/T/#mbf72641e9d7d274daee9003ef5edf6833201f1bc
> 
> [...]

Here is the summary with links:
  - [net-next] configs/debug: run and debug PREEMPT
    https://git.kernel.org/netdev/net-next/c/311920774c40

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2025-04-10  0:59 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-02 17:23 [PATCH net-next] configs/debug: run and debug PREEMPT Stanislav Fomichev
2025-04-04  9:32 ` Simon Horman
2025-04-08 18:18 ` Matthieu Baerts
2025-04-08 19:03   ` Jakub Kicinski
2025-04-09 11:58     ` Matthieu Baerts
2025-04-09 15:55       ` Jakub Kicinski
2025-04-10  1:00 ` patchwork-bot+netdevbpf

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).