kernel_optimize_test/arch/powerpc/kernel
Paul Mackerras 9fb1b36ca1 powerpc: Make sure IPI handlers see data written by IPI senders
We have been observing hangs, both of KVM guest vcpu tasks and more
generally, where a process that is woken doesn't properly wake up and
continue to run, but instead sticks in TASK_WAKING state.  This
happens because the update of rq->wake_list in ttwu_queue_remote()
is not ordered with the update of ipi_message in
smp_muxed_ipi_message_pass(), and the reading of rq->wake_list in
scheduler_ipi() is not ordered with the reading of ipi_message in
smp_ipi_demux().  Thus it is possible for the IPI receiver not to see
the updated rq->wake_list and therefore conclude that there is nothing
for it to do.

In order to make sure that anything done before smp_send_reschedule()
is ordered before anything done in the resulting call to scheduler_ipi(),
this adds barriers in smp_muxed_message_pass() and smp_ipi_demux().
The barrier in smp_muxed_message_pass() is a full barrier to ensure that
there is a full ordering between the smp_send_reschedule() caller and
scheduler_ipi().  In smp_ipi_demux(), we use xchg() rather than
xchg_local() because xchg() includes release and acquire barriers.
Using xchg() rather than xchg_local() makes sense given that
ipi_message is not just accessed locally.

This moves the barrier between setting the message and calling the
cause_ipi() function into the individual cause_ipi implementations.
Most of them -- those that used outb, out_8 or similar -- already had
a full barrier because out_8 etc. include a sync before the MMIO
store.  This adds an explicit barrier in the two remaining cases.

These changes made no measurable difference to the speed of IPIs as
measured using a simple ping-pong latency test across two CPUs on
different cores of a POWER7 machine.

The analysis of the reason why processes were not waking up properly
is due to Milton Miller.

Cc: stable@vger.kernel.org # v3.0+
Reported-by: Milton Miller <miltonm@bga.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2012-09-05 16:05:22 +10:00
..
vdso32 powerpc: Add VDSO version of getcpu 2012-07-11 14:18:40 +10:00
vdso64 powerpc: Add VDSO version of getcpu 2012-07-11 14:18:40 +10:00
.gitignore
align.c
asm-offsets.c powerpc: Restore correct DSCR in context switch 2012-09-05 16:05:22 +10:00
audit.c
btext.c
cacheinfo.c
cacheinfo.h
clock.c
compat_audit.c
cpu_setup_6xx.S
cpu_setup_44x.S
cpu_setup_a2.S powerpc: Enforce usage of RA 0-R31 where possible 2012-07-10 19:18:35 +10:00
cpu_setup_fsl_booke.S KVM: PPC: e500mc support 2012-04-08 12:54:33 +03:00
cpu_setup_pa6t.S
cpu_setup_power7.S
cpu_setup_ppc970.S
cputable.c
crash_dump.c
crash.c
dbell.c powerpc: Make sure IPI handlers see data written by IPI senders 2012-09-05 16:05:22 +10:00
dma-iommu.c powerpc/dma-iommu: Fix IOMMU window check 2012-08-24 20:26:07 +10:00
dma-swiotlb.c common: dma-mapping: add support for generic dma_mmap_* calls 2012-07-30 12:25:46 +02:00
dma.c Merge branch 'for-linus-for-3.6-rc1' of git://git.linaro.org/people/mszyprowski/linux-dma-mapping 2012-07-30 10:11:31 -07:00
entry_32.S powerpc: Set stack limit properly in crit_transfer_to_handler 2012-07-27 11:42:31 +10:00
entry_64.S powerpc: Restore correct DSCR in context switch 2012-09-05 16:05:22 +10:00
epapr_hcalls.S KVM: PPC: Factor out guest epapr initialization 2012-05-30 11:43:10 +02:00
epapr_paravirt.c KVM: PPC: Factor out guest epapr initialization 2012-05-30 11:43:10 +02:00
exceptions-64e.S powerpc: Use CURRENT_THREAD_INFO instead of open coded assembly 2012-07-11 14:18:22 +10:00
exceptions-64s.S powerpc: Give hypervisor decrementer interrupts their own handler 2012-09-05 16:05:19 +10:00
fadump.c powerpc: Fix fallout from system.h split up 2012-04-02 14:00:03 +10:00
firmware.c
fpu.S powerpc: Enforce usage of R0-R31 where possible 2012-07-10 19:18:30 +10:00
fsl_booke_entry_mapping.S
ftrace.c powerpc/ftrace: Trace function graph entry before updating index 2012-07-27 11:42:34 +10:00
head_8xx.S
head_32.S
head_40x.S
head_44x.S Merge branch 'next' of git://git.kernel.org/pub/scm/virt/kvm/kvm 2012-05-24 16:17:30 -07:00
head_64.S
head_booke.h KVM: PPC: booke: category E.HV (GS-mode) support 2012-04-08 12:51:19 +03:00
head_fsl_booke.S Merge remote-tracking branch 'kumar/next' into next 2012-07-13 13:38:26 +10:00
hw_breakpoint.c powerpc: Fix null pointer deref in perf hardware breakpoints 2012-08-24 20:26:04 +10:00
ibmebus.c Merge branch 'for-linus' of git://git.linaro.org/people/mszyprowski/linux-dma-mapping 2012-04-04 17:13:43 -07:00
idle_6xx.S powerpc: Use CURRENT_THREAD_INFO instead of open coded assembly 2012-07-11 14:18:22 +10:00
idle_book3e.S powerpc: Use CURRENT_THREAD_INFO instead of open coded assembly 2012-07-11 14:18:22 +10:00
idle_e500.S powerpc: Use CURRENT_THREAD_INFO instead of open coded assembly 2012-07-11 14:18:22 +10:00
idle_power4.S powerpc: Use CURRENT_THREAD_INFO instead of open coded assembly 2012-07-11 14:18:22 +10:00
idle_power7.S powerpc/powernv: Always go into nap mode when CPU is offline 2012-09-05 16:05:20 +10:00
idle.c powerpc: Remove unused cpu_idle_wait() 2012-05-08 12:35:07 +02:00
io-workarounds.c
io.c
iomap.c
iommu.c powerpc/iommu: Fix iommu pool initialization 2012-07-13 17:45:49 +10:00
irq.c powerpc: Fix build of some debug irq code 2012-07-10 19:16:20 +10:00
isa-bridge.c
jump_label.c
kgdb.c powerpc/kgdb: Restore current_thread_info properly 2012-08-24 20:26:06 +10:00
kprobes.c
kvm_emul.S KVM: PPC: Not optimizing MSR_CE and MSR_ME with paravirt. 2012-05-30 11:43:11 +02:00
kvm.c KVM updates for the 3.6 merge window 2012-07-24 12:01:20 -07:00
l2cr_6xx.S
legacy_serial.c
lparcfg.c
machine_kexec_32.c
machine_kexec_64.c
machine_kexec.c powerpc/irqdomain: Fix broken NR_IRQ references 2012-04-30 10:45:26 +10:00
Makefile KVM: PPC: Factor out guest epapr initialization 2012-05-30 11:43:10 +02:00
misc_32.S powerpc: Use CURRENT_THREAD_INFO instead of open coded assembly 2012-07-11 14:18:22 +10:00
misc_64.S powerpc: Fixes for instructions not using correct register naming 2012-07-10 19:18:16 +10:00
misc.S
module_32.c powerpc: Fix kernel panic during kernel module load 2012-06-08 19:59:08 +10:00
module_64.c
module.c
msi.c
nvram_64.c
of_platform.c
paca.c powerpc: Remove iseries specific fields in lppaca 2012-04-30 15:37:16 +10:00
pci_32.c
pci_64.c PCI: replace struct pci_bus secondary/subordinate with busn_res 2012-06-13 15:42:22 -06:00
pci_dn.c
pci_of_scan.c PCI changes for the 3.6 merge window: 2012-07-24 16:17:07 -07:00
pci-common.c PCI changes for the 3.6 merge window: 2012-07-24 16:17:07 -07:00
pmc.c
ppc_ksyms.c powerpc: Use the new generic strncpy_from_user() and strnlen_user() 2012-05-27 21:00:07 -07:00
ppc_save_regs.S
ppc32.h
proc_powerpc.c
process.c powerpc: Fix DSCR inheritance in copy_thread() 2012-09-05 16:05:21 +10:00
prom_init_check.sh
prom_init.c powerpc: Fix Section mismatch warnings in prom_init.c 2012-06-29 14:35:36 +10:00
prom_parse.c
prom.c
ptrace.c Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc 2012-05-23 09:02:42 -07:00
ptrace32.c powerpc: Remove old powerpc specific ptrace getregs/setregs calls 2012-04-30 15:37:28 +10:00
reloc_32.S
reloc_64.S
rtas_flash.c powerpc: Lack of firmware flash support is not an error 2012-07-27 11:42:33 +10:00
rtas_pci.c
rtas-proc.c
rtas-rtc.c
rtas.c
rtasd.c
setup_32.c powerpc/watchdog: move booke watchdog param related code to setup-common.c 2012-07-11 07:44:03 -05:00
setup_64.c
setup-common.c powerpc/watchdog: move booke watchdog param related code to setup-common.c 2012-07-11 07:44:03 -05:00
setup.h
signal_32.c powerpc: get rid of restore_sigmask() 2012-06-01 12:58:51 -04:00
signal_64.c powerpc: get rid of restore_sigmask() 2012-06-01 12:58:51 -04:00
signal.c new helper: signal_delivered() 2012-06-01 12:58:52 -04:00
signal.h powerpc: get rid of restore_sigmask() 2012-06-01 12:58:51 -04:00
smp-tbsync.c
smp.c powerpc: Make sure IPI handlers see data written by IPI senders 2012-09-05 16:05:22 +10:00
softemu8xx.c
stacktrace.c
suspend.c
swsusp_32.S
swsusp_64.c
swsusp_asm64.S
swsusp_booke.S
swsusp.c
sys_ppc32.c
syscalls.c powerpc: Fix personality handling in ppc64_personality() 2012-08-24 20:26:07 +10:00
sysfs.c powerpc: Keep thread.dscr and thread.dscr_inherit in sync 2012-09-05 16:05:21 +10:00
systbl_chk.c
systbl_chk.sh
systbl.S
tau_6xx.c
time.c powerpc: Give hypervisor decrementer interrupts their own handler 2012-09-05 16:05:19 +10:00
traps.c powerpc: Keep thread.dscr and thread.dscr_inherit in sync 2012-09-05 16:05:21 +10:00
udbg_16550.c
udbg.c
vdso.c powerpc: Add VDSO version of getcpu 2012-07-11 14:18:40 +10:00
vecemu.c
vector.S powerpc: Optimise enable_kernel_altivec 2012-04-30 15:37:17 +10:00
vio.c Merge branch 'for-linus-for-3.6-rc1' of git://git.linaro.org/people/mszyprowski/linux-dma-mapping 2012-07-30 10:11:31 -07:00
vmlinux.lds.S