Message ID | 20211202032139.3156411-9-eric.dumazet@gmail.com (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | net: add preliminary netdev refcount tracking | expand |
Hi Eric, I love your patch! Perhaps something to improve: [auto build test WARNING on net-next/master] url: https://github.com/0day-ci/linux/commits/Eric-Dumazet/net-add-preliminary-netdev-refcount-tracking/20211202-112353 base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 8057cbb8335cf6d419866737504473833e1d128a config: nds32-allyesconfig (https://download.01.org/0day-ci/archive/20211202/202112021345.IlporM5t-lkp@intel.com/config) compiler: nds32le-linux-gcc (GCC) 11.2.0 reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/0day-ci/linux/commit/6b336d0b301ebb1097132101a9e3bd01f71c40d4 git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Eric-Dumazet/net-add-preliminary-netdev-refcount-tracking/20211202-112353 git checkout 6b336d0b301ebb1097132101a9e3bd01f71c40d4 # save the config file to linux build tree mkdir build_dir COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=nds32 SHELL=/bin/bash net/core/ If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@intel.com> All warnings (new ones prefixed by >>): net/core/drop_monitor.c: In function 'net_dm_hw_metadata_free': >> net/core/drop_monitor.c:869:47: warning: passing argument 2 of 'dev_put_track' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] 869 | dev_put_track(hw_metadata->input_dev, &hw_metadata->dev_tracker); | ^~~~~~~~~~~~~~~~~~~~~~~~~ In file included from net/core/drop_monitor.c:10: include/linux/netdevice.h:3863:53: note: expected 'struct ref_tracker **' but argument is of type 'struct ref_tracker * const*' 3863 | netdevice_tracker *tracker) | ~~~~~~~~~~~~~~~~~~~^~~~~~~ vim +869 net/core/drop_monitor.c 865 866 static void 867 net_dm_hw_metadata_free(const struct devlink_trap_metadata *hw_metadata) 868 { > 869 dev_put_track(hw_metadata->input_dev, &hw_metadata->dev_tracker); 870 kfree(hw_metadata->fa_cookie); 871 kfree(hw_metadata->trap_name); 872 kfree(hw_metadata->trap_group_name); 873 kfree(hw_metadata); 874 } 875 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
On Wed, Dec 1, 2021 at 9:41 PM kernel test robot <lkp@intel.com> wrote: > > Hi Eric, > > I love your patch! Perhaps something to improve: > > [auto build test WARNING on net-next/master] > > url: https://github.com/0day-ci/linux/commits/Eric-Dumazet/net-add-preliminary-netdev-refcount-tracking/20211202-112353 > base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 8057cbb8335cf6d419866737504473833e1d128a > config: nds32-allyesconfig (https://download.01.org/0day-ci/archive/20211202/202112021345.IlporM5t-lkp@intel.com/config) > compiler: nds32le-linux-gcc (GCC) 11.2.0 > reproduce (this is a W=1 build): > wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross > chmod +x ~/bin/make.cross > # https://github.com/0day-ci/linux/commit/6b336d0b301ebb1097132101a9e3bd01f71c40d4 > git remote add linux-review https://github.com/0day-ci/linux > git fetch --no-tags linux-review Eric-Dumazet/net-add-preliminary-netdev-refcount-tracking/20211202-112353 > git checkout 6b336d0b301ebb1097132101a9e3bd01f71c40d4 > # save the config file to linux build tree > mkdir build_dir > COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=nds32 SHELL=/bin/bash net/core/ > > If you fix the issue, kindly add following tag as appropriate > Reported-by: kernel test robot <lkp@intel.com> > > All warnings (new ones prefixed by >>): > > net/core/drop_monitor.c: In function 'net_dm_hw_metadata_free': > >> net/core/drop_monitor.c:869:47: warning: passing argument 2 of 'dev_put_track' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] > 869 | dev_put_track(hw_metadata->input_dev, &hw_metadata->dev_tracker); > | ^~~~~~~~~~~~~~~~~~~~~~~~~ > In file included from net/core/drop_monitor.c:10: > include/linux/netdevice.h:3863:53: note: expected 'struct ref_tracker **' but argument is of type 'struct ref_tracker * const*' > 3863 | netdevice_tracker *tracker) > | ~~~~~~~~~~~~~~~~~~~^~~~~~~ > > > vim +869 net/core/drop_monitor.c > > 865 > 866 static void > 867 net_dm_hw_metadata_free(const struct devlink_trap_metadata *hw_metadata) Yep, I have removed this not really useful const qualifier net_dm_hw_metadata_free(struct devlink_trap_metadata *hw_metadata) ... > 868 { > > 869 dev_put_track(hw_metadata->input_dev, &hw_metadata->dev_tracker); > 870 kfree(hw_metadata->fa_cookie); > 871 kfree(hw_metadata->trap_name); > 872 kfree(hw_metadata->trap_group_name); > 873 kfree(hw_metadata); > 874 } > 875 > > --- > 0-DAY CI Kernel Test Service, Intel Corporation > https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
diff --git a/include/net/devlink.h b/include/net/devlink.h index 043fcec8b0aadf041aba35b8339c93ac9336b551..09b75fdfa74e268aaeb05ec640fd76ec5ba777ac 100644 --- a/include/net/devlink.h +++ b/include/net/devlink.h @@ -670,7 +670,10 @@ struct devlink_health_reporter_ops { struct devlink_trap_metadata { const char *trap_name; const char *trap_group_name; + struct net_device *input_dev; + netdevice_tracker dev_tracker; + const struct flow_action_cookie *fa_cookie; enum devlink_trap_type trap_type; }; diff --git a/net/core/drop_monitor.c b/net/core/drop_monitor.c index 49442cae6f69d5e9d93d00b53ab8f5a0563c1d37..dff13c208c1dafac26c3180a37e6e3be5f8fa744 100644 --- a/net/core/drop_monitor.c +++ b/net/core/drop_monitor.c @@ -850,7 +850,7 @@ net_dm_hw_metadata_copy(const struct devlink_trap_metadata *metadata) } hw_metadata->input_dev = metadata->input_dev; - dev_hold(hw_metadata->input_dev); + dev_hold_track(hw_metadata->input_dev, &hw_metadata->dev_tracker, GFP_ATOMIC); return hw_metadata; @@ -866,7 +866,7 @@ net_dm_hw_metadata_copy(const struct devlink_trap_metadata *metadata) static void net_dm_hw_metadata_free(const struct devlink_trap_metadata *hw_metadata) { - dev_put(hw_metadata->input_dev); + dev_put_track(hw_metadata->input_dev, &hw_metadata->dev_tracker); kfree(hw_metadata->fa_cookie); kfree(hw_metadata->trap_name); kfree(hw_metadata->trap_group_name);