From patchwork Thu Jul 20 18:23:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Govindarajulu Varadarajan (gvaradar)" X-Patchwork-Id: 9855571 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A984E600F5 for ; Thu, 20 Jul 2017 18:24:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9F97A2884E for ; Thu, 20 Jul 2017 18:24:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 924472883A; Thu, 20 Jul 2017 18:24:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI, USER_IN_DEF_DKIM_WL autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 08520287FF for ; Thu, 20 Jul 2017 18:23:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935621AbdGTSX6 (ORCPT ); Thu, 20 Jul 2017 14:23:58 -0400 Received: from alln-iport-3.cisco.com ([173.37.142.90]:62670 "EHLO alln-iport-3.cisco.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935408AbdGTSX5 (ORCPT ); Thu, 20 Jul 2017 14:23:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=2070; q=dns/txt; s=iport; t=1500575037; x=1501784637; h=from:to:cc:subject:date:message-id; bh=dK4OeiWlPCLao5xJXb1tVxddwq03+1ECMDD6rH/untY=; b=IkgYMvGtHXtmHF7cXz4COjQZ171SdCzcPL3eSiNnIC4TfSMyNu92boIZ uM3RbJes1dz0mg2UgAnCFabZDtgxV5xnliLLscwFM7YljmdjZv+wHjO1E HUHb0LKzwwtfTgyrFTnEHh4oZdq1T6lkV1Z9I4idzQ9v2jPjekK0M9ReA k=; X-IronPort-AV: E=Sophos;i="5.40,384,1496102400"; d="scan'208";a="458073017" Received: from alln-core-3.cisco.com ([173.36.13.136]) by alln-iport-3.cisco.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 20 Jul 2017 18:23:57 +0000 Received: from cisco.cisco.com ([10.157.132.143]) (authenticated bits=0) by alln-core-3.cisco.com (8.14.5/8.14.5) with ESMTP id v6KINq4C004144 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 20 Jul 2017 18:23:56 GMT From: Govindarajulu Varadarajan To: leon@kernel.org, linux-rdma@vger.kernel.org, dledford@redhat.com, sean.hefty@intel.com, hal.rosenstock@gmail.com, benve@cisco.com Cc: Govindarajulu Varadarajan Subject: [PATCH v2 1/2] usnic: add rtnl lock around __ethtool_get_link_ksettings() Date: Thu, 20 Jul 2017 11:23:39 -0700 Message-Id: <20170720182340.28864-1-gvaradar@cisco.com> X-Mailer: git-send-email 2.13.3 X-Authenticated-User: gvaradar@cisco.com Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP __ethtool_get_link_ksettings requires rtnl lock. If not it throws the following warnning. [ 1855.996191] RTNL: assertion failed at net/core/ethtool.c (564) [ 1855.997084] CPU: 12 PID: 1866 Comm: kworker/12:0 Not tainted 4.12.0+ #47 [ 1855.997982] Hardware name: Cisco Systems Inc UCSC-C240-M4S2/UCSC-C240-M4S2, BIOS C240M4.2.0.12.503.0307172239 03/07/2017 [ 1855.998949] Workqueue: infiniband ib_cache_task [ib_core] [ 1855.999920] Call Trace: [ 1856.000872] dump_stack+0x63/0x8b [ 1856.001576] enic 0000:11:00.0 a0: Link DOWN [ 1856.002769] __ethtool_get_link_ksettings+0xfe/0x110 [ 1856.003733] ? netlink_broadcast_filtered+0x14b/0x3a0 [ 1856.004703] usnic_ib_query_port+0x46/0x1c0 [usnic_verbs] [ 1856.005680] ib_query_port+0x9e/0x120 [ib_core] [ 1856.006654] ib_cache_update+0xcf/0x430 [ib_core] [ 1856.007621] ? ib_cache_update+0xcf/0x430 [ib_core] [ 1856.008601] ? netdev_run_todo+0x51/0x2f0 [ 1856.009581] ? linkwatch_do_dev+0x38/0x50 [ 1856.010588] ib_cache_task+0x1e/0x30 [ib_core] [ 1856.011564] process_one_work+0x1bc/0x3e0 [ 1856.012528] worker_thread+0x4a/0x3a0 [ 1856.013486] kthread+0x125/0x140 [ 1856.014437] ? process_one_work+0x3e0/0x3e0 [ 1856.015378] ? kthread_create_on_node+0x40/0x40 [ 1856.016318] ret_from_fork+0x25/0x30 Signed-off-by: Govindarajulu Varadarajan --- v2: resubmit for changes in patch 2/2 drivers/infiniband/hw/usnic/usnic_ib_verbs.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/infiniband/hw/usnic/usnic_ib_verbs.c b/drivers/infiniband/hw/usnic/usnic_ib_verbs.c index 4996984885c2..03002bac93e7 100644 --- a/drivers/infiniband/hw/usnic/usnic_ib_verbs.c +++ b/drivers/infiniband/hw/usnic/usnic_ib_verbs.c @@ -331,7 +331,9 @@ int usnic_ib_query_port(struct ib_device *ibdev, u8 port, usnic_dbg("\n"); mutex_lock(&us_ibdev->usdev_lock); + rtnl_lock(); __ethtool_get_link_ksettings(us_ibdev->netdev, &cmd); + rtnl_unlock(); /* props being zeroed by the caller, avoid zeroing it here */ props->lid = 0;