[PATCH] pktgen: fix misuse of BUG_ON() in pktgen_thread_worker()

Subsystems: networking [general], the rest

STALE2050d LANDED

Landed in mainline as 275b1e88cabb on 2021-01-28.

2 messages, 2 authors, 2021-01-28 · open the first message on its own page

[PATCH] pktgen: fix misuse of BUG_ON() in pktgen_thread_worker()

From: zhudi <hidden>
Date: 2021-01-25 12:46:43

From: Di Zhu <redacted>

pktgen create threads for all online cpus and bond these threads to
relevant cpu repecivtily. when this thread firstly be woken up, it
will compare cpu currently running with the cpu specified at the time
of creation and if the two cpus are not equal, BUG_ON() will take effect
causing panic on the system.
Notice that these threads could be migrated to other cpus before start
running because of the cpu hotplug after these threads have created. so the
BUG_ON() used here seems unreasonable and we can replace it with WARN_ON()
to just printf a warning other than panic the system.

Signed-off-by: Di Zhu <redacted>
---
 net/core/pktgen.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index 105978604ffd..3fba429f1f57 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -3464,7 +3464,7 @@ static int pktgen_thread_worker(void *arg)
 	struct pktgen_dev *pkt_dev = NULL;
 	int cpu = t->cpu;
 
-	BUG_ON(smp_processor_id() != cpu);
+	WARN_ON(smp_processor_id() != cpu);
 
 	init_waitqueue_head(&t->queue);
 	complete(&t->start_done);
-- 
2.23.0

Re: [PATCH] pktgen: fix misuse of BUG_ON() in pktgen_thread_worker()

From: patchwork-bot+netdevbpf@kernel.org
Date: 2021-01-28 00:51:13

Hello:

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

On Mon, 25 Jan 2021 20:42:29 +0800 you wrote:
From: Di Zhu <redacted>

pktgen create threads for all online cpus and bond these threads to
relevant cpu repecivtily. when this thread firstly be woken up, it
will compare cpu currently running with the cpu specified at the time
of creation and if the two cpus are not equal, BUG_ON() will take effect
causing panic on the system.
Notice that these threads could be migrated to other cpus before start
running because of the cpu hotplug after these threads have created. so the
BUG_ON() used here seems unreasonable and we can replace it with WARN_ON()
to just printf a warning other than panic the system.

[...]
Here is the summary with links:
  - pktgen: fix misuse of BUG_ON() in pktgen_thread_worker()
    https://git.kernel.org/netdev/net-next/c/275b1e88cabb

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

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help