From patchwork Fri Jul 6 10:28:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Salil Mehta X-Patchwork-Id: 141288 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp2945371ljj; Fri, 6 Jul 2018 03:29:54 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfIWhTt09du6WGTwBuJg0YmL2+MXC3+KFUOC3Ms2h+HlhGNMhQpDL0/pfAsJ4KKssUr1A3k X-Received: by 2002:a63:6243:: with SMTP id w64-v6mr4278355pgb.179.1530872994176; Fri, 06 Jul 2018 03:29:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530872994; cv=none; d=google.com; s=arc-20160816; b=FxhnkPMmN2+wfSfka0jKxE3s2+hIV/Im7bs+0o27V1mPAE1RSrzW/QtG1d9rM0k8VA AE1DyvJQQdcXDZBu06lc9Y1+gE/1a8inQN47a0fqP7J0ZmzCWHLIXb/+HakO+pQ9H6nY M2x9wuLTBq1LziXxrl+vEh3LEBJs7Bf4bfoy6w6LzkGnzB6CcQR8iFaTUvdhqJGSvbYK fihK64GuGaI/BLcle31R66r9O2VxnXV1Xk3+TMDPz984g+Z9vkiw05fID/E8+m366W9c i+uyrcu7PvVrtD9W//kjBv/CNHT0aV2aTBNEi/pO4IuGTEGzdV+vGwKHW0M08Pic9FZe csiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=wfabwEU0sZmhLEXFLx88Hamq/pImkXTVbB6+TnQ/yQ0=; b=OxS0iWbiUZee39ZAjKjh5XBApaKWJtGPX2l0tOTv3w7CpzFy36fMPYTTN7V4KpXWgM uHoQ/IRVxttZ+6udpFvKsvO/ywBetw7ifWsmZJKSibM6PA/WI5J8sA9a1gnD/3I9fPjM Lkvtpc9p20ejG2ax3X7GS6hT6hzn16n8DJ9tWB5eCPa+w67tktQs/b0LxfMnO73mOGhL RBE5GDqkPE6pMd9OLAVPmv18RxHwgxS8BFGskyC1ecKtTmP2PfscFFfvQ0mtBFD/XCq3 KGv+/Oisoltz6FnLw0on2HLxGZLJxKNVPMGyLS899Vuo+WUDkQPlZL0X64R489rq2lnL l1jw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k18-v6si7460857pgl.364.2018.07.06.03.29.53; Fri, 06 Jul 2018 03:29:54 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753854AbeGFK3w (ORCPT + 30 others); Fri, 6 Jul 2018 06:29:52 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:9208 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932310AbeGFK33 (ORCPT ); Fri, 6 Jul 2018 06:29:29 -0400 Received: from DGGEMS402-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 6B0C4A868C1AC; Fri, 6 Jul 2018 18:29:15 +0800 (CST) Received: from S00293818-DELL1.huawei.com (10.202.226.54) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.382.0; Fri, 6 Jul 2018 18:29:07 +0800 From: Salil Mehta To: CC: , , , , , , , Yunsheng Lin Subject: [PATCH net-next 07/10] net: hns3: Fix warning bug when doing lp selftest Date: Fri, 6 Jul 2018 11:28:01 +0100 Message-ID: <20180706102804.196-8-salil.mehta@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180706102804.196-1-salil.mehta@huawei.com> References: <20180706102804.196-1-salil.mehta@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.202.226.54] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yunsheng Lin 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 warning will be logged: [ 92.420780] BUG: using smp_processor_id() in preemptible [00000000] code: ethtool/1873 [ 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 Signed-off-by: Peng Li Signed-off-by: Salil Mehta --- drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c | 2 ++ 1 file changed, 2 insertions(+) -- 2.7.4 diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c index 40c0425..11620e0 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c @@ -201,7 +201,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;