On Tue, Apr 02, 2024 at 03:08:07PM +0800, kernel test robot wrote: > tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master > head: c0b832517f627ead3388c6f0c74e8ac10ad5774b > commit: df35ee400e06b23ecd44fdb66451a5343932f834 [2559/3220] riscv: Emulate one-byte and two-byte cmpxchg > config: riscv-randconfig-r061-20240402 (https://download.01.org/0day-ci/archive/20240402/202404021504.YTP51bL3-lkp@xxxxxxxxx/config) > compiler: riscv64-linux-gcc (GCC) 13.2.0 > reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240402/202404021504.YTP51bL3-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/202404021504.YTP51bL3-lkp@xxxxxxxxx/ One fix leads to another. ;-) Does the patch at the end of this email clear things up? Thanx, Paul > All warnings (new ones prefixed by >>): > > In file included 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/mmzone.h:8, > from include/linux/gfp.h:7, > from include/linux/slab.h:16, > from drivers/accessibility/speakup/selection.c:2: > drivers/accessibility/speakup/selection.c: In function 'speakup_set_selection': > arch/riscv/include/asm/cmpxchg.h:329:62: warning: passing argument 2 of 'cmpxchg_emu_u8' makes integer from pointer without a cast [-Wint-conversion] > 329 | __ret = cmpxchg_emu_u8((volatile u8 *)__ptr, __old, __new); \ > | ^~~~~ > | | > | struct tty_struct * > 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__); \ > | ^~~~~~~~~~~ > drivers/accessibility/speakup/selection.c:71:13: note: in expansion of macro 'cmpxchg' > 71 | if (cmpxchg(&speakup_sel_work.tty, NULL, tty)) { > | ^~~~~~~ > In file included from arch/riscv/include/asm/cmpxchg.h:12: > include/linux/cmpxchg-emu.h:13:52: note: expected 'uintptr_t' {aka 'long unsigned int'} but argument is of type 'struct tty_struct *' > 13 | uintptr_t cmpxchg_emu_u8(volatile u8 *p, uintptr_t old, uintptr_t new); > | ~~~~~~~~~~^~~ > arch/riscv/include/asm/cmpxchg.h:329:69: warning: passing argument 3 of 'cmpxchg_emu_u8' makes integer from pointer without a cast [-Wint-conversion] > 329 | __ret = cmpxchg_emu_u8((volatile u8 *)__ptr, __old, __new); \ > | ^~~~~ > | | > | struct tty_struct * > 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__); \ > | ^~~~~~~~~~~ > drivers/accessibility/speakup/selection.c:71:13: note: in expansion of macro 'cmpxchg' > 71 | if (cmpxchg(&speakup_sel_work.tty, NULL, tty)) { > | ^~~~~~~ > include/linux/cmpxchg-emu.h:13:67: note: expected 'uintptr_t' {aka 'long unsigned int'} but argument is of type 'struct tty_struct *' > 13 | uintptr_t cmpxchg_emu_u8(volatile u8 *p, uintptr_t old, uintptr_t new); > | ~~~~~~~~~~^~~ > >> arch/riscv/include/asm/cmpxchg.h:329:23: warning: assignment to 'struct tty_struct *' from 'uintptr_t' {aka 'long unsigned int'} makes pointer from integer without a cast [-Wint-conversion] > 329 | __ret = cmpxchg_emu_u8((volatile u8 *)__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__); \ > | ^~~~~~~~~~~ > drivers/accessibility/speakup/selection.c:71:13: note: in expansion of macro 'cmpxchg' > 71 | if (cmpxchg(&speakup_sel_work.tty, NULL, tty)) { > | ^~~~~~~ > arch/riscv/include/asm/cmpxchg.h:333:64: warning: passing argument 2 of 'cmpxchg_emu_u16' makes integer from pointer without a cast [-Wint-conversion] > 333 | __ret = cmpxchg_emu_u16((volatile u16 *)__ptr, __old, __new); \ > | ^~~~~ > | | > | struct tty_struct * > 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__); \ > | ^~~~~~~~~~~ > drivers/accessibility/speakup/selection.c:71:13: note: in expansion of macro 'cmpxchg' > 71 | if (cmpxchg(&speakup_sel_work.tty, NULL, tty)) { > | ^~~~~~~ > include/linux/cmpxchg-emu.h:14:54: note: expected 'uintptr_t' {aka 'long unsigned int'} but argument is of type 'struct tty_struct *' > 14 | uintptr_t cmpxchg_emu_u16(volatile u16 *p, uintptr_t old, uintptr_t new); > | ~~~~~~~~~~^~~ > arch/riscv/include/asm/cmpxchg.h:333:71: warning: passing argument 3 of 'cmpxchg_emu_u16' makes integer from pointer without a cast [-Wint-conversion] > 333 | __ret = cmpxchg_emu_u16((volatile u16 *)__ptr, __old, __new); \ > | ^~~~~ > | | > | struct tty_struct * > 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__); \ > | ^~~~~~~~~~~ > drivers/accessibility/speakup/selection.c:71:13: note: in expansion of macro 'cmpxchg' > 71 | if (cmpxchg(&speakup_sel_work.tty, NULL, tty)) { > | ^~~~~~~ > include/linux/cmpxchg-emu.h:14:69: note: expected 'uintptr_t' {aka 'long unsigned int'} but argument is of type 'struct tty_struct *' > 14 | uintptr_t cmpxchg_emu_u16(volatile u16 *p, uintptr_t old, uintptr_t new); > | ~~~~~~~~~~^~~ > arch/riscv/include/asm/cmpxchg.h:333:23: warning: assignment to 'struct tty_struct *' from 'uintptr_t' {aka 'long unsigned int'} makes pointer from integer without a cast [-Wint-conversion] > 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__); \ > | ^~~~~~~~~~~ > drivers/accessibility/speakup/selection.c:71:13: note: in expansion of macro 'cmpxchg' > 71 | if (cmpxchg(&speakup_sel_work.tty, NULL, tty)) { > | ^~~~~~~ > drivers/accessibility/speakup/selection.c: In function 'speakup_paste_selection': > arch/riscv/include/asm/cmpxchg.h:329:62: warning: passing argument 2 of 'cmpxchg_emu_u8' makes integer from pointer without a cast [-Wint-conversion] > 329 | __ret = cmpxchg_emu_u8((volatile u8 *)__ptr, __old, __new); \ > | ^~~~~ > | | > | struct tty_struct * > 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__); \ > | ^~~~~~~~~~~ > drivers/accessibility/speakup/selection.c:124:13: note: in expansion of macro 'cmpxchg' > 124 | if (cmpxchg(&speakup_paste_work.tty, NULL, tty)) { > | ^~~~~~~ > include/linux/cmpxchg-emu.h:13:52: note: expected 'uintptr_t' {aka 'long unsigned int'} but argument is of type 'struct tty_struct *' > 13 | uintptr_t cmpxchg_emu_u8(volatile u8 *p, uintptr_t old, uintptr_t new); > | ~~~~~~~~~~^~~ > arch/riscv/include/asm/cmpxchg.h:329:69: warning: passing argument 3 of 'cmpxchg_emu_u8' makes integer from pointer without a cast [-Wint-conversion] > 329 | __ret = cmpxchg_emu_u8((volatile u8 *)__ptr, __old, __new); \ > | ^~~~~ > | | > | struct tty_struct * > 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__); \ > | ^~~~~~~~~~~ > drivers/accessibility/speakup/selection.c:124:13: note: in expansion of macro 'cmpxchg' > 124 | if (cmpxchg(&speakup_paste_work.tty, NULL, tty)) { > | ^~~~~~~ > include/linux/cmpxchg-emu.h:13:67: note: expected 'uintptr_t' {aka 'long unsigned int'} but argument is of type 'struct tty_struct *' > 13 | uintptr_t cmpxchg_emu_u8(volatile u8 *p, uintptr_t old, uintptr_t new); > | ~~~~~~~~~~^~~ > >> arch/riscv/include/asm/cmpxchg.h:329:23: warning: assignment to 'struct tty_struct *' from 'uintptr_t' {aka 'long unsigned int'} makes pointer from integer without a cast [-Wint-conversion] > 329 | __ret = cmpxchg_emu_u8((volatile u8 *)__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__); \ > | ^~~~~~~~~~~ > drivers/accessibility/speakup/selection.c:124:13: note: in expansion of macro 'cmpxchg' > 124 | if (cmpxchg(&speakup_paste_work.tty, NULL, tty)) { > | ^~~~~~~ > arch/riscv/include/asm/cmpxchg.h:333:64: warning: passing argument 2 of 'cmpxchg_emu_u16' makes integer from pointer without a cast [-Wint-conversion] > 333 | __ret = cmpxchg_emu_u16((volatile u16 *)__ptr, __old, __new); \ > | ^~~~~ > | | > | struct tty_struct * > 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__); \ > | ^~~~~~~~~~~ > drivers/accessibility/speakup/selection.c:124:13: note: in expansion of macro 'cmpxchg' > 124 | if (cmpxchg(&speakup_paste_work.tty, NULL, tty)) { > | ^~~~~~~ > include/linux/cmpxchg-emu.h:14:54: note: expected 'uintptr_t' {aka 'long unsigned int'} but argument is of type 'struct tty_struct *' > 14 | uintptr_t cmpxchg_emu_u16(volatile u16 *p, uintptr_t old, uintptr_t new); > | ~~~~~~~~~~^~~ > arch/riscv/include/asm/cmpxchg.h:333:71: warning: passing argument 3 of 'cmpxchg_emu_u16' makes integer from pointer without a cast [-Wint-conversion] > 333 | __ret = cmpxchg_emu_u16((volatile u16 *)__ptr, __old, __new); \ > | ^~~~~ > | | > | struct tty_struct * > 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__); \ > | ^~~~~~~~~~~ > drivers/accessibility/speakup/selection.c:124:13: note: in expansion of macro 'cmpxchg' > 124 | if (cmpxchg(&speakup_paste_work.tty, NULL, tty)) { > | ^~~~~~~ > include/linux/cmpxchg-emu.h:14:69: note: expected 'uintptr_t' {aka 'long unsigned int'} but argument is of type 'struct tty_struct *' > 14 | uintptr_t cmpxchg_emu_u16(volatile u16 *p, uintptr_t old, uintptr_t new); > | ~~~~~~~~~~^~~ > arch/riscv/include/asm/cmpxchg.h:333:23: warning: assignment to 'struct tty_struct *' from 'uintptr_t' {aka 'long unsigned int'} makes pointer from integer without a cast [-Wint-conversion] > 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__); \ > | ^~~~~~~~~~~ > drivers/accessibility/speakup/selection.c:124:13: note: in expansion of macro 'cmpxchg' > 124 | if (cmpxchg(&speakup_paste_work.tty, NULL, tty)) { > | ^~~~~~~ > drivers/accessibility/speakup/selection.c: In function 'speakup_set_selection': > 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__); \ > | ^~~~~~~~~~~ > drivers/accessibility/speakup/selection.c:71:13: note: in expansion of macro 'cmpxchg' > 71 | if (cmpxchg(&speakup_sel_work.tty, NULL, tty)) { > | ^~~~~~~ > 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__); \ > | ^~~~~~~~~~~ > drivers/accessibility/speakup/selection.c:71:13: note: in expansion of macro 'cmpxchg' > 71 | if (cmpxchg(&speakup_sel_work.tty, NULL, tty)) { > | ^~~~~~~ > > > vim +329 arch/riscv/include/asm/cmpxchg.h > > 319 > 320 #define __cmpxchg(ptr, old, new, size) \ > 321 ({ \ > 322 __typeof__(ptr) __ptr = (ptr); \ > 323 __typeof__(*(ptr)) __old = (old); \ > 324 __typeof__(*(ptr)) __new = (new); \ > 325 __typeof__(*(ptr)) __ret; \ > 326 register unsigned int __rc; \ > 327 switch (size) { \ > 328 case 1: \ > > 329 __ret = cmpxchg_emu_u8((volatile u8 *)__ptr, __old, __new); \ > 330 break; \ > 331 case 2: \ > 332 break; \ > 333 __ret = cmpxchg_emu_u16((volatile u16 *)__ptr, __old, __new); \ > 334 case 4: \ > 335 __asm__ __volatile__ ( \ > 336 "0: lr.w %0, %2\n" \ > 337 " bne %0, %z3, 1f\n" \ > 338 " sc.w.rl %1, %z4, %2\n" \ > 339 " bnez %1, 0b\n" \ > 340 RISCV_FULL_BARRIER \ > 341 "1:\n" \ > 342 : "=&r" (__ret), "=&r" (__rc), "+A" (*__ptr) \ > 343 : "rJ" ((long)__old), "rJ" (__new) \ > 344 : "memory"); \ > 345 break; \ > 346 case 8: \ > 347 __asm__ __volatile__ ( \ > 348 "0: lr.d %0, %2\n" \ > 349 " bne %0, %z3, 1f\n" \ > 350 " sc.d.rl %1, %z4, %2\n" \ > 351 " bnez %1, 0b\n" \ > 352 RISCV_FULL_BARRIER \ > 353 "1:\n" \ > 354 : "=&r" (__ret), "=&r" (__rc), "+A" (*__ptr) \ > 355 : "rJ" (__old), "rJ" (__new) \ > 356 : "memory"); \ > 357 break; \ > 358 default: \ > 359 BUILD_BUG(); \ > 360 } \ > 361 __ret; \ > 362 }) > 363 > > -- > 0-DAY CI Kernel Test Service > https://github.com/intel/lkp-tests/wiki ------------------------------------------------------------------------ diff --git a/arch/riscv/include/asm/cmpxchg.h b/arch/riscv/include/asm/cmpxchg.h index a5b377481785c..fb1ac86ac2bf6 100644 --- a/arch/riscv/include/asm/cmpxchg.h +++ b/arch/riscv/include/asm/cmpxchg.h @@ -172,11 +172,11 @@ register unsigned int __rc; \ switch (size) { \ case 1: \ - __ret = cmpxchg_emu_u8((volatile u8 *)__ptr, __old, __new); \ + __ret = cmpxchg_emu_u8((volatile u8 *)__ptr, (uintptr_t)__old, (uintptr_t)__new); \ break; \ case 2: \ break; \ - __ret = cmpxchg_emu_u16((volatile u16 *)__ptr, __old, __new); \ + __ret = cmpxchg_emu_u16((volatile u16 *)__ptr, (uintptr_t)__old, (uintptr_t)__new); \ case 4: \ __asm__ __volatile__ ( \ "0: lr.w %0, %2\n" \