Re: [PATCH] usbhid: Fix lockdep unannotated irqs-off warning
From: Sedat Dilek
Date: Wed Mar 02 2016 - 11:11:43 EST
On 3/2/16, Sedat Dilek <sedat.dilek@xxxxxxxxx> wrote:
> On 3/2/16, Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:
>>
>> [ Resend with reply all, instead of just "reply" ]
>>
>> On Wed, 2 Mar 2016 16:53:36 +0100
>> Sedat Dilek <sedat.dilek@xxxxxxxxx> wrote:
>>
>>> ffffffff8110f3f0 <del_timer>:
>>> ffffffff8110f3f0: 55 push %rbp
>>> ffffffff8110f3f1: 48 89 e5 mov %rsp,%rbp
>>> ffffffff8110f3f4: 41 57 push %r15
>>> ffffffff8110f3f6: 41 56 push %r14
>>> ffffffff8110f3f8: 53 push %rbx
>>> ffffffff8110f3f9: 50 push %rax
>>> ffffffff8110f3fa: 48 89 fb mov %rdi,%rbx
>>> ffffffff8110f3fd: e8 ee 6f 80 00 callq ffffffff819163f0 <mcount>
>>> ffffffff8110f402: e8 e9 6f 80 00 callq ffffffff819163f0 <mcount>
>>> ffffffff8110f407: e8 e4 6f 80 00 callq ffffffff819163f0 <mcount>
>>> ffffffff8110f40c: e8 df 6f 80 00 callq ffffffff819163f0 <mcount>
>>
>> What is this about?
>>
>
> Dunno.
>
> Not sure if this is relevant or not...
>
> [ LINUX-CONFIG ]
>
> $ ./scripts/diffconfig /boot/config-4.4.3-3-iniza-small
> /boot/config-4.4.3-3-llvmlinux-amd64
> ARCH_HWEIGHT_CFLAGS "-fcall-saved-rdi -fcall-saved-rsi
> -fcall-saved-rdx -fcall-saved-rcx -fcall-saved-r8 -fcall-saved-r9
> -fcall-saved-r10 -fcall-saved-r11" -> ""
>
> ...and my patchset on top of Linux v4.4.3 is attached.
>
That was my full linux-config and now and really the patchset.
( If you are ill, stay in your bed. )
- Sedat -
Al Viro (1):
use ->d_seq to get coherency between ->d_inode and ->d_flags
Sedat Dilek (23):
kbuild: llvmlinux: Add cross compilation support
kbuild: llvmlinux: Add support for integrated-assembler (IA)
kbuild: llvmlinux: Add LLVM bitcode support
kbuild: llvmlinux: Add some more clang compiler-flags
kbuild: llvmlinux: Add -Werror compiler-flag to cc-options
kbuild: llvmlinux: Fix ASM defines
kbuild: llvmlinux: Fix unsupported -fno-delete-null-pointer-checks compiler-flag
kbuild: llvmlinux: Fix unsupported -fcatch-undefined-behavior compiler-flag
compiler-gcc: llvmlinux: Add __maybe_unused attribute for inlining
fs/compat: llvmlinux: Fix warning in COMPATIBLE_IOCTL define
bcache: llvmlinux: Replace nested function with __bch_cache_cmp()
megaraid_sas: llvmlinux: Remove inline from megasas_return_cmd()
scsi: libosd: llvmlinux: Remove __weak and add __maybe_unused attribute
mpilib: llvmlinux: Fix compilation with clang
md/raid10: llvmlinux: Remove VLAIS from handle_reshape_read_error()
apparmor: llvmlinux: Remove VLAIS from aa_calc_profile_hash()
x86: llvmlinux: Fix unsupported -falign-{jumps,loops} compiler-flags
xen: llvmlinux: Remove VLAIS from xen_flush_tlb_others()
um: llvmlinux: Check for clang compiler in memcpy export
x86: boot: llvmlinux: Workaround LLVM Bug PR3997
x86/hweight: boot: llvmlinux: Workaround LLVM Bug PR9457
Merge branch 'for-4.4/vfs-fixes' into 4.4.3-3-iniza-small
Merge branch 'for-4.4/llvmlinux-amd64-fixes' into 4.4.3-3-llvmlinux-amd64
.gitignore | 1 +
Kbuild | 8 +++----
Makefile | 36 +++++++++++++++++++++++++++----
arch/x86/Kconfig | 4 ++--
arch/x86/Makefile | 6 ++++--
arch/x86/boot/memory.c | 6 ++++++
arch/x86/boot/string.h | 3 +++
arch/x86/include/asm/arch_hweight.h | 18 ++++------------
arch/x86/um/ksyms.c | 2 +-
arch/x86/xen/mmu.c | 35 +++++++++++++++---------------
drivers/md/bcache/sysfs.c | 10 +++++----
drivers/md/raid10.c | 8 +++----
drivers/scsi/megaraid/megaraid_sas_base.c | 2 +-
fs/compat_ioctl.c | 2 +-
fs/dcache.c | 20 +++++------------
include/linux/compiler-gcc.h | 12 +++++------
include/linux/dcache.h | 4 +---
include/linux/kbuild.h | 6 +++---
include/scsi/osd_types.h | 2 +-
lib/mpi/Makefile | 2 ++
lib/mpi/longlong.h | 9 +++-----
lib/mpi/mpi-inline.h | 2 +-
lib/mpi/mpi-internal.h | 10 +--------
scripts/Kbuild.include | 6 +++---
scripts/Makefile.build | 14 ++++++++++++
scripts/mod/Makefile | 8 +++----
security/apparmor/crypto.c | 17 ++++++---------
27 files changed, 137 insertions(+), 116 deletions(-)
diff --git a/.gitignore b/.gitignore
index fd3a35592543..34fe1346aa87 100644
--- a/.gitignore
+++ b/.gitignore
@@ -33,6 +33,7 @@
*.lzo
*.patch
*.gcno
+*.ll
modules.builtin
Module.symvers
*.dwo
diff --git a/Kbuild b/Kbuild
index f55cefd9bf29..0bbb86358942 100644
--- a/Kbuild
+++ b/Kbuild
@@ -8,10 +8,10 @@
# Default sed regexp - multiline due to syntax constraints
define sed-y
- "/^->/{s:->#\(.*\):/* \1 */:; \
- s:^->\([^ ]*\) [\$$#]*\([-0-9]*\) \(.*\):#define \1 \2 /* \3 */:; \
- s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; \
- s:->::; p;}"
+ "/^@->/{s:@->#\(.*\):/* \1 */:; \
+ s:^@->\([^ ]*\) [\$$#]*\([-0-9]*\) \(.*\):#define \1 \2 /* \3 */:; \
+ s:^@->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; \
+ s:@->::; p;}"
endef
# Use filechk to avoid rebuilds when a header changes, but the resulting file
diff --git a/Makefile b/Makefile
index 802be10c40c5..fc38f4c90ea4 100644
--- a/Makefile
+++ b/Makefile
@@ -301,8 +301,10 @@ HOSTCFLAGS = -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-p
HOSTCXXFLAGS = -O2
ifeq ($(shell $(HOSTCC) -v 2>&1 | grep -c "clang version"), 1)
-HOSTCFLAGS += -Wno-unused-value -Wno-unused-parameter \
- -Wno-missing-field-initializers -fno-delete-null-pointer-checks
+HOSTCFLAGS += -Wno-unused-value -Wno-unused-parameter -Wno-missing-field-initializers
+endif
+ifneq ($(shell $(HOSTCC) -v 2>&1 | grep -c "clang version"), 1)
+HOSTCFLAGS += -fno-delete-null-pointer-checks
endif
# Decide whether to build built-in, modular, or both.
@@ -366,6 +368,19 @@ CFLAGS_KERNEL =
AFLAGS_KERNEL =
CFLAGS_GCOV = -fprofile-arcs -ftest-coverage
+ifeq ($(cc-name),clang)
+ifneq ($(CROSS_COMPILE),)
+CLANG_TARGET := -target $(notdir $(CROSS_COMPILE:%-=%))
+GCC_TOOLCHAIN := $(dir $(CROSS_COMPILE))
+endif
+ifneq ($(GCC_TOOLCHAIN),)
+CLANG_GCC_TC := -gcc-toolchain $(GCC_TOOLCHAIN)
+endif
+ifneq ($(CLANG_ENABLE_IA),1)
+CLANG_IA_FLAG = -no-integrated-as
+endif
+CLANG_FLAGS := $(CLANG_TARGET) $(CLANG_GCC_TC) $(CLANG_IA_FLAG)
+endif
# Use USERINCLUDE when you must reference the UAPI directories only.
USERINCLUDE := \
@@ -391,11 +406,11 @@ KBUILD_CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
-fno-strict-aliasing -fno-common \
-Werror-implicit-function-declaration \
-Wno-format-security \
- -std=gnu89
+ -std=gnu89 $(CLANG_FLAGS)
KBUILD_AFLAGS_KERNEL :=
KBUILD_CFLAGS_KERNEL :=
-KBUILD_AFLAGS := -D__ASSEMBLY__
+KBUILD_AFLAGS := -D__ASSEMBLY__ $(CLANG_FLAGS)
KBUILD_AFLAGS_MODULE := -DMODULE
KBUILD_CFLAGS_MODULE := -DMODULE
KBUILD_LDFLAGS_MODULE := -T $(srctree)/scripts/module-common.lds
@@ -605,7 +620,9 @@ ARCH_AFLAGS :=
ARCH_CFLAGS :=
include arch/$(SRCARCH)/Makefile
+ifneq ($(cc-name),clang)
KBUILD_CFLAGS += $(call cc-option,-fno-delete-null-pointer-checks,)
+endif
ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
KBUILD_CFLAGS += -Os $(call cc-disable-warning,maybe-uninitialized,)
@@ -673,13 +690,18 @@ KBUILD_CPPFLAGS += $(call cc-option,-Wno-unknown-warning-option,)
KBUILD_CFLAGS += $(call cc-disable-warning, unused-variable)
KBUILD_CFLAGS += $(call cc-disable-warning, format-invalid-specifier)
KBUILD_CFLAGS += $(call cc-disable-warning, gnu)
+KBUILD_CFLAGS += $(call cc-disable-warning, asm-operand-widths)
+KBUILD_CFLAGS += $(call cc-disable-warning, initializer-overrides)
+KBUILD_CFLAGS += $(call cc-option, -fno-builtin)
# Quiet clang warning: comparison of unsigned expression < 0 is always false
KBUILD_CFLAGS += $(call cc-disable-warning, tautological-compare)
# CLANG uses a _MergedGlobals as optimization, but this breaks modpost, as the
# source of a reference will be _MergedGlobals and not on of the whitelisted names.
# See modpost pattern 2
KBUILD_CFLAGS += $(call cc-option, -mno-global-merge,)
+ifneq ($(cc-name),clang)
KBUILD_CFLAGS += $(call cc-option, -fcatch-undefined-behavior)
+endif
else
# This warning generated too much noise in a regular build.
@@ -1260,6 +1282,8 @@ help:
@echo ' (default: $$(INSTALL_MOD_PATH)/lib/firmware)'
@echo ' dir/ - Build all files in dir and below'
@echo ' dir/file.[oisS] - Build specified target only'
+ @echo ' dir/file.ll - Build the LLVM bitcode file'
+ @echo ' (requires compiler support for LLVM bitcode generation)'
@echo ' dir/file.lst - Build specified mixed source/assembly target only'
@echo ' (requires a recent binutils and recent build (System.map))'
@echo ' dir/file.ko - Build module including final link'
@@ -1538,6 +1562,10 @@ endif
$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
%.symtypes: %.c prepare scripts FORCE
$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
+%.ll: %.c prepare scripts FORCE
+ $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
+%.ll: %.S prepare scripts FORCE
+ $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
# Modules
/: prepare scripts FORCE
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index db3622f22b61..9c79418cb783 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -280,8 +280,8 @@ config X86_32_LAZY_GS
config ARCH_HWEIGHT_CFLAGS
string
- default "-fcall-saved-ecx -fcall-saved-edx" if X86_32
- default "-fcall-saved-rdi -fcall-saved-rsi -fcall-saved-rdx -fcall-saved-rcx -fcall-saved-r8 -fcall-saved-r9 -fcall-saved-r10 -fcall-saved-r11" if X86_64
+ # Workaround LLVM Bug PR9457
+ default "" if (X86_32 || X86_64)
config ARCH_SUPPORTS_UPROBES
def_bool y
diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index 4086abca0b32..5fa41ffe15e2 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -87,11 +87,13 @@ else
KBUILD_AFLAGS += -m64
KBUILD_CFLAGS += -m64
+ifneq ($(cc-name),clang)
# Align jump targets to 1 byte, not the default 16 bytes:
- KBUILD_CFLAGS += -falign-jumps=1
+ KBUILD_CFLAGS += $(call cc-option,-falign-jumps=1)
# Pack loops tightly as well:
- KBUILD_CFLAGS += -falign-loops=1
+ KBUILD_CFLAGS += $(call cc-option,-falign-loops=1)
+endif
# Don't autogenerate traditional x87 instructions
KBUILD_CFLAGS += $(call cc-option,-mno-80387)
diff --git a/arch/x86/boot/memory.c b/arch/x86/boot/memory.c
index db75d07c3645..d49115f80fbb 100644
--- a/arch/x86/boot/memory.c
+++ b/arch/x86/boot/memory.c
@@ -64,7 +64,13 @@ static int detect_memory_e820(void)
break;
}
+/* Workaround LLVM Bug PR3997 */
+#ifdef __clang__
+ memcpy(desc, &buf, sizeof(*desc));
+ desc++;
+#else
*desc++ = buf;
+#endif /* __clang__ */
count++;
} while (ireg.ebx && count < ARRAY_SIZE(boot_params.e820_map));
diff --git a/arch/x86/boot/string.h b/arch/x86/boot/string.h
index 725e820602b1..31a431e9d4e2 100644
--- a/arch/x86/boot/string.h
+++ b/arch/x86/boot/string.h
@@ -14,8 +14,11 @@ int memcmp(const void *s1, const void *s2, size_t len);
* Access builtin version by default. If one needs to use optimized version,
* do "undef memcpy" in .c file and link against right string.c
*/
+/* Workaround LLVM Bug PR3997 */
+#ifndef __clang__
#define memcpy(d,s,l) __builtin_memcpy(d,s,l)
#define memset(d,c,l) __builtin_memset(d,c,l)
#define memcmp __builtin_memcmp
+#endif /* __clang__ */
#endif /* BOOT_STRING_H */
diff --git a/arch/x86/include/asm/arch_hweight.h b/arch/x86/include/asm/arch_hweight.h
index 259a7c1ef709..33f828a659bc 100644
--- a/arch/x86/include/asm/arch_hweight.h
+++ b/arch/x86/include/asm/arch_hweight.h
@@ -23,13 +23,8 @@
*/
static __always_inline unsigned int __arch_hweight32(unsigned int w)
{
- unsigned int res = 0;
-
- asm (ALTERNATIVE("call __sw_hweight32", POPCNT32, X86_FEATURE_POPCNT)
- : "="REG_OUT (res)
- : REG_IN (w));
-
- return res;
+/* Workaround LLVM Bug PR9457 */
+ return __sw_hweight32(w);
}
static inline unsigned int __arch_hweight16(unsigned int w)
@@ -51,13 +46,8 @@ static inline unsigned long __arch_hweight64(__u64 w)
#else
static __always_inline unsigned long __arch_hweight64(__u64 w)
{
- unsigned long res = 0;
-
- asm (ALTERNATIVE("call __sw_hweight64", POPCNT64, X86_FEATURE_POPCNT)
- : "="REG_OUT (res)
- : REG_IN (w));
-
- return res;
+/* Workaround LLVM Bug PR9457 */
+ return __sw_hweight64(w);
}
#endif /* CONFIG_X86_32 */
diff --git a/arch/x86/um/ksyms.c b/arch/x86/um/ksyms.c
index 2e8f43ec6214..04aedcecd887 100644
--- a/arch/x86/um/ksyms.c
+++ b/arch/x86/um/ksyms.c
@@ -4,7 +4,7 @@
#ifndef CONFIG_X86_32
/*XXX: we need them because they would be exported by x86_64 */
-#if (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) || __GNUC__ > 4
+#if (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) || __GNUC__ > 4 || defined(__clang__)
EXPORT_SYMBOL(memcpy);
#else
EXPORT_SYMBOL(__memcpy);
diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
index cb5e266a8bf7..167620ea79ba 100644
--- a/arch/x86/xen/mmu.c
+++ b/arch/x86/xen/mmu.c
@@ -1374,36 +1374,37 @@ static void xen_flush_tlb_others(const struct cpumask *cpus,
struct mm_struct *mm, unsigned long start,
unsigned long end)
{
- struct {
- struct mmuext_op op;
-#ifdef CONFIG_SMP
- DECLARE_BITMAP(mask, num_processors);
-#else
- DECLARE_BITMAP(mask, NR_CPUS);
-#endif
- } *args;
struct multicall_space mcs;
+ struct mmuext_op *op;
+ struct cpumask *mask;
trace_xen_mmu_flush_tlb_others(cpus, mm, start, end);
if (cpumask_empty(cpus))
return; /* nothing to do */
- mcs = xen_mc_entry(sizeof(*args));
- args = mcs.args;
- args->op.arg2.vcpumask = to_cpumask(args->mask);
+#ifdef CONFIG_SMP
+ mcs = xen_mc_entry(sizeof(struct mmuext_op) + BITS_TO_LONGS(num_processors)*sizeof(unsigned long));
+#else
+ mcs = xen_mc_entry(sizeof(struct mmuext_op) + BITS_TO_LONGS(NR_CPUS)*sizeof(unsigned long));
+#endif
+ /* Extract fields */
+ op = mcs.args;
+ mask = to_cpumask(mcs.args + sizeof(struct mmuext_op));
+
+ op->arg2.vcpumask = mask;
/* Remove us, and any offline CPUS. */
- cpumask_and(to_cpumask(args->mask), cpus, cpu_online_mask);
- cpumask_clear_cpu(smp_processor_id(), to_cpumask(args->mask));
+ cpumask_and(mask, cpus, cpu_online_mask);
+ cpumask_clear_cpu(smp_processor_id(), mask);
- args->op.cmd = MMUEXT_TLB_FLUSH_MULTI;
+ op->cmd = MMUEXT_TLB_FLUSH_MULTI;
if (end != TLB_FLUSH_ALL && (end - start) <= PAGE_SIZE) {
- args->op.cmd = MMUEXT_INVLPG_MULTI;
- args->op.arg1.linear_addr = start;
+ op->cmd = MMUEXT_INVLPG_MULTI;
+ op->arg1.linear_addr = start;
}
- MULTI_mmuext_op(mcs.mc, &args->op, 1, NULL, DOMID_SELF);
+ MULTI_mmuext_op(mcs.mc, op, 1, NULL, DOMID_SELF);
xen_mc_issue(PARAVIRT_LAZY_MMU);
}
diff --git a/drivers/md/bcache/sysfs.c b/drivers/md/bcache/sysfs.c
index b3ff57d61dde..53d8baa741fb 100644
--- a/drivers/md/bcache/sysfs.c
+++ b/drivers/md/bcache/sysfs.c
@@ -731,6 +731,11 @@ static struct attribute *bch_cache_set_internal_files[] = {
};
KTYPE(bch_cache_set_internal);
+static int __bch_cache_cmp(const void *l, const void *r)
+{
+ return *((uint16_t *) r) - *((uint16_t *) l);
+}
+
SHOW(__bch_cache)
{
struct cache *ca = container_of(kobj, struct cache, kobj);
@@ -755,9 +760,6 @@ SHOW(__bch_cache)
CACHE_REPLACEMENT(&ca->sb));
if (attr == &sysfs_priority_stats) {
- int cmp(const void *l, const void *r)
- { return *((uint16_t *) r) - *((uint16_t *) l); }
-
struct bucket *b;
size_t n = ca->sb.nbuckets, i;
size_t unused = 0, available = 0, dirty = 0, meta = 0;
@@ -786,7 +788,7 @@ SHOW(__bch_cache)
p[i] = ca->buckets[i].prio;
mutex_unlock(&ca->set->bucket_lock);
- sort(p, n, sizeof(uint16_t), cmp, NULL);
+ sort(p, n, sizeof(uint16_t), __bch_cache_cmp, NULL);
while (n &&
!cached[n - 1])
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index ce959b4ae4df..e5b3abf1eb0e 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -4483,11 +4483,9 @@ static int handle_reshape_read_error(struct mddev *mddev,
/* Use sync reads to get the blocks from somewhere else */
int sectors = r10_bio->sectors;
struct r10conf *conf = mddev->private;
- struct {
- struct r10bio r10_bio;
- struct r10dev devs[conf->copies];
- } on_stack;
- struct r10bio *r10b = &on_stack.r10_bio;
+ /* Allocate space for r10bio on stack */
+ u8 r10bio_on_stack[sizeof(struct r10bio) + conf->copies * sizeof(struct r10dev)];
+ struct r10bio *r10b = (struct r10bio *) r10bio_on_stack;
int slot = 0;
int idx = 0;
struct bio_vec *bvec = r10_bio->master_bio->bi_io_vec;
diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c
index 97a1c1c33b05..abcec3020c83 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -234,7 +234,7 @@ struct megasas_cmd *megasas_get_cmd(struct megasas_instance
* @instance: Adapter soft state
* @cmd: Command packet to be returned to free command pool
*/
-inline void
+void
megasas_return_cmd(struct megasas_instance *instance, struct megasas_cmd *cmd)
{
unsigned long flags;
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c
index dcf26537c935..a52ca5cba015 100644
--- a/fs/compat_ioctl.c
+++ b/fs/compat_ioctl.c
@@ -811,7 +811,7 @@ static int compat_ioctl_preallocate(struct file *file,
*/
#define XFORM(i) (((i) ^ ((i) << 27) ^ ((i) << 17)) & 0xffffffff)
-#define COMPATIBLE_IOCTL(cmd) XFORM(cmd),
+#define COMPATIBLE_IOCTL(cmd) XFORM((u32)cmd),
/* ioctl should not be warned about even if it's not implemented.
Valid reasons to use this:
- It is implemented with ->compat_ioctl on some device, but programs
diff --git a/fs/dcache.c b/fs/dcache.c
index 5c33aeb0f68f..877bcbbd03ff 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -269,9 +269,6 @@ static inline int dname_external(const struct dentry *dentry)
return dentry->d_name.name != dentry->d_iname;
}
-/*
- * Make sure other CPUs see the inode attached before the type is set.
- */
static inline void __d_set_inode_and_type(struct dentry *dentry,
struct inode *inode,
unsigned type_flags)
@@ -279,28 +276,18 @@ static inline void __d_set_inode_and_type(struct dentry *dentry,
unsigned flags;
dentry->d_inode = inode;
- smp_wmb();
flags = READ_ONCE(dentry->d_flags);
flags &= ~(DCACHE_ENTRY_TYPE | DCACHE_FALLTHRU);
flags |= type_flags;
WRITE_ONCE(dentry->d_flags, flags);
}
-/*
- * Ideally, we want to make sure that other CPUs see the flags cleared before
- * the inode is detached, but this is really a violation of RCU principles
- * since the ordering suggests we should always set inode before flags.
- *
- * We should instead replace or discard the entire dentry - but that sucks
- * performancewise on mass deletion/rename.
- */
static inline void __d_clear_type_and_inode(struct dentry *dentry)
{
unsigned flags = READ_ONCE(dentry->d_flags);
flags &= ~(DCACHE_ENTRY_TYPE | DCACHE_FALLTHRU);
WRITE_ONCE(dentry->d_flags, flags);
- smp_wmb();
dentry->d_inode = NULL;
}
@@ -370,9 +357,11 @@ static void dentry_unlink_inode(struct dentry * dentry)
__releases(dentry->d_inode->i_lock)
{
struct inode *inode = dentry->d_inode;
+
+ raw_write_seqcount_begin(&dentry->d_seq);
__d_clear_type_and_inode(dentry);
hlist_del_init(&dentry->d_u.d_alias);
- dentry_rcuwalk_invalidate(dentry);
+ raw_write_seqcount_end(&dentry->d_seq);
spin_unlock(&dentry->d_lock);
spin_unlock(&inode->i_lock);
if (!inode->i_nlink)
@@ -1757,8 +1746,9 @@ static void __d_instantiate(struct dentry *dentry, struct inode *inode)
spin_lock(&dentry->d_lock);
if (inode)
hlist_add_head(&dentry->d_u.d_alias, &inode->i_dentry);
+ raw_write_seqcount_begin(&dentry->d_seq);
__d_set_inode_and_type(dentry, inode, add_flags);
- dentry_rcuwalk_invalidate(dentry);
+ raw_write_seqcount_end(&dentry->d_seq);
spin_unlock(&dentry->d_lock);
fsnotify_d_instantiate(dentry, inode);
}
diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
index 22ab246feed3..8d9b96b5648c 100644
--- a/include/linux/compiler-gcc.h
+++ b/include/linux/compiler-gcc.h
@@ -70,14 +70,14 @@
*/
#if !defined(CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING) || \
!defined(CONFIG_OPTIMIZE_INLINING) || (__GNUC__ < 4)
-#define inline inline __attribute__((always_inline)) notrace
-#define __inline__ __inline__ __attribute__((always_inline)) notrace
-#define __inline __inline __attribute__((always_inline)) notrace
+#define inline inline __attribute__((always_inline)) notrace __maybe_unused
+#define __inline__ __inline__ __attribute__((always_inline)) notrace __maybe_unused
+#define __inline __inline __attribute__((always_inline)) notrace __maybe_unused
#else
/* A lot of inline functions can cause havoc with function tracing */
-#define inline inline notrace
-#define __inline__ __inline__ notrace
-#define __inline __inline notrace
+#define inline inline notrace __maybe_unused
+#define __inline__ __inline__ notrace __maybe_unused
+#define __inline __inline notrace __maybe_unused
#endif
#define __always_inline inline __attribute__((always_inline))
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index d67ae119cf4e..8a2e009c8a5a 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -409,9 +409,7 @@ static inline bool d_mountpoint(const struct dentry *dentry)
*/
static inline unsigned __d_entry_type(const struct dentry *dentry)
{
- unsigned type = READ_ONCE(dentry->d_flags);
- smp_rmb();
- return type & DCACHE_ENTRY_TYPE;
+ return dentry->d_flags & DCACHE_ENTRY_TYPE;
}
static inline bool d_is_miss(const struct dentry *dentry)
diff --git a/include/linux/kbuild.h b/include/linux/kbuild.h
index 22a72198c14b..75fa2c3e0e1d 100644
--- a/include/linux/kbuild.h
+++ b/include/linux/kbuild.h
@@ -2,14 +2,14 @@
#define __LINUX_KBUILD_H
#define DEFINE(sym, val) \
- asm volatile("\n->" #sym " %0 " #val : : "i" (val))
+ asm volatile("\n@->" #sym " %0 " #val : : "i" (val))
-#define BLANK() asm volatile("\n->" : : )
+#define BLANK() asm volatile("\n@->" : : )
#define OFFSET(sym, str, mem) \
DEFINE(sym, offsetof(struct str, mem))
#define COMMENT(x) \
- asm volatile("\n->#" x)
+ asm volatile("\n@->#" x)
#endif
diff --git a/include/scsi/osd_types.h b/include/scsi/osd_types.h
index 48e8a165e136..c7ae7211d15d 100644
--- a/include/scsi/osd_types.h
+++ b/include/scsi/osd_types.h
@@ -28,7 +28,7 @@ struct osd_obj_id {
osd_id id;
};
-static const struct __weak osd_obj_id osd_root_object = {0, 0};
+static const struct osd_obj_id osd_root_object __maybe_unused = {0, 0};
struct osd_attr {
u32 attr_page;
diff --git a/lib/mpi/Makefile b/lib/mpi/Makefile
index 019a68c90144..d5553f6b9f09 100644
--- a/lib/mpi/Makefile
+++ b/lib/mpi/Makefile
@@ -4,6 +4,8 @@
obj-$(CONFIG_MPILIB) = mpi.o
+CFLAGS_KERNEL += $(call cc-option,-fheinous-gnu-extensions)
+
mpi-y = \
generic_mpih-lshift.o \
generic_mpih-mul1.o \
diff --git a/lib/mpi/longlong.h b/lib/mpi/longlong.h
index b90e255c2a68..881a62ca0578 100644
--- a/lib/mpi/longlong.h
+++ b/lib/mpi/longlong.h
@@ -193,8 +193,7 @@ extern UDItype __udiv_qrnnd(UDItype *, UDItype, UDItype, UDItype);
"rI" ((USItype)(bl)))
#if defined __ARM_ARCH_2__ || defined __ARM_ARCH_3__
#define umul_ppmm(xh, xl, a, b) \
- __asm__ ("%@ Inlined umul_ppmm\n" \
- "mov %|r0, %2, lsr #16 @ AAAA\n" \
+ __asm__ ("mov %|r0, %2, lsr #16 @ AAAA\n" \
"mov %|r2, %3, lsr #16 @ BBBB\n" \
"bic %|r1, %2, %|r0, lsl #16 @ aaaa\n" \
"bic %0, %3, %|r2, lsl #16 @ bbbb\n" \
@@ -213,10 +212,8 @@ extern UDItype __udiv_qrnnd(UDItype *, UDItype, UDItype, UDItype);
: "r0", "r1", "r2")
#else
#define umul_ppmm(xh, xl, a, b) \
- __asm__ ("%@ Inlined umul_ppmm\n" \
- "umull %r1, %r0, %r2, %r3" \
- : "=&r" ((USItype)(xh)), \
- "=r" ((USItype)(xl)) \
+ __asm__ ("umull %1, %0, %2, %3" \
+ : "=&r" ((xh)), "=r" ((xl)) \
: "r" ((USItype)(a)), \
"r" ((USItype)(b)) \
: "r0", "r1")
diff --git a/lib/mpi/mpi-inline.h b/lib/mpi/mpi-inline.h
index e2b39852b30a..c245ea31f785 100644
--- a/lib/mpi/mpi-inline.h
+++ b/lib/mpi/mpi-inline.h
@@ -30,7 +30,7 @@
#define G10_MPI_INLINE_H
#ifndef G10_MPI_INLINE_DECL
-#define G10_MPI_INLINE_DECL extern inline
+#define G10_MPI_INLINE_DECL static inline
#endif
G10_MPI_INLINE_DECL mpi_limb_t
diff --git a/lib/mpi/mpi-internal.h b/lib/mpi/mpi-internal.h
index c65dd1bff45a..09e9f13c5ba0 100644
--- a/lib/mpi/mpi-internal.h
+++ b/lib/mpi/mpi-internal.h
@@ -168,20 +168,12 @@ void mpi_rshift_limbs(MPI a, unsigned int count);
int mpi_lshift_limbs(MPI a, unsigned int count);
/*-- mpihelp-add.c --*/
-mpi_limb_t mpihelp_add_1(mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr,
- mpi_size_t s1_size, mpi_limb_t s2_limb);
mpi_limb_t mpihelp_add_n(mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr,
mpi_ptr_t s2_ptr, mpi_size_t size);
-mpi_limb_t mpihelp_add(mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr, mpi_size_t s1_size,
- mpi_ptr_t s2_ptr, mpi_size_t s2_size);
/*-- mpihelp-sub.c --*/
-mpi_limb_t mpihelp_sub_1(mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr,
- mpi_size_t s1_size, mpi_limb_t s2_limb);
mpi_limb_t mpihelp_sub_n(mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr,
mpi_ptr_t s2_ptr, mpi_size_t size);
-mpi_limb_t mpihelp_sub(mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr, mpi_size_t s1_size,
- mpi_ptr_t s2_ptr, mpi_size_t s2_size);
/*-- mpihelp-cmp.c --*/
int mpihelp_cmp(mpi_ptr_t op1_ptr, mpi_ptr_t op2_ptr, mpi_size_t size);
@@ -238,7 +230,7 @@ mpi_limb_t mpihelp_rshift(mpi_ptr_t wp, mpi_ptr_t up, mpi_size_t usize,
#define W_TYPE_SIZE BITS_PER_MPI_LIMB
typedef mpi_limb_t UWtype;
typedef unsigned int UHWtype;
-#if defined(__GNUC__)
+#if defined(__GNUC__) && !defined(__clang__)
typedef unsigned int UQItype __attribute__ ((mode(QI)));
typedef int SItype __attribute__ ((mode(SI)));
typedef unsigned int USItype __attribute__ ((mode(SI)));
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
index 1db6d73c8dd2..30d9343f0c4b 100644
--- a/scripts/Kbuild.include
+++ b/scripts/Kbuild.include
@@ -111,12 +111,12 @@ as-instr = $(call try-run,\
# Usage: cflags-y += $(call cc-option,-march=winchip-c6,-march=i586)
cc-option = $(call try-run,\
- $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(1) -c -x c /dev/null -o "$$TMP",$(1),$(2))
+ $(CC) -Werror $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(1) -c -x c /dev/null -o "$$TMP",$(1),$(2))
# cc-option-yn
# Usage: flag := $(call cc-option-yn,-march=winchip-c6)
cc-option-yn = $(call try-run,\
- $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(1) -c -x c /dev/null -o "$$TMP",y,n)
+ $(CC) -Werror $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(1) -c -x c /dev/null -o "$$TMP",y,n)
# cc-option-align
# Prefix align with either -falign or -malign
@@ -126,7 +126,7 @@ cc-option-align = $(subst -functions=0,,\
# cc-disable-warning
# Usage: cflags-y += $(call cc-disable-warning,unused-but-set-variable)
cc-disable-warning = $(call try-run,\
- $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) -W$(strip $(1)) -c -x c /dev/null -o "$$TMP",-Wno-$(strip $(1)))
+ $(CC) -Werror $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) -W$(strip $(1)) -c -x c /dev/null -o "$$TMP",-Wno-$(strip $(1)))
# cc-name
# Expands to either gcc or clang
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index 01df30af4d4a..6ff524dac82b 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -174,6 +174,20 @@ cmd_cc_symtypes_c = \
$(obj)/%.symtypes : $(src)/%.c FORCE
$(call cmd,cc_symtypes_c)
+# LLVM bitcode
+# Generate .ll files from .s and .c
+quiet_cmd_cc_ll_c = CC $(quiet_modtag) $@
+ cmd_cc_ll_c = $(CC) $(c_flags) -emit-llvm -S -o $@ $<
+
+$(obj)/%.ll: $(src)/%.c FORCE
+ $(call if_changed_dep,cc_ll_c)
+
+quiet_cmd_as_ll_S = CPP $(quiet_modtag) $@
+ cmd_as_ll_S = $(CPP) $(a_flags) -o $@ $<
+
+$(obj)/%.ll: $(src)/%.S FORCE
+ $(call if_changed_dep,as_ll_S)
+
# C (.c) files
# The C file is compiled and updated dependency information is generated.
# (See cmd_cc_o_c + relevant part of rule_cc_o_c)
diff --git a/scripts/mod/Makefile b/scripts/mod/Makefile
index c11212ff3510..86f6b852cd93 100644
--- a/scripts/mod/Makefile
+++ b/scripts/mod/Makefile
@@ -6,10 +6,10 @@ modpost-objs := modpost.o file2alias.o sumversion.o
devicetable-offsets-file := devicetable-offsets.h
define sed-y
- "/^->/{s:->#\(.*\):/* \1 */:; \
- s:^->\([^ ]*\) [\$$#]*\([-0-9]*\) \(.*\):#define \1 \2 /* \3 */:; \
- s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; \
- s:->::; p;}"
+ "/^@->/{s:@->#\(.*\):/* \1 */:; \
+ s:^@->\([^ ]*\) [\$$#]*\([-0-9]*\) \(.*\):#define \1 \2 /* \3 */:; \
+ s:^@->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; \
+ s:@->::; p;}"
endef
quiet_cmd_offsets = GEN $@
diff --git a/security/apparmor/crypto.c b/security/apparmor/crypto.c
index 532471d0b3a0..c948247e90c2 100644
--- a/security/apparmor/crypto.c
+++ b/security/apparmor/crypto.c
@@ -32,10 +32,7 @@ unsigned int aa_hash_size(void)
int aa_calc_profile_hash(struct aa_profile *profile, u32 version, void *start,
size_t len)
{
- struct {
- struct shash_desc shash;
- char ctx[crypto_shash_descsize(apparmor_tfm)];
- } desc;
+ SHASH_DESC_ON_STACK(shash, apparmor_tfm);
int error = -ENOMEM;
u32 le32_version = cpu_to_le32(version);
@@ -46,19 +43,19 @@ int aa_calc_profile_hash(struct aa_profile *profile, u32 version, void *start,
if (!profile->hash)
goto fail;
- desc.shash.tfm = apparmor_tfm;
- desc.shash.flags = 0;
+ shash->tfm = apparmor_tfm;
+ shash->flags = 0;
- error = crypto_shash_init(&desc.shash);
+ error = crypto_shash_init(shash);
if (error)
goto fail;
- error = crypto_shash_update(&desc.shash, (u8 *) &le32_version, 4);
+ error = crypto_shash_update(shash, (u8 *) &le32_version, 4);
if (error)
goto fail;
- error = crypto_shash_update(&desc.shash, (u8 *) start, len);
+ error = crypto_shash_update(shash, (u8 *) start, len);
if (error)
goto fail;
- error = crypto_shash_final(&desc.shash, profile->hash);
+ error = crypto_shash_final(shash, profile->hash);
if (error)
goto fail;