* kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
@ 2022-05-22 12:30 kernel test robot
2022-05-23 10:30 ` Toke Høiland-Jørgensen
0 siblings, 1 reply; 20+ messages in thread
From: kernel test robot @ 2022-05-22 12:30 UTC (permalink / raw)
To: Toke Høiland-Jørgensen
Cc: kbuild-all, linux-kernel, Daniel Borkmann
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: eaea45fc0e7b6ae439526b4a41d91230c8517336
commit: 782347b6bcad07ddb574422e01e22c92e05928c8 xdp: Add proper __rcu annotations to redirect map entries
date: 11 months ago
config: ia64-randconfig-s031-20220522 (https://download.01.org/0day-ci/archive/20220522/202205222029.xpW3PM1y-lkp@intel.com/config)
compiler: ia64-linux-gcc (GCC) 11.3.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.4-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=782347b6bcad07ddb574422e01e22c92e05928c8
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 782347b6bcad07ddb574422e01e22c92e05928c8
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=ia64 SHELL=/bin/bash kernel/bpf/
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>
sparse warnings: (new ones prefixed by >>)
kernel/bpf/devmap.c:561:29: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct bpf_dtab_netdev *dst @@ got struct bpf_dtab_netdev [noderef] __rcu * @@
kernel/bpf/devmap.c:561:29: sparse: expected struct bpf_dtab_netdev *dst
kernel/bpf/devmap.c:561:29: sparse: got struct bpf_dtab_netdev [noderef] __rcu *
kernel/bpf/devmap.c:657:29: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct bpf_dtab_netdev *dst @@ got struct bpf_dtab_netdev [noderef] __rcu * @@
kernel/bpf/devmap.c:657:29: sparse: expected struct bpf_dtab_netdev *dst
kernel/bpf/devmap.c:657:29: sparse: got struct bpf_dtab_netdev [noderef] __rcu *
>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
vim +/__rcu +1030 kernel/bpf/devmap.c
990
991 static int dev_map_notification(struct notifier_block *notifier,
992 ulong event, void *ptr)
993 {
994 struct net_device *netdev = netdev_notifier_info_to_dev(ptr);
995 struct bpf_dtab *dtab;
996 int i, cpu;
997
998 switch (event) {
999 case NETDEV_REGISTER:
1000 if (!netdev->netdev_ops->ndo_xdp_xmit || netdev->xdp_bulkq)
1001 break;
1002
1003 /* will be freed in free_netdev() */
1004 netdev->xdp_bulkq = alloc_percpu(struct xdp_dev_bulk_queue);
1005 if (!netdev->xdp_bulkq)
1006 return NOTIFY_BAD;
1007
1008 for_each_possible_cpu(cpu)
1009 per_cpu_ptr(netdev->xdp_bulkq, cpu)->dev = netdev;
1010 break;
1011 case NETDEV_UNREGISTER:
1012 /* This rcu_read_lock/unlock pair is needed because
1013 * dev_map_list is an RCU list AND to ensure a delete
1014 * operation does not free a netdev_map entry while we
1015 * are comparing it against the netdev being unregistered.
1016 */
1017 rcu_read_lock();
1018 list_for_each_entry_rcu(dtab, &dev_map_list, list) {
1019 if (dtab->map.map_type == BPF_MAP_TYPE_DEVMAP_HASH) {
1020 dev_map_hash_remove_netdev(dtab, netdev);
1021 continue;
1022 }
1023
1024 for (i = 0; i < dtab->map.max_entries; i++) {
1025 struct bpf_dtab_netdev *dev, *odev;
1026
1027 dev = rcu_dereference(dtab->netdev_map[i]);
1028 if (!dev || netdev != dev->dev)
1029 continue;
> 1030 odev = unrcu_pointer(cmpxchg(&dtab->netdev_map[i], RCU_INITIALIZER(dev), NULL));
1031 if (dev == odev)
1032 call_rcu(&dev->rcu,
1033 __dev_map_entry_free);
1034 }
1035 }
1036 rcu_read_unlock();
1037 break;
1038 default:
1039 break;
1040 }
1041 return NOTIFY_OK;
1042 }
1043
--
0-DAY CI Kernel Test Service
https://01.org/lkp
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
2022-05-22 12:30 kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression kernel test robot
@ 2022-05-23 10:30 ` Toke Høiland-Jørgensen
0 siblings, 0 replies; 20+ messages in thread
From: Toke Høiland-Jørgensen @ 2022-05-23 10:30 UTC (permalink / raw)
To: kernel test robot
Cc: kbuild-all, linux-kernel, Daniel Borkmann, Paul E . McKenney
kernel test robot <lkp@intel.com> writes:
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head: eaea45fc0e7b6ae439526b4a41d91230c8517336
> commit: 782347b6bcad07ddb574422e01e22c92e05928c8 xdp: Add proper __rcu annotations to redirect map entries
> date: 11 months ago
> config: ia64-randconfig-s031-20220522 (https://download.01.org/0day-ci/archive/20220522/202205222029.xpW3PM1y-lkp@intel.com/config)
> compiler: ia64-linux-gcc (GCC) 11.3.0
Hmm, so this is ia64-only? Some kind of macro breakage? Paul, any ideas?
-Toke
> reproduce:
> wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> chmod +x ~/bin/make.cross
> # apt-get install sparse
> # sparse version: v0.6.4-dirty
> # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=782347b6bcad07ddb574422e01e22c92e05928c8
> git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
> git fetch --no-tags linus master
> git checkout 782347b6bcad07ddb574422e01e22c92e05928c8
> # save the config file
> mkdir build_dir && cp config build_dir/.config
> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=ia64 SHELL=/bin/bash kernel/bpf/
>
> If you fix the issue, kindly add following tag where applicable
> Reported-by: kernel test robot <lkp@intel.com>
>
>
> sparse warnings: (new ones prefixed by >>)
> kernel/bpf/devmap.c:561:29: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct bpf_dtab_netdev *dst @@ got struct bpf_dtab_netdev [noderef] __rcu * @@
> kernel/bpf/devmap.c:561:29: sparse: expected struct bpf_dtab_netdev *dst
> kernel/bpf/devmap.c:561:29: sparse: got struct bpf_dtab_netdev [noderef] __rcu *
> kernel/bpf/devmap.c:657:29: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct bpf_dtab_netdev *dst @@ got struct bpf_dtab_netdev [noderef] __rcu * @@
> kernel/bpf/devmap.c:657:29: sparse: expected struct bpf_dtab_netdev *dst
> kernel/bpf/devmap.c:657:29: sparse: got struct bpf_dtab_netdev [noderef] __rcu *
>>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>
> vim +/__rcu +1030 kernel/bpf/devmap.c
>
> 990
> 991 static int dev_map_notification(struct notifier_block *notifier,
> 992 ulong event, void *ptr)
> 993 {
> 994 struct net_device *netdev = netdev_notifier_info_to_dev(ptr);
> 995 struct bpf_dtab *dtab;
> 996 int i, cpu;
> 997
> 998 switch (event) {
> 999 case NETDEV_REGISTER:
> 1000 if (!netdev->netdev_ops->ndo_xdp_xmit || netdev->xdp_bulkq)
> 1001 break;
> 1002
> 1003 /* will be freed in free_netdev() */
> 1004 netdev->xdp_bulkq = alloc_percpu(struct xdp_dev_bulk_queue);
> 1005 if (!netdev->xdp_bulkq)
> 1006 return NOTIFY_BAD;
> 1007
> 1008 for_each_possible_cpu(cpu)
> 1009 per_cpu_ptr(netdev->xdp_bulkq, cpu)->dev = netdev;
> 1010 break;
> 1011 case NETDEV_UNREGISTER:
> 1012 /* This rcu_read_lock/unlock pair is needed because
> 1013 * dev_map_list is an RCU list AND to ensure a delete
> 1014 * operation does not free a netdev_map entry while we
> 1015 * are comparing it against the netdev being unregistered.
> 1016 */
> 1017 rcu_read_lock();
> 1018 list_for_each_entry_rcu(dtab, &dev_map_list, list) {
> 1019 if (dtab->map.map_type == BPF_MAP_TYPE_DEVMAP_HASH) {
> 1020 dev_map_hash_remove_netdev(dtab, netdev);
> 1021 continue;
> 1022 }
> 1023
> 1024 for (i = 0; i < dtab->map.max_entries; i++) {
> 1025 struct bpf_dtab_netdev *dev, *odev;
> 1026
> 1027 dev = rcu_dereference(dtab->netdev_map[i]);
> 1028 if (!dev || netdev != dev->dev)
> 1029 continue;
>> 1030 odev = unrcu_pointer(cmpxchg(&dtab->netdev_map[i], RCU_INITIALIZER(dev), NULL));
> 1031 if (dev == odev)
> 1032 call_rcu(&dev->rcu,
> 1033 __dev_map_entry_free);
> 1034 }
> 1035 }
> 1036 rcu_read_unlock();
> 1037 break;
> 1038 default:
> 1039 break;
> 1040 }
> 1041 return NOTIFY_OK;
> 1042 }
> 1043
>
> --
> 0-DAY CI Kernel Test Service
> https://01.org/lkp
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
@ 2022-05-23 10:30 ` Toke Høiland-Jørgensen
0 siblings, 0 replies; 20+ messages in thread
From: Toke Høiland-Jørgensen @ 2022-05-23 10:30 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 7220 bytes --]
kernel test robot <lkp@intel.com> writes:
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head: eaea45fc0e7b6ae439526b4a41d91230c8517336
> commit: 782347b6bcad07ddb574422e01e22c92e05928c8 xdp: Add proper __rcu annotations to redirect map entries
> date: 11 months ago
> config: ia64-randconfig-s031-20220522 (https://download.01.org/0day-ci/archive/20220522/202205222029.xpW3PM1y-lkp(a)intel.com/config)
> compiler: ia64-linux-gcc (GCC) 11.3.0
Hmm, so this is ia64-only? Some kind of macro breakage? Paul, any ideas?
-Toke
> reproduce:
> wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> chmod +x ~/bin/make.cross
> # apt-get install sparse
> # sparse version: v0.6.4-dirty
> # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=782347b6bcad07ddb574422e01e22c92e05928c8
> git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
> git fetch --no-tags linus master
> git checkout 782347b6bcad07ddb574422e01e22c92e05928c8
> # save the config file
> mkdir build_dir && cp config build_dir/.config
> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=ia64 SHELL=/bin/bash kernel/bpf/
>
> If you fix the issue, kindly add following tag where applicable
> Reported-by: kernel test robot <lkp@intel.com>
>
>
> sparse warnings: (new ones prefixed by >>)
> kernel/bpf/devmap.c:561:29: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct bpf_dtab_netdev *dst @@ got struct bpf_dtab_netdev [noderef] __rcu * @@
> kernel/bpf/devmap.c:561:29: sparse: expected struct bpf_dtab_netdev *dst
> kernel/bpf/devmap.c:561:29: sparse: got struct bpf_dtab_netdev [noderef] __rcu *
> kernel/bpf/devmap.c:657:29: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct bpf_dtab_netdev *dst @@ got struct bpf_dtab_netdev [noderef] __rcu * @@
> kernel/bpf/devmap.c:657:29: sparse: expected struct bpf_dtab_netdev *dst
> kernel/bpf/devmap.c:657:29: sparse: got struct bpf_dtab_netdev [noderef] __rcu *
>>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>
> vim +/__rcu +1030 kernel/bpf/devmap.c
>
> 990
> 991 static int dev_map_notification(struct notifier_block *notifier,
> 992 ulong event, void *ptr)
> 993 {
> 994 struct net_device *netdev = netdev_notifier_info_to_dev(ptr);
> 995 struct bpf_dtab *dtab;
> 996 int i, cpu;
> 997
> 998 switch (event) {
> 999 case NETDEV_REGISTER:
> 1000 if (!netdev->netdev_ops->ndo_xdp_xmit || netdev->xdp_bulkq)
> 1001 break;
> 1002
> 1003 /* will be freed in free_netdev() */
> 1004 netdev->xdp_bulkq = alloc_percpu(struct xdp_dev_bulk_queue);
> 1005 if (!netdev->xdp_bulkq)
> 1006 return NOTIFY_BAD;
> 1007
> 1008 for_each_possible_cpu(cpu)
> 1009 per_cpu_ptr(netdev->xdp_bulkq, cpu)->dev = netdev;
> 1010 break;
> 1011 case NETDEV_UNREGISTER:
> 1012 /* This rcu_read_lock/unlock pair is needed because
> 1013 * dev_map_list is an RCU list AND to ensure a delete
> 1014 * operation does not free a netdev_map entry while we
> 1015 * are comparing it against the netdev being unregistered.
> 1016 */
> 1017 rcu_read_lock();
> 1018 list_for_each_entry_rcu(dtab, &dev_map_list, list) {
> 1019 if (dtab->map.map_type == BPF_MAP_TYPE_DEVMAP_HASH) {
> 1020 dev_map_hash_remove_netdev(dtab, netdev);
> 1021 continue;
> 1022 }
> 1023
> 1024 for (i = 0; i < dtab->map.max_entries; i++) {
> 1025 struct bpf_dtab_netdev *dev, *odev;
> 1026
> 1027 dev = rcu_dereference(dtab->netdev_map[i]);
> 1028 if (!dev || netdev != dev->dev)
> 1029 continue;
>> 1030 odev = unrcu_pointer(cmpxchg(&dtab->netdev_map[i], RCU_INITIALIZER(dev), NULL));
> 1031 if (dev == odev)
> 1032 call_rcu(&dev->rcu,
> 1033 __dev_map_entry_free);
> 1034 }
> 1035 }
> 1036 rcu_read_unlock();
> 1037 break;
> 1038 default:
> 1039 break;
> 1040 }
> 1041 return NOTIFY_OK;
> 1042 }
> 1043
>
> --
> 0-DAY CI Kernel Test Service
> https://01.org/lkp
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
2022-05-23 10:30 ` Toke Høiland-Jørgensen
@ 2022-05-24 20:51 ` Paul E. McKenney
-1 siblings, 0 replies; 20+ messages in thread
From: Paul E. McKenney @ 2022-05-24 20:51 UTC (permalink / raw)
To: Toke Høiland-Jørgensen
Cc: kernel test robot, kbuild-all, linux-kernel, Daniel Borkmann
On Mon, May 23, 2022 at 12:30:14PM +0200, Toke Høiland-Jørgensen wrote:
> kernel test robot <lkp@intel.com> writes:
>
> > tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> > head: eaea45fc0e7b6ae439526b4a41d91230c8517336
> > commit: 782347b6bcad07ddb574422e01e22c92e05928c8 xdp: Add proper __rcu annotations to redirect map entries
> > date: 11 months ago
> > config: ia64-randconfig-s031-20220522 (https://download.01.org/0day-ci/archive/20220522/202205222029.xpW3PM1y-lkp@intel.com/config)
> > compiler: ia64-linux-gcc (GCC) 11.3.0
>
> Hmm, so this is ia64-only? Some kind of macro breakage? Paul, any ideas?
Line 1030 looks to me like it is doing everything correctly. I am not
sure why sparse would care about the architecture, but perhaps it does.
The unrcu_pointer() macro has not changed since March of 2020.
All I can suggest is to break that line up to make it easier to figure
out exactly what sparse is upset about.
Thanx, Paul
> -Toke
>
> > reproduce:
> > wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> > chmod +x ~/bin/make.cross
> > # apt-get install sparse
> > # sparse version: v0.6.4-dirty
> > # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=782347b6bcad07ddb574422e01e22c92e05928c8
> > git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
> > git fetch --no-tags linus master
> > git checkout 782347b6bcad07ddb574422e01e22c92e05928c8
> > # save the config file
> > mkdir build_dir && cp config build_dir/.config
> > COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=ia64 SHELL=/bin/bash kernel/bpf/
> >
> > If you fix the issue, kindly add following tag where applicable
> > Reported-by: kernel test robot <lkp@intel.com>
> >
> >
> > sparse warnings: (new ones prefixed by >>)
> > kernel/bpf/devmap.c:561:29: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct bpf_dtab_netdev *dst @@ got struct bpf_dtab_netdev [noderef] __rcu * @@
> > kernel/bpf/devmap.c:561:29: sparse: expected struct bpf_dtab_netdev *dst
> > kernel/bpf/devmap.c:561:29: sparse: got struct bpf_dtab_netdev [noderef] __rcu *
> > kernel/bpf/devmap.c:657:29: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct bpf_dtab_netdev *dst @@ got struct bpf_dtab_netdev [noderef] __rcu * @@
> > kernel/bpf/devmap.c:657:29: sparse: expected struct bpf_dtab_netdev *dst
> > kernel/bpf/devmap.c:657:29: sparse: got struct bpf_dtab_netdev [noderef] __rcu *
> >>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
> >>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
> >>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
> >>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
> >>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
> >>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
> >>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
> >>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
> >>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
> >>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
> >>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
> >>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
> >>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
> >>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
> >>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
> >>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
> >>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
> >>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
> >>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
> >>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
> >>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
> >>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
> >>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
> >>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
> >>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
> >>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
> >>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
> >>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
> >
> > vim +/__rcu +1030 kernel/bpf/devmap.c
> >
> > 990
> > 991 static int dev_map_notification(struct notifier_block *notifier,
> > 992 ulong event, void *ptr)
> > 993 {
> > 994 struct net_device *netdev = netdev_notifier_info_to_dev(ptr);
> > 995 struct bpf_dtab *dtab;
> > 996 int i, cpu;
> > 997
> > 998 switch (event) {
> > 999 case NETDEV_REGISTER:
> > 1000 if (!netdev->netdev_ops->ndo_xdp_xmit || netdev->xdp_bulkq)
> > 1001 break;
> > 1002
> > 1003 /* will be freed in free_netdev() */
> > 1004 netdev->xdp_bulkq = alloc_percpu(struct xdp_dev_bulk_queue);
> > 1005 if (!netdev->xdp_bulkq)
> > 1006 return NOTIFY_BAD;
> > 1007
> > 1008 for_each_possible_cpu(cpu)
> > 1009 per_cpu_ptr(netdev->xdp_bulkq, cpu)->dev = netdev;
> > 1010 break;
> > 1011 case NETDEV_UNREGISTER:
> > 1012 /* This rcu_read_lock/unlock pair is needed because
> > 1013 * dev_map_list is an RCU list AND to ensure a delete
> > 1014 * operation does not free a netdev_map entry while we
> > 1015 * are comparing it against the netdev being unregistered.
> > 1016 */
> > 1017 rcu_read_lock();
> > 1018 list_for_each_entry_rcu(dtab, &dev_map_list, list) {
> > 1019 if (dtab->map.map_type == BPF_MAP_TYPE_DEVMAP_HASH) {
> > 1020 dev_map_hash_remove_netdev(dtab, netdev);
> > 1021 continue;
> > 1022 }
> > 1023
> > 1024 for (i = 0; i < dtab->map.max_entries; i++) {
> > 1025 struct bpf_dtab_netdev *dev, *odev;
> > 1026
> > 1027 dev = rcu_dereference(dtab->netdev_map[i]);
> > 1028 if (!dev || netdev != dev->dev)
> > 1029 continue;
> >> 1030 odev = unrcu_pointer(cmpxchg(&dtab->netdev_map[i], RCU_INITIALIZER(dev), NULL));
> > 1031 if (dev == odev)
> > 1032 call_rcu(&dev->rcu,
> > 1033 __dev_map_entry_free);
> > 1034 }
> > 1035 }
> > 1036 rcu_read_unlock();
> > 1037 break;
> > 1038 default:
> > 1039 break;
> > 1040 }
> > 1041 return NOTIFY_OK;
> > 1042 }
> > 1043
> >
> > --
> > 0-DAY CI Kernel Test Service
> > https://01.org/lkp
>
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
@ 2022-05-24 20:51 ` Paul E. McKenney
0 siblings, 0 replies; 20+ messages in thread
From: Paul E. McKenney @ 2022-05-24 20:51 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 7895 bytes --]
On Mon, May 23, 2022 at 12:30:14PM +0200, Toke Høiland-Jørgensen wrote:
> kernel test robot <lkp@intel.com> writes:
>
> > tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> > head: eaea45fc0e7b6ae439526b4a41d91230c8517336
> > commit: 782347b6bcad07ddb574422e01e22c92e05928c8 xdp: Add proper __rcu annotations to redirect map entries
> > date: 11 months ago
> > config: ia64-randconfig-s031-20220522 (https://download.01.org/0day-ci/archive/20220522/202205222029.xpW3PM1y-lkp(a)intel.com/config)
> > compiler: ia64-linux-gcc (GCC) 11.3.0
>
> Hmm, so this is ia64-only? Some kind of macro breakage? Paul, any ideas?
Line 1030 looks to me like it is doing everything correctly. I am not
sure why sparse would care about the architecture, but perhaps it does.
The unrcu_pointer() macro has not changed since March of 2020.
All I can suggest is to break that line up to make it easier to figure
out exactly what sparse is upset about.
Thanx, Paul
> -Toke
>
> > reproduce:
> > wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> > chmod +x ~/bin/make.cross
> > # apt-get install sparse
> > # sparse version: v0.6.4-dirty
> > # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=782347b6bcad07ddb574422e01e22c92e05928c8
> > git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
> > git fetch --no-tags linus master
> > git checkout 782347b6bcad07ddb574422e01e22c92e05928c8
> > # save the config file
> > mkdir build_dir && cp config build_dir/.config
> > COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=ia64 SHELL=/bin/bash kernel/bpf/
> >
> > If you fix the issue, kindly add following tag where applicable
> > Reported-by: kernel test robot <lkp@intel.com>
> >
> >
> > sparse warnings: (new ones prefixed by >>)
> > kernel/bpf/devmap.c:561:29: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct bpf_dtab_netdev *dst @@ got struct bpf_dtab_netdev [noderef] __rcu * @@
> > kernel/bpf/devmap.c:561:29: sparse: expected struct bpf_dtab_netdev *dst
> > kernel/bpf/devmap.c:561:29: sparse: got struct bpf_dtab_netdev [noderef] __rcu *
> > kernel/bpf/devmap.c:657:29: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct bpf_dtab_netdev *dst @@ got struct bpf_dtab_netdev [noderef] __rcu * @@
> > kernel/bpf/devmap.c:657:29: sparse: expected struct bpf_dtab_netdev *dst
> > kernel/bpf/devmap.c:657:29: sparse: got struct bpf_dtab_netdev [noderef] __rcu *
> >>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
> >>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
> >>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
> >>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
> >>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
> >>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
> >>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
> >>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
> >>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
> >>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
> >>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
> >>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
> >>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
> >>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
> >>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
> >>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
> >>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
> >>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
> >>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
> >>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
> >>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
> >>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
> >>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
> >>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
> >>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
> >>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
> >>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
> >>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
> >
> > vim +/__rcu +1030 kernel/bpf/devmap.c
> >
> > 990
> > 991 static int dev_map_notification(struct notifier_block *notifier,
> > 992 ulong event, void *ptr)
> > 993 {
> > 994 struct net_device *netdev = netdev_notifier_info_to_dev(ptr);
> > 995 struct bpf_dtab *dtab;
> > 996 int i, cpu;
> > 997
> > 998 switch (event) {
> > 999 case NETDEV_REGISTER:
> > 1000 if (!netdev->netdev_ops->ndo_xdp_xmit || netdev->xdp_bulkq)
> > 1001 break;
> > 1002
> > 1003 /* will be freed in free_netdev() */
> > 1004 netdev->xdp_bulkq = alloc_percpu(struct xdp_dev_bulk_queue);
> > 1005 if (!netdev->xdp_bulkq)
> > 1006 return NOTIFY_BAD;
> > 1007
> > 1008 for_each_possible_cpu(cpu)
> > 1009 per_cpu_ptr(netdev->xdp_bulkq, cpu)->dev = netdev;
> > 1010 break;
> > 1011 case NETDEV_UNREGISTER:
> > 1012 /* This rcu_read_lock/unlock pair is needed because
> > 1013 * dev_map_list is an RCU list AND to ensure a delete
> > 1014 * operation does not free a netdev_map entry while we
> > 1015 * are comparing it against the netdev being unregistered.
> > 1016 */
> > 1017 rcu_read_lock();
> > 1018 list_for_each_entry_rcu(dtab, &dev_map_list, list) {
> > 1019 if (dtab->map.map_type == BPF_MAP_TYPE_DEVMAP_HASH) {
> > 1020 dev_map_hash_remove_netdev(dtab, netdev);
> > 1021 continue;
> > 1022 }
> > 1023
> > 1024 for (i = 0; i < dtab->map.max_entries; i++) {
> > 1025 struct bpf_dtab_netdev *dev, *odev;
> > 1026
> > 1027 dev = rcu_dereference(dtab->netdev_map[i]);
> > 1028 if (!dev || netdev != dev->dev)
> > 1029 continue;
> >> 1030 odev = unrcu_pointer(cmpxchg(&dtab->netdev_map[i], RCU_INITIALIZER(dev), NULL));
> > 1031 if (dev == odev)
> > 1032 call_rcu(&dev->rcu,
> > 1033 __dev_map_entry_free);
> > 1034 }
> > 1035 }
> > 1036 rcu_read_unlock();
> > 1037 break;
> > 1038 default:
> > 1039 break;
> > 1040 }
> > 1041 return NOTIFY_OK;
> > 1042 }
> > 1043
> >
> > --
> > 0-DAY CI Kernel Test Service
> > https://01.org/lkp
>
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
2022-05-23 10:30 ` Toke Høiland-Jørgensen
@ 2022-06-01 0:38 ` Luc Van Oostenryck
-1 siblings, 0 replies; 20+ messages in thread
From: Luc Van Oostenryck @ 2022-06-01 0:38 UTC (permalink / raw)
To: Toke Høiland-Jørgensen
Cc: kernel test robot, kbuild-all, linux-kernel, Daniel Borkmann,
Paul E . McKenney
On Mon, May 23, 2022 at 12:30:14PM +0200, Toke Høiland-Jørgensen wrote:
> kernel test robot <lkp@intel.com> writes:
>
> > tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> > head: eaea45fc0e7b6ae439526b4a41d91230c8517336
> > commit: 782347b6bcad07ddb574422e01e22c92e05928c8 xdp: Add proper __rcu annotations to redirect map entries
> > date: 11 months ago
> > config: ia64-randconfig-s031-20220522 (https://download.01.org/0day-ci/archive/20220522/202205222029.xpW3PM1y-lkp@intel.com/config)
> > compiler: ia64-linux-gcc (GCC) 11.3.0
>
> Hmm, so this is ia64-only? Some kind of macro breakage? Paul, any ideas?
Hi,
It's surely IA64's cmpxchg() which contains lines like:
_r_ = ia64_cmpxchg8_##sem((__u64 *) ptr, new, _o_);
-- Luc
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
@ 2022-06-01 0:38 ` Luc Van Oostenryck
0 siblings, 0 replies; 20+ messages in thread
From: Luc Van Oostenryck @ 2022-06-01 0:38 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 796 bytes --]
On Mon, May 23, 2022 at 12:30:14PM +0200, Toke Høiland-Jørgensen wrote:
> kernel test robot <lkp@intel.com> writes:
>
> > tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> > head: eaea45fc0e7b6ae439526b4a41d91230c8517336
> > commit: 782347b6bcad07ddb574422e01e22c92e05928c8 xdp: Add proper __rcu annotations to redirect map entries
> > date: 11 months ago
> > config: ia64-randconfig-s031-20220522 (https://download.01.org/0day-ci/archive/20220522/202205222029.xpW3PM1y-lkp(a)intel.com/config)
> > compiler: ia64-linux-gcc (GCC) 11.3.0
>
> Hmm, so this is ia64-only? Some kind of macro breakage? Paul, any ideas?
Hi,
It's surely IA64's cmpxchg() which contains lines like:
_r_ = ia64_cmpxchg8_##sem((__u64 *) ptr, new, _o_);
-- Luc
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
2022-06-01 0:38 ` Luc Van Oostenryck
@ 2022-06-01 10:26 ` Toke Høiland-Jørgensen
-1 siblings, 0 replies; 20+ messages in thread
From: Toke Høiland-Jørgensen @ 2022-06-01 10:26 UTC (permalink / raw)
To: Luc Van Oostenryck
Cc: kernel test robot, kbuild-all, linux-kernel, Daniel Borkmann,
Paul E . McKenney
Luc Van Oostenryck <luc.vanoostenryck@gmail.com> writes:
> On Mon, May 23, 2022 at 12:30:14PM +0200, Toke Høiland-Jørgensen wrote:
>> kernel test robot <lkp@intel.com> writes:
>>
>> > tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
>> > head: eaea45fc0e7b6ae439526b4a41d91230c8517336
>> > commit: 782347b6bcad07ddb574422e01e22c92e05928c8 xdp: Add proper __rcu annotations to redirect map entries
>> > date: 11 months ago
>> > config: ia64-randconfig-s031-20220522 (https://download.01.org/0day-ci/archive/20220522/202205222029.xpW3PM1y-lkp@intel.com/config)
>> > compiler: ia64-linux-gcc (GCC) 11.3.0
>>
>> Hmm, so this is ia64-only? Some kind of macro breakage? Paul, any ideas?
>
> Hi,
>
> It's surely IA64's cmpxchg() which contains lines like:
> _r_ = ia64_cmpxchg8_##sem((__u64 *) ptr, new, _o_);
Oh, right. Hmm, well, if the cmpxchg does an internal cast that
complicates things a bit. My immediate thought was to move the
unrcu_pointer() inside the calls to cmpxchg(), like:
diff --git a/kernel/bpf/devmap.c b/kernel/bpf/devmap.c
index 980f8928e977..3b6dc6d34177 100644
--- a/kernel/bpf/devmap.c
+++ b/kernel/bpf/devmap.c
@@ -1098,7 +1098,7 @@ static int dev_map_notification(struct notifier_block *notifier,
dev = rcu_dereference(dtab->netdev_map[i]);
if (!dev || netdev != dev->dev)
continue;
- odev = unrcu_pointer(cmpxchg(&dtab->netdev_map[i], RCU_INITIALIZER(dev), NULL));
+ odev = cmpxchg(unrcu_pointer(&dtab->netdev_map[i]), dev, NULL);
if (dev == odev)
call_rcu(&dev->rcu,
__dev_map_entry_free);
But that seems to confuse sparse because these are ptr-to-ptr
constructs:
kernel/bpf/devmap.c:1101:40: error: incompatible types in comparison expression (different address spaces):
kernel/bpf/devmap.c:1101:40: struct bpf_dtab_netdev [noderef] __rcu *[noderef] __rcu *
kernel/bpf/devmap.c:1101:40: struct bpf_dtab_netdev [noderef] __rcu **
kernel/bpf/devmap.c:1101:40: error: incompatible types in comparison expression (different address spaces):
kernel/bpf/devmap.c:1101:40: struct bpf_dtab_netdev [noderef] __rcu *[noderef] __rcu *
kernel/bpf/devmap.c:1101:40: struct bpf_dtab_netdev [noderef] __rcu **
which I'm not sure how to fix. And not really sure if it's the
semantically right thing to do either in this case...
-Toke
^ permalink raw reply related [flat|nested] 20+ messages in thread
* Re: kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
@ 2022-06-01 10:26 ` Toke Høiland-Jørgensen
0 siblings, 0 replies; 20+ messages in thread
From: Toke Høiland-Jørgensen @ 2022-06-01 10:26 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 2643 bytes --]
Luc Van Oostenryck <luc.vanoostenryck@gmail.com> writes:
> On Mon, May 23, 2022 at 12:30:14PM +0200, Toke Høiland-Jørgensen wrote:
>> kernel test robot <lkp@intel.com> writes:
>>
>> > tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
>> > head: eaea45fc0e7b6ae439526b4a41d91230c8517336
>> > commit: 782347b6bcad07ddb574422e01e22c92e05928c8 xdp: Add proper __rcu annotations to redirect map entries
>> > date: 11 months ago
>> > config: ia64-randconfig-s031-20220522 (https://download.01.org/0day-ci/archive/20220522/202205222029.xpW3PM1y-lkp(a)intel.com/config)
>> > compiler: ia64-linux-gcc (GCC) 11.3.0
>>
>> Hmm, so this is ia64-only? Some kind of macro breakage? Paul, any ideas?
>
> Hi,
>
> It's surely IA64's cmpxchg() which contains lines like:
> _r_ = ia64_cmpxchg8_##sem((__u64 *) ptr, new, _o_);
Oh, right. Hmm, well, if the cmpxchg does an internal cast that
complicates things a bit. My immediate thought was to move the
unrcu_pointer() inside the calls to cmpxchg(), like:
diff --git a/kernel/bpf/devmap.c b/kernel/bpf/devmap.c
index 980f8928e977..3b6dc6d34177 100644
--- a/kernel/bpf/devmap.c
+++ b/kernel/bpf/devmap.c
@@ -1098,7 +1098,7 @@ static int dev_map_notification(struct notifier_block *notifier,
dev = rcu_dereference(dtab->netdev_map[i]);
if (!dev || netdev != dev->dev)
continue;
- odev = unrcu_pointer(cmpxchg(&dtab->netdev_map[i], RCU_INITIALIZER(dev), NULL));
+ odev = cmpxchg(unrcu_pointer(&dtab->netdev_map[i]), dev, NULL);
if (dev == odev)
call_rcu(&dev->rcu,
__dev_map_entry_free);
But that seems to confuse sparse because these are ptr-to-ptr
constructs:
kernel/bpf/devmap.c:1101:40: error: incompatible types in comparison expression (different address spaces):
kernel/bpf/devmap.c:1101:40: struct bpf_dtab_netdev [noderef] __rcu *[noderef] __rcu *
kernel/bpf/devmap.c:1101:40: struct bpf_dtab_netdev [noderef] __rcu **
kernel/bpf/devmap.c:1101:40: error: incompatible types in comparison expression (different address spaces):
kernel/bpf/devmap.c:1101:40: struct bpf_dtab_netdev [noderef] __rcu *[noderef] __rcu *
kernel/bpf/devmap.c:1101:40: struct bpf_dtab_netdev [noderef] __rcu **
which I'm not sure how to fix. And not really sure if it's the
semantically right thing to do either in this case...
-Toke
^ permalink raw reply related [flat|nested] 20+ messages in thread
* Re: kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
2022-06-01 10:26 ` Toke Høiland-Jørgensen
(?)
@ 2022-06-01 12:00 ` Luc Van Oostenryck
-1 siblings, 0 replies; 20+ messages in thread
From: Luc Van Oostenryck @ 2022-06-01 11:59 UTC (permalink / raw)
To: Toke Høiland-Jørgensen
Cc: kernel test robot, kbuild-all, linux-kernel, Daniel Borkmann,
Paul E . McKenney, linux-ia64
On Wed, Jun 01, 2022 at 12:26:27PM +0200, Toke Høiland-Jørgensen wrote:
> Luc Van Oostenryck <luc.vanoostenryck@gmail.com> writes:
>
> > On Mon, May 23, 2022 at 12:30:14PM +0200, Toke Høiland-Jørgensen wrote:
> >> kernel test robot <lkp@intel.com> writes:
> >>
> >> > tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> >> > head: eaea45fc0e7b6ae439526b4a41d91230c8517336
> >> > commit: 782347b6bcad07ddb574422e01e22c92e05928c8 xdp: Add proper __rcu annotations to redirect map entries
> >> > date: 11 months ago
> >> > config: ia64-randconfig-s031-20220522 (https://download.01.org/0day-ci/archive/20220522/202205222029.xpW3PM1y-lkp@intel.com/config)
> >> > compiler: ia64-linux-gcc (GCC) 11.3.0
> >>
> >> Hmm, so this is ia64-only? Some kind of macro breakage? Paul, any ideas?
> >
> > Hi,
> >
> > It's surely IA64's cmpxchg() which contains lines like:
> > _r_ = ia64_cmpxchg8_##sem((__u64 *) ptr, new, _o_);
>
> Oh, right. Hmm, well, if the cmpxchg does an internal cast that
> complicates things a bit. My immediate thought was to move the
> unrcu_pointer() inside the calls to cmpxchg(), like:
> But that seems to confuse sparse because these are ptr-to-ptr
> constructs:
Yes, that can't work because it applies on the wrong level (same difference as
between "int const ** ptr" and "int * const * ptr").
I've taken a quick look and the problem is really to be solved in IA64's
macros for cmpxchg() and friends. Two things need to be done:
1) avoid casts like the "(__u64 *) ptr" here above (ideally no cast would
be needed but a "(__u64 __force *) ptr" would be pefectly acceptable in
such macros.
2) the value returned by these macros must match the type of the pointer
and the old/new values. For example, on x86 such macros are written as:
({
__typeof__ (*(ptr)) __ret = (arg);
switch (sizeof(*(ptr))) {
case ...
... use ptr without dropping the address space ..
__ret;
)}
See, for example, arch/x86/include/asm/cmpxchg.h
-- Luc
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
@ 2022-06-01 12:00 ` Luc Van Oostenryck
0 siblings, 0 replies; 20+ messages in thread
From: Luc Van Oostenryck @ 2022-06-01 12:00 UTC (permalink / raw)
To: Toke Høiland-Jørgensen
Cc: kernel test robot, kbuild-all, linux-kernel, Daniel Borkmann,
Paul E . McKenney, linux-ia64
On Wed, Jun 01, 2022 at 12:26:27PM +0200, Toke Høiland-Jørgensen wrote:
> Luc Van Oostenryck <luc.vanoostenryck@gmail.com> writes:
>
> > On Mon, May 23, 2022 at 12:30:14PM +0200, Toke Høiland-Jørgensen wrote:
> >> kernel test robot <lkp@intel.com> writes:
> >>
> >> > tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> >> > head: eaea45fc0e7b6ae439526b4a41d91230c8517336
> >> > commit: 782347b6bcad07ddb574422e01e22c92e05928c8 xdp: Add proper __rcu annotations to redirect map entries
> >> > date: 11 months ago
> >> > config: ia64-randconfig-s031-20220522 (https://download.01.org/0day-ci/archive/20220522/202205222029.xpW3PM1y-lkp@intel.com/config)
> >> > compiler: ia64-linux-gcc (GCC) 11.3.0
> >>
> >> Hmm, so this is ia64-only? Some kind of macro breakage? Paul, any ideas?
> >
> > Hi,
> >
> > It's surely IA64's cmpxchg() which contains lines like:
> > _r_ = ia64_cmpxchg8_##sem((__u64 *) ptr, new, _o_);
>
> Oh, right. Hmm, well, if the cmpxchg does an internal cast that
> complicates things a bit. My immediate thought was to move the
> unrcu_pointer() inside the calls to cmpxchg(), like:
> But that seems to confuse sparse because these are ptr-to-ptr
> constructs:
Yes, that can't work because it applies on the wrong level (same difference as
between "int const ** ptr" and "int * const * ptr").
I've taken a quick look and the problem is really to be solved in IA64's
macros for cmpxchg() and friends. Two things need to be done:
1) avoid casts like the "(__u64 *) ptr" here above (ideally no cast would
be needed but a "(__u64 __force *) ptr" would be pefectly acceptable in
such macros.
2) the value returned by these macros must match the type of the pointer
and the old/new values. For example, on x86 such macros are written as:
({
__typeof__ (*(ptr)) __ret = (arg);
switch (sizeof(*(ptr))) {
case ...
... use ptr without dropping the address space ..
__ret;
)}
See, for example, arch/x86/include/asm/cmpxchg.h
-- Luc
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
@ 2022-06-01 12:00 ` Luc Van Oostenryck
0 siblings, 0 replies; 20+ messages in thread
From: Luc Van Oostenryck @ 2022-06-01 12:00 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 2063 bytes --]
On Wed, Jun 01, 2022 at 12:26:27PM +0200, Toke Høiland-Jørgensen wrote:
> Luc Van Oostenryck <luc.vanoostenryck@gmail.com> writes:
>
> > On Mon, May 23, 2022 at 12:30:14PM +0200, Toke Høiland-Jørgensen wrote:
> >> kernel test robot <lkp@intel.com> writes:
> >>
> >> > tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> >> > head: eaea45fc0e7b6ae439526b4a41d91230c8517336
> >> > commit: 782347b6bcad07ddb574422e01e22c92e05928c8 xdp: Add proper __rcu annotations to redirect map entries
> >> > date: 11 months ago
> >> > config: ia64-randconfig-s031-20220522 (https://download.01.org/0day-ci/archive/20220522/202205222029.xpW3PM1y-lkp(a)intel.com/config)
> >> > compiler: ia64-linux-gcc (GCC) 11.3.0
> >>
> >> Hmm, so this is ia64-only? Some kind of macro breakage? Paul, any ideas?
> >
> > Hi,
> >
> > It's surely IA64's cmpxchg() which contains lines like:
> > _r_ = ia64_cmpxchg8_##sem((__u64 *) ptr, new, _o_);
>
> Oh, right. Hmm, well, if the cmpxchg does an internal cast that
> complicates things a bit. My immediate thought was to move the
> unrcu_pointer() inside the calls to cmpxchg(), like:
> But that seems to confuse sparse because these are ptr-to-ptr
> constructs:
Yes, that can't work because it applies on the wrong level (same difference as
between "int const ** ptr" and "int * const * ptr").
I've taken a quick look and the problem is really to be solved in IA64's
macros for cmpxchg() and friends. Two things need to be done:
1) avoid casts like the "(__u64 *) ptr" here above (ideally no cast would
be needed but a "(__u64 __force *) ptr" would be pefectly acceptable in
such macros.
2) the value returned by these macros must match the type of the pointer
and the old/new values. For example, on x86 such macros are written as:
({
__typeof__ (*(ptr)) __ret = (arg);
switch (sizeof(*(ptr))) {
case ...
... use ptr without dropping the address space ..
__ret;
)}
See, for example, arch/x86/include/asm/cmpxchg.h
-- Luc
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH] ia64: fix sparse warnings with cmpxchg() & xchg()
2022-06-01 10:26 ` Toke Høiland-Jørgensen
@ 2022-06-05 16:07 ` Luc Van Oostenryck
-1 siblings, 0 replies; 20+ messages in thread
From: Luc Van Oostenryck @ 2022-06-05 16:07 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Andrew Morton, linux-ia64, linux-kernel, Paul E. McKenney,
Luc Van Oostenryck, kernel test robot,
Toke Høiland-Jørgensen
On IA64, new sparse's warnings where issued after fixing
some __rcu annotations in kernel/bpf/.
These new warnings are false positives and appear on IA64 because
on this architecture, the macros for cmpxchg() and xchg() make
casts that ignore sparse annotations.
This patch contains the minimal patch to fix this issue:
adding a missing cast and some missing '__force'.
Link: https://lore.kernel.org/r/20220601120013.bq5a3ynbkc3hngm5@mail
Reported-by: kernel test robot <lkp@intel.com>
Cc: Toke Høiland-Jørgensen <toke@redhat.com>
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
Note: This patch is only compile tested on defconfig. The corresponding
binary is unchanged (except some .rodata with the kernel version)
as it should be.
arch/ia64/include/uapi/asm/cmpxchg.h | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/arch/ia64/include/uapi/asm/cmpxchg.h b/arch/ia64/include/uapi/asm/cmpxchg.h
index 2c2f3cfeaa77..ca2e02685343 100644
--- a/arch/ia64/include/uapi/asm/cmpxchg.h
+++ b/arch/ia64/include/uapi/asm/cmpxchg.h
@@ -33,24 +33,24 @@ extern void ia64_xchg_called_with_bad_pointer(void);
\
switch (size) { \
case 1: \
- __xchg_result = ia64_xchg1((__u8 *)ptr, x); \
+ __xchg_result = ia64_xchg1((__u8 __force *)ptr, x); \
break; \
\
case 2: \
- __xchg_result = ia64_xchg2((__u16 *)ptr, x); \
+ __xchg_result = ia64_xchg2((__u16 __force *)ptr, x); \
break; \
\
case 4: \
- __xchg_result = ia64_xchg4((__u32 *)ptr, x); \
+ __xchg_result = ia64_xchg4((__u32 __force *)ptr, x); \
break; \
\
case 8: \
- __xchg_result = ia64_xchg8((__u64 *)ptr, x); \
+ __xchg_result = ia64_xchg8((__u64 __force *)ptr, x); \
break; \
default: \
ia64_xchg_called_with_bad_pointer(); \
} \
- __xchg_result; \
+ (__typeof__ (*(ptr)) __force) __xchg_result; \
})
#ifndef __KERNEL__
@@ -76,42 +76,42 @@ extern long ia64_cmpxchg_called_with_bad_pointer(void);
\
switch (size) { \
case 1: \
- _o_ = (__u8) (long) (old); \
+ _o_ = (__u8) (long __force) (old); \
break; \
case 2: \
- _o_ = (__u16) (long) (old); \
+ _o_ = (__u16) (long __force) (old); \
break; \
case 4: \
- _o_ = (__u32) (long) (old); \
+ _o_ = (__u32) (long __force) (old); \
break; \
case 8: \
- _o_ = (__u64) (long) (old); \
+ _o_ = (__u64) (long __force) (old); \
break; \
default: \
break; \
} \
switch (size) { \
case 1: \
- _r_ = ia64_cmpxchg1_##sem((__u8 *) ptr, new, _o_); \
+ _r_ = ia64_cmpxchg1_##sem((__u8 __force *) ptr, new, _o_); \
break; \
\
case 2: \
- _r_ = ia64_cmpxchg2_##sem((__u16 *) ptr, new, _o_); \
+ _r_ = ia64_cmpxchg2_##sem((__u16 __force *) ptr, new, _o_); \
break; \
\
case 4: \
- _r_ = ia64_cmpxchg4_##sem((__u32 *) ptr, new, _o_); \
+ _r_ = ia64_cmpxchg4_##sem((__u32 __force *) ptr, new, _o_); \
break; \
\
case 8: \
- _r_ = ia64_cmpxchg8_##sem((__u64 *) ptr, new, _o_); \
+ _r_ = ia64_cmpxchg8_##sem((__u64 __force *) ptr, new, _o_); \
break; \
\
default: \
_r_ = ia64_cmpxchg_called_with_bad_pointer(); \
break; \
} \
- (__typeof__(old)) _r_; \
+ (__typeof__(old) __force) _r_; \
})
#define cmpxchg_acq(ptr, o, n) \
--
2.36.1
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH] ia64: fix sparse warnings with cmpxchg() & xchg()
@ 2022-06-05 16:07 ` Luc Van Oostenryck
0 siblings, 0 replies; 20+ messages in thread
From: Luc Van Oostenryck @ 2022-06-05 16:07 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Andrew Morton, linux-ia64, linux-kernel, Paul E. McKenney,
Luc Van Oostenryck, kernel test robot,
Toke Høiland-Jørgensen
On IA64, new sparse's warnings where issued after fixing
some __rcu annotations in kernel/bpf/.
These new warnings are false positives and appear on IA64 because
on this architecture, the macros for cmpxchg() and xchg() make
casts that ignore sparse annotations.
This patch contains the minimal patch to fix this issue:
adding a missing cast and some missing '__force'.
Link: https://lore.kernel.org/r/20220601120013.bq5a3ynbkc3hngm5@mail
Reported-by: kernel test robot <lkp@intel.com>
Cc: Toke Høiland-Jørgensen <toke@redhat.com>
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
Note: This patch is only compile tested on defconfig. The corresponding
binary is unchanged (except some .rodata with the kernel version)
as it should be.
arch/ia64/include/uapi/asm/cmpxchg.h | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/arch/ia64/include/uapi/asm/cmpxchg.h b/arch/ia64/include/uapi/asm/cmpxchg.h
index 2c2f3cfeaa77..ca2e02685343 100644
--- a/arch/ia64/include/uapi/asm/cmpxchg.h
+++ b/arch/ia64/include/uapi/asm/cmpxchg.h
@@ -33,24 +33,24 @@ extern void ia64_xchg_called_with_bad_pointer(void);
\
switch (size) { \
case 1: \
- __xchg_result = ia64_xchg1((__u8 *)ptr, x); \
+ __xchg_result = ia64_xchg1((__u8 __force *)ptr, x); \
break; \
\
case 2: \
- __xchg_result = ia64_xchg2((__u16 *)ptr, x); \
+ __xchg_result = ia64_xchg2((__u16 __force *)ptr, x); \
break; \
\
case 4: \
- __xchg_result = ia64_xchg4((__u32 *)ptr, x); \
+ __xchg_result = ia64_xchg4((__u32 __force *)ptr, x); \
break; \
\
case 8: \
- __xchg_result = ia64_xchg8((__u64 *)ptr, x); \
+ __xchg_result = ia64_xchg8((__u64 __force *)ptr, x); \
break; \
default: \
ia64_xchg_called_with_bad_pointer(); \
} \
- __xchg_result; \
+ (__typeof__ (*(ptr)) __force) __xchg_result; \
})
#ifndef __KERNEL__
@@ -76,42 +76,42 @@ extern long ia64_cmpxchg_called_with_bad_pointer(void);
\
switch (size) { \
case 1: \
- _o_ = (__u8) (long) (old); \
+ _o_ = (__u8) (long __force) (old); \
break; \
case 2: \
- _o_ = (__u16) (long) (old); \
+ _o_ = (__u16) (long __force) (old); \
break; \
case 4: \
- _o_ = (__u32) (long) (old); \
+ _o_ = (__u32) (long __force) (old); \
break; \
case 8: \
- _o_ = (__u64) (long) (old); \
+ _o_ = (__u64) (long __force) (old); \
break; \
default: \
break; \
} \
switch (size) { \
case 1: \
- _r_ = ia64_cmpxchg1_##sem((__u8 *) ptr, new, _o_); \
+ _r_ = ia64_cmpxchg1_##sem((__u8 __force *) ptr, new, _o_); \
break; \
\
case 2: \
- _r_ = ia64_cmpxchg2_##sem((__u16 *) ptr, new, _o_); \
+ _r_ = ia64_cmpxchg2_##sem((__u16 __force *) ptr, new, _o_); \
break; \
\
case 4: \
- _r_ = ia64_cmpxchg4_##sem((__u32 *) ptr, new, _o_); \
+ _r_ = ia64_cmpxchg4_##sem((__u32 __force *) ptr, new, _o_); \
break; \
\
case 8: \
- _r_ = ia64_cmpxchg8_##sem((__u64 *) ptr, new, _o_); \
+ _r_ = ia64_cmpxchg8_##sem((__u64 __force *) ptr, new, _o_); \
break; \
\
default: \
_r_ = ia64_cmpxchg_called_with_bad_pointer(); \
break; \
} \
- (__typeof__(old)) _r_; \
+ (__typeof__(old) __force) _r_; \
})
#define cmpxchg_acq(ptr, o, n) \
--
2.36.1
^ permalink raw reply related [flat|nested] 20+ messages in thread
* Re: [PATCH] ia64: fix sparse warnings with cmpxchg() & xchg()
2022-06-05 16:07 ` Luc Van Oostenryck
@ 2022-06-05 19:58 ` Paul E. McKenney
-1 siblings, 0 replies; 20+ messages in thread
From: Paul E. McKenney @ 2022-06-05 19:58 UTC (permalink / raw)
To: Luc Van Oostenryck
Cc: Arnd Bergmann, Andrew Morton, linux-ia64, linux-kernel,
kernel test robot, Toke Høiland-Jørgensen
On Sun, Jun 05, 2022 at 06:07:38PM +0200, Luc Van Oostenryck wrote:
> On IA64, new sparse's warnings where issued after fixing
> some __rcu annotations in kernel/bpf/.
>
> These new warnings are false positives and appear on IA64 because
> on this architecture, the macros for cmpxchg() and xchg() make
> casts that ignore sparse annotations.
>
> This patch contains the minimal patch to fix this issue:
> adding a missing cast and some missing '__force'.
>
> Link: https://lore.kernel.org/r/20220601120013.bq5a3ynbkc3hngm5@mail
> Reported-by: kernel test robot <lkp@intel.com>
> Cc: Toke Høiland-Jørgensen <toke@redhat.com>
> Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Looks good to me!
Acked-by: Paul E. McKenney <paulmck@kernel.org>
> ---
>
> Note: This patch is only compile tested on defconfig. The corresponding
> binary is unchanged (except some .rodata with the kernel version)
> as it should be.
>
> arch/ia64/include/uapi/asm/cmpxchg.h | 28 ++++++++++++++--------------
> 1 file changed, 14 insertions(+), 14 deletions(-)
>
> diff --git a/arch/ia64/include/uapi/asm/cmpxchg.h b/arch/ia64/include/uapi/asm/cmpxchg.h
> index 2c2f3cfeaa77..ca2e02685343 100644
> --- a/arch/ia64/include/uapi/asm/cmpxchg.h
> +++ b/arch/ia64/include/uapi/asm/cmpxchg.h
> @@ -33,24 +33,24 @@ extern void ia64_xchg_called_with_bad_pointer(void);
> \
> switch (size) { \
> case 1: \
> - __xchg_result = ia64_xchg1((__u8 *)ptr, x); \
> + __xchg_result = ia64_xchg1((__u8 __force *)ptr, x); \
> break; \
> \
> case 2: \
> - __xchg_result = ia64_xchg2((__u16 *)ptr, x); \
> + __xchg_result = ia64_xchg2((__u16 __force *)ptr, x); \
> break; \
> \
> case 4: \
> - __xchg_result = ia64_xchg4((__u32 *)ptr, x); \
> + __xchg_result = ia64_xchg4((__u32 __force *)ptr, x); \
> break; \
> \
> case 8: \
> - __xchg_result = ia64_xchg8((__u64 *)ptr, x); \
> + __xchg_result = ia64_xchg8((__u64 __force *)ptr, x); \
> break; \
> default: \
> ia64_xchg_called_with_bad_pointer(); \
> } \
> - __xchg_result; \
> + (__typeof__ (*(ptr)) __force) __xchg_result; \
> })
>
> #ifndef __KERNEL__
> @@ -76,42 +76,42 @@ extern long ia64_cmpxchg_called_with_bad_pointer(void);
> \
> switch (size) { \
> case 1: \
> - _o_ = (__u8) (long) (old); \
> + _o_ = (__u8) (long __force) (old); \
> break; \
> case 2: \
> - _o_ = (__u16) (long) (old); \
> + _o_ = (__u16) (long __force) (old); \
> break; \
> case 4: \
> - _o_ = (__u32) (long) (old); \
> + _o_ = (__u32) (long __force) (old); \
> break; \
> case 8: \
> - _o_ = (__u64) (long) (old); \
> + _o_ = (__u64) (long __force) (old); \
> break; \
> default: \
> break; \
> } \
> switch (size) { \
> case 1: \
> - _r_ = ia64_cmpxchg1_##sem((__u8 *) ptr, new, _o_); \
> + _r_ = ia64_cmpxchg1_##sem((__u8 __force *) ptr, new, _o_); \
> break; \
> \
> case 2: \
> - _r_ = ia64_cmpxchg2_##sem((__u16 *) ptr, new, _o_); \
> + _r_ = ia64_cmpxchg2_##sem((__u16 __force *) ptr, new, _o_); \
> break; \
> \
> case 4: \
> - _r_ = ia64_cmpxchg4_##sem((__u32 *) ptr, new, _o_); \
> + _r_ = ia64_cmpxchg4_##sem((__u32 __force *) ptr, new, _o_); \
> break; \
> \
> case 8: \
> - _r_ = ia64_cmpxchg8_##sem((__u64 *) ptr, new, _o_); \
> + _r_ = ia64_cmpxchg8_##sem((__u64 __force *) ptr, new, _o_); \
> break; \
> \
> default: \
> _r_ = ia64_cmpxchg_called_with_bad_pointer(); \
> break; \
> } \
> - (__typeof__(old)) _r_; \
> + (__typeof__(old) __force) _r_; \
> })
>
> #define cmpxchg_acq(ptr, o, n) \
> --
> 2.36.1
>
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH] ia64: fix sparse warnings with cmpxchg() & xchg()
@ 2022-06-05 19:58 ` Paul E. McKenney
0 siblings, 0 replies; 20+ messages in thread
From: Paul E. McKenney @ 2022-06-05 19:58 UTC (permalink / raw)
To: Luc Van Oostenryck
Cc: Arnd Bergmann, Andrew Morton, linux-ia64, linux-kernel,
kernel test robot, Toke Høiland-Jørgensen
On Sun, Jun 05, 2022 at 06:07:38PM +0200, Luc Van Oostenryck wrote:
> On IA64, new sparse's warnings where issued after fixing
> some __rcu annotations in kernel/bpf/.
>
> These new warnings are false positives and appear on IA64 because
> on this architecture, the macros for cmpxchg() and xchg() make
> casts that ignore sparse annotations.
>
> This patch contains the minimal patch to fix this issue:
> adding a missing cast and some missing '__force'.
>
> Link: https://lore.kernel.org/r/20220601120013.bq5a3ynbkc3hngm5@mail
> Reported-by: kernel test robot <lkp@intel.com>
> Cc: Toke Høiland-Jørgensen <toke@redhat.com>
> Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Looks good to me!
Acked-by: Paul E. McKenney <paulmck@kernel.org>
> ---
>
> Note: This patch is only compile tested on defconfig. The corresponding
> binary is unchanged (except some .rodata with the kernel version)
> as it should be.
>
> arch/ia64/include/uapi/asm/cmpxchg.h | 28 ++++++++++++++--------------
> 1 file changed, 14 insertions(+), 14 deletions(-)
>
> diff --git a/arch/ia64/include/uapi/asm/cmpxchg.h b/arch/ia64/include/uapi/asm/cmpxchg.h
> index 2c2f3cfeaa77..ca2e02685343 100644
> --- a/arch/ia64/include/uapi/asm/cmpxchg.h
> +++ b/arch/ia64/include/uapi/asm/cmpxchg.h
> @@ -33,24 +33,24 @@ extern void ia64_xchg_called_with_bad_pointer(void);
> \
> switch (size) { \
> case 1: \
> - __xchg_result = ia64_xchg1((__u8 *)ptr, x); \
> + __xchg_result = ia64_xchg1((__u8 __force *)ptr, x); \
> break; \
> \
> case 2: \
> - __xchg_result = ia64_xchg2((__u16 *)ptr, x); \
> + __xchg_result = ia64_xchg2((__u16 __force *)ptr, x); \
> break; \
> \
> case 4: \
> - __xchg_result = ia64_xchg4((__u32 *)ptr, x); \
> + __xchg_result = ia64_xchg4((__u32 __force *)ptr, x); \
> break; \
> \
> case 8: \
> - __xchg_result = ia64_xchg8((__u64 *)ptr, x); \
> + __xchg_result = ia64_xchg8((__u64 __force *)ptr, x); \
> break; \
> default: \
> ia64_xchg_called_with_bad_pointer(); \
> } \
> - __xchg_result; \
> + (__typeof__ (*(ptr)) __force) __xchg_result; \
> })
>
> #ifndef __KERNEL__
> @@ -76,42 +76,42 @@ extern long ia64_cmpxchg_called_with_bad_pointer(void);
> \
> switch (size) { \
> case 1: \
> - _o_ = (__u8) (long) (old); \
> + _o_ = (__u8) (long __force) (old); \
> break; \
> case 2: \
> - _o_ = (__u16) (long) (old); \
> + _o_ = (__u16) (long __force) (old); \
> break; \
> case 4: \
> - _o_ = (__u32) (long) (old); \
> + _o_ = (__u32) (long __force) (old); \
> break; \
> case 8: \
> - _o_ = (__u64) (long) (old); \
> + _o_ = (__u64) (long __force) (old); \
> break; \
> default: \
> break; \
> } \
> switch (size) { \
> case 1: \
> - _r_ = ia64_cmpxchg1_##sem((__u8 *) ptr, new, _o_); \
> + _r_ = ia64_cmpxchg1_##sem((__u8 __force *) ptr, new, _o_); \
> break; \
> \
> case 2: \
> - _r_ = ia64_cmpxchg2_##sem((__u16 *) ptr, new, _o_); \
> + _r_ = ia64_cmpxchg2_##sem((__u16 __force *) ptr, new, _o_); \
> break; \
> \
> case 4: \
> - _r_ = ia64_cmpxchg4_##sem((__u32 *) ptr, new, _o_); \
> + _r_ = ia64_cmpxchg4_##sem((__u32 __force *) ptr, new, _o_); \
> break; \
> \
> case 8: \
> - _r_ = ia64_cmpxchg8_##sem((__u64 *) ptr, new, _o_); \
> + _r_ = ia64_cmpxchg8_##sem((__u64 __force *) ptr, new, _o_); \
> break; \
> \
> default: \
> _r_ = ia64_cmpxchg_called_with_bad_pointer(); \
> break; \
> } \
> - (__typeof__(old)) _r_; \
> + (__typeof__(old) __force) _r_; \
> })
>
> #define cmpxchg_acq(ptr, o, n) \
> --
> 2.36.1
>
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH] ia64: fix sparse warnings with cmpxchg() & xchg()
2022-06-05 16:07 ` Luc Van Oostenryck
@ 2022-06-06 7:53 ` Toke Høiland-Jørgensen
-1 siblings, 0 replies; 20+ messages in thread
From: Toke Høiland-Jørgensen @ 2022-06-06 7:53 UTC (permalink / raw)
To: Luc Van Oostenryck, Arnd Bergmann
Cc: Andrew Morton, linux-ia64, linux-kernel, Paul E. McKenney,
Luc Van Oostenryck, kernel test robot
Luc Van Oostenryck <luc.vanoostenryck@gmail.com> writes:
> On IA64, new sparse's warnings where issued after fixing
> some __rcu annotations in kernel/bpf/.
>
> These new warnings are false positives and appear on IA64 because
> on this architecture, the macros for cmpxchg() and xchg() make
> casts that ignore sparse annotations.
>
> This patch contains the minimal patch to fix this issue:
> adding a missing cast and some missing '__force'.
>
> Link: https://lore.kernel.org/r/20220601120013.bq5a3ynbkc3hngm5@mail
> Reported-by: kernel test robot <lkp@intel.com>
> Cc: Toke Høiland-Jørgensen <toke@redhat.com>
> Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Ah, thank you for taking care of this! :)
Acked-by: Toke Høiland-Jørgensen <toke@redhat.com>
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH] ia64: fix sparse warnings with cmpxchg() & xchg()
@ 2022-06-06 7:53 ` Toke Høiland-Jørgensen
0 siblings, 0 replies; 20+ messages in thread
From: Toke Høiland-Jørgensen @ 2022-06-06 7:53 UTC (permalink / raw)
To: Luc Van Oostenryck, Arnd Bergmann
Cc: Andrew Morton, linux-ia64, linux-kernel, Paul E. McKenney,
Luc Van Oostenryck, kernel test robot
Luc Van Oostenryck <luc.vanoostenryck@gmail.com> writes:
> On IA64, new sparse's warnings where issued after fixing
> some __rcu annotations in kernel/bpf/.
>
> These new warnings are false positives and appear on IA64 because
> on this architecture, the macros for cmpxchg() and xchg() make
> casts that ignore sparse annotations.
>
> This patch contains the minimal patch to fix this issue:
> adding a missing cast and some missing '__force'.
>
> Link: https://lore.kernel.org/r/20220601120013.bq5a3ynbkc3hngm5@mail
> Reported-by: kernel test robot <lkp@intel.com>
> Cc: Toke Høiland-Jørgensen <toke@redhat.com>
> Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Ah, thank you for taking care of this! :)
Acked-by: Toke Høiland-Jørgensen <toke@redhat.com>
^ permalink raw reply [flat|nested] 20+ messages in thread
* kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
@ 2021-11-20 1:45 ` kernel test robot
0 siblings, 0 replies; 20+ messages in thread
From: kernel test robot @ 2021-11-20 1:45 UTC (permalink / raw)
To: Toke Høiland-Jørgensen
Cc: kbuild-all, linux-kernel, Daniel Borkmann
[-- Attachment #1: Type: text/plain, Size: 6725 bytes --]
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: a90af8f15bdc9449ee2d24e1d73fa3f7e8633f81
commit: 782347b6bcad07ddb574422e01e22c92e05928c8 xdp: Add proper __rcu annotations to redirect map entries
date: 5 months ago
config: ia64-randconfig-s032-20211116 (attached as .config)
compiler: ia64-linux-gcc (GCC) 11.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.4-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=782347b6bcad07ddb574422e01e22c92e05928c8
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 782347b6bcad07ddb574422e01e22c92e05928c8
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=ia64 SHELL=/bin/bash kernel/bpf/ lib/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
sparse warnings: (new ones prefixed by >>)
kernel/bpf/devmap.c:561:29: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct bpf_dtab_netdev *dst @@ got struct bpf_dtab_netdev [noderef] __rcu * @@
kernel/bpf/devmap.c:561:29: sparse: expected struct bpf_dtab_netdev *dst
kernel/bpf/devmap.c:561:29: sparse: got struct bpf_dtab_netdev [noderef] __rcu *
kernel/bpf/devmap.c:657:29: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct bpf_dtab_netdev *dst @@ got struct bpf_dtab_netdev [noderef] __rcu * @@
kernel/bpf/devmap.c:657:29: sparse: expected struct bpf_dtab_netdev *dst
kernel/bpf/devmap.c:657:29: sparse: got struct bpf_dtab_netdev [noderef] __rcu *
>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
vim +/__rcu +1030 kernel/bpf/devmap.c
990
991 static int dev_map_notification(struct notifier_block *notifier,
992 ulong event, void *ptr)
993 {
994 struct net_device *netdev = netdev_notifier_info_to_dev(ptr);
995 struct bpf_dtab *dtab;
996 int i, cpu;
997
998 switch (event) {
999 case NETDEV_REGISTER:
1000 if (!netdev->netdev_ops->ndo_xdp_xmit || netdev->xdp_bulkq)
1001 break;
1002
1003 /* will be freed in free_netdev() */
1004 netdev->xdp_bulkq = alloc_percpu(struct xdp_dev_bulk_queue);
1005 if (!netdev->xdp_bulkq)
1006 return NOTIFY_BAD;
1007
1008 for_each_possible_cpu(cpu)
1009 per_cpu_ptr(netdev->xdp_bulkq, cpu)->dev = netdev;
1010 break;
1011 case NETDEV_UNREGISTER:
1012 /* This rcu_read_lock/unlock pair is needed because
1013 * dev_map_list is an RCU list AND to ensure a delete
1014 * operation does not free a netdev_map entry while we
1015 * are comparing it against the netdev being unregistered.
1016 */
1017 rcu_read_lock();
1018 list_for_each_entry_rcu(dtab, &dev_map_list, list) {
1019 if (dtab->map.map_type == BPF_MAP_TYPE_DEVMAP_HASH) {
1020 dev_map_hash_remove_netdev(dtab, netdev);
1021 continue;
1022 }
1023
1024 for (i = 0; i < dtab->map.max_entries; i++) {
1025 struct bpf_dtab_netdev *dev, *odev;
1026
1027 dev = rcu_dereference(dtab->netdev_map[i]);
1028 if (!dev || netdev != dev->dev)
1029 continue;
> 1030 odev = unrcu_pointer(cmpxchg(&dtab->netdev_map[i], RCU_INITIALIZER(dev), NULL));
1031 if (dev == odev)
1032 call_rcu(&dev->rcu,
1033 __dev_map_entry_free);
1034 }
1035 }
1036 rcu_read_unlock();
1037 break;
1038 default:
1039 break;
1040 }
1041 return NOTIFY_OK;
1042 }
1043
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 33803 bytes --]
^ permalink raw reply [flat|nested] 20+ messages in thread
* kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
@ 2021-11-20 1:45 ` kernel test robot
0 siblings, 0 replies; 20+ messages in thread
From: kernel test robot @ 2021-11-20 1:45 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 6845 bytes --]
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: a90af8f15bdc9449ee2d24e1d73fa3f7e8633f81
commit: 782347b6bcad07ddb574422e01e22c92e05928c8 xdp: Add proper __rcu annotations to redirect map entries
date: 5 months ago
config: ia64-randconfig-s032-20211116 (attached as .config)
compiler: ia64-linux-gcc (GCC) 11.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.4-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=782347b6bcad07ddb574422e01e22c92e05928c8
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 782347b6bcad07ddb574422e01e22c92e05928c8
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=ia64 SHELL=/bin/bash kernel/bpf/ lib/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
sparse warnings: (new ones prefixed by >>)
kernel/bpf/devmap.c:561:29: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct bpf_dtab_netdev *dst @@ got struct bpf_dtab_netdev [noderef] __rcu * @@
kernel/bpf/devmap.c:561:29: sparse: expected struct bpf_dtab_netdev *dst
kernel/bpf/devmap.c:561:29: sparse: got struct bpf_dtab_netdev [noderef] __rcu *
kernel/bpf/devmap.c:657:29: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct bpf_dtab_netdev *dst @@ got struct bpf_dtab_netdev [noderef] __rcu * @@
kernel/bpf/devmap.c:657:29: sparse: expected struct bpf_dtab_netdev *dst
kernel/bpf/devmap.c:657:29: sparse: got struct bpf_dtab_netdev [noderef] __rcu *
>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
vim +/__rcu +1030 kernel/bpf/devmap.c
990
991 static int dev_map_notification(struct notifier_block *notifier,
992 ulong event, void *ptr)
993 {
994 struct net_device *netdev = netdev_notifier_info_to_dev(ptr);
995 struct bpf_dtab *dtab;
996 int i, cpu;
997
998 switch (event) {
999 case NETDEV_REGISTER:
1000 if (!netdev->netdev_ops->ndo_xdp_xmit || netdev->xdp_bulkq)
1001 break;
1002
1003 /* will be freed in free_netdev() */
1004 netdev->xdp_bulkq = alloc_percpu(struct xdp_dev_bulk_queue);
1005 if (!netdev->xdp_bulkq)
1006 return NOTIFY_BAD;
1007
1008 for_each_possible_cpu(cpu)
1009 per_cpu_ptr(netdev->xdp_bulkq, cpu)->dev = netdev;
1010 break;
1011 case NETDEV_UNREGISTER:
1012 /* This rcu_read_lock/unlock pair is needed because
1013 * dev_map_list is an RCU list AND to ensure a delete
1014 * operation does not free a netdev_map entry while we
1015 * are comparing it against the netdev being unregistered.
1016 */
1017 rcu_read_lock();
1018 list_for_each_entry_rcu(dtab, &dev_map_list, list) {
1019 if (dtab->map.map_type == BPF_MAP_TYPE_DEVMAP_HASH) {
1020 dev_map_hash_remove_netdev(dtab, netdev);
1021 continue;
1022 }
1023
1024 for (i = 0; i < dtab->map.max_entries; i++) {
1025 struct bpf_dtab_netdev *dev, *odev;
1026
1027 dev = rcu_dereference(dtab->netdev_map[i]);
1028 if (!dev || netdev != dev->dev)
1029 continue;
> 1030 odev = unrcu_pointer(cmpxchg(&dtab->netdev_map[i], RCU_INITIALIZER(dev), NULL));
1031 if (dev == odev)
1032 call_rcu(&dev->rcu,
1033 __dev_map_entry_free);
1034 }
1035 }
1036 rcu_read_unlock();
1037 break;
1038 default:
1039 break;
1040 }
1041 return NOTIFY_OK;
1042 }
1043
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 33803 bytes --]
^ permalink raw reply [flat|nested] 20+ messages in thread
end of thread, other threads:[~2022-06-06 7:53 UTC | newest]
Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-22 12:30 kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression kernel test robot
2022-05-23 10:30 ` Toke Høiland-Jørgensen
2022-05-23 10:30 ` Toke Høiland-Jørgensen
2022-05-24 20:51 ` Paul E. McKenney
2022-05-24 20:51 ` Paul E. McKenney
2022-06-01 0:38 ` Luc Van Oostenryck
2022-06-01 0:38 ` Luc Van Oostenryck
2022-06-01 10:26 ` Toke Høiland-Jørgensen
2022-06-01 10:26 ` Toke Høiland-Jørgensen
2022-06-01 11:59 ` Luc Van Oostenryck
2022-06-01 12:00 ` Luc Van Oostenryck
2022-06-01 12:00 ` Luc Van Oostenryck
2022-06-05 16:07 ` [PATCH] ia64: fix sparse warnings with cmpxchg() & xchg() Luc Van Oostenryck
2022-06-05 16:07 ` Luc Van Oostenryck
2022-06-05 19:58 ` Paul E. McKenney
2022-06-05 19:58 ` Paul E. McKenney
2022-06-06 7:53 ` Toke Høiland-Jørgensen
2022-06-06 7:53 ` Toke Høiland-Jørgensen
-- strict thread matches above, loose matches on Subject: below --
2021-11-20 1:45 kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression kernel test robot
2021-11-20 1:45 ` kernel test robot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.