Skip to content

Commit

Permalink
pktgen: fix misuse of BUG_ON() in pktgen_thread_worker()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Di Zhu authored and kuba-moo committed Jan 28, 2021
1 parent 6b2e04b commit 275b1e8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/core/pktgen.c
Expand Up @@ -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);
Expand Down

0 comments on commit 275b1e8

Please sign in to comment.