[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202210131210.8Pjd4Nca-lkp@intel.com>
Date: Thu, 13 Oct 2022 21:48:09 +0800
From: kernel test robot <lkp@...el.com>
To: Bart Van Assche <bvanassche@....org>
Cc: llvm@...ts.linux.dev, kbuild-all@...ts.01.org,
linux-kernel@...r.kernel.org
Subject: [bvanassche:block-barrier 1/4] kernel/trace/blktrace.c:239:10:
warning: shift count is negative
tree: https://github.com/bvanassche/linux block-barrier
head: dde514bc95cdec20aea9a5cd9186cd18272d3552
commit: b2789e48235e043851a30f528686b41604f35d89 [1/4] block: Introduce the REQ_FLUSH_IS_BARRIER flag
config: hexagon-randconfig-r041-20221012
compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project 791a7ae1ba3efd6bca96338e10ffde557ba83920)
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/bvanassche/linux/commit/b2789e48235e043851a30f528686b41604f35d89
git remote add bvanassche https://github.com/bvanassche/linux
git fetch --no-tags bvanassche block-barrier
git checkout b2789e48235e043851a30f528686b41604f35d89
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash kernel/trace/
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@...el.com>
All warnings (new ones prefixed by >>):
In file included from kernel/trace/blktrace.c:10:
In file included from include/linux/blkdev.h:9:
In file included from include/linux/blk_types.h:10:
In file included from include/linux/bvec.h:10:
In file included from include/linux/highmem.h:11:
In file included from include/linux/hardirq.h:11:
In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1:
In file included from include/asm-generic/hardirq.h:17:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:13:
In file included from arch/hexagon/include/asm/io.h:334:
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 kernel/trace/blktrace.c:10:
In file included from include/linux/blkdev.h:9:
In file included from include/linux/blk_types.h:10:
In file included from include/linux/bvec.h:10:
In file included from include/linux/highmem.h:11:
In file included from include/linux/hardirq.h:11:
In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1:
In file included from include/asm-generic/hardirq.h:17:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:13:
In file included from arch/hexagon/include/asm/io.h:334:
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 kernel/trace/blktrace.c:10:
In file included from include/linux/blkdev.h:9:
In file included from include/linux/blk_types.h:10:
In file included from include/linux/bvec.h:10:
In file included from include/linux/highmem.h:11:
In file included from include/linux/hardirq.h:11:
In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1:
In file included from include/asm-generic/hardirq.h:17:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:13:
In file included from arch/hexagon/include/asm/io.h:334:
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);
~~~~~~~~~~ ^
>> kernel/trace/blktrace.c:239:10: warning: shift count is negative [-Wshift-count-negative]
what |= MASK_TC_BIT(opf, PREFLUSH);
^~~~~~~~~~~~~~~~~~~~~~~~~~
kernel/trace/blktrace.c:208:69: note: expanded from macro 'MASK_TC_BIT'
#define MASK_TC_BIT(rw, __name) ((__force u32)(rw & REQ_ ## __name) << \
^
7 warnings generated.
vim +239 kernel/trace/blktrace.c
7b6d91daee5cac kernel/trace/blktrace.c Christoph Hellwig 2010-08-07 206
35ba8f7083e876 block/blktrace.c David Woodhouse 2008-08-10 207 /* The ilog2() calls fall out because they're constant */
919dbca8670d0f kernel/trace/blktrace.c Bart Van Assche 2022-07-14 208 #define MASK_TC_BIT(rw, __name) ((__force u32)(rw & REQ_ ## __name) << \
7b6d91daee5cac kernel/trace/blktrace.c Christoph Hellwig 2010-08-07 209 (ilog2(BLK_TC_ ## __name) + BLK_TC_SHIFT - __REQ_ ## __name))
2056a782f8e7e6 block/blktrace.c Jens Axboe 2006-03-23 210
2056a782f8e7e6 block/blktrace.c Jens Axboe 2006-03-23 211 /*
2056a782f8e7e6 block/blktrace.c Jens Axboe 2006-03-23 212 * The worker for the various blk_add_trace*() types. Fills out a
2056a782f8e7e6 block/blktrace.c Jens Axboe 2006-03-23 213 * blk_io_trace structure and places it in a per-cpu subbuffer.
2056a782f8e7e6 block/blktrace.c Jens Axboe 2006-03-23 214 */
5f3ea37c7716db block/blktrace.c Arnaldo Carvalho de Melo 2008-10-30 215 static void __blk_add_trace(struct blk_trace *bt, sector_t sector, int bytes,
919dbca8670d0f kernel/trace/blktrace.c Bart Van Assche 2022-07-14 216 const blk_opf_t opf, u32 what, int error,
919dbca8670d0f kernel/trace/blktrace.c Bart Van Assche 2022-07-14 217 int pdu_len, void *pdu_data, u64 cgid)
2056a782f8e7e6 block/blktrace.c Jens Axboe 2006-03-23 218 {
2056a782f8e7e6 block/blktrace.c Jens Axboe 2006-03-23 219 struct task_struct *tsk = current;
c71a896154119f block/blktrace.c Arnaldo Carvalho de Melo 2009-01-23 220 struct ring_buffer_event *event = NULL;
13292494379f92 kernel/trace/blktrace.c Steven Rostedt (VMware 2019-12-13 221) struct trace_buffer *buffer = NULL;
2056a782f8e7e6 block/blktrace.c Jens Axboe 2006-03-23 222 struct blk_io_trace *t;
0a9877514c4fed block/blktrace.c Arnaldo Carvalho de Melo 2009-02-05 223 unsigned long flags = 0;
2056a782f8e7e6 block/blktrace.c Jens Axboe 2006-03-23 224 unsigned long *sequence;
36590c50b2d072 kernel/trace/blktrace.c Sebastian Andrzej Siewior 2021-01-25 225 unsigned int trace_ctx = 0;
2056a782f8e7e6 block/blktrace.c Jens Axboe 2006-03-23 226 pid_t pid;
36590c50b2d072 kernel/trace/blktrace.c Sebastian Andrzej Siewior 2021-01-25 227 int cpu;
18cea4591a9881 kernel/trace/blktrace.c Li Zefan 2009-03-27 228 bool blk_tracer = blk_tracer_enabled;
67c0496e87d193 kernel/trace/blktrace.c Tejun Heo 2019-11-04 229 ssize_t cgid_len = cgid ? sizeof(cgid) : 0;
919dbca8670d0f kernel/trace/blktrace.c Bart Van Assche 2022-07-14 230 const enum req_op op = opf & REQ_OP_MASK;
2056a782f8e7e6 block/blktrace.c Jens Axboe 2006-03-23 231
18cea4591a9881 kernel/trace/blktrace.c Li Zefan 2009-03-27 232 if (unlikely(bt->trace_state != Blktrace_running && !blk_tracer))
2056a782f8e7e6 block/blktrace.c Jens Axboe 2006-03-23 233 return;
2056a782f8e7e6 block/blktrace.c Jens Axboe 2006-03-23 234
1b9a9ab78b0ab7 kernel/trace/blktrace.c Mike Christie 2016-06-05 235 what |= ddir_act[op_is_write(op) ? WRITE : READ];
919dbca8670d0f kernel/trace/blktrace.c Bart Van Assche 2022-07-14 236 what |= MASK_TC_BIT(opf, SYNC);
919dbca8670d0f kernel/trace/blktrace.c Bart Van Assche 2022-07-14 237 what |= MASK_TC_BIT(opf, RAHEAD);
919dbca8670d0f kernel/trace/blktrace.c Bart Van Assche 2022-07-14 238 what |= MASK_TC_BIT(opf, META);
919dbca8670d0f kernel/trace/blktrace.c Bart Van Assche 2022-07-14 @239 what |= MASK_TC_BIT(opf, PREFLUSH);
919dbca8670d0f kernel/trace/blktrace.c Bart Van Assche 2022-07-14 240 what |= MASK_TC_BIT(opf, FUA);
7afafc8a44bf0a kernel/trace/blktrace.c Adrian Hunter 2016-08-16 241 if (op == REQ_OP_DISCARD || op == REQ_OP_SECURE_ERASE)
1b9a9ab78b0ab7 kernel/trace/blktrace.c Mike Christie 2016-06-05 242 what |= BLK_TC_ACT(BLK_TC_DISCARD);
3a5e02ced11e22 kernel/trace/blktrace.c Mike Christie 2016-06-05 243 if (op == REQ_OP_FLUSH)
3a5e02ced11e22 kernel/trace/blktrace.c Mike Christie 2016-06-05 244 what |= BLK_TC_ACT(BLK_TC_FLUSH);
ca1136c99b66b1 kernel/trace/blktrace.c Shaohua Li 2017-07-12 245 if (cgid)
ca1136c99b66b1 kernel/trace/blktrace.c Shaohua Li 2017-07-12 246 what |= __BLK_TA_CGROUP;
2056a782f8e7e6 block/blktrace.c Jens Axboe 2006-03-23 247
2056a782f8e7e6 block/blktrace.c Jens Axboe 2006-03-23 248 pid = tsk->pid;
d0deef5b14af7d kernel/trace/blktrace.c Shawn Du 2009-04-14 249 if (act_log_check(bt, what, sector, pid))
2056a782f8e7e6 block/blktrace.c Jens Axboe 2006-03-23 250 return;
c71a896154119f block/blktrace.c Arnaldo Carvalho de Melo 2009-01-23 251 cpu = raw_smp_processor_id();
c71a896154119f block/blktrace.c Arnaldo Carvalho de Melo 2009-01-23 252
18cea4591a9881 kernel/trace/blktrace.c Li Zefan 2009-03-27 253 if (blk_tracer) {
c71a896154119f block/blktrace.c Arnaldo Carvalho de Melo 2009-01-23 254 tracing_record_cmdline(current);
c71a896154119f block/blktrace.c Arnaldo Carvalho de Melo 2009-01-23 255
1c5eb4481e0151 kernel/trace/blktrace.c Steven Rostedt (VMware 2020-01-09 256) buffer = blk_tr->array_buffer.buffer;
36590c50b2d072 kernel/trace/blktrace.c Sebastian Andrzej Siewior 2021-01-25 257 trace_ctx = tracing_gen_ctx_flags(0);
e77405ad80f539 kernel/trace/blktrace.c Steven Rostedt 2009-09-02 258 event = trace_buffer_lock_reserve(buffer, TRACE_BLK,
ca1136c99b66b1 kernel/trace/blktrace.c Shaohua Li 2017-07-12 259 sizeof(*t) + pdu_len + cgid_len,
36590c50b2d072 kernel/trace/blktrace.c Sebastian Andrzej Siewior 2021-01-25 260 trace_ctx);
c71a896154119f block/blktrace.c Arnaldo Carvalho de Melo 2009-01-23 261 if (!event)
c71a896154119f block/blktrace.c Arnaldo Carvalho de Melo 2009-01-23 262 return;
51a763dd84253b block/blktrace.c Arnaldo Carvalho de Melo 2009-02-05 263 t = ring_buffer_event_data(event);
c71a896154119f block/blktrace.c Arnaldo Carvalho de Melo 2009-01-23 264 goto record_it;
c71a896154119f block/blktrace.c Arnaldo Carvalho de Melo 2009-01-23 265 }
2056a782f8e7e6 block/blktrace.c Jens Axboe 2006-03-23 266
a404d5576bbe58 kernel/trace/blktrace.c Jan Kara 2013-09-17 267 if (unlikely(tsk->btrace_seq != blktrace_seq))
a404d5576bbe58 kernel/trace/blktrace.c Jan Kara 2013-09-17 268 trace_note_tsk(tsk);
a404d5576bbe58 kernel/trace/blktrace.c Jan Kara 2013-09-17 269
2056a782f8e7e6 block/blktrace.c Jens Axboe 2006-03-23 270 /*
2056a782f8e7e6 block/blktrace.c Jens Axboe 2006-03-23 271 * A word about the locking here - we disable interrupts to reserve
2056a782f8e7e6 block/blktrace.c Jens Axboe 2006-03-23 272 * some space in the relay per-cpu buffer, to prevent an irq
14a73f54798f39 block/blktrace.c Carl Henrik Lunde 2008-06-12 273 * from coming in and stepping on our toes.
2056a782f8e7e6 block/blktrace.c Jens Axboe 2006-03-23 274 */
2056a782f8e7e6 block/blktrace.c Jens Axboe 2006-03-23 275 local_irq_save(flags);
ca1136c99b66b1 kernel/trace/blktrace.c Shaohua Li 2017-07-12 276 t = relay_reserve(bt->rchan, sizeof(*t) + pdu_len + cgid_len);
2056a782f8e7e6 block/blktrace.c Jens Axboe 2006-03-23 277 if (t) {
2056a782f8e7e6 block/blktrace.c Jens Axboe 2006-03-23 278 sequence = per_cpu_ptr(bt->sequence, cpu);
2056a782f8e7e6 block/blktrace.c Jens Axboe 2006-03-23 279
2056a782f8e7e6 block/blktrace.c Jens Axboe 2006-03-23 280 t->magic = BLK_IO_TRACE_MAGIC | BLK_IO_TRACE_VERSION;
2056a782f8e7e6 block/blktrace.c Jens Axboe 2006-03-23 281 t->sequence = ++(*sequence);
2997c8c4a0b179 block/blktrace.c Ingo Molnar 2008-01-11 282 t->time = ktime_to_ns(ktime_get());
08a06b83ff8b27 block/blktrace.c Arnaldo Carvalho de Melo 2009-02-02 283 record_it:
08a06b83ff8b27 block/blktrace.c Arnaldo Carvalho de Melo 2009-02-02 284 /*
08a06b83ff8b27 block/blktrace.c Arnaldo Carvalho de Melo 2009-02-02 285 * These two are not needed in ftrace as they are in the
08a06b83ff8b27 block/blktrace.c Arnaldo Carvalho de Melo 2009-02-02 286 * generic trace_entry, filled by tracing_generic_entry_update,
08a06b83ff8b27 block/blktrace.c Arnaldo Carvalho de Melo 2009-02-02 287 * but for the trace_event->bin() synthesizer benefit we do it
08a06b83ff8b27 block/blktrace.c Arnaldo Carvalho de Melo 2009-02-02 288 * here too.
08a06b83ff8b27 block/blktrace.c Arnaldo Carvalho de Melo 2009-02-02 289 */
c71a896154119f block/blktrace.c Arnaldo Carvalho de Melo 2009-01-23 290 t->cpu = cpu;
c71a896154119f block/blktrace.c Arnaldo Carvalho de Melo 2009-01-23 291 t->pid = pid;
08a06b83ff8b27 block/blktrace.c Arnaldo Carvalho de Melo 2009-02-02 292
2056a782f8e7e6 block/blktrace.c Jens Axboe 2006-03-23 293 t->sector = sector;
2056a782f8e7e6 block/blktrace.c Jens Axboe 2006-03-23 294 t->bytes = bytes;
2056a782f8e7e6 block/blktrace.c Jens Axboe 2006-03-23 295 t->action = what;
2056a782f8e7e6 block/blktrace.c Jens Axboe 2006-03-23 296 t->device = bt->dev;
2056a782f8e7e6 block/blktrace.c Jens Axboe 2006-03-23 297 t->error = error;
ca1136c99b66b1 kernel/trace/blktrace.c Shaohua Li 2017-07-12 298 t->pdu_len = pdu_len + cgid_len;
2056a782f8e7e6 block/blktrace.c Jens Axboe 2006-03-23 299
ca1136c99b66b1 kernel/trace/blktrace.c Shaohua Li 2017-07-12 300 if (cgid_len)
67c0496e87d193 kernel/trace/blktrace.c Tejun Heo 2019-11-04 301 memcpy((void *)t + sizeof(*t), &cgid, cgid_len);
2056a782f8e7e6 block/blktrace.c Jens Axboe 2006-03-23 302 if (pdu_len)
ca1136c99b66b1 kernel/trace/blktrace.c Shaohua Li 2017-07-12 303 memcpy((void *)t + sizeof(*t) + cgid_len, pdu_data, pdu_len);
c71a896154119f block/blktrace.c Arnaldo Carvalho de Melo 2009-01-23 304
18cea4591a9881 kernel/trace/blktrace.c Li Zefan 2009-03-27 305 if (blk_tracer) {
36590c50b2d072 kernel/trace/blktrace.c Sebastian Andrzej Siewior 2021-01-25 306 trace_buffer_unlock_commit(blk_tr, buffer, event, trace_ctx);
c71a896154119f block/blktrace.c Arnaldo Carvalho de Melo 2009-01-23 307 return;
c71a896154119f block/blktrace.c Arnaldo Carvalho de Melo 2009-01-23 308 }
2056a782f8e7e6 block/blktrace.c Jens Axboe 2006-03-23 309 }
2056a782f8e7e6 block/blktrace.c Jens Axboe 2006-03-23 310
2056a782f8e7e6 block/blktrace.c Jens Axboe 2006-03-23 311 local_irq_restore(flags);
2056a782f8e7e6 block/blktrace.c Jens Axboe 2006-03-23 312 }
2056a782f8e7e6 block/blktrace.c Jens Axboe 2006-03-23 313
:::::: The code at line 239 was first introduced by commit
:::::: 919dbca8670d0f7828dfbb2f9b434ac22dca8d2e blktrace: Use the new blk_opf_t type
:::::: TO: Bart Van Assche <bvanassche@....org>
:::::: CC: Jens Axboe <axboe@...nel.dk>
--
0-DAY CI Kernel Test Service
https://01.org/lkp
View attachment "config" of type "text/plain" (150194 bytes)
Powered by blists - more mailing lists