Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

pktgen: fix misuse of BUG_ON() in pktgen_thread_worker()

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 <zhudi21@huawei.com>
Link: https://lore.kernel.org/r/20210125124229.19334-1-zhudi21@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Di Zhu and committed by
Jakub Kicinski
275b1e88 6b2e04bc

+1 -1
+1 -1
net/core/pktgen.c
··· 3464 3464 struct pktgen_dev *pkt_dev = NULL; 3465 3465 int cpu = t->cpu; 3466 3466 3467 - BUG_ON(smp_processor_id() != cpu); 3467 + WARN_ON(smp_processor_id() != cpu); 3468 3468 3469 3469 init_waitqueue_head(&t->queue); 3470 3470 complete(&t->start_done);