]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
UBUNTU: SAUCE: {topost} net: hns3: fix warning bug when doing lp selftest
authorYunsheng Lin <linyunsheng@huawei.com>
Wed, 2 May 2018 08:47:17 +0000 (16:47 +0800)
committerKhalid Elmously <khalid.elmously@canonical.com>
Wed, 6 Jun 2018 18:42:10 +0000 (14:42 -0400)
BugLink: https://bugs.launchpad.net/bugs/1768670
The napi_alloc_skb is excepted to be called under the
non-preemptible code path when it is called by hns3_clean_rx_ring
during loopback selftest, otherwise the below warnging will be
logged:

[   92.420780] BUG: using smp_processor_id() in preemptible
[00000000] code: ethtool/1873
[   92.428699] caller is debug_smp_processor_id+0x1c/0x28
[   92.433834] CPU: 0 PID: 1873 Comm: ethtool Not tainted
4.16.0-rc1-g14491cb-dirty #452
[   92.441651] Hardware name: Huawei D06/D06, BIOS Hisilicon
D06 UEFI Nemo 2.0 RC0 - B203 04/18/2018
[   92.450509] Call trace:
[   92.452945]  dump_backtrace+0x0/0x1a8
[   92.456596]  show_stack+0x24/0x30
[   92.459900]  dump_stack+0x8c/0xb0
[   92.463202]  check_preemption_disabled+0xf8/0x100
[   92.467893]  debug_smp_processor_id+0x1c/0x28
[   92.472239]  __napi_alloc_skb+0x30/0x130
[   92.476158]  hns3_clean_rx_ring+0x118/0x5f0 [hns3]
[   92.480941]  hns3_self_test+0x32c/0x4d0 [hns3]
[   92.485375]  ethtool_self_test+0xdc/0x1e8
[   92.489372]  dev_ethtool+0x1020/0x1da8
[   92.493109]  dev_ioctl+0x188/0x3a0
[   92.496499]  sock_do_ioctl+0xf4/0x208
[   92.500148]  sock_ioctl+0x228/0x3e8
[   92.503626]  do_vfs_ioctl+0xc4/0x880
[   92.507189]  SyS_ioctl+0x94/0xa8
[   92.510404]  el0_svc_naked+0x30/0x34

This patch fix it by disabling preemption when calling
hns3_clean_rx_ring during loopback selftest.

Fixes: c39c4d98dc65 ("net: hns3: Add mac loopback selftest support in hns3 driver")
Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com>
Signed-off-by: Peng Li <lipeng321@huawei.com>
Signed-off-by: dann frazier <dann.frazier@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c

index fa310cb6f23453e1790d73eba05475ad0554c212..f4710e498c590472141f4211dcf54f63d2cd3275 100644 (file)
@@ -196,7 +196,9 @@ static u32 hns3_lb_check_rx_ring(struct hns3_nic_priv *priv, u32 budget)
                rx_group = &ring->tqp_vector->rx_group;
                pre_rx_pkt = rx_group->total_packets;
 
+               preempt_disable();
                hns3_clean_rx_ring(ring, budget, hns3_lb_check_skb_data);
+               preempt_enable();
 
                rcv_good_pkt_total += (rx_group->total_packets - pre_rx_pkt);
                rx_group->total_packets = pre_rx_pkt;