* [axboe-block:io_uring-sendzc-provided 8/9] io_uring/kbuf.c:312:2: error: call to '__compiletime_assert_308' declared with 'error' attribute: BUILD_BUG_ON failed: sizeof(struct iovec) != sizeof(struct bio_vec)
@ 2024-10-20 18:19 kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2024-10-20 18:19 UTC (permalink / raw)
To: Jens Axboe; +Cc: llvm, oe-kbuild-all
tree: https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git io_uring-sendzc-provided
head: 5867ef85190744b26e0a5f7b1ee19c4744a92f29
commit: f5b285713cba03be9c941661157659aa29facca9 [8/9] io_uring/kbuf: add support for mapping type KBUF_MODE_BVEC
config: arm-allnoconfig (https://download.01.org/0day-ci/archive/20241021/202410210246.JPWRvAHU-lkp@intel.com/config)
compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project bfe84f7085d82d06d61c632a7bad1e692fd159e4)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241021/202410210246.JPWRvAHU-lkp@intel.com/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@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202410210246.JPWRvAHU-lkp@intel.com/
All errors (new ones prefixed by >>):
In file included from io_uring/kbuf.c:6:
In file included from include/linux/mm.h:2213:
include/linux/vmstat.h:518:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
518 | return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
| ~~~~~~~~~~~ ^ ~~~
>> io_uring/kbuf.c:312:2: error: call to '__compiletime_assert_308' declared with 'error' attribute: BUILD_BUG_ON failed: sizeof(struct iovec) != sizeof(struct bio_vec)
312 | BUILD_BUG_ON(sizeof(struct iovec) != sizeof(struct bio_vec));
| ^
include/linux/build_bug.h:50:2: note: expanded from macro 'BUILD_BUG_ON'
50 | BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
| ^
include/linux/build_bug.h:39:37: note: expanded from macro 'BUILD_BUG_ON_MSG'
39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
| ^
include/linux/compiler_types.h:517:2: note: expanded from macro 'compiletime_assert'
517 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
| ^
include/linux/compiler_types.h:505:2: note: expanded from macro '_compiletime_assert'
505 | __compiletime_assert(condition, msg, prefix, suffix)
| ^
include/linux/compiler_types.h:498:4: note: expanded from macro '__compiletime_assert'
498 | prefix ## suffix(); \
| ^
<scratch space>:109:1: note: expanded from here
109 | __compiletime_assert_308
| ^
>> io_uring/kbuf.c:312:2: error: call to '__compiletime_assert_308' declared with 'error' attribute: BUILD_BUG_ON failed: sizeof(struct iovec) != sizeof(struct bio_vec)
include/linux/build_bug.h:50:2: note: expanded from macro 'BUILD_BUG_ON'
50 | BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
| ^
include/linux/build_bug.h:39:37: note: expanded from macro 'BUILD_BUG_ON_MSG'
39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
| ^
include/linux/compiler_types.h:517:2: note: expanded from macro 'compiletime_assert'
517 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
| ^
include/linux/compiler_types.h:505:2: note: expanded from macro '_compiletime_assert'
505 | __compiletime_assert(condition, msg, prefix, suffix)
| ^
include/linux/compiler_types.h:498:4: note: expanded from macro '__compiletime_assert'
498 | prefix ## suffix(); \
| ^
<scratch space>:109:1: note: expanded from here
109 | __compiletime_assert_308
| ^
1 warning and 2 errors generated.
vim +312 io_uring/kbuf.c
301
302 static int io_ring_buffers_peek(struct io_kiocb *req, struct buf_sel_arg *arg,
303 struct io_buffer_list *bl, int *nbufs)
304 {
305 struct io_uring_buf_ring *br = bl->buf_ring;
306 struct iovec *iov = arg->iovs;
307 int nr_iovs = arg->nr_vecs;
308 __u16 nr_avail, tail, head;
309 struct io_uring_buf *buf;
310 int vec_off;
311
> 312 BUILD_BUG_ON(sizeof(struct iovec) != sizeof(struct bio_vec));
313
314 tail = smp_load_acquire(&br->tail);
315 head = bl->head;
316 nr_avail = min_t(__u16, tail - head, UIO_MAXIOV);
317 if (unlikely(!nr_avail))
318 return -ENOBUFS;
319
320 buf = io_ring_head_to_buf(br, head, bl->mask);
321 if (arg->max_len) {
322 u32 len = READ_ONCE(buf->len);
323
324 if (unlikely(!len))
325 return -ENOBUFS;
326 /*
327 * Limit incremental buffers to 1 segment. No point trying
328 * to peek ahead and map more than we need, when the buffers
329 * themselves should be large when setup with
330 * IOU_PBUF_RING_INC.
331 */
332 if (bl->flags & IOBL_INC) {
333 nr_avail = 1;
334 } else {
335 size_t needed;
336
337 needed = (arg->max_len + len - 1) / len;
338 needed = min_not_zero(needed, (size_t) PEEK_MAX_IMPORT);
339 if (nr_avail > needed)
340 nr_avail = needed;
341 }
342 }
343
344 /*
345 * only alloc a bigger array if we know we have data to map, eg not
346 * a speculative peek operation. Note that struct bio_vec and
347 * struct iovec are the same size, so we can use them interchangably
348 * here as it's just for sizing purposes.
349 */
350 if (arg->mode & KBUF_MODE_EXPAND && nr_avail > nr_iovs && arg->max_len) {
351 iov = kmalloc_array(nr_avail, sizeof(struct iovec), GFP_KERNEL);
352 if (unlikely(!iov))
353 return -ENOMEM;
354 if (arg->mode & KBUF_MODE_FREE)
355 kfree(arg->iovs);
356 arg->iovs = iov;
357 nr_iovs = nr_avail;
358 arg->mode |= KBUF_MODE_FREE;
359 } else if (nr_avail < nr_iovs) {
360 nr_iovs = nr_avail;
361 }
362
363 /* set it to max, if not set, so we can use it unconditionally */
364 if (!arg->max_len)
365 arg->max_len = INT_MAX;
366
367 vec_off = 0;
368 req->buf_index = buf->bid;
369 do {
370 u32 len = buf->len;
371
372 /* truncate end piece, if needed, for non partial buffers */
373 if (len > arg->max_len) {
374 len = arg->max_len;
375 if (!(bl->flags & IOBL_INC))
376 buf->len = len;
377 }
378
379 if (arg->mode & KBUF_MODE_BVEC) {
380 int ret;
381
382 ret = io_fill_bvecs(req->ctx, buf->addr, arg, len, &vec_off);
383 if (unlikely(ret < 0))
384 return ret;
385 len = ret;
386 } else {
387 iov->iov_base = u64_to_user_ptr(buf->addr);
388 iov->iov_len = len;
389 iov++;
390 vec_off++;
391 }
392
393 arg->out_len += len;
394 arg->max_len -= len;
395 (*nbufs)++;
396 if (!arg->max_len)
397 break;
398 buf = io_ring_head_to_buf(br, ++head, bl->mask);
399 } while (--nr_iovs);
400
401 if (head == tail)
402 req->flags |= REQ_F_BL_EMPTY;
403
404 req->flags |= REQ_F_BUFFER_RING;
405 req->buf_list = bl;
406 return vec_off;
407 }
408
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-10-20 18:20 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-20 18:19 [axboe-block:io_uring-sendzc-provided 8/9] io_uring/kbuf.c:312:2: error: call to '__compiletime_assert_308' declared with 'error' attribute: BUILD_BUG_ON failed: sizeof(struct iovec) != sizeof(struct bio_vec) kernel test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox