lkml.org 
[lkml]   [2021]   [Feb]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH AUTOSEL 4.14 05/16] pktgen: fix misuse of BUG_ON() in pktgen_thread_worker()
    Date
    From: Di Zhu <zhudi21@huawei.com>

    [ 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 | 2 +-
    1 file changed, 1 insertion(+), 1 deletion(-)

    diff --git a/net/core/pktgen.c b/net/core/pktgen.c
    index 884afb8e9fc4e..b3132f11afeb9 100644
    --- a/net/core/pktgen.c
    +++ b/net/core/pktgen.c
    @@ -3555,7 +3555,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.27.0
    \
     
     \ /
      Last update: 2021-02-24 15:40    [W:4.156 / U:0.212 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site