Linux Power Management development
 help / color / mirror / Atom feed
From: Nathan Chancellor <nathan@kernel.org>
To: Vincent Guittot <vincent.guittot@linaro.org>
Cc: Naresh Kamboju <naresh.kamboju@linaro.org>,
	open list <linux-kernel@vger.kernel.org>,
	Linux Regressions <regressions@lists.linux.dev>,
	lkft-triage@lists.linaro.org,
	clang-built-linux <llvm@lists.linux.dev>,
	Linux PM <linux-pm@vger.kernel.org>,
	Ingo Molnar <mingo@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Juri Lelli <juri.lelli@redhat.com>,
	Nick Desaulniers <ndesaulniers@google.com>,
	linux-riscv@lists.infradead.org,
	Paul Walmsley <paul.walmsley@sifive.com>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Albert Ou <aou@eecs.berkeley.edu>,
	"Paul E. McKenney" <paulmck@kernel.org>
Subject: Re: kernel/sched/core.c:961:15: error: incompatible pointer to integer conversion passing 'typeof
Date: Wed, 3 Apr 2024 09:00:41 -0700	[thread overview]
Message-ID: <20240403160041.GA1252923@dev-arch.thelio-3990X> (raw)
In-Reply-To: <CAKfTPtC9YgbZgGNK82MhhzzsD3P6j64+w6oieJMDKQNOmrC4FQ@mail.gmail.com>

Hi all,

+ Paul McKenney

On Wed, Apr 03, 2024 at 03:26:05PM +0200, Vincent Guittot wrote:
> Hi Naresh,
> 
> Adding riscv people
> 
> On Wed, 3 Apr 2024 at 09:38, Naresh Kamboju <naresh.kamboju@linaro.org> wrote:
> >
> > The riscv clang-17 defconfig build failed due to following warnings / errors
> > on the Linux next-20240402.
> 
> Could you confirm that there is no problem with other arch and/or
> other toolchain ?

This is not a clang specific issue, it happens with GCC too:

  $ make -skj"$(nproc)" ARCH=riscv CROSS_COMPILE=riscv64-linux- mrproper defconfig kernel/sched/core.o
  kernel/sched/core.c: In function '__wake_q_add':
  arch/riscv/include/asm/cmpxchg.h:175:62: warning: passing argument 2 of 'cmpxchg_emu_u8' makes integer from pointer without a cast [-Wint-conversion]
    175 |                 __ret = cmpxchg_emu_u8((volatile u8 *)__ptr, __old, __new); \
        |                                                              ^~~~~
        |                                                              |
        |                                                              struct wake_q_node *
  include/linux/compiler.h:77:45: note: in definition of macro 'unlikely'
     77 | # define unlikely(x)    __builtin_expect(!!(x), 0)
        |                                             ^
  arch/riscv/include/asm/cmpxchg.h:212:30: note: in expansion of macro '__cmpxchg_relaxed'
    212 |         (__typeof__(*(ptr))) __cmpxchg_relaxed((ptr),                   \
        |                              ^~~~~~~~~~~~~~~~~
  include/linux/atomic/atomic-arch-fallback.h:89:29: note: in expansion of macro 'arch_cmpxchg_relaxed'
     89 | #define raw_cmpxchg_relaxed arch_cmpxchg_relaxed
        |                             ^~~~~~~~~~~~~~~~~~~~
  include/linux/atomic/atomic-instrumented.h:4810:9: note: in expansion of macro 'raw_cmpxchg_relaxed'
   4810 |         raw_cmpxchg_relaxed(__ai_ptr, __VA_ARGS__); \
        |         ^~~~~~~~~~~~~~~~~~~
  kernel/sched/core.c:961:22: note: in expansion of macro 'cmpxchg_relaxed'
    961 |         if (unlikely(cmpxchg_relaxed(&node->next, NULL, WAKE_Q_TAIL)))
        |                      ^~~~~~~~~~~~~~~
  In file included from arch/riscv/include/asm/cmpxchg.h:12,
                   from arch/riscv/include/asm/atomic.h:19,
                   from include/linux/atomic.h:7,
                   from include/linux/cpumask.h:14,
                   from include/linux/smp.h:13,
                   from include/linux/lockdep.h:14,
                   from include/linux/spinlock.h:63,
                   from include/linux/wait.h:9,
                   from include/linux/wait_bit.h:8,
                   from include/linux/fs.h:6:
  include/linux/cmpxchg-emu.h:13:52: note: expected 'uintptr_t' {aka 'long unsigned int'} but argument is of type 'struct wake_q_node *'
     13 | uintptr_t cmpxchg_emu_u8(volatile u8 *p, uintptr_t old, uintptr_t new);
        |                                          ~~~~~~~~~~^~~
  arch/riscv/include/asm/cmpxchg.h:175:69: warning: passing argument 3 of 'cmpxchg_emu_u8' makes integer from pointer without a cast [-Wint-conversion]
    175 |                 __ret = cmpxchg_emu_u8((volatile u8 *)__ptr, __old, __new); \
        |                                                                     ^~~~~
        |                                                                     |
        |                                                                     struct wake_q_node *
  include/linux/compiler.h:77:45: note: in definition of macro 'unlikely'
     77 | # define unlikely(x)    __builtin_expect(!!(x), 0)
        |                                             ^
  arch/riscv/include/asm/cmpxchg.h:212:30: note: in expansion of macro '__cmpxchg_relaxed'
    212 |         (__typeof__(*(ptr))) __cmpxchg_relaxed((ptr),                   \
        |                              ^~~~~~~~~~~~~~~~~
  include/linux/atomic/atomic-arch-fallback.h:89:29: note: in expansion of macro 'arch_cmpxchg_relaxed'
     89 | #define raw_cmpxchg_relaxed arch_cmpxchg_relaxed
        |                             ^~~~~~~~~~~~~~~~~~~~
  include/linux/atomic/atomic-instrumented.h:4810:9: note: in expansion of macro 'raw_cmpxchg_relaxed'
   4810 |         raw_cmpxchg_relaxed(__ai_ptr, __VA_ARGS__); \
        |         ^~~~~~~~~~~~~~~~~~~
  kernel/sched/core.c:961:22: note: in expansion of macro 'cmpxchg_relaxed'
    961 |         if (unlikely(cmpxchg_relaxed(&node->next, NULL, WAKE_Q_TAIL)))
        |                      ^~~~~~~~~~~~~~~
  include/linux/cmpxchg-emu.h:13:67: note: expected 'uintptr_t' {aka 'long unsigned int'} but argument is of type 'struct wake_q_node *'
     13 | uintptr_t cmpxchg_emu_u8(volatile u8 *p, uintptr_t old, uintptr_t new);
        |                                                         ~~~~~~~~~~^~~
  arch/riscv/include/asm/cmpxchg.h:175:23: warning: assignment to 'struct wake_q_node *' from 'uintptr_t' {aka 'long unsigned int'} makes pointer from integer without a cast [-Wint-conversion]
    175 |                 __ret = cmpxchg_emu_u8((volatile u8 *)__ptr, __old, __new); \
        |                       ^
  include/linux/compiler.h:77:45: note: in definition of macro 'unlikely'
     77 | # define unlikely(x)    __builtin_expect(!!(x), 0)
        |                                             ^
  arch/riscv/include/asm/cmpxchg.h:212:30: note: in expansion of macro '__cmpxchg_relaxed'
    212 |         (__typeof__(*(ptr))) __cmpxchg_relaxed((ptr),                   \
        |                              ^~~~~~~~~~~~~~~~~
  include/linux/atomic/atomic-arch-fallback.h:89:29: note: in expansion of macro 'arch_cmpxchg_relaxed'
     89 | #define raw_cmpxchg_relaxed arch_cmpxchg_relaxed
        |                             ^~~~~~~~~~~~~~~~~~~~
  include/linux/atomic/atomic-instrumented.h:4810:9: note: in expansion of macro 'raw_cmpxchg_relaxed'
   4810 |         raw_cmpxchg_relaxed(__ai_ptr, __VA_ARGS__); \
        |         ^~~~~~~~~~~~~~~~~~~
  kernel/sched/core.c:961:22: note: in expansion of macro 'cmpxchg_relaxed'
    961 |         if (unlikely(cmpxchg_relaxed(&node->next, NULL, WAKE_Q_TAIL)))
        |                      ^~~~~~~~~~~~~~~
  arch/riscv/include/asm/cmpxchg.h:179:64: warning: passing argument 2 of 'cmpxchg_emu_u16' makes integer from pointer without a cast [-Wint-conversion]
    179 |                 __ret = cmpxchg_emu_u16((volatile u16 *)__ptr, __old, __new); \
        |                                                                ^~~~~
        |                                                                |
        |                                                                struct wake_q_node *
  include/linux/compiler.h:77:45: note: in definition of macro 'unlikely'
     77 | # define unlikely(x)    __builtin_expect(!!(x), 0)
        |                                             ^
  arch/riscv/include/asm/cmpxchg.h:212:30: note: in expansion of macro '__cmpxchg_relaxed'
    212 |         (__typeof__(*(ptr))) __cmpxchg_relaxed((ptr),                   \
        |                              ^~~~~~~~~~~~~~~~~
  include/linux/atomic/atomic-arch-fallback.h:89:29: note: in expansion of macro 'arch_cmpxchg_relaxed'
     89 | #define raw_cmpxchg_relaxed arch_cmpxchg_relaxed
        |                             ^~~~~~~~~~~~~~~~~~~~
  include/linux/atomic/atomic-instrumented.h:4810:9: note: in expansion of macro 'raw_cmpxchg_relaxed'
   4810 |         raw_cmpxchg_relaxed(__ai_ptr, __VA_ARGS__); \
        |         ^~~~~~~~~~~~~~~~~~~
  kernel/sched/core.c:961:22: note: in expansion of macro 'cmpxchg_relaxed'
    961 |         if (unlikely(cmpxchg_relaxed(&node->next, NULL, WAKE_Q_TAIL)))
        |                      ^~~~~~~~~~~~~~~
  include/linux/cmpxchg-emu.h:14:54: note: expected 'uintptr_t' {aka 'long unsigned int'} but argument is of type 'struct wake_q_node *'
     14 | uintptr_t cmpxchg_emu_u16(volatile u16 *p, uintptr_t old, uintptr_t new);
        |                                            ~~~~~~~~~~^~~
  arch/riscv/include/asm/cmpxchg.h:179:71: warning: passing argument 3 of 'cmpxchg_emu_u16' makes integer from pointer without a cast [-Wint-conversion]
    179 |                 __ret = cmpxchg_emu_u16((volatile u16 *)__ptr, __old, __new); \
        |                                                                       ^~~~~
        |                                                                       |
        |                                                                       struct wake_q_node *
  include/linux/compiler.h:77:45: note: in definition of macro 'unlikely'
     77 | # define unlikely(x)    __builtin_expect(!!(x), 0)
        |                                             ^
  arch/riscv/include/asm/cmpxchg.h:212:30: note: in expansion of macro '__cmpxchg_relaxed'
    212 |         (__typeof__(*(ptr))) __cmpxchg_relaxed((ptr),                   \
        |                              ^~~~~~~~~~~~~~~~~
  include/linux/atomic/atomic-arch-fallback.h:89:29: note: in expansion of macro 'arch_cmpxchg_relaxed'
     89 | #define raw_cmpxchg_relaxed arch_cmpxchg_relaxed
        |                             ^~~~~~~~~~~~~~~~~~~~
  include/linux/atomic/atomic-instrumented.h:4810:9: note: in expansion of macro 'raw_cmpxchg_relaxed'
   4810 |         raw_cmpxchg_relaxed(__ai_ptr, __VA_ARGS__); \
        |         ^~~~~~~~~~~~~~~~~~~
  kernel/sched/core.c:961:22: note: in expansion of macro 'cmpxchg_relaxed'
    961 |         if (unlikely(cmpxchg_relaxed(&node->next, NULL, WAKE_Q_TAIL)))
        |                      ^~~~~~~~~~~~~~~
  include/linux/cmpxchg-emu.h:14:69: note: expected 'uintptr_t' {aka 'long unsigned int'} but argument is of type 'struct wake_q_node *'
     14 | uintptr_t cmpxchg_emu_u16(volatile u16 *p, uintptr_t old, uintptr_t new);
        |                                                           ~~~~~~~~~~^~~
  arch/riscv/include/asm/cmpxchg.h:179:23: warning: assignment to 'struct wake_q_node *' from 'uintptr_t' {aka 'long unsigned int'} makes pointer from integer without a cast [-Wint-conversion]
    179 |                 __ret = cmpxchg_emu_u16((volatile u16 *)__ptr, __old, __new); \
        |                       ^
  include/linux/compiler.h:77:45: note: in definition of macro 'unlikely'
     77 | # define unlikely(x)    __builtin_expect(!!(x), 0)
        |                                             ^
  arch/riscv/include/asm/cmpxchg.h:212:30: note: in expansion of macro '__cmpxchg_relaxed'
    212 |         (__typeof__(*(ptr))) __cmpxchg_relaxed((ptr),                   \
        |                              ^~~~~~~~~~~~~~~~~
  include/linux/atomic/atomic-arch-fallback.h:89:29: note: in expansion of macro 'arch_cmpxchg_relaxed'
     89 | #define raw_cmpxchg_relaxed arch_cmpxchg_relaxed
        |                             ^~~~~~~~~~~~~~~~~~~~
  include/linux/atomic/atomic-instrumented.h:4810:9: note: in expansion of macro 'raw_cmpxchg_relaxed'
   4810 |         raw_cmpxchg_relaxed(__ai_ptr, __VA_ARGS__); \
        |         ^~~~~~~~~~~~~~~~~~~
  kernel/sched/core.c:961:22: note: in expansion of macro 'cmpxchg_relaxed'
    961 |         if (unlikely(cmpxchg_relaxed(&node->next, NULL, WAKE_Q_TAIL)))
        |                      ^~~~~~~~~~~~~~~
  arch/riscv/include/asm/cmpxchg.h:179:23: warning: this statement may fall through [-Wimplicit-fallthrough=]
    179 |                 __ret = cmpxchg_emu_u16((volatile u16 *)__ptr, __old, __new); \
        |                 ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  include/linux/compiler.h:77:45: note: in definition of macro 'unlikely'
     77 | # define unlikely(x)    __builtin_expect(!!(x), 0)
        |                                             ^
  arch/riscv/include/asm/cmpxchg.h:212:30: note: in expansion of macro '__cmpxchg_relaxed'
    212 |         (__typeof__(*(ptr))) __cmpxchg_relaxed((ptr),                   \
        |                              ^~~~~~~~~~~~~~~~~
  include/linux/atomic/atomic-arch-fallback.h:89:29: note: in expansion of macro 'arch_cmpxchg_relaxed'
     89 | #define raw_cmpxchg_relaxed arch_cmpxchg_relaxed
        |                             ^~~~~~~~~~~~~~~~~~~~
  include/linux/atomic/atomic-instrumented.h:4810:9: note: in expansion of macro 'raw_cmpxchg_relaxed'
   4810 |         raw_cmpxchg_relaxed(__ai_ptr, __VA_ARGS__); \
        |         ^~~~~~~~~~~~~~~~~~~
  kernel/sched/core.c:961:22: note: in expansion of macro 'cmpxchg_relaxed'
    961 |         if (unlikely(cmpxchg_relaxed(&node->next, NULL, WAKE_Q_TAIL)))
        |                      ^~~~~~~~~~~~~~~
  arch/riscv/include/asm/cmpxchg.h:180:9: note: here
    180 |         case 4:                                                         \
        |         ^~~~
  include/linux/compiler.h:77:45: note: in definition of macro 'unlikely'
     77 | # define unlikely(x)    __builtin_expect(!!(x), 0)
        |                                             ^
  arch/riscv/include/asm/cmpxchg.h:212:30: note: in expansion of macro '__cmpxchg_relaxed'
    212 |         (__typeof__(*(ptr))) __cmpxchg_relaxed((ptr),                   \
        |                              ^~~~~~~~~~~~~~~~~
  include/linux/atomic/atomic-arch-fallback.h:89:29: note: in expansion of macro 'arch_cmpxchg_relaxed'
     89 | #define raw_cmpxchg_relaxed arch_cmpxchg_relaxed
        |                             ^~~~~~~~~~~~~~~~~~~~
  include/linux/atomic/atomic-instrumented.h:4810:9: note: in expansion of macro 'raw_cmpxchg_relaxed'
   4810 |         raw_cmpxchg_relaxed(__ai_ptr, __VA_ARGS__); \
        |         ^~~~~~~~~~~~~~~~~~~
  kernel/sched/core.c:961:22: note: in expansion of macro 'cmpxchg_relaxed'
    961 |         if (unlikely(cmpxchg_relaxed(&node->next, NULL, WAKE_Q_TAIL)))
        |                      ^~~~~~~~~~~~~~~
  kernel/sched/sched.h: In function 'mm_cid_put_lazy':
  arch/riscv/include/asm/cmpxchg.h:333:23: warning: this statement may fall through [-Wimplicit-fallthrough=]
    333 |                 __ret = cmpxchg_emu_u16((volatile u16 *)__ptr, __old, __new); \
        |                 ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  arch/riscv/include/asm/cmpxchg.h:368:30: note: in expansion of macro '__cmpxchg'
    368 |         (__typeof__(*(ptr))) __cmpxchg((ptr),                           \
        |                              ^~~~~~~~~
  include/linux/atomic/atomic-arch-fallback.h:55:21: note: in expansion of macro 'arch_cmpxchg'
     55 | #define raw_cmpxchg arch_cmpxchg
        |                     ^~~~~~~~~~~~
  include/linux/atomic/atomic-arch-fallback.h:192:16: note: in expansion of macro 'raw_cmpxchg'
    192 |         ___r = raw_cmpxchg((_ptr), ___o, (_new)); \
        |                ^~~~~~~~~~~
  include/linux/atomic/atomic-instrumented.h:4880:9: note: in expansion of macro 'raw_try_cmpxchg'
   4880 |         raw_try_cmpxchg(__ai_ptr, __ai_oldp, __VA_ARGS__); \
        |         ^~~~~~~~~~~~~~~
  kernel/sched/sched.h:3292:14: note: in expansion of macro 'try_cmpxchg'
   3292 |             !try_cmpxchg(&this_cpu_ptr(pcpu_cid)->cid, &cid, MM_CID_UNSET))
        |              ^~~~~~~~~~~
  arch/riscv/include/asm/cmpxchg.h:334:9: note: here
    334 |         case 4:                                                         \
        |         ^~~~
  arch/riscv/include/asm/cmpxchg.h:368:30: note: in expansion of macro '__cmpxchg'
    368 |         (__typeof__(*(ptr))) __cmpxchg((ptr),                           \
        |                              ^~~~~~~~~
  include/linux/atomic/atomic-arch-fallback.h:55:21: note: in expansion of macro 'arch_cmpxchg'
     55 | #define raw_cmpxchg arch_cmpxchg
        |                     ^~~~~~~~~~~~
  include/linux/atomic/atomic-arch-fallback.h:192:16: note: in expansion of macro 'raw_cmpxchg'
    192 |         ___r = raw_cmpxchg((_ptr), ___o, (_new)); \
        |                ^~~~~~~~~~~
  include/linux/atomic/atomic-instrumented.h:4880:9: note: in expansion of macro 'raw_try_cmpxchg'
   4880 |         raw_try_cmpxchg(__ai_ptr, __ai_oldp, __VA_ARGS__); \
        |         ^~~~~~~~~~~~~~~
  kernel/sched/sched.h:3292:14: note: in expansion of macro 'try_cmpxchg'
   3292 |             !try_cmpxchg(&this_cpu_ptr(pcpu_cid)->cid, &cid, MM_CID_UNSET))
        |              ^~~~~~~~~~~
  kernel/sched/sched.h: In function 'mm_cid_get':
  arch/riscv/include/asm/cmpxchg.h:333:23: warning: this statement may fall through [-Wimplicit-fallthrough=]
    333 |                 __ret = cmpxchg_emu_u16((volatile u16 *)__ptr, __old, __new); \
        |                 ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  arch/riscv/include/asm/cmpxchg.h:368:30: note: in expansion of macro '__cmpxchg'
    368 |         (__typeof__(*(ptr))) __cmpxchg((ptr),                           \
        |                              ^~~~~~~~~
  include/linux/atomic/atomic-arch-fallback.h:55:21: note: in expansion of macro 'arch_cmpxchg'
     55 | #define raw_cmpxchg arch_cmpxchg
        |                     ^~~~~~~~~~~~
  include/linux/atomic/atomic-arch-fallback.h:192:16: note: in expansion of macro 'raw_cmpxchg'
    192 |         ___r = raw_cmpxchg((_ptr), ___o, (_new)); \
        |                ^~~~~~~~~~~
  include/linux/atomic/atomic-instrumented.h:4880:9: note: in expansion of macro 'raw_try_cmpxchg'
   4880 |         raw_try_cmpxchg(__ai_ptr, __ai_oldp, __VA_ARGS__); \
        |         ^~~~~~~~~~~~~~~
  kernel/sched/sched.h:3429:21: note: in expansion of macro 'try_cmpxchg'
   3429 |                 if (try_cmpxchg(&this_cpu_ptr(pcpu_cid)->cid, &cid, MM_CID_UNSET))
        |                     ^~~~~~~~~~~
  arch/riscv/include/asm/cmpxchg.h:334:9: note: here
    334 |         case 4:                                                         \
        |         ^~~~
  arch/riscv/include/asm/cmpxchg.h:368:30: note: in expansion of macro '__cmpxchg'
    368 |         (__typeof__(*(ptr))) __cmpxchg((ptr),                           \
        |                              ^~~~~~~~~
  include/linux/atomic/atomic-arch-fallback.h:55:21: note: in expansion of macro 'arch_cmpxchg'
     55 | #define raw_cmpxchg arch_cmpxchg
        |                     ^~~~~~~~~~~~
  include/linux/atomic/atomic-arch-fallback.h:192:16: note: in expansion of macro 'raw_cmpxchg'
    192 |         ___r = raw_cmpxchg((_ptr), ___o, (_new)); \
        |                ^~~~~~~~~~~
  include/linux/atomic/atomic-instrumented.h:4880:9: note: in expansion of macro 'raw_try_cmpxchg'
   4880 |         raw_try_cmpxchg(__ai_ptr, __ai_oldp, __VA_ARGS__); \
        |         ^~~~~~~~~~~~~~~
  kernel/sched/sched.h:3429:21: note: in expansion of macro 'try_cmpxchg'
   3429 |                 if (try_cmpxchg(&this_cpu_ptr(pcpu_cid)->cid, &cid, MM_CID_UNSET))
        |                     ^~~~~~~~~~~
  include/linux/atomic/atomic-arch-fallback.h: In function 'raw_atomic_cmpxchg_relaxed':
  arch/riscv/include/asm/cmpxchg.h:179:23: warning: this statement may fall through [-Wimplicit-fallthrough=]
    179 |                 __ret = cmpxchg_emu_u16((volatile u16 *)__ptr, __old, __new); \
        |                 ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  arch/riscv/include/asm/cmpxchg.h:212:30: note: in expansion of macro '__cmpxchg_relaxed'
    212 |         (__typeof__(*(ptr))) __cmpxchg_relaxed((ptr),                   \
        |                              ^~~~~~~~~~~~~~~~~
  include/linux/atomic/atomic-arch-fallback.h:89:29: note: in expansion of macro 'arch_cmpxchg_relaxed'
     89 | #define raw_cmpxchg_relaxed arch_cmpxchg_relaxed
        |                             ^~~~~~~~~~~~~~~~~~~~
  include/linux/atomic/atomic-arch-fallback.h:2108:16: note: in expansion of macro 'raw_cmpxchg_relaxed'
   2108 |         return raw_cmpxchg_relaxed(&v->counter, old, new);
        |                ^~~~~~~~~~~~~~~~~~~
  arch/riscv/include/asm/cmpxchg.h:180:9: note: here
    180 |         case 4:                                                         \
        |         ^~~~
  arch/riscv/include/asm/cmpxchg.h:212:30: note: in expansion of macro '__cmpxchg_relaxed'
    212 |         (__typeof__(*(ptr))) __cmpxchg_relaxed((ptr),                   \
        |                              ^~~~~~~~~~~~~~~~~
  include/linux/atomic/atomic-arch-fallback.h:89:29: note: in expansion of macro 'arch_cmpxchg_relaxed'
     89 | #define raw_cmpxchg_relaxed arch_cmpxchg_relaxed
        |                             ^~~~~~~~~~~~~~~~~~~~
  include/linux/atomic/atomic-arch-fallback.h:2108:16: note: in expansion of macro 'raw_cmpxchg_relaxed'
   2108 |         return raw_cmpxchg_relaxed(&v->counter, old, new);
        |                ^~~~~~~~~~~~~~~~~~~
  kernel/sched/core.c: In function '__sched_mm_cid_migrate_from_try_steal_cid':
  arch/riscv/include/asm/cmpxchg.h:333:23: warning: this statement may fall through [-Wimplicit-fallthrough=]
    333 |                 __ret = cmpxchg_emu_u16((volatile u16 *)__ptr, __old, __new); \
        |                 ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  arch/riscv/include/asm/cmpxchg.h:368:30: note: in expansion of macro '__cmpxchg'
    368 |         (__typeof__(*(ptr))) __cmpxchg((ptr),                           \
        |                              ^~~~~~~~~
  include/linux/atomic/atomic-arch-fallback.h:55:21: note: in expansion of macro 'arch_cmpxchg'
     55 | #define raw_cmpxchg arch_cmpxchg
        |                     ^~~~~~~~~~~~
  include/linux/atomic/atomic-arch-fallback.h:192:16: note: in expansion of macro 'raw_cmpxchg'
    192 |         ___r = raw_cmpxchg((_ptr), ___o, (_new)); \
        |                ^~~~~~~~~~~
  include/linux/atomic/atomic-instrumented.h:4880:9: note: in expansion of macro 'raw_try_cmpxchg'
   4880 |         raw_try_cmpxchg(__ai_ptr, __ai_oldp, __VA_ARGS__); \
        |         ^~~~~~~~~~~~~~~
  kernel/sched/core.c:11724:14: note: in expansion of macro 'try_cmpxchg'
  11724 |         if (!try_cmpxchg(&src_pcpu_cid->cid, &src_cid, lazy_cid))
        |              ^~~~~~~~~~~
  arch/riscv/include/asm/cmpxchg.h:334:9: note: here
    334 |         case 4:                                                         \
        |         ^~~~
  arch/riscv/include/asm/cmpxchg.h:368:30: note: in expansion of macro '__cmpxchg'
    368 |         (__typeof__(*(ptr))) __cmpxchg((ptr),                           \
        |                              ^~~~~~~~~
  include/linux/atomic/atomic-arch-fallback.h:55:21: note: in expansion of macro 'arch_cmpxchg'
     55 | #define raw_cmpxchg arch_cmpxchg
        |                     ^~~~~~~~~~~~
  include/linux/atomic/atomic-arch-fallback.h:192:16: note: in expansion of macro 'raw_cmpxchg'
    192 |         ___r = raw_cmpxchg((_ptr), ___o, (_new)); \
        |                ^~~~~~~~~~~
  include/linux/atomic/atomic-instrumented.h:4880:9: note: in expansion of macro 'raw_try_cmpxchg'
   4880 |         raw_try_cmpxchg(__ai_ptr, __ai_oldp, __VA_ARGS__); \
        |         ^~~~~~~~~~~~~~~
  kernel/sched/core.c:11724:14: note: in expansion of macro 'try_cmpxchg'
  11724 |         if (!try_cmpxchg(&src_pcpu_cid->cid, &src_cid, lazy_cid))
        |              ^~~~~~~~~~~
  arch/riscv/include/asm/cmpxchg.h:333:23: warning: this statement may fall through [-Wimplicit-fallthrough=]
    333 |                 __ret = cmpxchg_emu_u16((volatile u16 *)__ptr, __old, __new); \
        |                 ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  arch/riscv/include/asm/cmpxchg.h:368:30: note: in expansion of macro '__cmpxchg'
    368 |         (__typeof__(*(ptr))) __cmpxchg((ptr),                           \
        |                              ^~~~~~~~~
  include/linux/atomic/atomic-arch-fallback.h:55:21: note: in expansion of macro 'arch_cmpxchg'
     55 | #define raw_cmpxchg arch_cmpxchg
        |                     ^~~~~~~~~~~~
  include/linux/atomic/atomic-arch-fallback.h:192:16: note: in expansion of macro 'raw_cmpxchg'
    192 |         ___r = raw_cmpxchg((_ptr), ___o, (_new)); \
        |                ^~~~~~~~~~~
  include/linux/atomic/atomic-instrumented.h:4880:9: note: in expansion of macro 'raw_try_cmpxchg'
   4880 |         raw_try_cmpxchg(__ai_ptr, __ai_oldp, __VA_ARGS__); \
        |         ^~~~~~~~~~~~~~~
  kernel/sched/core.c:11760:14: note: in expansion of macro 'try_cmpxchg'
  11760 |         if (!try_cmpxchg(&src_pcpu_cid->cid, &lazy_cid, MM_CID_UNSET))
        |              ^~~~~~~~~~~
  arch/riscv/include/asm/cmpxchg.h:334:9: note: here
    334 |         case 4:                                                         \
        |         ^~~~
  arch/riscv/include/asm/cmpxchg.h:368:30: note: in expansion of macro '__cmpxchg'
    368 |         (__typeof__(*(ptr))) __cmpxchg((ptr),                           \
        |                              ^~~~~~~~~
  include/linux/atomic/atomic-arch-fallback.h:55:21: note: in expansion of macro 'arch_cmpxchg'
     55 | #define raw_cmpxchg arch_cmpxchg
        |                     ^~~~~~~~~~~~
  include/linux/atomic/atomic-arch-fallback.h:192:16: note: in expansion of macro 'raw_cmpxchg'
    192 |         ___r = raw_cmpxchg((_ptr), ___o, (_new)); \
        |                ^~~~~~~~~~~
  include/linux/atomic/atomic-instrumented.h:4880:9: note: in expansion of macro 'raw_try_cmpxchg'
   4880 |         raw_try_cmpxchg(__ai_ptr, __ai_oldp, __VA_ARGS__); \
        |         ^~~~~~~~~~~~~~~
  kernel/sched/core.c:11760:14: note: in expansion of macro 'try_cmpxchg'
  11760 |         if (!try_cmpxchg(&src_pcpu_cid->cid, &lazy_cid, MM_CID_UNSET))
        |              ^~~~~~~~~~~
  kernel/sched/core.c: In function 'task_mm_cid_work':
  arch/riscv/include/asm/cmpxchg.h:333:25: warning: this statement may fall through [-Wimplicit-fallthrough=]
    333 |                 __ret = cmpxchg_emu_u16((volatile u16 *)__ptr, __old, __new); \
        |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  arch/riscv/include/asm/cmpxchg.h:368:30: note: in expansion of macro '__cmpxchg'
    368 |         (__typeof__(*(ptr))) __cmpxchg((ptr),                           \
        |                              ^~~~~~~~~
  include/linux/atomic/atomic-arch-fallback.h:55:21: note: in expansion of macro 'arch_cmpxchg'
     55 | #define raw_cmpxchg arch_cmpxchg
        |                     ^~~~~~~~~~~~
  include/linux/atomic/atomic-instrumented.h:4788:9: note: in expansion of macro 'raw_cmpxchg'
   4788 |         raw_cmpxchg(__ai_ptr, __VA_ARGS__); \
        |         ^~~~~~~~~~~
  kernel/sched/core.c:11945:23: note: in expansion of macro 'cmpxchg'
  11945 |                 res = cmpxchg(&mm->mm_cid_next_scan, old_scan, next_scan);
        |                       ^~~~~~~
  arch/riscv/include/asm/cmpxchg.h:334:9: note: here
    334 |         case 4:                                                         \
        |         ^~~~
  arch/riscv/include/asm/cmpxchg.h:368:30: note: in expansion of macro '__cmpxchg'
    368 |         (__typeof__(*(ptr))) __cmpxchg((ptr),                           \
        |                              ^~~~~~~~~
  include/linux/atomic/atomic-arch-fallback.h:55:21: note: in expansion of macro 'arch_cmpxchg'
     55 | #define raw_cmpxchg arch_cmpxchg
        |                     ^~~~~~~~~~~~
  include/linux/atomic/atomic-instrumented.h:4788:9: note: in expansion of macro 'raw_cmpxchg'
   4788 |         raw_cmpxchg(__ai_ptr, __VA_ARGS__); \
        |         ^~~~~~~~~~~
  kernel/sched/core.c:11945:23: note: in expansion of macro 'cmpxchg'
  11945 |                 res = cmpxchg(&mm->mm_cid_next_scan, old_scan, next_scan);
        |                       ^~~~~~~
  arch/riscv/include/asm/cmpxchg.h:333:25: warning: this statement may fall through [-Wimplicit-fallthrough=]
    333 |                 __ret = cmpxchg_emu_u16((volatile u16 *)__ptr, __old, __new); \
        |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  arch/riscv/include/asm/cmpxchg.h:368:30: note: in expansion of macro '__cmpxchg'
    368 |         (__typeof__(*(ptr))) __cmpxchg((ptr),                           \
        |                              ^~~~~~~~~
  include/linux/atomic/atomic-arch-fallback.h:55:21: note: in expansion of macro 'arch_cmpxchg'
     55 | #define raw_cmpxchg arch_cmpxchg
        |                     ^~~~~~~~~~~~
  include/linux/atomic/atomic-arch-fallback.h:192:16: note: in expansion of macro 'raw_cmpxchg'
    192 |         ___r = raw_cmpxchg((_ptr), ___o, (_new)); \
        |                ^~~~~~~~~~~
  include/linux/atomic/atomic-instrumented.h:4880:9: note: in expansion of macro 'raw_try_cmpxchg'
   4880 |         raw_try_cmpxchg(__ai_ptr, __ai_oldp, __VA_ARGS__); \
        |         ^~~~~~~~~~~~~~~
  kernel/sched/core.c:11953:14: note: in expansion of macro 'try_cmpxchg'
  11953 |         if (!try_cmpxchg(&mm->mm_cid_next_scan, &old_scan, next_scan))
        |              ^~~~~~~~~~~
  arch/riscv/include/asm/cmpxchg.h:334:9: note: here
    334 |         case 4:                                                         \
        |         ^~~~
  arch/riscv/include/asm/cmpxchg.h:368:30: note: in expansion of macro '__cmpxchg'
    368 |         (__typeof__(*(ptr))) __cmpxchg((ptr),                           \
        |                              ^~~~~~~~~
  include/linux/atomic/atomic-arch-fallback.h:55:21: note: in expansion of macro 'arch_cmpxchg'
     55 | #define raw_cmpxchg arch_cmpxchg
        |                     ^~~~~~~~~~~~
  include/linux/atomic/atomic-arch-fallback.h:192:16: note: in expansion of macro 'raw_cmpxchg'
    192 |         ___r = raw_cmpxchg((_ptr), ___o, (_new)); \
        |                ^~~~~~~~~~~
  include/linux/atomic/atomic-instrumented.h:4880:9: note: in expansion of macro 'raw_try_cmpxchg'
   4880 |         raw_try_cmpxchg(__ai_ptr, __ai_oldp, __VA_ARGS__); \
        |         ^~~~~~~~~~~~~~~
  kernel/sched/core.c:11953:14: note: in expansion of macro 'try_cmpxchg'
  11953 |         if (!try_cmpxchg(&mm->mm_cid_next_scan, &old_scan, next_scan))
        |              ^~~~~~~~~~~
  kernel/sched/core.c: In function 'sched_mm_cid_remote_clear':
  arch/riscv/include/asm/cmpxchg.h:333:23: warning: this statement may fall through [-Wimplicit-fallthrough=]
    333 |                 __ret = cmpxchg_emu_u16((volatile u16 *)__ptr, __old, __new); \
        |                 ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  arch/riscv/include/asm/cmpxchg.h:368:30: note: in expansion of macro '__cmpxchg'
    368 |         (__typeof__(*(ptr))) __cmpxchg((ptr),                           \
        |                              ^~~~~~~~~
  include/linux/atomic/atomic-arch-fallback.h:55:21: note: in expansion of macro 'arch_cmpxchg'
     55 | #define raw_cmpxchg arch_cmpxchg
        |                     ^~~~~~~~~~~~
  include/linux/atomic/atomic-arch-fallback.h:192:16: note: in expansion of macro 'raw_cmpxchg'
    192 |         ___r = raw_cmpxchg((_ptr), ___o, (_new)); \
        |                ^~~~~~~~~~~
  include/linux/atomic/atomic-instrumented.h:4880:9: note: in expansion of macro 'raw_try_cmpxchg'
   4880 |         raw_try_cmpxchg(__ai_ptr, __ai_oldp, __VA_ARGS__); \
        |         ^~~~~~~~~~~~~~~
  kernel/sched/core.c:11841:14: note: in expansion of macro 'try_cmpxchg'
  11841 |         if (!try_cmpxchg(&pcpu_cid->cid, &cid, lazy_cid))
        |              ^~~~~~~~~~~
  arch/riscv/include/asm/cmpxchg.h:334:9: note: here
    334 |         case 4:                                                         \
        |         ^~~~
  arch/riscv/include/asm/cmpxchg.h:368:30: note: in expansion of macro '__cmpxchg'
    368 |         (__typeof__(*(ptr))) __cmpxchg((ptr),                           \
        |                              ^~~~~~~~~
  include/linux/atomic/atomic-arch-fallback.h:55:21: note: in expansion of macro 'arch_cmpxchg'
     55 | #define raw_cmpxchg arch_cmpxchg
        |                     ^~~~~~~~~~~~
  include/linux/atomic/atomic-arch-fallback.h:192:16: note: in expansion of macro 'raw_cmpxchg'
    192 |         ___r = raw_cmpxchg((_ptr), ___o, (_new)); \
        |                ^~~~~~~~~~~
  include/linux/atomic/atomic-instrumented.h:4880:9: note: in expansion of macro 'raw_try_cmpxchg'
   4880 |         raw_try_cmpxchg(__ai_ptr, __ai_oldp, __VA_ARGS__); \
        |         ^~~~~~~~~~~~~~~
  kernel/sched/core.c:11841:14: note: in expansion of macro 'try_cmpxchg'
  11841 |         if (!try_cmpxchg(&pcpu_cid->cid, &cid, lazy_cid))
        |              ^~~~~~~~~~~
  arch/riscv/include/asm/cmpxchg.h:333:23: warning: this statement may fall through [-Wimplicit-fallthrough=]
    333 |                 __ret = cmpxchg_emu_u16((volatile u16 *)__ptr, __old, __new); \
        |                 ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  arch/riscv/include/asm/cmpxchg.h:368:30: note: in expansion of macro '__cmpxchg'
    368 |         (__typeof__(*(ptr))) __cmpxchg((ptr),                           \
        |                              ^~~~~~~~~
  include/linux/atomic/atomic-arch-fallback.h:55:21: note: in expansion of macro 'arch_cmpxchg'
     55 | #define raw_cmpxchg arch_cmpxchg
        |                     ^~~~~~~~~~~~
  include/linux/atomic/atomic-arch-fallback.h:192:16: note: in expansion of macro 'raw_cmpxchg'
    192 |         ___r = raw_cmpxchg((_ptr), ___o, (_new)); \
        |                ^~~~~~~~~~~
  include/linux/atomic/atomic-instrumented.h:4880:9: note: in expansion of macro 'raw_try_cmpxchg'
   4880 |         raw_try_cmpxchg(__ai_ptr, __ai_oldp, __VA_ARGS__); \
        |         ^~~~~~~~~~~~~~~
  kernel/sched/core.c:11874:21: note: in expansion of macro 'try_cmpxchg'
  11874 |                 if (try_cmpxchg(&pcpu_cid->cid, &lazy_cid, MM_CID_UNSET))
        |                     ^~~~~~~~~~~
  arch/riscv/include/asm/cmpxchg.h:334:9: note: here
    334 |         case 4:                                                         \
        |         ^~~~
  arch/riscv/include/asm/cmpxchg.h:368:30: note: in expansion of macro '__cmpxchg'
    368 |         (__typeof__(*(ptr))) __cmpxchg((ptr),                           \
        |                              ^~~~~~~~~
  include/linux/atomic/atomic-arch-fallback.h:55:21: note: in expansion of macro 'arch_cmpxchg'
     55 | #define raw_cmpxchg arch_cmpxchg
        |                     ^~~~~~~~~~~~
  include/linux/atomic/atomic-arch-fallback.h:192:16: note: in expansion of macro 'raw_cmpxchg'
    192 |         ___r = raw_cmpxchg((_ptr), ___o, (_new)); \
        |                ^~~~~~~~~~~
  include/linux/atomic/atomic-instrumented.h:4880:9: note: in expansion of macro 'raw_try_cmpxchg'
   4880 |         raw_try_cmpxchg(__ai_ptr, __ai_oldp, __VA_ARGS__); \
        |         ^~~~~~~~~~~~~~~
  kernel/sched/core.c:11874:21: note: in expansion of macro 'try_cmpxchg'
  11874 |                 if (try_cmpxchg(&pcpu_cid->cid, &lazy_cid, MM_CID_UNSET))
        |                     ^~~~~~~~~~~
  kernel/sched/sched.h: In function 'mm_cid_pcpu_unset':
  arch/riscv/include/asm/cmpxchg.h:333:23: warning: this statement may fall through [-Wimplicit-fallthrough=]
    333 |                 __ret = cmpxchg_emu_u16((volatile u16 *)__ptr, __old, __new); \
        |                 ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  arch/riscv/include/asm/cmpxchg.h:368:30: note: in expansion of macro '__cmpxchg'
    368 |         (__typeof__(*(ptr))) __cmpxchg((ptr),                           \
        |                              ^~~~~~~~~
  include/linux/atomic/atomic-arch-fallback.h:55:21: note: in expansion of macro 'arch_cmpxchg'
     55 | #define raw_cmpxchg arch_cmpxchg
        |                     ^~~~~~~~~~~~
  include/linux/atomic/atomic-instrumented.h:4788:9: note: in expansion of macro 'raw_cmpxchg'
   4788 |         raw_cmpxchg(__ai_ptr, __VA_ARGS__); \
        |         ^~~~~~~~~~~
  kernel/sched/sched.h:3310:23: note: in expansion of macro 'cmpxchg'
   3310 |                 res = cmpxchg(&this_cpu_ptr(pcpu_cid)->cid, cid, MM_CID_UNSET);
        |                       ^~~~~~~
  arch/riscv/include/asm/cmpxchg.h:334:9: note: here
    334 |         case 4:                                                         \
        |         ^~~~
  arch/riscv/include/asm/cmpxchg.h:368:30: note: in expansion of macro '__cmpxchg'
    368 |         (__typeof__(*(ptr))) __cmpxchg((ptr),                           \
        |                              ^~~~~~~~~
  include/linux/atomic/atomic-arch-fallback.h:55:21: note: in expansion of macro 'arch_cmpxchg'
     55 | #define raw_cmpxchg arch_cmpxchg
        |                     ^~~~~~~~~~~~
  include/linux/atomic/atomic-instrumented.h:4788:9: note: in expansion of macro 'raw_cmpxchg'
   4788 |         raw_cmpxchg(__ai_ptr, __VA_ARGS__); \
        |         ^~~~~~~~~~~
  kernel/sched/sched.h:3310:23: note: in expansion of macro 'cmpxchg'
   3310 |                 res = cmpxchg(&this_cpu_ptr(pcpu_cid)->cid, cid, MM_CID_UNSET);
        |                       ^~~~~~~

> > Reported-by: Linux Kernel Functional Testing <lkft@linaro.org>
> >
> > riscv:
> >   build:
> >     * clang-17-lkftconfig - Failed
> >     * rv32-clang-17-defconfig - Failed
> >     * clang-17-tinyconfig - Failed
> >     * rv32-clang-17-tinyconfig - Failed
> >     * clang-17-defconfig - Failed
> >     * clang-17-allnoconfig - Failed
> >     * rv32-clang-17-allnoconfig - Failed
> >
> > Build log:
> > -------
> > kernel/sched/core.c:961:15: error: incompatible pointer to integer
> > conversion passing 'typeof (*((__ai_ptr)))' (aka 'struct wake_q_node
> > *') to parameter of type 'uintptr_t' (aka 'unsigned long')
> > [-Wint-conversion]
> >   961 |         if (unlikely(cmpxchg_relaxed(&node->next, NULL, WAKE_Q_TAIL)))
> >       |                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> There is no recent change on this code. Could it be a change in
> cmpxchg_relaxed ?

Yes, it is caused by commit df35ee400e06 ("riscv: Emulate one-byte and
two-byte cmpxchg") in -next. There is another thread on this problem
with a suggested diff that resolves it for me (there are other issues
with that change as well such as break not being in the correct
location):

https://lore.kernel.org/Zgz98szFLLjTIZSO@yujie-X299/

Cheers,
Nathan

  reply	other threads:[~2024-04-03 16:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-03  7:38 kernel/sched/core.c:961:15: error: incompatible pointer to integer conversion passing 'typeof Naresh Kamboju
2024-04-03 13:26 ` Vincent Guittot
2024-04-03 16:00   ` Nathan Chancellor [this message]
2024-04-03 19:56     ` Paul E. McKenney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240403160041.GA1252923@dev-arch.thelio-3990X \
    --to=nathan@kernel.org \
    --cc=aou@eecs.berkeley.edu \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=lkft-triage@lists.linaro.org \
    --cc=llvm@lists.linux.dev \
    --cc=mingo@redhat.com \
    --cc=naresh.kamboju@linaro.org \
    --cc=ndesaulniers@google.com \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    --cc=paulmck@kernel.org \
    --cc=peterz@infradead.org \
    --cc=regressions@lists.linux.dev \
    --cc=vincent.guittot@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox