Re: [PATCH v2] kdb: Adopt scheduler's task clasification

From: kernel test robot
Date: Sat Oct 30 2021 - 23:50:19 EST


Hi Daniel,

I love your patch! Perhaps something to improve:

[auto build test WARNING on 6880fa6c56601bb8ed59df6c30fd390cc5f6dd8f]

url: https://github.com/0day-ci/linux/commits/Daniel-Thompson/kdb-Adopt-scheduler-s-task-clasification/20211030-012127
base: 6880fa6c56601bb8ed59df6c30fd390cc5f6dd8f
config: riscv-randconfig-r042-20211031 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 82ed106567063ea269c6d5669278b733e173a42f)
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
# install riscv cross compiling tool for clang build
# apt-get install binutils-riscv64-linux-gnu
# https://github.com/0day-ci/linux/commit/9f7ea8ffacb27d8b7fe10190fa91e2803c985611
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Daniel-Thompson/kdb-Adopt-scheduler-s-task-clasification/20211030-012127
git checkout 9f7ea8ffacb27d8b7fe10190fa91e2803c985611
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=riscv

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

In file included from kernel/debug/kdb/kdb_support.c:21:
In file included from include/linux/highmem.h:10:
In file included from include/linux/hardirq.h:11:
In file included from ./arch/riscv/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/riscv/include/asm/io.h:136:
include/asm-generic/io.h:464: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:477: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:36:51: note: expanded from macro '__le16_to_cpu'
#define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
^
In file included from kernel/debug/kdb/kdb_support.c:21:
In file included from include/linux/highmem.h:10:
In file included from include/linux/hardirq.h:11:
In file included from ./arch/riscv/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/riscv/include/asm/io.h:136:
include/asm-generic/io.h:490: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:34:51: note: expanded from macro '__le32_to_cpu'
#define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
^
In file included from kernel/debug/kdb/kdb_support.c:21:
In file included from include/linux/highmem.h:10:
In file included from include/linux/hardirq.h:11:
In file included from ./arch/riscv/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/riscv/include/asm/io.h:136:
include/asm-generic/io.h:501: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:511: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:521: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);
~~~~~~~~~~ ^
include/asm-generic/io.h:1024:55: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
return (port > MMIO_UPPER_LIMIT) ? NULL : PCI_IOBASE + port;
~~~~~~~~~~ ^
>> kernel/debug/kdb/kdb_support.c:501:41: warning: variable 'cpu' is uninitialized when used here [-Wuninitialized]
if (!kdb_task_has_cpu(p) || kgdb_info[cpu].irq_depth == 1) {
^~~
kernel/debug/kdb/kdb_support.c:490:9: note: initialize the variable 'cpu' to silence this warning
int cpu;
^
= 0
8 warnings generated.


vim +/cpu +501 kernel/debug/kdb/kdb_support.c

5d5314d6795f3c Jason Wessel 2010-05-20 476
5d5314d6795f3c Jason Wessel 2010-05-20 477
5d5314d6795f3c Jason Wessel 2010-05-20 478
5d5314d6795f3c Jason Wessel 2010-05-20 479 /*
5d5314d6795f3c Jason Wessel 2010-05-20 480 * kdb_task_state_char - Return the character that represents the task state.
5d5314d6795f3c Jason Wessel 2010-05-20 481 * Inputs:
5d5314d6795f3c Jason Wessel 2010-05-20 482 * p struct task for the process
5d5314d6795f3c Jason Wessel 2010-05-20 483 * Returns:
5d5314d6795f3c Jason Wessel 2010-05-20 484 * One character to represent the task state.
5d5314d6795f3c Jason Wessel 2010-05-20 485 */
5d5314d6795f3c Jason Wessel 2010-05-20 486 char kdb_task_state_char (const struct task_struct *p)
5d5314d6795f3c Jason Wessel 2010-05-20 487 {
5d5314d6795f3c Jason Wessel 2010-05-20 488 unsigned long tmp;
2f064a59a11ff9 Peter Zijlstra 2021-06-11 489 char state;
2f064a59a11ff9 Peter Zijlstra 2021-06-11 490 int cpu;
5d5314d6795f3c Jason Wessel 2010-05-20 491
fe557319aa06c2 Christoph Hellwig 2020-06-17 492 if (!p ||
fe557319aa06c2 Christoph Hellwig 2020-06-17 493 copy_from_kernel_nofault(&tmp, (char *)p, sizeof(unsigned long)))
5d5314d6795f3c Jason Wessel 2010-05-20 494 return 'E';
5d5314d6795f3c Jason Wessel 2010-05-20 495
9f7ea8ffacb27d Daniel Thompson 2021-10-29 496 state = task_state_to_char((struct task_struct *) p);
9f7ea8ffacb27d Daniel Thompson 2021-10-29 497
7fc20c5cbdd184 Paul E. McKenney 2011-11-10 498 if (is_idle_task(p)) {
5d5314d6795f3c Jason Wessel 2010-05-20 499 /* Idle task. Is it really idle, apart from the kdb
5d5314d6795f3c Jason Wessel 2010-05-20 500 * interrupt? */
5d5314d6795f3c Jason Wessel 2010-05-20 @501 if (!kdb_task_has_cpu(p) || kgdb_info[cpu].irq_depth == 1) {
5d5314d6795f3c Jason Wessel 2010-05-20 502 if (cpu != kdb_initial_cpu)
9f7ea8ffacb27d Daniel Thompson 2021-10-29 503 state = '-'; /* idle task */
5d5314d6795f3c Jason Wessel 2010-05-20 504 }
9f7ea8ffacb27d Daniel Thompson 2021-10-29 505 } else if (!p->mm && strchr("IMS", state)) {
9f7ea8ffacb27d Daniel Thompson 2021-10-29 506 state = tolower(state); /* sleeping system daemon */
5d5314d6795f3c Jason Wessel 2010-05-20 507 }
5d5314d6795f3c Jason Wessel 2010-05-20 508 return state;
5d5314d6795f3c Jason Wessel 2010-05-20 509 }
5d5314d6795f3c Jason Wessel 2010-05-20 510

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip