Re: [PATCH net-next 2/8] netvsc: add some rtnl_dereference annotations
Hi Stephen, [auto build test ERROR on net-next/master] url: https://github.com/0day-ci/linux/commits/Stephen-Hemminger/netvsc-lockdep-and-related-fixes/20170720-191938 config: x86_64-rhel (attached as .config) compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901 reproduce: # save the attached .config to linux build tree make ARCH=x86_64 Note: the linux-review/Stephen-Hemminger/netvsc-lockdep-and-related-fixes/20170720-191938 HEAD a5e48342eae178e9ed020d3634cdf92f1f05cb70 builds fine. It only hurts bisectibility. All error/warnings (new ones prefixed by >>): drivers/net/hyperv/netvsc.c: In function 'netvsc_switch_datapath': >> drivers/net/hyperv/netvsc.c:44:33: error: implicit declaration of function >> 'rtnl_dereference' [-Werror=implicit-function-declaration] struct netvsc_device *nv_dev = rtnl_dereference(net_device_ctx->nvdev); ^~~~ >> drivers/net/hyperv/netvsc.c:44:33: warning: initialization makes pointer >> from integer without a cast [-Wint-conversion] drivers/net/hyperv/netvsc.c: In function 'netvsc_device_remove': drivers/net/hyperv/netvsc.c:553:5: warning: initialization makes pointer from integer without a cast [-Wint-conversion] = rtnl_dereference(net_device_ctx->nvdev); ^~~~ cc1: some warnings being treated as errors vim +/rtnl_dereference +44 drivers/net/hyperv/netvsc.c 35 36 /* 37 * Switch the data path from the synthetic interface to the VF 38 * interface. 39 */ 40 void netvsc_switch_datapath(struct net_device *ndev, bool vf) 41 { 42 struct net_device_context *net_device_ctx = netdev_priv(ndev); 43 struct hv_device *dev = net_device_ctx->device_ctx; > 44 struct netvsc_device *nv_dev = rtnl_dereference(net_device_ctx->nvdev); 45 struct nvsp_message *init_pkt = _dev->channel_init_pkt; 46 47 memset(init_pkt, 0, sizeof(struct nvsp_message)); 48 init_pkt->hdr.msg_type = NVSP_MSG4_TYPE_SWITCH_DATA_PATH; 49 if (vf) 50 init_pkt->msg.v4_msg.active_dp.active_datapath = 51 NVSP_DATAPATH_VF; 52 else 53 init_pkt->msg.v4_msg.active_dp.active_datapath = 54 NVSP_DATAPATH_SYNTHETIC; 55 56 vmbus_sendpacket(dev->channel, init_pkt, 57 sizeof(struct nvsp_message), 58 (unsigned long)init_pkt, 59 VM_PKT_DATA_INBAND, 0); 60 61 net_device_ctx->datapath = vf; 62 } 63 --- 0-DAY kernel test infrastructureOpen Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation .config.gz Description: application/gzip
[PATCH net-next 2/8] netvsc: add some rtnl_dereference annotations
In a couple places RTNL is held, and the netvsc_device pointer is acquired without annotation. Signed-off-by: Stephen Hemminger--- drivers/net/hyperv/netvsc.c | 5 +++-- drivers/net/hyperv/netvsc_drv.c | 7 --- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c index 0a9167dd72fb..e202ec5d6f63 100644 --- a/drivers/net/hyperv/netvsc.c +++ b/drivers/net/hyperv/netvsc.c @@ -41,7 +41,7 @@ void netvsc_switch_datapath(struct net_device *ndev, bool vf) { struct net_device_context *net_device_ctx = netdev_priv(ndev); struct hv_device *dev = net_device_ctx->device_ctx; - struct netvsc_device *nv_dev = net_device_ctx->nvdev; + struct netvsc_device *nv_dev = rtnl_dereference(net_device_ctx->nvdev); struct nvsp_message *init_pkt = _dev->channel_init_pkt; memset(init_pkt, 0, sizeof(struct nvsp_message)); @@ -549,7 +549,8 @@ void netvsc_device_remove(struct hv_device *device) { struct net_device *ndev = hv_get_drvdata(device); struct net_device_context *net_device_ctx = netdev_priv(ndev); - struct netvsc_device *net_device = net_device_ctx->nvdev; + struct netvsc_device *net_device + = rtnl_dereference(net_device_ctx->nvdev); int i; netvsc_disconnect_vsp(device); diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c index 09b07ca9e69a..e8e82a6a4b1a 100644 --- a/drivers/net/hyperv/netvsc_drv.c +++ b/drivers/net/hyperv/netvsc_drv.c @@ -69,7 +69,7 @@ static void netvsc_set_multicast_list(struct net_device *net) static int netvsc_open(struct net_device *net) { struct net_device_context *ndev_ctx = netdev_priv(net); - struct netvsc_device *nvdev = ndev_ctx->nvdev; + struct netvsc_device *nvdev = rtnl_dereference(ndev_ctx->nvdev); struct rndis_device *rdev; int ret = 0; @@ -1364,7 +1364,7 @@ static struct net_device *get_netvsc_byref(struct net_device *vf_netdev) continue; /* not a netvsc device */ net_device_ctx = netdev_priv(dev); - if (net_device_ctx->nvdev == NULL) + if (!rtnl_dereference(net_device_ctx->nvdev)) continue; /* device is removed */ if (rtnl_dereference(net_device_ctx->vf_netdev) == vf_netdev) @@ -1589,7 +1589,8 @@ static int netvsc_remove(struct hv_device *dev) * removed. Also blocks mtu and channel changes. */ rtnl_lock(); - rndis_filter_device_remove(dev, ndev_ctx->nvdev); + rndis_filter_device_remove(dev, + rtnl_dereference(ndev_ctx->nvdev)); rtnl_unlock(); unregister_netdev(net); -- 2.11.0