linux/arch/powerpc
Paul Mackerras 2e25aa5f64 KVM: PPC: Book3S HV: Make virtual processor area registration more robust
The PAPR API allows three sorts of per-virtual-processor areas to be
registered (VPA, SLB shadow buffer, and dispatch trace log), and
furthermore, these can be registered and unregistered for another
virtual CPU.  Currently we just update the vcpu fields pointing to
these areas at the time of registration or unregistration.  If this
is done on another vcpu, there is the possibility that the target vcpu
is using those fields at the time and could end up using a bogus
pointer and corrupting memory.

This fixes the race by making the target cpu itself do the update, so
we can be sure that the update happens at a time when the fields
aren't being used.  Each area now has a struct kvmppc_vpa which is
used to manage these updates.  There is also a spinlock which protects
access to all of the kvmppc_vpa structs, other than to the pinned_addr
fields.  (We could have just taken the spinlock when using the vpa,
slb_shadow or dtl fields, but that would mean taking the spinlock on
every guest entry and exit.)

This also changes 'struct dtl' (which was undefined) to 'struct dtl_entry',
which is what the rest of the kernel uses.

Thanks to Michael Ellerman <michael@ellerman.id.au> for pointing out
the need to initialize vcpu->arch.vpa_update_lock.

Signed-off-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Avi Kivity <avi@redhat.com>
2012-04-08 14:01:27 +03:00
..
boot powerpc/dts: Removed fsl,msi property from dts. 2012-03-29 08:14:15 -05:00
configs Merge remote-tracking branch 'kumar/next' into merge 2012-04-02 13:57:46 +10:00
include/asm KVM: PPC: Book3S HV: Make virtual processor area registration more robust 2012-04-08 14:01:27 +03:00
kernel KVM: PPC: Book3S HV: Make virtual processor area registration more robust 2012-04-08 14:01:27 +03:00
kvm KVM: PPC: Book3S HV: Make virtual processor area registration more robust 2012-04-08 14:01:27 +03:00
lib Disintegrate asm/system.h for PowerPC 2012-03-28 18:30:02 +01:00
math-emu powerpc/math_emu/efp: Look for errata handler when type mismatches 2011-10-06 23:36:47 -05:00
mm Disintegrate and delete asm/system.h 2012-03-28 15:58:21 -07:00
net net: filter: BPF 'JIT' compiler for PPC64 2011-07-21 12:38:32 -07:00
oprofile Disintegrate asm/system.h for PowerPC 2012-03-28 18:30:02 +01:00
perf powerpc/perf: Fix instruction address sampling on 970 and Power4 2012-03-28 11:33:24 +11:00
platforms Merge branch 'for-linus' of git://git.linaro.org/people/mszyprowski/linux-dma-mapping 2012-04-04 17:13:43 -07:00
sysdev Merge remote-tracking branch 'kumar/next' into merge 2012-04-02 13:57:46 +10:00
xmon Disintegrate and delete asm/system.h 2012-03-28 15:58:21 -07:00
Kconfig Merge branch 'for-linus' of git://git.linaro.org/people/rmk/linux-arm 2012-03-29 16:53:48 -07:00
Kconfig.debug irqdomain: Remove powerpc dependency from debugfs file 2012-03-29 14:31:02 -06:00
Makefile powerpc/perf: Move perf core & PMU code into a subdirectory 2012-02-23 10:50:04 +11:00
relocs_check.pl powerpc: Process dynamic relocations for kernel 2011-12-20 10:21:08 -05:00