On Thu, Oct 16, 2014 at 3:35 PM, Andrew Pinski <pins...@gmail.com> wrote: > On Wed, Oct 15, 2014 at 3:08 AM, Marek Polacek <pola...@redhat.com> wrote: >> On Tue, Oct 14, 2014 at 09:23:29AM +0200, Marek Polacek wrote: >>> The consensus seems to be to go forward with this change. I will >>> commit the patch in 24 hours unless I hear objections. >> >> I made the change. Please report any fallout to me. > > Yes the Linux kernel fails to compile for aarch64 after this change: > In file included from include/linux/mutex.h:15:0, > from include/linux/kvm_host.h:12, > from arch/arm64/kvm/../../../virt/kvm/kvm_main.c:21: > include/linux/spinlock_types.h:82:2: error: initializer element is not > constant > (spinlock_t ) __SPIN_LOCK_INITIALIZER(lockname) > ^ > include/linux/spinlock_types.h:84:43: note: in expansion of macro > ‘__SPIN_LOCK_UNLOCKED’ > #define DEFINE_SPINLOCK(x) spinlock_t x = __SPIN_LOCK_UNLOCKED(x) > ^ > arch/arm64/kvm/../../../virt/kvm/kvm_main.c:75:1: note: in expansion > of macro ‘DEFINE_SPINLOCK’ > DEFINE_SPINLOCK(kvm_lock); > ^ > include/linux/spinlock_types.h:60:2: error: initializer element is not > constant > (raw_spinlock_t) __RAW_SPIN_LOCK_INITIALIZER(lockname) > ^ > include/linux/spinlock_types.h:62:51: note: in expansion of macro > ‘__RAW_SPIN_LOCK_UNLOCKED’ > #define DEFINE_RAW_SPINLOCK(x) raw_spinlock_t x = __RAW_SPIN_LOCK_UNLOCKED(x) > ^ > arch/arm64/kvm/../../../virt/kvm/kvm_main.c:76:8: note: in expansion > of macro ‘DEFINE_RAW_SPINLOCK’ > static DEFINE_RAW_SPINLOCK(kvm_count_lock); > ^
Here is a short testcase which shows the behavior difference between GNU89 and GNU11: typedef struct { volatile unsigned int lock; } arch_rwlock_t; typedef struct { arch_rwlock_t raw_lock; } rwlock_t; static rwlock_t step_hook_lock = (rwlock_t) { .raw_lock = { 0 }, }; Thanks, Andrew > > > >> >> Enjoy. >> >> Marek