All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: "Toke Høiland-Jørgensen" <toke@redhat.com>
Cc: kbuild-all@lists.01.org, linux-kernel@vger.kernel.org,
	Daniel Borkmann <daniel@iogearbox.net>
Subject: kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
Date: Sat, 20 Nov 2021 09:45:55 +0800	[thread overview]
Message-ID: <202111200946.PqwZ3DUo-lkp@intel.com> (raw)

[-- 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 --]

WARNING: multiple messages have this Message-ID (diff)
From: kernel test robot <lkp@intel.com>
To: kbuild-all@lists.01.org
Subject: kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression
Date: Sat, 20 Nov 2021 09:45:55 +0800	[thread overview]
Message-ID: <202111200946.PqwZ3DUo-lkp@intel.com> (raw)

[-- 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 --]

             reply	other threads:[~2021-11-20  1:46 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-20  1:45 kernel test robot [this message]
2021-11-20  1:45 ` kernel/bpf/devmap.c:1030:40: sparse: sparse: cast removes address space '__rcu' of expression kernel test robot
2022-05-22 12:30 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 12:00       ` Luc Van Oostenryck
2022-06-01 11:59         ` Luc Van Oostenryck
2022-06-01 12:00         ` Luc Van Oostenryck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202111200946.PqwZ3DUo-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=daniel@iogearbox.net \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=toke@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.