pktgen: fix misuse of BUG_ON() in pktgen_thread_worker()
authorDi Zhu <zhudi21@huawei.com>
Mon, 25 Jan 2021 12:42:29 +0000 (20:42 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 7 Mar 2021 11:34:09 +0000 (12:34 +0100)
commitaee0cc0d7a3476dbb8e90591726d8362ff2cc0ba
tree6777c62609305350683d2867926761af789a4958
parentaec5719681405af21102c2407b01f83ed19e9833
pktgen: fix misuse of BUG_ON() in pktgen_thread_worker()

[ Upstream commit 275b1e88cabb34dbcbe99756b67e9939d34a99b6 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/core/pktgen.c