s390/diag: avoid lockdep recursion

The diagnose tracer will indirectly call back into the lockdep code
when lockdep does not expect it (arch_spinlock). This causes lockdep
to disable itself and therefore we don't have a working lock
dependency validator anymore.

This patch effectively disables tracing of diag 0x9c and 0x44 if
lockdep is enabled.  If however lockdep is enabled spinlocks are
mainly implemented using a trylock variant, which will not issue any
diag 0x9c or 0x44. So this change has hardly any effect on tracing
except when arch_spinlock and friends are explicitly used.

Reported-and-Tested-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Acked-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
This commit is contained in:
Heiko Carstens 2016-02-10 14:13:24 +01:00 committed by Martin Schwidefsky
parent 9d862ababb
commit f6c9b16023

View file

@ -18,6 +18,9 @@ void trace_s390_diagnose_norecursion(int diag_nr)
unsigned long flags; unsigned long flags;
unsigned int *depth; unsigned int *depth;
/* Avoid lockdep recursion. */
if (IS_ENABLED(CONFIG_LOCKDEP))
return;
local_irq_save(flags); local_irq_save(flags);
depth = this_cpu_ptr(&diagnose_trace_depth); depth = this_cpu_ptr(&diagnose_trace_depth);
if (*depth == 0) { if (*depth == 0) {