diff mbox series

[net-next] net/core: disable NET_RX_BUSY_POLL on PREEMPT_RT

Message ID 20211001145841.2308454-1-bigeasy@linutronix.de (mailing list archive)
State Accepted
Commit 20ab39d13e2e9f916cf570fc834f2cadd6e5dc4a
Delegated to: Netdev Maintainers
Headers show
Series [net-next] net/core: disable NET_RX_BUSY_POLL on PREEMPT_RT | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Clearly marked for net-next
netdev/subject_prefix success Link
netdev/cc_maintainers success CCed 3 of 3 maintainers
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/header_inline success Link

Commit Message

Sebastian Andrzej Siewior Oct. 1, 2021, 2:58 p.m. UTC
napi_busy_loop() disables preemption and performs a NAPI poll. We can't acquire
sleeping locks with disabled preemption which would be required while
__napi_poll() invokes the callback of the driver.

A threaded interrupt performing the NAPI-poll can be preempted on PREEMPT_RT.
A RT thread on another CPU may observe NAPIF_STATE_SCHED bit set and busy-spin
until it is cleared or its spin time runs out. Given it is the task with the
highest priority it will never observe the NEED_RESCHED bit set.
In this case the time is better spent by simply sleeping.

The NET_RX_BUSY_POLL is disabled by default (the system wide sysctls for
poll/read are set to zero). Disabling NET_RX_BUSY_POLL on PREEMPT_RT to avoid
wrong locking context in case it is used.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 net/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

patchwork-bot+netdevbpf@kernel.org Oct. 1, 2021, 10:50 p.m. UTC | #1
Hello:

This patch was applied to netdev/net-next.git (refs/heads/master):

On Fri,  1 Oct 2021 16:58:41 +0200 you wrote:
> napi_busy_loop() disables preemption and performs a NAPI poll. We can't acquire
> sleeping locks with disabled preemption which would be required while
> __napi_poll() invokes the callback of the driver.
> 
> A threaded interrupt performing the NAPI-poll can be preempted on PREEMPT_RT.
> A RT thread on another CPU may observe NAPIF_STATE_SCHED bit set and busy-spin
> until it is cleared or its spin time runs out. Given it is the task with the
> highest priority it will never observe the NEED_RESCHED bit set.
> In this case the time is better spent by simply sleeping.
> 
> [...]

Here is the summary with links:
  - [net-next] net/core: disable NET_RX_BUSY_POLL on PREEMPT_RT
    https://git.kernel.org/netdev/net-next/c/20ab39d13e2e

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

Patch

diff --git a/net/Kconfig b/net/Kconfig
index fb13460c6dab3..074472dfa94ae 100644
--- a/net/Kconfig
+++ b/net/Kconfig
@@ -294,7 +294,7 @@  config CGROUP_NET_CLASSID
 
 config NET_RX_BUSY_POLL
 	bool
-	default y
+	default y if !PREEMPT_RT
 
 config BQL
 	bool