Patch "sparc64: Measure receiver forward progress to avoid send mondo timeout" has been added to the 4.4-stable tree
Subsystems (2)
This is a note to let you know that I've just added the patch titled
sparc64: Measure receiver forward progress to avoid send mondo timeout
to the 4.4-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
sparc64-measure-receiver-forward-progress-to-avoid-send-mondo-timeout.patch
and it can be found in the queue-4.4 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From foo@baz Tue Aug 8 16:56:08 PDT 2017
From: Jane Chu <[email protected]>
Date: Tue, 11 Jul 2017 12:00:54 -0600
Subject: sparc64: Measure receiver forward progress to avoid send mondo timeout
From: Jane Chu <[email protected]>
[ Upstream commit 9d53caec84c7c5700e7c1ed744ea584fff55f9ac ]
A large sun4v SPARC system may have moments of intensive xcall activities, usually caused by unmapping many pages on many CPUs concurrently. This can flood receivers with CPU mondo interrupts for an extended period, causing some unlucky senders to hit send-mondo timeout. This problem gets worse as cpu count increases because sometimes mappings must be invalidated on all CPUs, and sometimes all CPUs may gang up on a single CPU.
But a busy system is not a broken system. In the above scenario, as long as the receiver is making forward progress processing mondo interrupts, the sender should continue to retry.
This patch implements the receiver's forward progress meter by introducing a per cpu counter 'cpu_mondo_counter[cpu]' where 'cpu' is in the range of 0..NR_CPUS. The receiver increments its counter as soon as it receives a mondo and the sender tracks the receiver's counter. If the receiver has stopped making forward progress when the retry limit is reached, the sender declares send-mondo-timeout and panic; otherwise, the receiver is allowed to keep making forward progress.
In addition, it's been observed that PCIe hotplug events generate Correctable Errors that are handled by hypervisor and then OS. Hypervisor 'borrows' a guest cpu strand briefly to provide the service. If the cpu strand is simultaneously the only cpu targeted by a mondo, it may not be available for the mondo in 20msec, causing SUN4V mondo timeout. It appears that 1 second is the agreed wait time between hypervisor and guest OS, this patch makes the adjustment.
Orabug: 25476541
Orabug: 26417466
--- arch/sparc/include/asm/trap_block.h | 1 arch/sparc/kernel/smp_64.c | 189 ++++++++++++++++++++++-------------- arch/sparc/kernel/sun4v_ivec.S | 15 ++ arch/sparc/kernel/traps_64.c | 1 4 files changed, 134 insertions(+), 72 deletions(-)
arch/sparc/include/asm/trap_block.h +1 -0
@@ -54,6 +54,7 @@ extern struct trap_per_cpu trap_block[NRvoid init_cur_cpu_trap (struct thread_info *);void setup_tba (void );extern int ncpus_probed; +extern u64 cpu_mondo_counter[NR_CPUS ];unsigned long real_hard_smp_processor_id (void );
arch/sparc/kernel/smp_64.c +117 -72
233 lines not on this page · raw message
arch/sparc/kernel/sun4v_ivec.S +15 -0
@@ -26,6 +26,21 @@ sun4v_cpu_mondo: ldxa [%g0] ASI_SCRATCHPAD, %g4 sub %g4, TRAP_PER_CPU_FAULT_INFO, %g4 + /* Get smp_processor_id() into %g3 */ + sethi %hi(trap_block), %g5 + or %g5, %lo(trap_block), %g5 + sub %g4, %g5, %g3 + srlx %g3, TRAP_BLOCK_SZ_SHIFT, %g3 + + /* Increment cpu_mondo_counter[smp_processor_id()] */ + sethi %hi(cpu_mondo_counter), %g5 + or %g5, %lo(cpu_mondo_counter), %g5 + sllx %g3, 3, %g3 + add %g5, %g3, %g5 + ldx [%g5], %g3 + add %g3, 1, %g3 + stx %g3, [%g5] + /* Get CPU mondo queue base phys address into %g7. */ ldx [%g4 + TRAP_PER_CPU_CPU_MONDO_PA], %g7
arch/sparc/kernel/traps_64.c +1 -0
@@ -2659,6 +2659,7 @@ void do_getpsr(struct pt_regs *regs) } } +u64 cpu_mondo_counter[NR_CPUS ] = {0 };struct trap_per_cpu trap_block[NR_CPUS ];EXPORT_SYMBOL (trap_block);
Patches currently in stable-queue which might be from [email protected] are
queue-4.4/sparc64-measure-receiver-forward-progress-to-avoid-send-mondo-timeout.patch