linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: core: sock_map: Use built-in RCU list checking
@ 2020-02-21 17:03 madhuparnabhowmik10
  2020-02-23  1:06 ` kbuild test robot
  0 siblings, 1 reply; 2+ messages in thread
From: madhuparnabhowmik10 @ 2020-02-21 17:03 UTC (permalink / raw)
  To: john.fastabend, daniel, davem
  Cc: netdev, bpf, linux-kernel, joel, frextrite, linux-kernel-mentees,
	paulmck, Madhuparna Bhowmik

From: Madhuparna Bhowmik <madhuparnabhowmik10@gmail.com>

hlist_for_each_entry_rcu() has built-in RCU and lock checking.

Pass cond argument to list_for_each_entry_rcu() to silence
false lockdep warning when CONFIG_PROVE_RCU_LIST is enabled
by default.

Signed-off-by: Madhuparna Bhowmik <madhuparnabhowmik10@gmail.com>
---
 net/core/sock_map.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/core/sock_map.c b/net/core/sock_map.c
index eb114ee419b6..c1549f189b0d 100644
--- a/net/core/sock_map.c
+++ b/net/core/sock_map.c
@@ -546,7 +546,7 @@ sock_hash_lookup_elem_raw(struct hlist_head *head, u32 hash, void *key,
 {
 	struct bpf_htab_elem *elem;
 
-	hlist_for_each_entry_rcu(elem, head, node) {
+	hlist_for_each_entry_rcu(elem, head, node, lockdep_is_held(&bucket->lock)) {
 		if (elem->hash == hash &&
 		    !memcmp(&elem->key, key, key_size))
 			return elem;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] net: core: sock_map: Use built-in RCU list checking
  2020-02-21 17:03 [PATCH] net: core: sock_map: Use built-in RCU list checking madhuparnabhowmik10
@ 2020-02-23  1:06 ` kbuild test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kbuild test robot @ 2020-02-23  1:06 UTC (permalink / raw)
  To: madhuparnabhowmik10
  Cc: kbuild-all, john.fastabend, daniel, davem, netdev, bpf,
	linux-kernel, joel, frextrite, linux-kernel-mentees, paulmck,
	Madhuparna Bhowmik

[-- Attachment #1: Type: text/plain, Size: 3786 bytes --]

Hi,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v5.6-rc2 next-20200221]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/madhuparnabhowmik10-gmail-com/net-core-sock_map-Use-built-in-RCU-list-checking/20200223-040222
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 0a115e5f23b948be369faf14d3bccab283830f56
config: x86_64-randconfig-a002-20200223 (attached as .config)
compiler: gcc-6 (Debian 6.3.0-18+deb9u1) 6.3.0 20170516
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   In file included from include/linux/workqueue.h:16:0,
                    from include/linux/bpf.h:9,
                    from net/core/sock_map.c:4:
   net/core/sock_map.c: In function 'sock_hash_lookup_elem_raw':
>> net/core/sock_map.c:555:62: error: 'bucket' undeclared (first use in this function)
     hlist_for_each_entry_rcu(elem, head, node, lockdep_is_held(&bucket->lock)) {
                                                                 ^
   include/linux/rcupdate.h:263:52: note: in definition of macro 'RCU_LOCKDEP_WARN'
      if (debug_lockdep_rcu_enabled() && !__warned && (c)) { \
                                                       ^
   include/linux/rculist.h:656:7: note: in expansion of macro '__list_check_rcu'
     for (__list_check_rcu(dummy, ## cond, 0),   \
          ^~~~~~~~~~~~~~~~
   include/linux/rculist.h:656:34: note: in expansion of macro 'lockdep_is_held'
     for (__list_check_rcu(dummy, ## cond, 0),   \
                                     ^~~~
   net/core/sock_map.c:555:2: note: in expansion of macro 'hlist_for_each_entry_rcu'
     hlist_for_each_entry_rcu(elem, head, node, lockdep_is_held(&bucket->lock)) {
     ^~~~~~~~~~~~~~~~~~~~~~~~
   net/core/sock_map.c:555:62: note: each undeclared identifier is reported only once for each function it appears in
     hlist_for_each_entry_rcu(elem, head, node, lockdep_is_held(&bucket->lock)) {
                                                                 ^
   include/linux/rcupdate.h:263:52: note: in definition of macro 'RCU_LOCKDEP_WARN'
      if (debug_lockdep_rcu_enabled() && !__warned && (c)) { \
                                                       ^
   include/linux/rculist.h:656:7: note: in expansion of macro '__list_check_rcu'
     for (__list_check_rcu(dummy, ## cond, 0),   \
          ^~~~~~~~~~~~~~~~
   include/linux/rculist.h:656:34: note: in expansion of macro 'lockdep_is_held'
     for (__list_check_rcu(dummy, ## cond, 0),   \
                                     ^~~~
   net/core/sock_map.c:555:2: note: in expansion of macro 'hlist_for_each_entry_rcu'
     hlist_for_each_entry_rcu(elem, head, node, lockdep_is_held(&bucket->lock)) {
     ^~~~~~~~~~~~~~~~~~~~~~~~

vim +/bucket +555 net/core/sock_map.c

   548	
   549	static struct bpf_htab_elem *
   550	sock_hash_lookup_elem_raw(struct hlist_head *head, u32 hash, void *key,
   551				  u32 key_size)
   552	{
   553		struct bpf_htab_elem *elem;
   554	
 > 555		hlist_for_each_entry_rcu(elem, head, node, lockdep_is_held(&bucket->lock)) {
   556			if (elem->hash == hash &&
   557			    !memcmp(&elem->key, key, key_size))
   558				return elem;
   559		}
   560	
   561		return NULL;
   562	}
   563	

---
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: 31969 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-02-23  1:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-21 17:03 [PATCH] net: core: sock_map: Use built-in RCU list checking madhuparnabhowmik10
2020-02-23  1:06 ` kbuild test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).