Re: [PATCH] irqbypass: convert producers/consumers single linked list to hlist

From: kernel test robot
Date: Tue Feb 28 2023 - 23:12:14 EST


Hi Longpeng(Mike),

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v6.2 next-20230301]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Longpeng-Mike/irqbypass-convert-producers-consumers-single-linked-list-to-hlist/20230301-101936
patch link: https://lore.kernel.org/r/20230301021830.880-1-longpeng2%40huawei.com
patch subject: [PATCH] irqbypass: convert producers/consumers single linked list to hlist
config: m68k-allyesconfig (https://download.01.org/0day-ci/archive/20230301/202303011218.cfYZyYAh-lkp@xxxxxxxxx/config)
compiler: m68k-linux-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/4dcec57dc5acaecbf3bb03634ab1ef6a696927be
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Longpeng-Mike/irqbypass-convert-producers-consumers-single-linked-list-to-hlist/20230301-101936
git checkout 4dcec57dc5acaecbf3bb03634ab1ef6a696927be
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=m68k olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=m68k SHELL=/bin/bash virt/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Link: https://lore.kernel.org/oe-kbuild-all/202303011218.cfYZyYAh-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

In file included from include/linux/irqbypass.h:11,
from virt/lib/irqbypass.c:17:
virt/lib/irqbypass.c: In function 'find_producer_by_token':
>> virt/lib/irqbypass.c:42:59: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
42 | hash_for_each_possible(producers, producer, node, (uint64_t)token)
| ^
include/linux/list.h:1043:19: note: in definition of macro 'hlist_entry_safe'
1043 | ({ typeof(ptr) ____ptr = (ptr); \
| ^~~
include/linux/hashtable.h:166:9: note: in expansion of macro 'hlist_for_each_entry'
166 | hlist_for_each_entry(obj, &name[hash_min(key, HASH_BITS(name))], member)
| ^~~~~~~~~~~~~~~~~~~~
include/linux/hashtable.h:166:41: note: in expansion of macro 'hash_min'
166 | hlist_for_each_entry(obj, &name[hash_min(key, HASH_BITS(name))], member)
| ^~~~~~~~
virt/lib/irqbypass.c:42:9: note: in expansion of macro 'hash_for_each_possible'
42 | hash_for_each_possible(producers, producer, node, (uint64_t)token)
| ^~~~~~~~~~~~~~~~~~~~~~
>> virt/lib/irqbypass.c:42:59: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
42 | hash_for_each_possible(producers, producer, node, (uint64_t)token)
| ^
include/linux/list.h:1043:19: note: in definition of macro 'hlist_entry_safe'
1043 | ({ typeof(ptr) ____ptr = (ptr); \
| ^~~
include/linux/hashtable.h:166:9: note: in expansion of macro 'hlist_for_each_entry'
166 | hlist_for_each_entry(obj, &name[hash_min(key, HASH_BITS(name))], member)
| ^~~~~~~~~~~~~~~~~~~~
include/linux/hashtable.h:166:41: note: in expansion of macro 'hash_min'
166 | hlist_for_each_entry(obj, &name[hash_min(key, HASH_BITS(name))], member)
| ^~~~~~~~
virt/lib/irqbypass.c:42:9: note: in expansion of macro 'hash_for_each_possible'
42 | hash_for_each_possible(producers, producer, node, (uint64_t)token)
| ^~~~~~~~~~~~~~~~~~~~~~
>> virt/lib/irqbypass.c:42:59: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
42 | hash_for_each_possible(producers, producer, node, (uint64_t)token)
| ^
include/linux/list.h:1043:19: note: in definition of macro 'hlist_entry_safe'
1043 | ({ typeof(ptr) ____ptr = (ptr); \
| ^~~
include/linux/hashtable.h:166:9: note: in expansion of macro 'hlist_for_each_entry'
166 | hlist_for_each_entry(obj, &name[hash_min(key, HASH_BITS(name))], member)
| ^~~~~~~~~~~~~~~~~~~~
include/linux/hashtable.h:32:50: note: in expansion of macro 'hash_long'
32 | (sizeof(val) <= 4 ? hash_32(val, bits) : hash_long(val, bits))
| ^~~~~~~~~
include/linux/hashtable.h:166:41: note: in expansion of macro 'hash_min'
166 | hlist_for_each_entry(obj, &name[hash_min(key, HASH_BITS(name))], member)
| ^~~~~~~~
virt/lib/irqbypass.c:42:9: note: in expansion of macro 'hash_for_each_possible'
42 | hash_for_each_possible(producers, producer, node, (uint64_t)token)
| ^~~~~~~~~~~~~~~~~~~~~~
>> virt/lib/irqbypass.c:42:59: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
42 | hash_for_each_possible(producers, producer, node, (uint64_t)token)
| ^
include/linux/list.h:1043:35: note: in definition of macro 'hlist_entry_safe'
1043 | ({ typeof(ptr) ____ptr = (ptr); \
| ^~~
include/linux/hashtable.h:166:9: note: in expansion of macro 'hlist_for_each_entry'
166 | hlist_for_each_entry(obj, &name[hash_min(key, HASH_BITS(name))], member)
| ^~~~~~~~~~~~~~~~~~~~
include/linux/hashtable.h:166:41: note: in expansion of macro 'hash_min'
166 | hlist_for_each_entry(obj, &name[hash_min(key, HASH_BITS(name))], member)
| ^~~~~~~~
virt/lib/irqbypass.c:42:9: note: in expansion of macro 'hash_for_each_possible'
42 | hash_for_each_possible(producers, producer, node, (uint64_t)token)
| ^~~~~~~~~~~~~~~~~~~~~~
>> virt/lib/irqbypass.c:42:59: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
42 | hash_for_each_possible(producers, producer, node, (uint64_t)token)
| ^
include/linux/list.h:1043:35: note: in definition of macro 'hlist_entry_safe'
1043 | ({ typeof(ptr) ____ptr = (ptr); \
| ^~~
include/linux/hashtable.h:166:9: note: in expansion of macro 'hlist_for_each_entry'
166 | hlist_for_each_entry(obj, &name[hash_min(key, HASH_BITS(name))], member)
| ^~~~~~~~~~~~~~~~~~~~
include/linux/hashtable.h:166:41: note: in expansion of macro 'hash_min'
166 | hlist_for_each_entry(obj, &name[hash_min(key, HASH_BITS(name))], member)
| ^~~~~~~~
virt/lib/irqbypass.c:42:9: note: in expansion of macro 'hash_for_each_possible'
42 | hash_for_each_possible(producers, producer, node, (uint64_t)token)
| ^~~~~~~~~~~~~~~~~~~~~~
>> virt/lib/irqbypass.c:42:59: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
42 | hash_for_each_possible(producers, producer, node, (uint64_t)token)
| ^
include/linux/list.h:1043:35: note: in definition of macro 'hlist_entry_safe'
1043 | ({ typeof(ptr) ____ptr = (ptr); \
| ^~~
include/linux/hashtable.h:166:9: note: in expansion of macro 'hlist_for_each_entry'
166 | hlist_for_each_entry(obj, &name[hash_min(key, HASH_BITS(name))], member)
| ^~~~~~~~~~~~~~~~~~~~
include/linux/hashtable.h:32:50: note: in expansion of macro 'hash_long'
32 | (sizeof(val) <= 4 ? hash_32(val, bits) : hash_long(val, bits))
| ^~~~~~~~~
include/linux/hashtable.h:166:41: note: in expansion of macro 'hash_min'
166 | hlist_for_each_entry(obj, &name[hash_min(key, HASH_BITS(name))], member)
| ^~~~~~~~
virt/lib/irqbypass.c:42:9: note: in expansion of macro 'hash_for_each_possible'
42 | hash_for_each_possible(producers, producer, node, (uint64_t)token)
| ^~~~~~~~~~~~~~~~~~~~~~
virt/lib/irqbypass.c: In function 'find_consumer_by_token':
virt/lib/irqbypass.c:54:59: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
54 | hash_for_each_possible(producers, consumer, node, (uint64_t)token)
| ^
include/linux/list.h:1043:19: note: in definition of macro 'hlist_entry_safe'
1043 | ({ typeof(ptr) ____ptr = (ptr); \
| ^~~
include/linux/hashtable.h:166:9: note: in expansion of macro 'hlist_for_each_entry'
166 | hlist_for_each_entry(obj, &name[hash_min(key, HASH_BITS(name))], member)
| ^~~~~~~~~~~~~~~~~~~~
include/linux/hashtable.h:166:41: note: in expansion of macro 'hash_min'
166 | hlist_for_each_entry(obj, &name[hash_min(key, HASH_BITS(name))], member)
| ^~~~~~~~
virt/lib/irqbypass.c:54:9: note: in expansion of macro 'hash_for_each_possible'
54 | hash_for_each_possible(producers, consumer, node, (uint64_t)token)
| ^~~~~~~~~~~~~~~~~~~~~~
virt/lib/irqbypass.c:54:59: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
54 | hash_for_each_possible(producers, consumer, node, (uint64_t)token)
| ^
include/linux/list.h:1043:19: note: in definition of macro 'hlist_entry_safe'
1043 | ({ typeof(ptr) ____ptr = (ptr); \
| ^~~
include/linux/hashtable.h:166:9: note: in expansion of macro 'hlist_for_each_entry'
166 | hlist_for_each_entry(obj, &name[hash_min(key, HASH_BITS(name))], member)
| ^~~~~~~~~~~~~~~~~~~~
include/linux/hashtable.h:166:41: note: in expansion of macro 'hash_min'
166 | hlist_for_each_entry(obj, &name[hash_min(key, HASH_BITS(name))], member)
| ^~~~~~~~
virt/lib/irqbypass.c:54:9: note: in expansion of macro 'hash_for_each_possible'
54 | hash_for_each_possible(producers, consumer, node, (uint64_t)token)
| ^~~~~~~~~~~~~~~~~~~~~~
virt/lib/irqbypass.c:54:59: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
54 | hash_for_each_possible(producers, consumer, node, (uint64_t)token)
| ^
include/linux/list.h:1043:19: note: in definition of macro 'hlist_entry_safe'
1043 | ({ typeof(ptr) ____ptr = (ptr); \
| ^~~
include/linux/hashtable.h:166:9: note: in expansion of macro 'hlist_for_each_entry'
166 | hlist_for_each_entry(obj, &name[hash_min(key, HASH_BITS(name))], member)
| ^~~~~~~~~~~~~~~~~~~~
include/linux/hashtable.h:32:50: note: in expansion of macro 'hash_long'
32 | (sizeof(val) <= 4 ? hash_32(val, bits) : hash_long(val, bits))
| ^~~~~~~~~
include/linux/hashtable.h:166:41: note: in expansion of macro 'hash_min'
166 | hlist_for_each_entry(obj, &name[hash_min(key, HASH_BITS(name))], member)
| ^~~~~~~~
virt/lib/irqbypass.c:54:9: note: in expansion of macro 'hash_for_each_possible'
54 | hash_for_each_possible(producers, consumer, node, (uint64_t)token)
| ^~~~~~~~~~~~~~~~~~~~~~
virt/lib/irqbypass.c:54:59: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
54 | hash_for_each_possible(producers, consumer, node, (uint64_t)token)
| ^
include/linux/list.h:1043:35: note: in definition of macro 'hlist_entry_safe'
1043 | ({ typeof(ptr) ____ptr = (ptr); \
| ^~~
include/linux/hashtable.h:166:9: note: in expansion of macro 'hlist_for_each_entry'
166 | hlist_for_each_entry(obj, &name[hash_min(key, HASH_BITS(name))], member)
| ^~~~~~~~~~~~~~~~~~~~
include/linux/hashtable.h:166:41: note: in expansion of macro 'hash_min'
166 | hlist_for_each_entry(obj, &name[hash_min(key, HASH_BITS(name))], member)
| ^~~~~~~~
virt/lib/irqbypass.c:54:9: note: in expansion of macro 'hash_for_each_possible'
54 | hash_for_each_possible(producers, consumer, node, (uint64_t)token)
| ^~~~~~~~~~~~~~~~~~~~~~
virt/lib/irqbypass.c:54:59: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
54 | hash_for_each_possible(producers, consumer, node, (uint64_t)token)
| ^
include/linux/list.h:1043:35: note: in definition of macro 'hlist_entry_safe'
1043 | ({ typeof(ptr) ____ptr = (ptr); \
| ^~~
include/linux/hashtable.h:166:9: note: in expansion of macro 'hlist_for_each_entry'
166 | hlist_for_each_entry(obj, &name[hash_min(key, HASH_BITS(name))], member)
| ^~~~~~~~~~~~~~~~~~~~
include/linux/hashtable.h:166:41: note: in expansion of macro 'hash_min'
166 | hlist_for_each_entry(obj, &name[hash_min(key, HASH_BITS(name))], member)
| ^~~~~~~~
virt/lib/irqbypass.c:54:9: note: in expansion of macro 'hash_for_each_possible'
54 | hash_for_each_possible(producers, consumer, node, (uint64_t)token)
| ^~~~~~~~~~~~~~~~~~~~~~
virt/lib/irqbypass.c:54:59: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
54 | hash_for_each_possible(producers, consumer, node, (uint64_t)token)
| ^
include/linux/list.h:1043:35: note: in definition of macro 'hlist_entry_safe'


vim +42 virt/lib/irqbypass.c

> 17 #include <linux/irqbypass.h>
18 #include <linux/list.h>
19 #include <linux/module.h>
20 #include <linux/mutex.h>
21 #include <linux/hashtable.h>
22
23 MODULE_LICENSE("GPL v2");
24 MODULE_DESCRIPTION("IRQ bypass manager utility module");
25
26 /*
27 * hash table for produces/consumers. This improve the performace to find
28 * an existing producer/consumer.
29 */
30 #define PRODUCERS_HASH_BITS 9
31 #define CONSUMERS_HASH_BITS 9
32 static DEFINE_HASHTABLE(producers, PRODUCERS_HASH_BITS);
33 static DEFINE_HASHTABLE(consumers, CONSUMERS_HASH_BITS);
34 static DEFINE_MUTEX(lock);
35
36
37 /* @lock must be held */
38 static struct irq_bypass_producer *find_producer_by_token(void *token)
39 {
40 struct irq_bypass_producer *producer;
41
> 42 hash_for_each_possible(producers, producer, node, (uint64_t)token)
43 if (producer->token == token)
44 return producer;
45
46 return NULL;
47 }
48

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests