From: kernel test robot <lkp@intel.com>
To: kbuild-all@lists.01.org
Subject: arch/mips/kernel/cmpxchg.c:44:12: warning: converting the result of '<<' to a boolean always evaluates to true
Date: Thu, 03 Dec 2020 15:24:02 +0800 [thread overview]
Message-ID: <202012031558.obnesxFc-lkp@intel.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 28349 bytes --]
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 34816d20f173a90389c8a7e641166d8ea9dce70a
commit: afe956c577b2d5a3d9834e4424587c1ebcf90c4c kbuild: Enable -Wtautological-compare
date: 8 months ago
config: mips-randconfig-r021-20201203 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 32c501dd88b62787d3a5ffda7aabcf4650dbe3cd)
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 mips cross compiling tool for clang build
# apt-get install binutils-mips-linux-gnu
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=afe956c577b2d5a3d9834e4424587c1ebcf90c4c
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout afe956c577b2d5a3d9834e4424587c1ebcf90c4c
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=mips
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
>> arch/mips/kernel/cmpxchg.c:44:12: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
load32 = cmpxchg(ptr32, old32, new32);
^
arch/mips/include/asm/cmpxchg.h:194:7: note: expanded from macro 'cmpxchg'
if (!__SYNC_loongson3_war) \
^
arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
# define __SYNC_loongson3_war (1 << 31)
^
>> arch/mips/kernel/cmpxchg.c:44:12: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
arch/mips/include/asm/cmpxchg.h:204:7: note: expanded from macro 'cmpxchg'
if (!__SYNC_loongson3_war) \
^
arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
# define __SYNC_loongson3_war (1 << 31)
^
arch/mips/kernel/cmpxchg.c:100:12: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
load32 = cmpxchg(ptr32, old32, new32);
^
arch/mips/include/asm/cmpxchg.h:194:7: note: expanded from macro 'cmpxchg'
if (!__SYNC_loongson3_war) \
^
arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
# define __SYNC_loongson3_war (1 << 31)
^
arch/mips/kernel/cmpxchg.c:100:12: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
arch/mips/include/asm/cmpxchg.h:204:7: note: expanded from macro 'cmpxchg'
if (!__SYNC_loongson3_war) \
^
arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
# define __SYNC_loongson3_war (1 << 31)
^
4 warnings generated.
Assembler messages:
Fatal error: invalid -march= option: `mips64r2'
clang-12: error: assembler command failed with exit code 1 (use -v to see invocation)
--
In file included from arch/mips/kernel/cpu-probe.c:12:
In file included from include/linux/ptrace.h:6:
In file included from include/linux/sched.h:12:
In file included from ./arch/mips/include/generated/asm/current.h:1:
In file included from include/asm-generic/current.h:5:
In file included from include/linux/thread_info.h:38:
In file included from arch/mips/include/asm/thread_info.h:16:
In file included from arch/mips/include/asm/processor.h:14:
In file included from include/linux/atomic.h:7:
>> arch/mips/include/asm/atomic.h:49:1: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
ATOMIC_OPS(atomic, int)
^
arch/mips/include/asm/atomic.h:40:9: note: expanded from macro 'ATOMIC_OPS'
return cmpxchg(&v->counter, o, n); \
^
arch/mips/include/asm/cmpxchg.h:194:7: note: expanded from macro 'cmpxchg'
if (!__SYNC_loongson3_war) \
^
arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
# define __SYNC_loongson3_war (1 << 31)
^
In file included from arch/mips/kernel/cpu-probe.c:12:
In file included from include/linux/ptrace.h:6:
In file included from include/linux/sched.h:12:
In file included from ./arch/mips/include/generated/asm/current.h:1:
In file included from include/asm-generic/current.h:5:
In file included from include/linux/thread_info.h:38:
In file included from arch/mips/include/asm/thread_info.h:16:
In file included from arch/mips/include/asm/processor.h:14:
In file included from include/linux/atomic.h:7:
>> arch/mips/include/asm/atomic.h:49:1: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
arch/mips/include/asm/atomic.h:40:9: note: expanded from macro 'ATOMIC_OPS'
return cmpxchg(&v->counter, o, n); \
^
arch/mips/include/asm/cmpxchg.h:204:7: note: expanded from macro 'cmpxchg'
if (!__SYNC_loongson3_war) \
^
arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
# define __SYNC_loongson3_war (1 << 31)
^
In file included from arch/mips/kernel/cpu-probe.c:12:
In file included from include/linux/ptrace.h:6:
In file included from include/linux/sched.h:12:
In file included from ./arch/mips/include/generated/asm/current.h:1:
In file included from include/asm-generic/current.h:5:
In file included from include/linux/thread_info.h:38:
In file included from arch/mips/include/asm/thread_info.h:16:
In file included from arch/mips/include/asm/processor.h:14:
In file included from include/linux/atomic.h:7:
>> arch/mips/include/asm/atomic.h:49:1: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
arch/mips/include/asm/atomic.h:45:9: note: expanded from macro 'ATOMIC_OPS'
return xchg(&v->counter, n); \
^
arch/mips/include/asm/cmpxchg.h:102:7: note: expanded from macro 'xchg'
if (!__SYNC_loongson3_war) \
^
arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
# define __SYNC_loongson3_war (1 << 31)
^
In file included from arch/mips/kernel/cpu-probe.c:12:
In file included from include/linux/ptrace.h:6:
In file included from include/linux/sched.h:12:
In file included from ./arch/mips/include/generated/asm/current.h:1:
In file included from include/asm-generic/current.h:5:
In file included from include/linux/thread_info.h:38:
In file included from arch/mips/include/asm/thread_info.h:16:
In file included from arch/mips/include/asm/processor.h:14:
In file included from include/linux/atomic.h:7:
arch/mips/include/asm/atomic.h:53:1: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
ATOMIC_OPS(atomic64, s64)
^
arch/mips/include/asm/atomic.h:40:9: note: expanded from macro 'ATOMIC_OPS'
return cmpxchg(&v->counter, o, n); \
^
arch/mips/include/asm/cmpxchg.h:194:7: note: expanded from macro 'cmpxchg'
if (!__SYNC_loongson3_war) \
^
arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
# define __SYNC_loongson3_war (1 << 31)
^
In file included from arch/mips/kernel/cpu-probe.c:12:
In file included from include/linux/ptrace.h:6:
In file included from include/linux/sched.h:12:
In file included from ./arch/mips/include/generated/asm/current.h:1:
In file included from include/asm-generic/current.h:5:
In file included from include/linux/thread_info.h:38:
In file included from arch/mips/include/asm/thread_info.h:16:
In file included from arch/mips/include/asm/processor.h:14:
In file included from include/linux/atomic.h:7:
arch/mips/include/asm/atomic.h:53:1: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
arch/mips/include/asm/atomic.h:40:9: note: expanded from macro 'ATOMIC_OPS'
return cmpxchg(&v->counter, o, n); \
^
arch/mips/include/asm/cmpxchg.h:204:7: note: expanded from macro 'cmpxchg'
if (!__SYNC_loongson3_war) \
^
arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
# define __SYNC_loongson3_war (1 << 31)
^
In file included from arch/mips/kernel/cpu-probe.c:12:
In file included from include/linux/ptrace.h:6:
In file included from include/linux/sched.h:12:
In file included from ./arch/mips/include/generated/asm/current.h:1:
In file included from include/asm-generic/current.h:5:
In file included from include/linux/thread_info.h:38:
In file included from arch/mips/include/asm/thread_info.h:16:
In file included from arch/mips/include/asm/processor.h:14:
In file included from include/linux/atomic.h:7:
arch/mips/include/asm/atomic.h:53:1: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
arch/mips/include/asm/atomic.h:45:9: note: expanded from macro 'ATOMIC_OPS'
return xchg(&v->counter, n); \
^
arch/mips/include/asm/cmpxchg.h:102:7: note: expanded from macro 'xchg'
if (!__SYNC_loongson3_war) \
^
arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
# define __SYNC_loongson3_war (1 << 31)
^
In file included from arch/mips/kernel/cpu-probe.c:12:
In file included from include/linux/ptrace.h:6:
In file included from include/linux/sched.h:12:
In file included from ./arch/mips/include/generated/asm/current.h:1:
In file included from include/asm-generic/current.h:5:
In file included from include/linux/thread_info.h:38:
In file included from arch/mips/include/asm/thread_info.h:16:
In file included from arch/mips/include/asm/processor.h:14:
In file included from include/linux/atomic.h:7:
arch/mips/include/asm/atomic.h:258:1: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
ATOMIC_SIP_OP(atomic, int, subu, ll, sc)
^
arch/mips/include/asm/atomic.h:252:7: note: expanded from macro 'ATOMIC_SIP_OP'
if (!__SYNC_loongson3_war) \
^
arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
# define __SYNC_loongson3_war (1 << 31)
^
In file included from arch/mips/kernel/cpu-probe.c:12:
In file included from include/linux/ptrace.h:6:
In file included from include/linux/sched.h:12:
In file included from ./arch/mips/include/generated/asm/current.h:1:
In file included from include/asm-generic/current.h:5:
In file included from include/linux/thread_info.h:38:
In file included from arch/mips/include/asm/thread_info.h:16:
In file included from arch/mips/include/asm/processor.h:14:
In file included from include/linux/atomic.h:7:
arch/mips/include/asm/atomic.h:262:1: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
ATOMIC_SIP_OP(atomic64, s64, dsubu, lld, scd)
^
arch/mips/include/asm/atomic.h:252:7: note: expanded from macro 'ATOMIC_SIP_OP'
if (!__SYNC_loongson3_war) \
^
arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
# define __SYNC_loongson3_war (1 << 31)
^
In file included from arch/mips/kernel/cpu-probe.c:12:
In file included from include/linux/ptrace.h:6:
In file included from include/linux/sched.h:15:
In file included from include/linux/sem.h:5:
In file included from include/uapi/linux/sem.h:5:
In file included from include/linux/ipc.h:7:
In file included from include/linux/rhashtable-types.h:14:
In file included from include/linux/mutex.h:21:
>> include/linux/debug_locks.h:17:9: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
return xchg(&debug_locks, 0);
^
arch/mips/include/asm/cmpxchg.h:102:7: note: expanded from macro 'xchg'
if (!__SYNC_loongson3_war) \
^
arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
# define __SYNC_loongson3_war (1 << 31)
^
In file included from arch/mips/kernel/cpu-probe.c:12:
In file included from include/linux/ptrace.h:6:
In file included from include/linux/sched.h:15:
In file included from include/linux/sem.h:5:
In file included from include/uapi/linux/sem.h:5:
In file included from include/linux/ipc.h:7:
In file included from include/linux/rhashtable-types.h:15:
In file included from include/linux/workqueue.h:9:
In file included from include/linux/timer.h:6:
In file included from include/linux/ktime.h:24:
In file included from include/linux/time.h:74:
In file included from include/linux/time32.h:13:
In file included from include/linux/timex.h:65:
In file included from arch/mips/include/asm/timex.h:19:
In file included from arch/mips/include/asm/cpu-type.h:12:
In file included from include/linux/smp.h:15:
>> include/linux/llist.h:222:9: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
return xchg(&head->first, NULL);
^
arch/mips/include/asm/cmpxchg.h:102:7: note: expanded from macro 'xchg'
if (!__SYNC_loongson3_war) \
^
arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
# define __SYNC_loongson3_war (1 << 31)
^
In file included from arch/mips/kernel/cpu-probe.c:12:
In file included from include/linux/ptrace.h:6:
In file included from include/linux/sched.h:15:
In file included from include/linux/sem.h:5:
In file included from include/uapi/linux/sem.h:5:
In file included from include/linux/ipc.h:7:
In file included from include/linux/rhashtable-types.h:15:
In file included from include/linux/workqueue.h:9:
In file included from include/linux/timer.h:6:
In file included from include/linux/ktime.h:25:
include/linux/jiffies.h:13:10: fatal error: 'generated/timeconst.h' file not found
#include <generated/timeconst.h>
^~~~~~~~~~~~~~~~~~~~~~~
10 warnings and 1 error generated.
--
In file included from arch/mips/kernel/irq.c:14:
In file included from include/linux/interrupt.h:8:
In file included from include/linux/cpumask.h:13:
In file included from include/linux/atomic.h:7:
>> arch/mips/include/asm/atomic.h:49:1: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
ATOMIC_OPS(atomic, int)
^
arch/mips/include/asm/atomic.h:40:9: note: expanded from macro 'ATOMIC_OPS'
return cmpxchg(&v->counter, o, n); \
^
arch/mips/include/asm/cmpxchg.h:194:7: note: expanded from macro 'cmpxchg'
if (!__SYNC_loongson3_war) \
^
arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
# define __SYNC_loongson3_war (1 << 31)
^
In file included from arch/mips/kernel/irq.c:14:
In file included from include/linux/interrupt.h:8:
In file included from include/linux/cpumask.h:13:
In file included from include/linux/atomic.h:7:
>> arch/mips/include/asm/atomic.h:49:1: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
arch/mips/include/asm/atomic.h:40:9: note: expanded from macro 'ATOMIC_OPS'
return cmpxchg(&v->counter, o, n); \
^
arch/mips/include/asm/cmpxchg.h:204:7: note: expanded from macro 'cmpxchg'
if (!__SYNC_loongson3_war) \
^
arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
# define __SYNC_loongson3_war (1 << 31)
^
In file included from arch/mips/kernel/irq.c:14:
In file included from include/linux/interrupt.h:8:
In file included from include/linux/cpumask.h:13:
In file included from include/linux/atomic.h:7:
>> arch/mips/include/asm/atomic.h:49:1: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
arch/mips/include/asm/atomic.h:45:9: note: expanded from macro 'ATOMIC_OPS'
return xchg(&v->counter, n); \
^
arch/mips/include/asm/cmpxchg.h:102:7: note: expanded from macro 'xchg'
if (!__SYNC_loongson3_war) \
^
arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
# define __SYNC_loongson3_war (1 << 31)
^
In file included from arch/mips/kernel/irq.c:14:
In file included from include/linux/interrupt.h:8:
In file included from include/linux/cpumask.h:13:
In file included from include/linux/atomic.h:7:
arch/mips/include/asm/atomic.h:53:1: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
ATOMIC_OPS(atomic64, s64)
^
arch/mips/include/asm/atomic.h:40:9: note: expanded from macro 'ATOMIC_OPS'
return cmpxchg(&v->counter, o, n); \
^
arch/mips/include/asm/cmpxchg.h:194:7: note: expanded from macro 'cmpxchg'
if (!__SYNC_loongson3_war) \
^
arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
# define __SYNC_loongson3_war (1 << 31)
^
In file included from arch/mips/kernel/irq.c:14:
In file included from include/linux/interrupt.h:8:
In file included from include/linux/cpumask.h:13:
In file included from include/linux/atomic.h:7:
arch/mips/include/asm/atomic.h:53:1: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
arch/mips/include/asm/atomic.h:40:9: note: expanded from macro 'ATOMIC_OPS'
return cmpxchg(&v->counter, o, n); \
^
arch/mips/include/asm/cmpxchg.h:204:7: note: expanded from macro 'cmpxchg'
if (!__SYNC_loongson3_war) \
^
arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
# define __SYNC_loongson3_war (1 << 31)
^
In file included from arch/mips/kernel/irq.c:14:
In file included from include/linux/interrupt.h:8:
In file included from include/linux/cpumask.h:13:
In file included from include/linux/atomic.h:7:
arch/mips/include/asm/atomic.h:53:1: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
arch/mips/include/asm/atomic.h:45:9: note: expanded from macro 'ATOMIC_OPS'
return xchg(&v->counter, n); \
^
arch/mips/include/asm/cmpxchg.h:102:7: note: expanded from macro 'xchg'
if (!__SYNC_loongson3_war) \
^
arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
# define __SYNC_loongson3_war (1 << 31)
^
In file included from arch/mips/kernel/irq.c:14:
In file included from include/linux/interrupt.h:8:
In file included from include/linux/cpumask.h:13:
In file included from include/linux/atomic.h:7:
arch/mips/include/asm/atomic.h:258:1: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
ATOMIC_SIP_OP(atomic, int, subu, ll, sc)
^
arch/mips/include/asm/atomic.h:252:7: note: expanded from macro 'ATOMIC_SIP_OP'
if (!__SYNC_loongson3_war) \
^
arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
# define __SYNC_loongson3_war (1 << 31)
^
In file included from arch/mips/kernel/irq.c:14:
In file included from include/linux/interrupt.h:8:
In file included from include/linux/cpumask.h:13:
In file included from include/linux/atomic.h:7:
arch/mips/include/asm/atomic.h:262:1: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
ATOMIC_SIP_OP(atomic64, s64, dsubu, lld, scd)
^
arch/mips/include/asm/atomic.h:252:7: note: expanded from macro 'ATOMIC_SIP_OP'
if (!__SYNC_loongson3_war) \
^
arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
# define __SYNC_loongson3_war (1 << 31)
^
In file included from arch/mips/kernel/irq.c:14:
In file included from include/linux/interrupt.h:11:
In file included from include/linux/hardirq.h:8:
In file included from include/linux/vtime.h:5:
In file included from include/linux/context_tracking_state.h:5:
In file included from include/linux/percpu.h:7:
In file included from include/linux/smp.h:15:
>> include/linux/llist.h:222:9: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
return xchg(&head->first, NULL);
^
arch/mips/include/asm/cmpxchg.h:102:7: note: expanded from macro 'xchg'
if (!__SYNC_loongson3_war) \
^
arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
# define __SYNC_loongson3_war (1 << 31)
^
In file included from arch/mips/kernel/irq.c:14:
In file included from include/linux/interrupt.h:11:
In file included from include/linux/hardirq.h:9:
In file included from arch/mips/include/asm/hardirq.h:16:
In file included from include/asm-generic/hardirq.h:13:
In file included from include/linux/irq.h:19:
In file included from include/linux/topology.h:33:
In file included from include/linux/mmzone.h:19:
include/linux/page-flags-layout.h:6:10: fatal error: 'generated/bounds.h' file not found
#include <generated/bounds.h>
^~~~~~~~~~~~~~~~~~~~
9 warnings and 1 error generated.
..
vim +44 arch/mips/kernel/cmpxchg.c
b70eb30056dc845 Paul Burton 2017-06-09 9
b70eb30056dc845 Paul Burton 2017-06-09 10 unsigned long __xchg_small(volatile void *ptr, unsigned long val, unsigned int size)
b70eb30056dc845 Paul Burton 2017-06-09 11 {
b70eb30056dc845 Paul Burton 2017-06-09 12 u32 old32, new32, load32, mask;
b70eb30056dc845 Paul Burton 2017-06-09 13 volatile u32 *ptr32;
b70eb30056dc845 Paul Burton 2017-06-09 14 unsigned int shift;
b70eb30056dc845 Paul Burton 2017-06-09 15
b70eb30056dc845 Paul Burton 2017-06-09 16 /* Check that ptr is naturally aligned */
b70eb30056dc845 Paul Burton 2017-06-09 17 WARN_ON((unsigned long)ptr & (size - 1));
b70eb30056dc845 Paul Burton 2017-06-09 18
b70eb30056dc845 Paul Burton 2017-06-09 19 /* Mask value to the correct size. */
b70eb30056dc845 Paul Burton 2017-06-09 20 mask = GENMASK((size * BITS_PER_BYTE) - 1, 0);
b70eb30056dc845 Paul Burton 2017-06-09 21 val &= mask;
b70eb30056dc845 Paul Burton 2017-06-09 22
b70eb30056dc845 Paul Burton 2017-06-09 23 /*
b70eb30056dc845 Paul Burton 2017-06-09 24 * Calculate a shift & mask that correspond to the value we wish to
b70eb30056dc845 Paul Burton 2017-06-09 25 * exchange within the naturally aligned 4 byte integerthat includes
b70eb30056dc845 Paul Burton 2017-06-09 26 * it.
b70eb30056dc845 Paul Burton 2017-06-09 27 */
b70eb30056dc845 Paul Burton 2017-06-09 28 shift = (unsigned long)ptr & 0x3;
b70eb30056dc845 Paul Burton 2017-06-09 29 if (IS_ENABLED(CONFIG_CPU_BIG_ENDIAN))
b70eb30056dc845 Paul Burton 2017-06-09 30 shift ^= sizeof(u32) - size;
b70eb30056dc845 Paul Burton 2017-06-09 31 shift *= BITS_PER_BYTE;
b70eb30056dc845 Paul Burton 2017-06-09 32 mask <<= shift;
b70eb30056dc845 Paul Burton 2017-06-09 33
b70eb30056dc845 Paul Burton 2017-06-09 34 /*
b70eb30056dc845 Paul Burton 2017-06-09 35 * Calculate a pointer to the naturally aligned 4 byte integer that
b70eb30056dc845 Paul Burton 2017-06-09 36 * includes our byte of interest, and load its value.
b70eb30056dc845 Paul Burton 2017-06-09 37 */
b70eb30056dc845 Paul Burton 2017-06-09 38 ptr32 = (volatile u32 *)((unsigned long)ptr & ~0x3);
b70eb30056dc845 Paul Burton 2017-06-09 39 load32 = *ptr32;
b70eb30056dc845 Paul Burton 2017-06-09 40
b70eb30056dc845 Paul Burton 2017-06-09 41 do {
b70eb30056dc845 Paul Burton 2017-06-09 42 old32 = load32;
b70eb30056dc845 Paul Burton 2017-06-09 43 new32 = (load32 & ~mask) | (val << shift);
b70eb30056dc845 Paul Burton 2017-06-09 @44 load32 = cmpxchg(ptr32, old32, new32);
b70eb30056dc845 Paul Burton 2017-06-09 45 } while (load32 != old32);
b70eb30056dc845 Paul Burton 2017-06-09 46
b70eb30056dc845 Paul Burton 2017-06-09 47 return (load32 & mask) >> shift;
b70eb30056dc845 Paul Burton 2017-06-09 48 }
3ba7f44d2b19166 Paul Burton 2017-06-09 49
:::::: The code at line 44 was first introduced by commit
:::::: b70eb30056dc84568f3d32440d9be6a558025843 MIPS: cmpxchg: Implement 1 byte & 2 byte xchg()
:::::: TO: Paul Burton <paul.burton@imgtec.com>
:::::: CC: Ralf Baechle <ralf@linux-mips.org>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 25444 bytes --]
WARNING: multiple messages have this Message-ID (diff)
From: kernel test robot <lkp@intel.com>
To: Nathan Chancellor <natechancellor@gmail.com>
Cc: kbuild-all@lists.01.org, clang-built-linux@googlegroups.com,
linux-kernel@vger.kernel.org,
Masahiro Yamada <masahiroy@kernel.org>
Subject: arch/mips/kernel/cmpxchg.c:44:12: warning: converting the result of '<<' to a boolean always evaluates to true
Date: Thu, 3 Dec 2020 15:24:02 +0800 [thread overview]
Message-ID: <202012031558.obnesxFc-lkp@intel.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 27879 bytes --]
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 34816d20f173a90389c8a7e641166d8ea9dce70a
commit: afe956c577b2d5a3d9834e4424587c1ebcf90c4c kbuild: Enable -Wtautological-compare
date: 8 months ago
config: mips-randconfig-r021-20201203 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 32c501dd88b62787d3a5ffda7aabcf4650dbe3cd)
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 mips cross compiling tool for clang build
# apt-get install binutils-mips-linux-gnu
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=afe956c577b2d5a3d9834e4424587c1ebcf90c4c
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout afe956c577b2d5a3d9834e4424587c1ebcf90c4c
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=mips
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
>> arch/mips/kernel/cmpxchg.c:44:12: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
load32 = cmpxchg(ptr32, old32, new32);
^
arch/mips/include/asm/cmpxchg.h:194:7: note: expanded from macro 'cmpxchg'
if (!__SYNC_loongson3_war) \
^
arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
# define __SYNC_loongson3_war (1 << 31)
^
>> arch/mips/kernel/cmpxchg.c:44:12: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
arch/mips/include/asm/cmpxchg.h:204:7: note: expanded from macro 'cmpxchg'
if (!__SYNC_loongson3_war) \
^
arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
# define __SYNC_loongson3_war (1 << 31)
^
arch/mips/kernel/cmpxchg.c:100:12: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
load32 = cmpxchg(ptr32, old32, new32);
^
arch/mips/include/asm/cmpxchg.h:194:7: note: expanded from macro 'cmpxchg'
if (!__SYNC_loongson3_war) \
^
arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
# define __SYNC_loongson3_war (1 << 31)
^
arch/mips/kernel/cmpxchg.c:100:12: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
arch/mips/include/asm/cmpxchg.h:204:7: note: expanded from macro 'cmpxchg'
if (!__SYNC_loongson3_war) \
^
arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
# define __SYNC_loongson3_war (1 << 31)
^
4 warnings generated.
Assembler messages:
Fatal error: invalid -march= option: `mips64r2'
clang-12: error: assembler command failed with exit code 1 (use -v to see invocation)
--
In file included from arch/mips/kernel/cpu-probe.c:12:
In file included from include/linux/ptrace.h:6:
In file included from include/linux/sched.h:12:
In file included from ./arch/mips/include/generated/asm/current.h:1:
In file included from include/asm-generic/current.h:5:
In file included from include/linux/thread_info.h:38:
In file included from arch/mips/include/asm/thread_info.h:16:
In file included from arch/mips/include/asm/processor.h:14:
In file included from include/linux/atomic.h:7:
>> arch/mips/include/asm/atomic.h:49:1: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
ATOMIC_OPS(atomic, int)
^
arch/mips/include/asm/atomic.h:40:9: note: expanded from macro 'ATOMIC_OPS'
return cmpxchg(&v->counter, o, n); \
^
arch/mips/include/asm/cmpxchg.h:194:7: note: expanded from macro 'cmpxchg'
if (!__SYNC_loongson3_war) \
^
arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
# define __SYNC_loongson3_war (1 << 31)
^
In file included from arch/mips/kernel/cpu-probe.c:12:
In file included from include/linux/ptrace.h:6:
In file included from include/linux/sched.h:12:
In file included from ./arch/mips/include/generated/asm/current.h:1:
In file included from include/asm-generic/current.h:5:
In file included from include/linux/thread_info.h:38:
In file included from arch/mips/include/asm/thread_info.h:16:
In file included from arch/mips/include/asm/processor.h:14:
In file included from include/linux/atomic.h:7:
>> arch/mips/include/asm/atomic.h:49:1: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
arch/mips/include/asm/atomic.h:40:9: note: expanded from macro 'ATOMIC_OPS'
return cmpxchg(&v->counter, o, n); \
^
arch/mips/include/asm/cmpxchg.h:204:7: note: expanded from macro 'cmpxchg'
if (!__SYNC_loongson3_war) \
^
arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
# define __SYNC_loongson3_war (1 << 31)
^
In file included from arch/mips/kernel/cpu-probe.c:12:
In file included from include/linux/ptrace.h:6:
In file included from include/linux/sched.h:12:
In file included from ./arch/mips/include/generated/asm/current.h:1:
In file included from include/asm-generic/current.h:5:
In file included from include/linux/thread_info.h:38:
In file included from arch/mips/include/asm/thread_info.h:16:
In file included from arch/mips/include/asm/processor.h:14:
In file included from include/linux/atomic.h:7:
>> arch/mips/include/asm/atomic.h:49:1: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
arch/mips/include/asm/atomic.h:45:9: note: expanded from macro 'ATOMIC_OPS'
return xchg(&v->counter, n); \
^
arch/mips/include/asm/cmpxchg.h:102:7: note: expanded from macro 'xchg'
if (!__SYNC_loongson3_war) \
^
arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
# define __SYNC_loongson3_war (1 << 31)
^
In file included from arch/mips/kernel/cpu-probe.c:12:
In file included from include/linux/ptrace.h:6:
In file included from include/linux/sched.h:12:
In file included from ./arch/mips/include/generated/asm/current.h:1:
In file included from include/asm-generic/current.h:5:
In file included from include/linux/thread_info.h:38:
In file included from arch/mips/include/asm/thread_info.h:16:
In file included from arch/mips/include/asm/processor.h:14:
In file included from include/linux/atomic.h:7:
arch/mips/include/asm/atomic.h:53:1: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
ATOMIC_OPS(atomic64, s64)
^
arch/mips/include/asm/atomic.h:40:9: note: expanded from macro 'ATOMIC_OPS'
return cmpxchg(&v->counter, o, n); \
^
arch/mips/include/asm/cmpxchg.h:194:7: note: expanded from macro 'cmpxchg'
if (!__SYNC_loongson3_war) \
^
arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
# define __SYNC_loongson3_war (1 << 31)
^
In file included from arch/mips/kernel/cpu-probe.c:12:
In file included from include/linux/ptrace.h:6:
In file included from include/linux/sched.h:12:
In file included from ./arch/mips/include/generated/asm/current.h:1:
In file included from include/asm-generic/current.h:5:
In file included from include/linux/thread_info.h:38:
In file included from arch/mips/include/asm/thread_info.h:16:
In file included from arch/mips/include/asm/processor.h:14:
In file included from include/linux/atomic.h:7:
arch/mips/include/asm/atomic.h:53:1: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
arch/mips/include/asm/atomic.h:40:9: note: expanded from macro 'ATOMIC_OPS'
return cmpxchg(&v->counter, o, n); \
^
arch/mips/include/asm/cmpxchg.h:204:7: note: expanded from macro 'cmpxchg'
if (!__SYNC_loongson3_war) \
^
arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
# define __SYNC_loongson3_war (1 << 31)
^
In file included from arch/mips/kernel/cpu-probe.c:12:
In file included from include/linux/ptrace.h:6:
In file included from include/linux/sched.h:12:
In file included from ./arch/mips/include/generated/asm/current.h:1:
In file included from include/asm-generic/current.h:5:
In file included from include/linux/thread_info.h:38:
In file included from arch/mips/include/asm/thread_info.h:16:
In file included from arch/mips/include/asm/processor.h:14:
In file included from include/linux/atomic.h:7:
arch/mips/include/asm/atomic.h:53:1: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
arch/mips/include/asm/atomic.h:45:9: note: expanded from macro 'ATOMIC_OPS'
return xchg(&v->counter, n); \
^
arch/mips/include/asm/cmpxchg.h:102:7: note: expanded from macro 'xchg'
if (!__SYNC_loongson3_war) \
^
arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
# define __SYNC_loongson3_war (1 << 31)
^
In file included from arch/mips/kernel/cpu-probe.c:12:
In file included from include/linux/ptrace.h:6:
In file included from include/linux/sched.h:12:
In file included from ./arch/mips/include/generated/asm/current.h:1:
In file included from include/asm-generic/current.h:5:
In file included from include/linux/thread_info.h:38:
In file included from arch/mips/include/asm/thread_info.h:16:
In file included from arch/mips/include/asm/processor.h:14:
In file included from include/linux/atomic.h:7:
arch/mips/include/asm/atomic.h:258:1: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
ATOMIC_SIP_OP(atomic, int, subu, ll, sc)
^
arch/mips/include/asm/atomic.h:252:7: note: expanded from macro 'ATOMIC_SIP_OP'
if (!__SYNC_loongson3_war) \
^
arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
# define __SYNC_loongson3_war (1 << 31)
^
In file included from arch/mips/kernel/cpu-probe.c:12:
In file included from include/linux/ptrace.h:6:
In file included from include/linux/sched.h:12:
In file included from ./arch/mips/include/generated/asm/current.h:1:
In file included from include/asm-generic/current.h:5:
In file included from include/linux/thread_info.h:38:
In file included from arch/mips/include/asm/thread_info.h:16:
In file included from arch/mips/include/asm/processor.h:14:
In file included from include/linux/atomic.h:7:
arch/mips/include/asm/atomic.h:262:1: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
ATOMIC_SIP_OP(atomic64, s64, dsubu, lld, scd)
^
arch/mips/include/asm/atomic.h:252:7: note: expanded from macro 'ATOMIC_SIP_OP'
if (!__SYNC_loongson3_war) \
^
arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
# define __SYNC_loongson3_war (1 << 31)
^
In file included from arch/mips/kernel/cpu-probe.c:12:
In file included from include/linux/ptrace.h:6:
In file included from include/linux/sched.h:15:
In file included from include/linux/sem.h:5:
In file included from include/uapi/linux/sem.h:5:
In file included from include/linux/ipc.h:7:
In file included from include/linux/rhashtable-types.h:14:
In file included from include/linux/mutex.h:21:
>> include/linux/debug_locks.h:17:9: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
return xchg(&debug_locks, 0);
^
arch/mips/include/asm/cmpxchg.h:102:7: note: expanded from macro 'xchg'
if (!__SYNC_loongson3_war) \
^
arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
# define __SYNC_loongson3_war (1 << 31)
^
In file included from arch/mips/kernel/cpu-probe.c:12:
In file included from include/linux/ptrace.h:6:
In file included from include/linux/sched.h:15:
In file included from include/linux/sem.h:5:
In file included from include/uapi/linux/sem.h:5:
In file included from include/linux/ipc.h:7:
In file included from include/linux/rhashtable-types.h:15:
In file included from include/linux/workqueue.h:9:
In file included from include/linux/timer.h:6:
In file included from include/linux/ktime.h:24:
In file included from include/linux/time.h:74:
In file included from include/linux/time32.h:13:
In file included from include/linux/timex.h:65:
In file included from arch/mips/include/asm/timex.h:19:
In file included from arch/mips/include/asm/cpu-type.h:12:
In file included from include/linux/smp.h:15:
>> include/linux/llist.h:222:9: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
return xchg(&head->first, NULL);
^
arch/mips/include/asm/cmpxchg.h:102:7: note: expanded from macro 'xchg'
if (!__SYNC_loongson3_war) \
^
arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
# define __SYNC_loongson3_war (1 << 31)
^
In file included from arch/mips/kernel/cpu-probe.c:12:
In file included from include/linux/ptrace.h:6:
In file included from include/linux/sched.h:15:
In file included from include/linux/sem.h:5:
In file included from include/uapi/linux/sem.h:5:
In file included from include/linux/ipc.h:7:
In file included from include/linux/rhashtable-types.h:15:
In file included from include/linux/workqueue.h:9:
In file included from include/linux/timer.h:6:
In file included from include/linux/ktime.h:25:
include/linux/jiffies.h:13:10: fatal error: 'generated/timeconst.h' file not found
#include <generated/timeconst.h>
^~~~~~~~~~~~~~~~~~~~~~~
10 warnings and 1 error generated.
--
In file included from arch/mips/kernel/irq.c:14:
In file included from include/linux/interrupt.h:8:
In file included from include/linux/cpumask.h:13:
In file included from include/linux/atomic.h:7:
>> arch/mips/include/asm/atomic.h:49:1: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
ATOMIC_OPS(atomic, int)
^
arch/mips/include/asm/atomic.h:40:9: note: expanded from macro 'ATOMIC_OPS'
return cmpxchg(&v->counter, o, n); \
^
arch/mips/include/asm/cmpxchg.h:194:7: note: expanded from macro 'cmpxchg'
if (!__SYNC_loongson3_war) \
^
arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
# define __SYNC_loongson3_war (1 << 31)
^
In file included from arch/mips/kernel/irq.c:14:
In file included from include/linux/interrupt.h:8:
In file included from include/linux/cpumask.h:13:
In file included from include/linux/atomic.h:7:
>> arch/mips/include/asm/atomic.h:49:1: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
arch/mips/include/asm/atomic.h:40:9: note: expanded from macro 'ATOMIC_OPS'
return cmpxchg(&v->counter, o, n); \
^
arch/mips/include/asm/cmpxchg.h:204:7: note: expanded from macro 'cmpxchg'
if (!__SYNC_loongson3_war) \
^
arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
# define __SYNC_loongson3_war (1 << 31)
^
In file included from arch/mips/kernel/irq.c:14:
In file included from include/linux/interrupt.h:8:
In file included from include/linux/cpumask.h:13:
In file included from include/linux/atomic.h:7:
>> arch/mips/include/asm/atomic.h:49:1: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
arch/mips/include/asm/atomic.h:45:9: note: expanded from macro 'ATOMIC_OPS'
return xchg(&v->counter, n); \
^
arch/mips/include/asm/cmpxchg.h:102:7: note: expanded from macro 'xchg'
if (!__SYNC_loongson3_war) \
^
arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
# define __SYNC_loongson3_war (1 << 31)
^
In file included from arch/mips/kernel/irq.c:14:
In file included from include/linux/interrupt.h:8:
In file included from include/linux/cpumask.h:13:
In file included from include/linux/atomic.h:7:
arch/mips/include/asm/atomic.h:53:1: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
ATOMIC_OPS(atomic64, s64)
^
arch/mips/include/asm/atomic.h:40:9: note: expanded from macro 'ATOMIC_OPS'
return cmpxchg(&v->counter, o, n); \
^
arch/mips/include/asm/cmpxchg.h:194:7: note: expanded from macro 'cmpxchg'
if (!__SYNC_loongson3_war) \
^
arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
# define __SYNC_loongson3_war (1 << 31)
^
In file included from arch/mips/kernel/irq.c:14:
In file included from include/linux/interrupt.h:8:
In file included from include/linux/cpumask.h:13:
In file included from include/linux/atomic.h:7:
arch/mips/include/asm/atomic.h:53:1: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
arch/mips/include/asm/atomic.h:40:9: note: expanded from macro 'ATOMIC_OPS'
return cmpxchg(&v->counter, o, n); \
^
arch/mips/include/asm/cmpxchg.h:204:7: note: expanded from macro 'cmpxchg'
if (!__SYNC_loongson3_war) \
^
arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
# define __SYNC_loongson3_war (1 << 31)
^
In file included from arch/mips/kernel/irq.c:14:
In file included from include/linux/interrupt.h:8:
In file included from include/linux/cpumask.h:13:
In file included from include/linux/atomic.h:7:
arch/mips/include/asm/atomic.h:53:1: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
arch/mips/include/asm/atomic.h:45:9: note: expanded from macro 'ATOMIC_OPS'
return xchg(&v->counter, n); \
^
arch/mips/include/asm/cmpxchg.h:102:7: note: expanded from macro 'xchg'
if (!__SYNC_loongson3_war) \
^
arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
# define __SYNC_loongson3_war (1 << 31)
^
In file included from arch/mips/kernel/irq.c:14:
In file included from include/linux/interrupt.h:8:
In file included from include/linux/cpumask.h:13:
In file included from include/linux/atomic.h:7:
arch/mips/include/asm/atomic.h:258:1: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
ATOMIC_SIP_OP(atomic, int, subu, ll, sc)
^
arch/mips/include/asm/atomic.h:252:7: note: expanded from macro 'ATOMIC_SIP_OP'
if (!__SYNC_loongson3_war) \
^
arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
# define __SYNC_loongson3_war (1 << 31)
^
In file included from arch/mips/kernel/irq.c:14:
In file included from include/linux/interrupt.h:8:
In file included from include/linux/cpumask.h:13:
In file included from include/linux/atomic.h:7:
arch/mips/include/asm/atomic.h:262:1: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
ATOMIC_SIP_OP(atomic64, s64, dsubu, lld, scd)
^
arch/mips/include/asm/atomic.h:252:7: note: expanded from macro 'ATOMIC_SIP_OP'
if (!__SYNC_loongson3_war) \
^
arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
# define __SYNC_loongson3_war (1 << 31)
^
In file included from arch/mips/kernel/irq.c:14:
In file included from include/linux/interrupt.h:11:
In file included from include/linux/hardirq.h:8:
In file included from include/linux/vtime.h:5:
In file included from include/linux/context_tracking_state.h:5:
In file included from include/linux/percpu.h:7:
In file included from include/linux/smp.h:15:
>> include/linux/llist.h:222:9: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
return xchg(&head->first, NULL);
^
arch/mips/include/asm/cmpxchg.h:102:7: note: expanded from macro 'xchg'
if (!__SYNC_loongson3_war) \
^
arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
# define __SYNC_loongson3_war (1 << 31)
^
In file included from arch/mips/kernel/irq.c:14:
In file included from include/linux/interrupt.h:11:
In file included from include/linux/hardirq.h:9:
In file included from arch/mips/include/asm/hardirq.h:16:
In file included from include/asm-generic/hardirq.h:13:
In file included from include/linux/irq.h:19:
In file included from include/linux/topology.h:33:
In file included from include/linux/mmzone.h:19:
include/linux/page-flags-layout.h:6:10: fatal error: 'generated/bounds.h' file not found
#include <generated/bounds.h>
^~~~~~~~~~~~~~~~~~~~
9 warnings and 1 error generated.
..
vim +44 arch/mips/kernel/cmpxchg.c
b70eb30056dc845 Paul Burton 2017-06-09 9
b70eb30056dc845 Paul Burton 2017-06-09 10 unsigned long __xchg_small(volatile void *ptr, unsigned long val, unsigned int size)
b70eb30056dc845 Paul Burton 2017-06-09 11 {
b70eb30056dc845 Paul Burton 2017-06-09 12 u32 old32, new32, load32, mask;
b70eb30056dc845 Paul Burton 2017-06-09 13 volatile u32 *ptr32;
b70eb30056dc845 Paul Burton 2017-06-09 14 unsigned int shift;
b70eb30056dc845 Paul Burton 2017-06-09 15
b70eb30056dc845 Paul Burton 2017-06-09 16 /* Check that ptr is naturally aligned */
b70eb30056dc845 Paul Burton 2017-06-09 17 WARN_ON((unsigned long)ptr & (size - 1));
b70eb30056dc845 Paul Burton 2017-06-09 18
b70eb30056dc845 Paul Burton 2017-06-09 19 /* Mask value to the correct size. */
b70eb30056dc845 Paul Burton 2017-06-09 20 mask = GENMASK((size * BITS_PER_BYTE) - 1, 0);
b70eb30056dc845 Paul Burton 2017-06-09 21 val &= mask;
b70eb30056dc845 Paul Burton 2017-06-09 22
b70eb30056dc845 Paul Burton 2017-06-09 23 /*
b70eb30056dc845 Paul Burton 2017-06-09 24 * Calculate a shift & mask that correspond to the value we wish to
b70eb30056dc845 Paul Burton 2017-06-09 25 * exchange within the naturally aligned 4 byte integerthat includes
b70eb30056dc845 Paul Burton 2017-06-09 26 * it.
b70eb30056dc845 Paul Burton 2017-06-09 27 */
b70eb30056dc845 Paul Burton 2017-06-09 28 shift = (unsigned long)ptr & 0x3;
b70eb30056dc845 Paul Burton 2017-06-09 29 if (IS_ENABLED(CONFIG_CPU_BIG_ENDIAN))
b70eb30056dc845 Paul Burton 2017-06-09 30 shift ^= sizeof(u32) - size;
b70eb30056dc845 Paul Burton 2017-06-09 31 shift *= BITS_PER_BYTE;
b70eb30056dc845 Paul Burton 2017-06-09 32 mask <<= shift;
b70eb30056dc845 Paul Burton 2017-06-09 33
b70eb30056dc845 Paul Burton 2017-06-09 34 /*
b70eb30056dc845 Paul Burton 2017-06-09 35 * Calculate a pointer to the naturally aligned 4 byte integer that
b70eb30056dc845 Paul Burton 2017-06-09 36 * includes our byte of interest, and load its value.
b70eb30056dc845 Paul Burton 2017-06-09 37 */
b70eb30056dc845 Paul Burton 2017-06-09 38 ptr32 = (volatile u32 *)((unsigned long)ptr & ~0x3);
b70eb30056dc845 Paul Burton 2017-06-09 39 load32 = *ptr32;
b70eb30056dc845 Paul Burton 2017-06-09 40
b70eb30056dc845 Paul Burton 2017-06-09 41 do {
b70eb30056dc845 Paul Burton 2017-06-09 42 old32 = load32;
b70eb30056dc845 Paul Burton 2017-06-09 43 new32 = (load32 & ~mask) | (val << shift);
b70eb30056dc845 Paul Burton 2017-06-09 @44 load32 = cmpxchg(ptr32, old32, new32);
b70eb30056dc845 Paul Burton 2017-06-09 45 } while (load32 != old32);
b70eb30056dc845 Paul Burton 2017-06-09 46
b70eb30056dc845 Paul Burton 2017-06-09 47 return (load32 & mask) >> shift;
b70eb30056dc845 Paul Burton 2017-06-09 48 }
3ba7f44d2b19166 Paul Burton 2017-06-09 49
:::::: The code at line 44 was first introduced by commit
:::::: b70eb30056dc84568f3d32440d9be6a558025843 MIPS: cmpxchg: Implement 1 byte & 2 byte xchg()
:::::: TO: Paul Burton <paul.burton@imgtec.com>
:::::: CC: Ralf Baechle <ralf@linux-mips.org>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 25444 bytes --]
next reply other threads:[~2020-12-03 7:24 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-03 7:24 kernel test robot [this message]
2020-12-03 7:24 ` arch/mips/kernel/cmpxchg.c:44:12: warning: converting the result of '<<' to a boolean always evaluates to true kernel test robot
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=202012031558.obnesxFc-lkp@intel.com \
--to=lkp@intel.com \
--cc=kbuild-all@lists.01.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.