linux-next: build failure after merge of the akpm tree

From: Stephen Rothwell
Date: Thu Mar 06 2014 - 02:55:43 EST


Hi Andrew,

After merging the akpm tree, today's linux-next build (powerpc
ppc64_defconfig) failed like this:

arch/powerpc/mm/stab.c: In function '__ste_allocate':
arch/powerpc/mm/stab.c:138:42: error: lvalue required as left operand of assignment
__this_cpu_read(stab_cache[offset++]) = stab_entry;
^
In file included from include/linux/kernel_stat.h:8:0,
from kernel/softirq.c:14:
kernel/softirq.c: In function '__do_softirq':
include/linux/interrupt.h:328:57: error: lvalue required as left operand of assignment
#define set_softirq_pending(x) (local_softirq_pending() = (x))
^
kernel/softirq.c:252:2: note: in expansion of macro 'set_softirq_pending'
set_softirq_pending(0);
^
kernel/softirq.c: In function '__raise_softirq_irqoff':
include/linux/interrupt.h:329:57: error: lvalue required as left operand of assignment
#define or_softirq_pending(x) (local_softirq_pending() |= (x))
^
kernel/softirq.c:427:2: note: in expansion of macro 'or_softirq_pending'
or_softirq_pending(1UL << nr);
^
In file included from arch/powerpc/include/asm/time.h:18:0,
from arch/powerpc/include/asm/cputime.h:29,
from include/linux/sched.h:33,
from include/linux/ptrace.h:5,
from arch/powerpc/kernel/mce.c:26:
arch/powerpc/kernel/mce.c: In function 'save_mce_event':
include/linux/percpu.h:737:2: error: incompatible types when initializing type 'struct machine_check_event *' using type 'struct machine_check_event'
(__this_cpu_preempt_check("read"),__pcpu_size_call_return(raw_cpu_read_, (pcp)))
^
arch/powerpc/kernel/mce.c:77:36: note: in expansion of macro '__this_cpu_read'
struct machine_check_event *mce = __this_cpu_read(mce_event[index]);
^
arch/powerpc/kernel/mce.c: In function 'get_mce_event':
arch/powerpc/kernel/mce.c:156:10: error: incompatible types when assigning to type 'struct machine_check_event *' from type 'struct machine_check_event'
mc_evt = __this_cpu_read(mce_event[index]);
^

Caused by commits 1c55f79be84e ("powerpc: replace __get_cpu_var uses")
and 0884f89e7e08 ("powerpc: handle new __get_cpu_var calls in 3.14").
Someone should check the build results overnight ...
http://kisskb.ellerman.id.au/linux-next

I added the following patch:

From: Stephen Rothwell <sfr@xxxxxxxxxxxxxxxx>
Date: Thu, 6 Mar 2014 18:36:39 +1100
Subject: [PATCH] powerpc: replace __get_cpu_var uses fix

Signed-off-by: Stephen Rothwell <sfr@xxxxxxxxxxxxxxxx>
---
arch/powerpc/include/asm/hardirq.h | 4 ++++
arch/powerpc/kernel/mce.c | 4 ++--
arch/powerpc/mm/stab.c | 2 +-
3 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/include/asm/hardirq.h b/arch/powerpc/include/asm/hardirq.h
index 2e14594ccea4..f8c2a0e71f24 100644
--- a/arch/powerpc/include/asm/hardirq.h
+++ b/arch/powerpc/include/asm/hardirq.h
@@ -21,6 +21,10 @@ DECLARE_PER_CPU_SHARED_ALIGNED(irq_cpustat_t, irq_stat);
#define __ARCH_IRQ_STAT

#define local_softirq_pending() __this_cpu_read(irq_stat.__softirq_pending)
+#define set_softirq_pending(x) __this_cpu_write(irq_stat.__softirq_pending, (x))
+#define or_softirq_pending(x) __this_cpu_or(irq_stat.__softirq_pending, (x))
+
+#define __ARCH_SET_SOFTIRQ_PENDING

static inline void ack_bad_irq(unsigned int irq)
{
diff --git a/arch/powerpc/kernel/mce.c b/arch/powerpc/kernel/mce.c
index a9bf88affe79..46da0810a03b 100644
--- a/arch/powerpc/kernel/mce.c
+++ b/arch/powerpc/kernel/mce.c
@@ -74,7 +74,7 @@ void save_mce_event(struct pt_regs *regs, long handled,
{
uint64_t srr1;
int index = __this_cpu_inc_return(mce_nest_count);
- struct machine_check_event *mce = __this_cpu_read(mce_event[index]);
+ struct machine_check_event *mce = this_cpu_ptr(&mce_event[index]);

/*
* Return if we don't have enough space to log mce event.
@@ -153,7 +153,7 @@ int get_mce_event(struct machine_check_event *mce, bool release)

/* Check if we have MCE info to process. */
if (index < MAX_MC_EVT) {
- mc_evt = __this_cpu_read(mce_event[index]);
+ mc_evt = this_cpu_ptr(&mce_event[index]);
/* Copy the event structure and release the original */
if (mce)
*mce = *mc_evt;
diff --git a/arch/powerpc/mm/stab.c b/arch/powerpc/mm/stab.c
index ecbdc28554c6..db4483e95382 100644
--- a/arch/powerpc/mm/stab.c
+++ b/arch/powerpc/mm/stab.c
@@ -135,7 +135,7 @@ static int __ste_allocate(unsigned long ea, struct mm_struct *mm)
if (!is_kernel_addr(ea)) {
offset = __this_cpu_read(stab_cache_ptr);
if (offset < NR_STAB_CACHE_ENTRIES)
- __this_cpu_read(stab_cache[offset++]) = stab_entry;
+ __this_cpu_write(stab_cache[offset++], stab_entry);
else
offset = NR_STAB_CACHE_ENTRIES+1;
__this_cpu_write(stab_cache_ptr, offset);
--
1.9.0

However, I then got these errors:

arch/powerpc/kernel/built-in.o: In function `.set_breakpoint':
(.text+0x84c4): undefined reference to `.__bad_size_call_parameter'
arch/powerpc/kernel/built-in.o: In function `.machine_check_queue_event':
(.text+0x19b60): undefined reference to `.__bad_size_call_parameter'

These are in arch/powerpc/kernel/process.c and
arch/powerpc/kernel/mce.c. They are assigning structs. This used to
work with __get_cpu_var(x) = y, but does not for __this_cpu_write(x, y)
if sizeof(x) > 8.

I have dropped my fix patch and reverted those two commits for today.
--
Cheers,
Stephen Rothwell sfr@xxxxxxxxxxxxxxxx

Attachment: pgp61Ly7YIKz5.pgp
Description: PGP signature