Re: [PATCH 2/7] poll: Add a poll_flags for poll_queue_proc()

From: kernel test robot
Date: Wed Sep 06 2023 - 16:54:12 EST


Hi Peter,

kernel test robot noticed the following build errors:

[auto build test ERROR on akpm-mm/mm-everything]

url: https://github.com/intel-lab-lkp/linux/commits/Peter-Xu/mm-userfaultfd-Make-uffd-read-wait-event-exclusive/20230906-054430
base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
patch link: https://lore.kernel.org/r/20230905214235.320571-3-peterx%40redhat.com
patch subject: [PATCH 2/7] poll: Add a poll_flags for poll_queue_proc()
config: hexagon-randconfig-002-20230906 (https://download.01.org/0day-ci/archive/20230907/202309070440.eKzBcg8X-lkp@xxxxxxxxx/config)
compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project.git f28c006a5895fc0e329fe15fead81e37457cb1d1)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20230907/202309070440.eKzBcg8X-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202309070440.eKzBcg8X-lkp@xxxxxxxxx/

All errors (new ones prefixed by >>):

In file included from drivers/vhost/vhost.c:14:
In file included from include/uapi/linux/vhost.h:14:
In file included from include/uapi/linux/vhost_types.h:16:
In file included from include/linux/virtio_config.h:7:
In file included from include/linux/virtio.h:7:
In file included from include/linux/scatterlist.h:9:
In file included from arch/hexagon/include/asm/io.h:337:
include/asm-generic/io.h:547:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
val = __raw_readb(PCI_IOBASE + addr);
~~~~~~~~~~ ^
include/asm-generic/io.h:560:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr));
~~~~~~~~~~ ^
include/uapi/linux/byteorder/little_endian.h:37:51: note: expanded from macro '__le16_to_cpu'
#define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
^
In file included from drivers/vhost/vhost.c:14:
In file included from include/uapi/linux/vhost.h:14:
In file included from include/uapi/linux/vhost_types.h:16:
In file included from include/linux/virtio_config.h:7:
In file included from include/linux/virtio.h:7:
In file included from include/linux/scatterlist.h:9:
In file included from arch/hexagon/include/asm/io.h:337:
include/asm-generic/io.h:573:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
~~~~~~~~~~ ^
include/uapi/linux/byteorder/little_endian.h:35:51: note: expanded from macro '__le32_to_cpu'
#define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
^
In file included from drivers/vhost/vhost.c:14:
In file included from include/uapi/linux/vhost.h:14:
In file included from include/uapi/linux/vhost_types.h:16:
In file included from include/linux/virtio_config.h:7:
In file included from include/linux/virtio.h:7:
In file included from include/linux/scatterlist.h:9:
In file included from arch/hexagon/include/asm/io.h:337:
include/asm-generic/io.h:584:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
__raw_writeb(value, PCI_IOBASE + addr);
~~~~~~~~~~ ^
include/asm-generic/io.h:594:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
__raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
~~~~~~~~~~ ^
include/asm-generic/io.h:604:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
__raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
~~~~~~~~~~ ^
>> drivers/vhost/vhost.c:193:41: error: incompatible function pointer types passing 'int (wait_queue_entry_t *, unsigned int, int, void *, poll_flags)' (aka 'int (struct wait_queue_entry *, unsigned int, int, void *, unsigned int)') to parameter of type 'wait_queue_func_t' (aka 'int (*)(struct wait_queue_entry *, unsigned int, int, void *)') [-Werror,-Wincompatible-function-pointer-types]
init_waitqueue_func_entry(&poll->wait, vhost_poll_wakeup);
^~~~~~~~~~~~~~~~~
include/linux/wait.h:90:80: note: passing argument to parameter 'func' here
init_waitqueue_func_entry(struct wait_queue_entry *wq_entry, wait_queue_func_t func)
^
>> drivers/vhost/vhost.c:194:34: error: incompatible function pointer types passing 'void (struct file *, wait_queue_head_t *, poll_table *)' (aka 'void (struct file *, struct wait_queue_head *, struct poll_table_struct *)') to parameter of type 'poll_queue_proc' (aka 'void (*)(struct file *, struct wait_queue_head *, struct poll_table_struct *, unsigned int)') [-Werror,-Wincompatible-function-pointer-types]
init_poll_funcptr(&poll->table, vhost_poll_func);
^~~~~~~~~~~~~~~
include/linux/poll.h:76:70: note: passing argument to parameter 'qproc' here
static inline void init_poll_funcptr(poll_table *pt, poll_queue_proc qproc)
^
>> drivers/vhost/vhost.c:215:57: error: too few arguments to function call, expected 5, have 4
vhost_poll_wakeup(&poll->wait, 0, 0, poll_to_key(mask));
~~~~~~~~~~~~~~~~~ ^
drivers/vhost/vhost.c:164:12: note: 'vhost_poll_wakeup' declared here
static int vhost_poll_wakeup(wait_queue_entry_t *wait, unsigned mode, int sync,
^
6 warnings and 3 errors generated.


vim +193 drivers/vhost/vhost.c

87d6a412bd1ed8 Michael S. Tsirkin 2010-09-02 187
3a4d5c94e95935 Michael S. Tsirkin 2010-01-14 188 /* Init poll structure */
c23f3445e68e1d Tejun Heo 2010-06-02 189 void vhost_poll_init(struct vhost_poll *poll, vhost_work_fn_t fn,
493b94bf5ae0f6 Mike Christie 2023-06-26 190 __poll_t mask, struct vhost_dev *dev,
493b94bf5ae0f6 Mike Christie 2023-06-26 191 struct vhost_virtqueue *vq)
3a4d5c94e95935 Michael S. Tsirkin 2010-01-14 192 {
3a4d5c94e95935 Michael S. Tsirkin 2010-01-14 @193 init_waitqueue_func_entry(&poll->wait, vhost_poll_wakeup);
3a4d5c94e95935 Michael S. Tsirkin 2010-01-14 @194 init_poll_funcptr(&poll->table, vhost_poll_func);
3a4d5c94e95935 Michael S. Tsirkin 2010-01-14 195 poll->mask = mask;
c23f3445e68e1d Tejun Heo 2010-06-02 196 poll->dev = dev;
2b8b328b61c799 Jason Wang 2013-01-28 197 poll->wqh = NULL;
493b94bf5ae0f6 Mike Christie 2023-06-26 198 poll->vq = vq;
c23f3445e68e1d Tejun Heo 2010-06-02 199
87d6a412bd1ed8 Michael S. Tsirkin 2010-09-02 200 vhost_work_init(&poll->work, fn);
3a4d5c94e95935 Michael S. Tsirkin 2010-01-14 201 }
6ac1afbf6132df Asias He 2013-05-06 202 EXPORT_SYMBOL_GPL(vhost_poll_init);
3a4d5c94e95935 Michael S. Tsirkin 2010-01-14 203
3a4d5c94e95935 Michael S. Tsirkin 2010-01-14 204 /* Start polling a file. We add ourselves to file's wait queue. The caller must
3a4d5c94e95935 Michael S. Tsirkin 2010-01-14 205 * keep a reference to a file until after vhost_poll_stop is called. */
2b8b328b61c799 Jason Wang 2013-01-28 206 int vhost_poll_start(struct vhost_poll *poll, struct file *file)
3a4d5c94e95935 Michael S. Tsirkin 2010-01-14 207 {
e6c8adca20ba45 Al Viro 2017-07-03 208 __poll_t mask;
d47effe1be0c4f Krishna Kumar 2011-03-01 209
70181d51209cbc Jason Wang 2013-04-10 210 if (poll->wqh)
70181d51209cbc Jason Wang 2013-04-10 211 return 0;
70181d51209cbc Jason Wang 2013-04-10 212
9965ed174e7d38 Christoph Hellwig 2018-03-05 213 mask = vfs_poll(file, &poll->table);
3a4d5c94e95935 Michael S. Tsirkin 2010-01-14 214 if (mask)
3ad6f93e98d6df Al Viro 2017-07-03 @215 vhost_poll_wakeup(&poll->wait, 0, 0, poll_to_key(mask));
a9a08845e9acbd Linus Torvalds 2018-02-11 216 if (mask & EPOLLERR) {
dc6455a71c7fc5 Jason Wang 2018-03-27 217 vhost_poll_stop(poll);
896fc242bc1d26 Yunsheng Lin 2019-08-20 218 return -EINVAL;
2b8b328b61c799 Jason Wang 2013-01-28 219 }
2b8b328b61c799 Jason Wang 2013-01-28 220
896fc242bc1d26 Yunsheng Lin 2019-08-20 221 return 0;
3a4d5c94e95935 Michael S. Tsirkin 2010-01-14 222 }
6ac1afbf6132df Asias He 2013-05-06 223 EXPORT_SYMBOL_GPL(vhost_poll_start);
3a4d5c94e95935 Michael S. Tsirkin 2010-01-14 224

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