* [bpf-next:master 15/30] kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
@ 2021-06-26 8:41 kernel test robot
2021-06-26 10:00 ` Toke Høiland-Jørgensen
0 siblings, 1 reply; 9+ messages in thread
From: kernel test robot @ 2021-06-26 8:41 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 6791 bytes --]
tree: https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
head: a196fa78a26571359740f701cf30d774eb8a72cb
commit: 782347b6bcad07ddb574422e01e22c92e05928c8 [15/30] xdp: Add proper __rcu annotations to redirect map entries
config: ia64-allmodconfig (attached as .config)
compiler: ia64-linux-gcc (GCC) 9.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.3-341-g8af24329-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/commit/?id=782347b6bcad07ddb574422e01e22c92e05928c8
git remote add bpf-next https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git
git fetch --no-tags bpf-next master
git checkout 782347b6bcad07ddb574422e01e22c92e05928c8
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' W=1 ARCH=ia64
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: 64154 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [bpf-next:master 15/30] kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
2021-06-26 8:41 [bpf-next:master 15/30] kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression kernel test robot
@ 2021-06-26 10:00 ` Toke Høiland-Jørgensen
2021-06-28 15:53 ` Paul E. McKenney
0 siblings, 1 reply; 9+ messages in thread
From: Toke Høiland-Jørgensen @ 2021-06-26 10:00 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 7059 bytes --]
+Paul - any idea why unrcu_pointer() isn't working here?
-Toke
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
> head: a196fa78a26571359740f701cf30d774eb8a72cb
> commit: 782347b6bcad07ddb574422e01e22c92e05928c8 [15/30] xdp: Add proper __rcu annotations to redirect map entries
> config: ia64-allmodconfig (attached as .config)
> compiler: ia64-linux-gcc (GCC) 9.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.3-341-g8af24329-dirty
> # https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/commit/?id=782347b6bcad07ddb574422e01e22c92e05928c8
> git remote add bpf-next https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git
> git fetch --no-tags bpf-next master
> git checkout 782347b6bcad07ddb574422e01e22c92e05928c8
> # save the attached .config to linux build tree
> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' W=1 ARCH=ia64
>
> 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
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [bpf-next:master 15/30] kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
2021-06-26 10:00 ` Toke Høiland-Jørgensen
@ 2021-06-28 15:53 ` Paul E. McKenney
2021-06-28 22:42 ` Toke Høiland-Jørgensen
0 siblings, 1 reply; 9+ messages in thread
From: Paul E. McKenney @ 2021-06-28 15:53 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 8476 bytes --]
On Sat, Jun 26, 2021 at 12:00:55PM +0200, Toke Høiland-Jørgensen wrote:
> +Paul - any idea why unrcu_pointer() isn't working here?
Hello, Toke!
My distro version of sparse core-dumped before getting that far along.
I cloned and built the latest version, and got only the following errors
from kernel/bpf/devmap.c:
------------------------------------------------------------------------
CHECK scripts/mod/empty.c
CALL scripts/checksyscalls.sh
CALL scripts/atomic/check-atomics.sh
DESCEND objtool
CC kernel/bpf/devmap.o
CHECK kernel/bpf/devmap.c
kernel/bpf/devmap.c:561:29: warning: incorrect type in assignment (different address spaces)
kernel/bpf/devmap.c:561:29: expected struct bpf_dtab_netdev *dst
kernel/bpf/devmap.c:561:29: got struct bpf_dtab_netdev [noderef] __rcu *
kernel/bpf/devmap.c:657:29: warning: incorrect type in assignment (different address spaces)
kernel/bpf/devmap.c:657:29: expected struct bpf_dtab_netdev *dst
kernel/bpf/devmap.c:657:29: got struct bpf_dtab_netdev [noderef] __rcu *
------------------------------------------------------------------------
Might the kbuild test robot need to update their sparse?
Thanx, Paul
> -Toke
>
> > tree: https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
> > head: a196fa78a26571359740f701cf30d774eb8a72cb
> > commit: 782347b6bcad07ddb574422e01e22c92e05928c8 [15/30] xdp: Add proper __rcu annotations to redirect map entries
> > config: ia64-allmodconfig (attached as .config)
> > compiler: ia64-linux-gcc (GCC) 9.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.3-341-g8af24329-dirty
> > # https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/commit/?id=782347b6bcad07ddb574422e01e22c92e05928c8
> > git remote add bpf-next https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git
> > git fetch --no-tags bpf-next master
> > git checkout 782347b6bcad07ddb574422e01e22c92e05928c8
> > # save the attached .config to linux build tree
> > COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' W=1 ARCH=ia64
> >
> > 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
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [bpf-next:master 15/30] kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
2021-06-28 15:53 ` Paul E. McKenney
@ 2021-06-28 22:42 ` Toke Høiland-Jørgensen
2021-06-28 22:53 ` Paul E. McKenney
0 siblings, 1 reply; 9+ messages in thread
From: Toke Høiland-Jørgensen @ 2021-06-28 22:42 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 1292 bytes --]
"Paul E. McKenney" <paulmck@kernel.org> writes:
> On Sat, Jun 26, 2021 at 12:00:55PM +0200, Toke Høiland-Jørgensen wrote:
>> +Paul - any idea why unrcu_pointer() isn't working here?
>
> Hello, Toke!
>
> My distro version of sparse core-dumped before getting that far along.
>
> I cloned and built the latest version, and got only the following errors
> from kernel/bpf/devmap.c:
>
> ------------------------------------------------------------------------
>
> CHECK scripts/mod/empty.c
> CALL scripts/checksyscalls.sh
> CALL scripts/atomic/check-atomics.sh
> DESCEND objtool
> CC kernel/bpf/devmap.o
> CHECK kernel/bpf/devmap.c
> kernel/bpf/devmap.c:561:29: warning: incorrect type in assignment (different address spaces)
> kernel/bpf/devmap.c:561:29: expected struct bpf_dtab_netdev *dst
> kernel/bpf/devmap.c:561:29: got struct bpf_dtab_netdev [noderef] __rcu *
> kernel/bpf/devmap.c:657:29: warning: incorrect type in assignment (different address spaces)
> kernel/bpf/devmap.c:657:29: expected struct bpf_dtab_netdev *dst
> kernel/bpf/devmap.c:657:29: got struct bpf_dtab_netdev [noderef] __rcu *
Hmm, but those shouldn't be there either. Seems I missed those when
rebasing, will send a follow-up patch...
-Toke
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [bpf-next:master 15/30] kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
2021-06-28 22:42 ` Toke Høiland-Jørgensen
@ 2021-06-28 22:53 ` Paul E. McKenney
2021-06-29 8:47 ` Chen, Rong A
0 siblings, 1 reply; 9+ messages in thread
From: Paul E. McKenney @ 2021-06-28 22:53 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 1513 bytes --]
On Tue, Jun 29, 2021 at 12:42:52AM +0200, Toke Høiland-Jørgensen wrote:
> "Paul E. McKenney" <paulmck@kernel.org> writes:
>
> > On Sat, Jun 26, 2021 at 12:00:55PM +0200, Toke Høiland-Jørgensen wrote:
> >> +Paul - any idea why unrcu_pointer() isn't working here?
> >
> > Hello, Toke!
> >
> > My distro version of sparse core-dumped before getting that far along.
> >
> > I cloned and built the latest version, and got only the following errors
> > from kernel/bpf/devmap.c:
> >
> > ------------------------------------------------------------------------
> >
> > CHECK scripts/mod/empty.c
> > CALL scripts/checksyscalls.sh
> > CALL scripts/atomic/check-atomics.sh
> > DESCEND objtool
> > CC kernel/bpf/devmap.o
> > CHECK kernel/bpf/devmap.c
> > kernel/bpf/devmap.c:561:29: warning: incorrect type in assignment (different address spaces)
> > kernel/bpf/devmap.c:561:29: expected struct bpf_dtab_netdev *dst
> > kernel/bpf/devmap.c:561:29: got struct bpf_dtab_netdev [noderef] __rcu *
> > kernel/bpf/devmap.c:657:29: warning: incorrect type in assignment (different address spaces)
> > kernel/bpf/devmap.c:657:29: expected struct bpf_dtab_netdev *dst
> > kernel/bpf/devmap.c:657:29: got struct bpf_dtab_netdev [noderef] __rcu *
>
> Hmm, but those shouldn't be there either. Seems I missed those when
> rebasing, will send a follow-up patch...
Just check out different versions of sparse and average the results? ;-)
Thanx, Paul
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [bpf-next:master 15/30] kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
2021-06-28 22:53 ` Paul E. McKenney
@ 2021-06-29 8:47 ` Chen, Rong A
2021-06-29 16:57 ` Paul E. McKenney
0 siblings, 1 reply; 9+ messages in thread
From: Chen, Rong A @ 2021-06-29 8:47 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 4065 bytes --]
On 6/29/2021 6:53 AM, Paul E. McKenney wrote:
> On Tue, Jun 29, 2021 at 12:42:52AM +0200, Toke Høiland-Jørgensen wrote:
>> "Paul E. McKenney" <paulmck@kernel.org> writes:
>>
>>> On Sat, Jun 26, 2021 at 12:00:55PM +0200, Toke Høiland-Jørgensen wrote:
>>>> +Paul - any idea why unrcu_pointer() isn't working here?
>>>
>>> Hello, Toke!
>>>
>>> My distro version of sparse core-dumped before getting that far along.
>>>
>>> I cloned and built the latest version, and got only the following errors
>>> from kernel/bpf/devmap.c:
>>>
>>> ------------------------------------------------------------------------
>>>
>>> CHECK scripts/mod/empty.c
>>> CALL scripts/checksyscalls.sh
>>> CALL scripts/atomic/check-atomics.sh
>>> DESCEND objtool
>>> CC kernel/bpf/devmap.o
>>> CHECK kernel/bpf/devmap.c
>>> kernel/bpf/devmap.c:561:29: warning: incorrect type in assignment (different address spaces)
>>> kernel/bpf/devmap.c:561:29: expected struct bpf_dtab_netdev *dst
>>> kernel/bpf/devmap.c:561:29: got struct bpf_dtab_netdev [noderef] __rcu *
>>> kernel/bpf/devmap.c:657:29: warning: incorrect type in assignment (different address spaces)
>>> kernel/bpf/devmap.c:657:29: expected struct bpf_dtab_netdev *dst
>>> kernel/bpf/devmap.c:657:29: got struct bpf_dtab_netdev [noderef] __rcu *
>>
>> Hmm, but those shouldn't be there either. Seems I missed those when
>> rebasing, will send a follow-up patch...
>
> Just check out different versions of sparse and average the results? ;-)
>
> Thanx, Paul
Hi Paul,
I tested the original attached config with the reproduce step, and I can
reproduce the warning:
$ COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1
CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' W=1 ARCH=ia64 kernel/bpf/
...
kernel/bpf/devmap.c:561:29: sparse: warning: incorrect type in
assignment (different address spaces)
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: warning: incorrect type in
assignment (different address spaces)
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: warning: cast removes address space
'__rcu' of expression
kernel/bpf/devmap.c:1030:40: sparse: warning: cast removes address space
'__rcu' of expression
kernel/bpf/devmap.c:1030:40: sparse: warning: cast removes address space
'__rcu' of expression
kernel/bpf/devmap.c:1030:40: sparse: warning: cast removes address space
'__rcu' of expression
kernel/bpf/devmap.c:1030:40: sparse: warning: cast removes address space
'__rcu' of expression
kernel/bpf/devmap.c:1030:40: sparse: warning: cast removes address space
'__rcu' of expression
kernel/bpf/devmap.c:1030:40: sparse: warning: cast removes address space
'__rcu' of expression
kernel/bpf/devmap.c:1030:40: sparse: warning: cast removes address space
'__rcu' of expression
kernel/bpf/devmap.c:1030:40: sparse: warning: cast removes address space
'__rcu' of expression
kernel/bpf/devmap.c:1030:40: sparse: warning: cast removes address space
'__rcu' of expression
kernel/bpf/devmap.c:1030:40: sparse: warning: cast removes address space
'__rcu' of expression
kernel/bpf/devmap.c:1030:40: sparse: warning: cast removes address space
'__rcu' of expression
kernel/bpf/devmap.c:1030:40: sparse: warning: cast removes address space
'__rcu' of expression
kernel/bpf/devmap.c:1030:40: sparse: warning: cast removes address space
'__rcu' of expression
kernel/bpf/devmap.c:1030:40: sparse: warning: cast removes address space
'__rcu' of expression
kernel/bpf/devmap.c:1030:40: sparse: warning: cast removes address space
'__rcu' of expression
and sparse is from latest master branch:
$ sparse --version
v0.6.3-341-g8af24329
Best Regards,
Rong Chen
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [bpf-next:master 15/30] kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
2021-06-29 8:47 ` Chen, Rong A
@ 2021-06-29 16:57 ` Paul E. McKenney
2021-06-30 7:31 ` Chen, Rong A
0 siblings, 1 reply; 9+ messages in thread
From: Paul E. McKenney @ 2021-06-29 16:57 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 4574 bytes --]
On Tue, Jun 29, 2021 at 04:47:17PM +0800, Chen, Rong A wrote:
>
>
> On 6/29/2021 6:53 AM, Paul E. McKenney wrote:
> > On Tue, Jun 29, 2021 at 12:42:52AM +0200, Toke Høiland-Jørgensen wrote:
> > > "Paul E. McKenney" <paulmck@kernel.org> writes:
> > >
> > > > On Sat, Jun 26, 2021 at 12:00:55PM +0200, Toke Høiland-Jørgensen wrote:
> > > > > +Paul - any idea why unrcu_pointer() isn't working here?
> > > >
> > > > Hello, Toke!
> > > >
> > > > My distro version of sparse core-dumped before getting that far along.
> > > >
> > > > I cloned and built the latest version, and got only the following errors
> > > > from kernel/bpf/devmap.c:
> > > >
> > > > ------------------------------------------------------------------------
> > > >
> > > > CHECK scripts/mod/empty.c
> > > > CALL scripts/checksyscalls.sh
> > > > CALL scripts/atomic/check-atomics.sh
> > > > DESCEND objtool
> > > > CC kernel/bpf/devmap.o
> > > > CHECK kernel/bpf/devmap.c
> > > > kernel/bpf/devmap.c:561:29: warning: incorrect type in assignment (different address spaces)
> > > > kernel/bpf/devmap.c:561:29: expected struct bpf_dtab_netdev *dst
> > > > kernel/bpf/devmap.c:561:29: got struct bpf_dtab_netdev [noderef] __rcu *
> > > > kernel/bpf/devmap.c:657:29: warning: incorrect type in assignment (different address spaces)
> > > > kernel/bpf/devmap.c:657:29: expected struct bpf_dtab_netdev *dst
> > > > kernel/bpf/devmap.c:657:29: got struct bpf_dtab_netdev [noderef] __rcu *
> > >
> > > Hmm, but those shouldn't be there either. Seems I missed those when
> > > rebasing, will send a follow-up patch...
> >
> > Just check out different versions of sparse and average the results? ;-)
> >
> > Thanx, Paul
>
> Hi Paul,
>
> I tested the original attached config with the reproduce step, and I can
> reproduce the warning:
>
> $ COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1
> CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' W=1 ARCH=ia64 kernel/bpf/
> ...
> kernel/bpf/devmap.c:561:29: sparse: warning: incorrect type in assignment
> (different address spaces)
> 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: warning: incorrect type in assignment
> (different address spaces)
> 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: warning: cast removes address space
> '__rcu' of expression
> kernel/bpf/devmap.c:1030:40: sparse: warning: cast removes address space
> '__rcu' of expression
> kernel/bpf/devmap.c:1030:40: sparse: warning: cast removes address space
> '__rcu' of expression
> kernel/bpf/devmap.c:1030:40: sparse: warning: cast removes address space
> '__rcu' of expression
> kernel/bpf/devmap.c:1030:40: sparse: warning: cast removes address space
> '__rcu' of expression
> kernel/bpf/devmap.c:1030:40: sparse: warning: cast removes address space
> '__rcu' of expression
> kernel/bpf/devmap.c:1030:40: sparse: warning: cast removes address space
> '__rcu' of expression
> kernel/bpf/devmap.c:1030:40: sparse: warning: cast removes address space
> '__rcu' of expression
> kernel/bpf/devmap.c:1030:40: sparse: warning: cast removes address space
> '__rcu' of expression
> kernel/bpf/devmap.c:1030:40: sparse: warning: cast removes address space
> '__rcu' of expression
> kernel/bpf/devmap.c:1030:40: sparse: warning: cast removes address space
> '__rcu' of expression
> kernel/bpf/devmap.c:1030:40: sparse: warning: cast removes address space
> '__rcu' of expression
> kernel/bpf/devmap.c:1030:40: sparse: warning: cast removes address space
> '__rcu' of expression
> kernel/bpf/devmap.c:1030:40: sparse: warning: cast removes address space
> '__rcu' of expression
> kernel/bpf/devmap.c:1030:40: sparse: warning: cast removes address space
> '__rcu' of expression
> kernel/bpf/devmap.c:1030:40: sparse: warning: cast removes address space
> '__rcu' of expression
>
> and sparse is from latest master branch:
> $ sparse --version
> v0.6.3-341-g8af24329
OK, we really are running the same sparse. And even the same gcc.
I did only a "make defconfig" followed by a "C=2" native build
on x86. Is your "ARCH=ia64" required, or does sparse also get
you these same errors on x86?
Thanx, Paul
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [bpf-next:master 15/30] kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
2021-06-29 16:57 ` Paul E. McKenney
@ 2021-06-30 7:31 ` Chen, Rong A
2021-06-30 15:38 ` Paul E. McKenney
0 siblings, 1 reply; 9+ messages in thread
From: Chen, Rong A @ 2021-06-30 7:31 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 5547 bytes --]
On 6/30/2021 12:57 AM, Paul E. McKenney wrote:
> On Tue, Jun 29, 2021 at 04:47:17PM +0800, Chen, Rong A wrote:
>>
>>
>> On 6/29/2021 6:53 AM, Paul E. McKenney wrote:
>>> On Tue, Jun 29, 2021 at 12:42:52AM +0200, Toke Høiland-Jørgensen wrote:
>>>> "Paul E. McKenney" <paulmck@kernel.org> writes:
>>>>
>>>>> On Sat, Jun 26, 2021 at 12:00:55PM +0200, Toke Høiland-Jørgensen wrote:
>>>>>> +Paul - any idea why unrcu_pointer() isn't working here?
>>>>>
>>>>> Hello, Toke!
>>>>>
>>>>> My distro version of sparse core-dumped before getting that far along.
>>>>>
>>>>> I cloned and built the latest version, and got only the following errors
>>>>> from kernel/bpf/devmap.c:
>>>>>
>>>>> ------------------------------------------------------------------------
>>>>>
>>>>> CHECK scripts/mod/empty.c
>>>>> CALL scripts/checksyscalls.sh
>>>>> CALL scripts/atomic/check-atomics.sh
>>>>> DESCEND objtool
>>>>> CC kernel/bpf/devmap.o
>>>>> CHECK kernel/bpf/devmap.c
>>>>> kernel/bpf/devmap.c:561:29: warning: incorrect type in assignment (different address spaces)
>>>>> kernel/bpf/devmap.c:561:29: expected struct bpf_dtab_netdev *dst
>>>>> kernel/bpf/devmap.c:561:29: got struct bpf_dtab_netdev [noderef] __rcu *
>>>>> kernel/bpf/devmap.c:657:29: warning: incorrect type in assignment (different address spaces)
>>>>> kernel/bpf/devmap.c:657:29: expected struct bpf_dtab_netdev *dst
>>>>> kernel/bpf/devmap.c:657:29: got struct bpf_dtab_netdev [noderef] __rcu *
>>>>
>>>> Hmm, but those shouldn't be there either. Seems I missed those when
>>>> rebasing, will send a follow-up patch...
>>>
>>> Just check out different versions of sparse and average the results? ;-)
>>>
>>> Thanx, Paul
>>
>> Hi Paul,
>>
>> I tested the original attached config with the reproduce step, and I can
>> reproduce the warning:
>>
>> $ COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1
>> CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' W=1 ARCH=ia64 kernel/bpf/
>> ...
>> kernel/bpf/devmap.c:561:29: sparse: warning: incorrect type in assignment
>> (different address spaces)
>> 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: warning: incorrect type in assignment
>> (different address spaces)
>> 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: warning: cast removes address space
>> '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: warning: cast removes address space
>> '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: warning: cast removes address space
>> '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: warning: cast removes address space
>> '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: warning: cast removes address space
>> '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: warning: cast removes address space
>> '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: warning: cast removes address space
>> '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: warning: cast removes address space
>> '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: warning: cast removes address space
>> '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: warning: cast removes address space
>> '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: warning: cast removes address space
>> '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: warning: cast removes address space
>> '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: warning: cast removes address space
>> '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: warning: cast removes address space
>> '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: warning: cast removes address space
>> '__rcu' of expression
>> kernel/bpf/devmap.c:1030:40: sparse: warning: cast removes address space
>> '__rcu' of expression
>>
>> and sparse is from latest master branch:
>> $ sparse --version
>> v0.6.3-341-g8af24329
>
> OK, we really are running the same sparse. And even the same gcc.
>
> I did only a "make defconfig" followed by a "C=2" native build
> on x86. Is your "ARCH=ia64" required, or does sparse also get
> you these same errors on x86?
>
> Thanx, Paul
>
Hi Paul,
I can't get the error on x86:
$ make --jobs=16 C=1 CF=-fdiagnostic-prefix -D__CHECK_ENDIAN__ W=1
ARCH=x86_64 kernel/bpf/
DESCEND objtool
CALL scripts/atomic/check-atomics.sh
CALL scripts/checksyscalls.sh
CC kernel/bpf/devmap.o
CHECK kernel/bpf/devmap.c
kernel/bpf/devmap.c:561:29: sparse: warning: incorrect type in
assignment (different address spaces)
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: warning: incorrect type in
assignment (different address spaces)
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 *
AR kernel/bpf/built-in.a
Best Regards,
Rong Chen
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [bpf-next:master 15/30] kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
2021-06-30 7:31 ` Chen, Rong A
@ 2021-06-30 15:38 ` Paul E. McKenney
0 siblings, 0 replies; 9+ messages in thread
From: Paul E. McKenney @ 2021-06-30 15:38 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 6428 bytes --]
On Wed, Jun 30, 2021 at 03:31:57PM +0800, Chen, Rong A wrote:
>
>
> On 6/30/2021 12:57 AM, Paul E. McKenney wrote:
> > On Tue, Jun 29, 2021 at 04:47:17PM +0800, Chen, Rong A wrote:
> > >
> > >
> > > On 6/29/2021 6:53 AM, Paul E. McKenney wrote:
> > > > On Tue, Jun 29, 2021 at 12:42:52AM +0200, Toke Høiland-Jørgensen wrote:
> > > > > "Paul E. McKenney" <paulmck@kernel.org> writes:
> > > > >
> > > > > > On Sat, Jun 26, 2021 at 12:00:55PM +0200, Toke Høiland-Jørgensen wrote:
> > > > > > > +Paul - any idea why unrcu_pointer() isn't working here?
> > > > > >
> > > > > > Hello, Toke!
> > > > > >
> > > > > > My distro version of sparse core-dumped before getting that far along.
> > > > > >
> > > > > > I cloned and built the latest version, and got only the following errors
> > > > > > from kernel/bpf/devmap.c:
> > > > > >
> > > > > > ------------------------------------------------------------------------
> > > > > >
> > > > > > CHECK scripts/mod/empty.c
> > > > > > CALL scripts/checksyscalls.sh
> > > > > > CALL scripts/atomic/check-atomics.sh
> > > > > > DESCEND objtool
> > > > > > CC kernel/bpf/devmap.o
> > > > > > CHECK kernel/bpf/devmap.c
> > > > > > kernel/bpf/devmap.c:561:29: warning: incorrect type in assignment (different address spaces)
> > > > > > kernel/bpf/devmap.c:561:29: expected struct bpf_dtab_netdev *dst
> > > > > > kernel/bpf/devmap.c:561:29: got struct bpf_dtab_netdev [noderef] __rcu *
> > > > > > kernel/bpf/devmap.c:657:29: warning: incorrect type in assignment (different address spaces)
> > > > > > kernel/bpf/devmap.c:657:29: expected struct bpf_dtab_netdev *dst
> > > > > > kernel/bpf/devmap.c:657:29: got struct bpf_dtab_netdev [noderef] __rcu *
> > > > >
> > > > > Hmm, but those shouldn't be there either. Seems I missed those when
> > > > > rebasing, will send a follow-up patch...
> > > >
> > > > Just check out different versions of sparse and average the results? ;-)
> > > >
> > > > Thanx, Paul
> > >
> > > Hi Paul,
> > >
> > > I tested the original attached config with the reproduce step, and I can
> > > reproduce the warning:
> > >
> > > $ COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1
> > > CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' W=1 ARCH=ia64 kernel/bpf/
> > > ...
> > > kernel/bpf/devmap.c:561:29: sparse: warning: incorrect type in assignment
> > > (different address spaces)
> > > 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: warning: incorrect type in assignment
> > > (different address spaces)
> > > 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: warning: cast removes address space
> > > '__rcu' of expression
> > > kernel/bpf/devmap.c:1030:40: sparse: warning: cast removes address space
> > > '__rcu' of expression
> > > kernel/bpf/devmap.c:1030:40: sparse: warning: cast removes address space
> > > '__rcu' of expression
> > > kernel/bpf/devmap.c:1030:40: sparse: warning: cast removes address space
> > > '__rcu' of expression
> > > kernel/bpf/devmap.c:1030:40: sparse: warning: cast removes address space
> > > '__rcu' of expression
> > > kernel/bpf/devmap.c:1030:40: sparse: warning: cast removes address space
> > > '__rcu' of expression
> > > kernel/bpf/devmap.c:1030:40: sparse: warning: cast removes address space
> > > '__rcu' of expression
> > > kernel/bpf/devmap.c:1030:40: sparse: warning: cast removes address space
> > > '__rcu' of expression
> > > kernel/bpf/devmap.c:1030:40: sparse: warning: cast removes address space
> > > '__rcu' of expression
> > > kernel/bpf/devmap.c:1030:40: sparse: warning: cast removes address space
> > > '__rcu' of expression
> > > kernel/bpf/devmap.c:1030:40: sparse: warning: cast removes address space
> > > '__rcu' of expression
> > > kernel/bpf/devmap.c:1030:40: sparse: warning: cast removes address space
> > > '__rcu' of expression
> > > kernel/bpf/devmap.c:1030:40: sparse: warning: cast removes address space
> > > '__rcu' of expression
> > > kernel/bpf/devmap.c:1030:40: sparse: warning: cast removes address space
> > > '__rcu' of expression
> > > kernel/bpf/devmap.c:1030:40: sparse: warning: cast removes address space
> > > '__rcu' of expression
> > > kernel/bpf/devmap.c:1030:40: sparse: warning: cast removes address space
> > > '__rcu' of expression
> > >
> > > and sparse is from latest master branch:
> > > $ sparse --version
> > > v0.6.3-341-g8af24329
> >
> > OK, we really are running the same sparse. And even the same gcc.
> >
> > I did only a "make defconfig" followed by a "C=2" native build
> > on x86. Is your "ARCH=ia64" required, or does sparse also get
> > you these same errors on x86?
> >
> > Thanx, Paul
> >
>
> Hi Paul,
>
> I can't get the error on x86:
>
> $ make --jobs=16 C=1 CF=-fdiagnostic-prefix -D__CHECK_ENDIAN__ W=1
> ARCH=x86_64 kernel/bpf/
> DESCEND objtool
> CALL scripts/atomic/check-atomics.sh
> CALL scripts/checksyscalls.sh
> CC kernel/bpf/devmap.o
> CHECK kernel/bpf/devmap.c
> kernel/bpf/devmap.c:561:29: sparse: warning: incorrect type in assignment
> (different address spaces)
> 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: warning: incorrect type in assignment
> (different address spaces)
> 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 *
> AR kernel/bpf/built-in.a
This looks similar to what I saw, and I believe that Toke sent out a
patch for these.
So this is likely to be an architecture-specific bug in IA64, correct?
I was going to add the IA64 maintainers on CC, but:
IA64 (Itanium) PLATFORM
L: linux-ia64(a)vger.kernel.org
S: Orphan
F: Documentation/ia64/
F: arch/ia64/
Over to you in your role as an Intel employee! ;-)
Thanx, Paul
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2021-06-30 15:38 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-26 8:41 [bpf-next:master 15/30] kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression kernel test robot
2021-06-26 10:00 ` Toke Høiland-Jørgensen
2021-06-28 15:53 ` Paul E. McKenney
2021-06-28 22:42 ` Toke Høiland-Jørgensen
2021-06-28 22:53 ` Paul E. McKenney
2021-06-29 8:47 ` Chen, Rong A
2021-06-29 16:57 ` Paul E. McKenney
2021-06-30 7:31 ` Chen, Rong A
2021-06-30 15:38 ` Paul E. McKenney
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.