On ppc64 with CONFIG_TRACE_IRQFLAGS enabled, the ring buffer code can
enter in an infinite recursion loop.
The problem occurs because some PowerPC's local_t operations
(local_inc/dec in particular) use powerpc_local_irq_pmu_save/restore()
which call trace_hardirqs_on/off() to generate trace events. This
creates a recursion loop:
ring_buffer_unlock_commit()
rb_commit()
local_inc(&cpu_buffer->entries)
powerpc_local_irq_pmu_save()
trace_hardirqs_off()
trace event => ring_buffer_unlock_commit()
[INFINITE RECURSION]
Use raw_local_irq_pmu_save/restore() instead of their
powerpc_local_* counterparts.
Fixes: 6cd74d2b61749 ("powerpc/64s: Implement local_t using irq soft masking")
Signed-off-by: Jerome Marchand <[email protected]>
---
arch/powerpc/include/asm/local.h | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/arch/powerpc/include/asm/local.h b/arch/powerpc/include/asm/local.h
index ec6ced6d7cedf..4c033526bfb0d 100644
--- a/arch/powerpc/include/asm/local.h
+++ b/arch/powerpc/include/asm/local.h
@@ -32,9 +32,9 @@ static __inline__ void local_##op(long i, local_t *l)
\
{ \
unsigned long flags; \
\
- powerpc_local_irq_pmu_save(flags); \
- l->v c_op i; \
- powerpc_local_irq_pmu_restore(flags); \
+ raw_local_irq_pmu_save(flags); \
+ l->v c_op i; \
+ raw_local_irq_pmu_restore(flags); \
}
#define LOCAL_OP_RETURN(op, c_op) \
@@ -43,9 +43,9 @@ static __inline__ long local_##op##_return(long a, local_t
*l) \
long t; \
unsigned long flags; \
\
- powerpc_local_irq_pmu_save(flags); \
+ raw_local_irq_pmu_save(flags); \
t = (l->v c_op a); \
- powerpc_local_irq_pmu_restore(flags); \
+ raw_local_irq_pmu_restore(flags); \
\
return t; \
}
@@ -81,11 +81,11 @@ static __inline__ long local_cmpxchg(local_t *l, long o,
long n)
long t;
unsigned long flags;
- powerpc_local_irq_pmu_save(flags);
+ raw_local_irq_pmu_save(flags);
t = l->v;
if (t == o)
l->v = n;
- powerpc_local_irq_pmu_restore(flags);
+ raw_local_irq_pmu_restore(flags);
return t;
}
@@ -106,10 +106,10 @@ static __inline__ long local_xchg(local_t *l, long n)
long t;
unsigned long flags;
- powerpc_local_irq_pmu_save(flags);
+ raw_local_irq_pmu_save(flags);
t = l->v;
l->v = n;
- powerpc_local_irq_pmu_restore(flags);
+ raw_local_irq_pmu_restore(flags);
return t;
}
@@ -128,12 +128,12 @@ static __inline__ bool local_add_unless(local_t *l, long
a, long u)
unsigned long flags;
bool ret = false;
- powerpc_local_irq_pmu_save(flags);
+ raw_local_irq_pmu_save(flags);
if (l->v != u) {
l->v += a;
ret = true;
}
- powerpc_local_irq_pmu_restore(flags);
+ raw_local_irq_pmu_restore(flags);
return ret;
}
--
2.56.0