Skip to content

Commit b69bea8

Browse files
committed
Merge tag 'locking-urgent-2020-08-30' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull locking fixes from Thomas Gleixner: "A set of fixes for lockdep, tracing and RCU: - Prevent recursion by using raw_cpu_* operations - Fixup the interrupt state in the cpu idle code to be consistent - Push rcu_idle_enter/exit() invocations deeper into the idle path so that the lock operations are inside the RCU watching sections - Move trace_cpu_idle() into generic code so it's called before RCU goes idle. - Handle raw_local_irq* vs. local_irq* operations correctly - Move the tracepoints out from under the lockdep recursion handling which turned out to be fragile and inconsistent" * tag 'locking-urgent-2020-08-30' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: lockdep,trace: Expose tracepoints lockdep: Only trace IRQ edges mips: Implement arch_irqs_disabled() arm64: Implement arch_irqs_disabled() nds32: Implement arch_irqs_disabled() locking/lockdep: Cleanup x86/entry: Remove unused THUNKs cpuidle: Move trace_cpu_idle() into generic code cpuidle: Make CPUIDLE_FLAG_TLB_FLUSHED generic sched,idle,rcu: Push rcu_idle deeper into the idle path cpuidle: Fixup IRQ state lockdep: Use raw_cpu_*() for per-cpu variables
2 parents 3edd8db + eb1f002 commit b69bea8

File tree

19 files changed

+123
-122
lines changed

19 files changed

+123
-122
lines changed

arch/arm/mach-omap2/pm34xx.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -298,11 +298,7 @@ static void omap3_pm_idle(void)
298298
if (omap_irq_pending())
299299
return;
300300

301-
trace_cpu_idle_rcuidle(1, smp_processor_id());
302-
303301
omap_sram_idle();
304-
305-
trace_cpu_idle_rcuidle(PWR_EVENT_EXIT, smp_processor_id());
306302
}
307303

308304
#ifdef CONFIG_SUSPEND

arch/arm64/include/asm/irqflags.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,11 @@ static inline int arch_irqs_disabled_flags(unsigned long flags)
9595
return res;
9696
}
9797

98+
static inline int arch_irqs_disabled(void)
99+
{
100+
return arch_irqs_disabled_flags(arch_local_save_flags());
101+
}
102+
98103
static inline unsigned long arch_local_irq_save(void)
99104
{
100105
unsigned long flags;

arch/arm64/kernel/process.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,8 @@ void arch_cpu_idle(void)
123123
* This should do all the clock switching and wait for interrupt
124124
* tricks
125125
*/
126-
trace_cpu_idle_rcuidle(1, smp_processor_id());
127126
cpu_do_idle();
128127
local_irq_enable();
129-
trace_cpu_idle_rcuidle(PWR_EVENT_EXIT, smp_processor_id());
130128
}
131129

132130
#ifdef CONFIG_HOTPLUG_CPU

arch/mips/include/asm/irqflags.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,11 @@ static inline int arch_irqs_disabled_flags(unsigned long flags)
137137
return !(flags & 1);
138138
}
139139

140+
static inline int arch_irqs_disabled(void)
141+
{
142+
return arch_irqs_disabled_flags(arch_local_save_flags());
143+
}
144+
140145
#endif /* #ifndef __ASSEMBLY__ */
141146

142147
/*

arch/nds32/include/asm/irqflags.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,8 @@ static inline int arch_irqs_disabled_flags(unsigned long flags)
3434
{
3535
return !flags;
3636
}
37+
38+
static inline int arch_irqs_disabled(void)
39+
{
40+
return arch_irqs_disabled_flags(arch_local_save_flags());
41+
}

arch/powerpc/include/asm/hw_irq.h

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -200,17 +200,14 @@ static inline bool arch_irqs_disabled(void)
200200
#define powerpc_local_irq_pmu_save(flags) \
201201
do { \
202202
raw_local_irq_pmu_save(flags); \
203-
trace_hardirqs_off(); \
203+
if (!raw_irqs_disabled_flags(flags)) \
204+
trace_hardirqs_off(); \
204205
} while(0)
205206
#define powerpc_local_irq_pmu_restore(flags) \
206207
do { \
207-
if (raw_irqs_disabled_flags(flags)) { \
208-
raw_local_irq_pmu_restore(flags); \
209-
trace_hardirqs_off(); \
210-
} else { \
208+
if (!raw_irqs_disabled_flags(flags)) \
211209
trace_hardirqs_on(); \
212-
raw_local_irq_pmu_restore(flags); \
213-
} \
210+
raw_local_irq_pmu_restore(flags); \
214211
} while(0)
215212
#else
216213
#define powerpc_local_irq_pmu_save(flags) \

arch/s390/kernel/idle.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,13 @@ void enabled_wait(void)
3333
PSW_MASK_IO | PSW_MASK_EXT | PSW_MASK_MCHECK;
3434
clear_cpu_flag(CIF_NOHZ_DELAY);
3535

36-
trace_cpu_idle_rcuidle(1, smp_processor_id());
3736
local_irq_save(flags);
3837
/* Call the assembler magic in entry.S */
3938
psw_idle(idle, psw_mask);
4039
local_irq_restore(flags);
41-
trace_cpu_idle_rcuidle(PWR_EVENT_EXIT, smp_processor_id());
4240

4341
/* Account time spent with enabled wait psw loaded as idle time. */
42+
/* XXX seqcount has tracepoints that require RCU */
4443
write_seqcount_begin(&idle->seqcount);
4544
idle_time = idle->clock_idle_exit - idle->clock_idle_enter;
4645
idle->clock_idle_enter = idle->clock_idle_exit = 0ULL;

arch/x86/entry/thunk_32.S

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,6 @@ SYM_CODE_START_NOALIGN(\name)
2929
SYM_CODE_END(\name)
3030
.endm
3131

32-
#ifdef CONFIG_TRACE_IRQFLAGS
33-
THUNK trace_hardirqs_on_thunk,trace_hardirqs_on_caller,1
34-
THUNK trace_hardirqs_off_thunk,trace_hardirqs_off_caller,1
35-
#endif
36-
3732
#ifdef CONFIG_PREEMPTION
3833
THUNK preempt_schedule_thunk, preempt_schedule
3934
THUNK preempt_schedule_notrace_thunk, preempt_schedule_notrace

arch/x86/include/asm/mmu.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,5 +59,6 @@ typedef struct {
5959
}
6060

6161
void leave_mm(int cpu);
62+
#define leave_mm leave_mm
6263

6364
#endif /* _ASM_X86_MMU_H */

arch/x86/kernel/process.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -684,9 +684,7 @@ void arch_cpu_idle(void)
684684
*/
685685
void __cpuidle default_idle(void)
686686
{
687-
trace_cpu_idle_rcuidle(1, smp_processor_id());
688687
safe_halt();
689-
trace_cpu_idle_rcuidle(PWR_EVENT_EXIT, smp_processor_id());
690688
}
691689
#if defined(CONFIG_APM_MODULE) || defined(CONFIG_HALTPOLL_CPUIDLE_MODULE)
692690
EXPORT_SYMBOL(default_idle);
@@ -792,7 +790,6 @@ static int prefer_mwait_c1_over_halt(const struct cpuinfo_x86 *c)
792790
static __cpuidle void mwait_idle(void)
793791
{
794792
if (!current_set_polling_and_test()) {
795-
trace_cpu_idle_rcuidle(1, smp_processor_id());
796793
if (this_cpu_has(X86_BUG_CLFLUSH_MONITOR)) {
797794
mb(); /* quirk */
798795
clflush((void *)&current_thread_info()->flags);
@@ -804,7 +801,6 @@ static __cpuidle void mwait_idle(void)
804801
__sti_mwait(0, 0);
805802
else
806803
local_irq_enable();
807-
trace_cpu_idle_rcuidle(PWR_EVENT_EXIT, smp_processor_id());
808804
} else {
809805
local_irq_enable();
810806
}

0 commit comments

Comments
 (0)