KVM: PPC: e500: SPE and MMU
cover KVM: PPC: e500: SPE and MMU
This patchset contains SPE state management for e500 KVM guests, as well as MMU enhancements (performance, userspace visibility, and support for mapping things that aren't standard kernel-managed pages).
They are combined into one patchset because they both touch the MSR update code.
Liu Yu (2):
KVM: PPC: e500: Stop keeping shadow TLB
KVM: PPC: e500: Add shadow PID support
Scott Wood (10):
powerpc/e500: SPE register saving: take arbitrary struct offset
KVM: PPC: booke: use shadow_msr
KVM: PPC: e500: Save/restore SPE state
KVM: PPC: e500: Disable preloading TLB1 in tlb_load().
KVM: PPC: e500: don't use MAS0 as intermediate storage.
KVM: PPC: e500: Eliminate shadow_pages[], and use pfns instead.
KVM: PPC: e500: Support large page mappings of PFNMAP vmas.
KVM: PPC: e500: enable magic page
KVM: PPC: e500: Don't search over the entire TLB0.
KVM: PPC: e500: MMU API
yu liu (1):
powerpc/e500: Save SPEFCSR in flush_spe_to_thread()
Documentation/virtual/kvm/api.txt | 84 +++- Documentation/virtual/kvm/ppc-pv.txt | 8 +- arch/powerpc/include/asm/kvm.h | 35 ++ arch/powerpc/include/asm/kvm_e500.h | 47 +- arch/powerpc/include/asm/kvm_host.h | 9 +- arch/powerpc/include/asm/kvm_ppc.h | 8 + arch/powerpc/include/asm/ppc_asm.h | 28 +- arch/powerpc/include/asm/reg_booke.h | 1 + arch/powerpc/kernel/asm-offsets.c | 10 +- arch/powerpc/kernel/head_fsl_booke.S | 8 +- arch/powerpc/kernel/process.c | 1 + arch/powerpc/kernel/traps.c | 5 +- arch/powerpc/kvm/44x_tlb.c | 4 +- arch/powerpc/kvm/booke.c | 99 +++- arch/powerpc/kvm/booke.h | 23 +- arch/powerpc/kvm/booke_interrupts.S | 66 ++- arch/powerpc/kvm/e500.c | 20 +- arch/powerpc/kvm/e500_emulate.c | 16 +- arch/powerpc/kvm/e500_tlb.c | 1082 +++++++++++++++++++++++++--------- arch/powerpc/kvm/e500_tlb.h | 68 +-- arch/powerpc/kvm/powerpc.c | 37 +- include/linux/kvm.h | 19 + 22 files changed, 1255 insertions(+), 423 deletions(-)
Signature · 1 line
1.7.4.1
Quoted 6 lines · Scott Wood
This patchset contains SPE state management for e500 KVM guests, as well as MMU enhancements (performance, userspace visibility, and support for mapping things that aren't standard kernel-managed pages).
They are combined into one patchset because they both touch the MSR update code.
I figured I'd try something new and just applied the whole patch set to see if it actually works. Of course it doesn't :). When I start a guest, it hangs at the point below in guest context and loops at 100%. Trying to dump the registers makes the whole process stall and drop down to 0% cpu usage. Only an external kill helps by then.
root@e500:/dev/shm/qemu# ./ppc-softmmu/qemu-system-ppc -nographic -kernel /boot/uImage.autotest -append 'root=/dev/vda3 console=ttyS0 rw' -enable-kvm -m 512 -M mpc8544ds -drive file=/dev/shm/test.qcow2,index=0,if=virtio
KVM: Couldn't find level irq capability. Expect the VM to stall at times!
Using MPC8544 DS machine description
Memory CAM mapping: 256/256 Mb, residual: 0Mb
Linux version 2.6.39-08593-g7fe3ef3 (agraf@huckleberry) (gcc version 4.3.4 [gcc-4_3-branch revision 152973] (SUSE Linux) ) #1 SMP Sat Jun 4 01:36:21 CEST 2011
CPU maps initialized for 1 thread per core
bootconsole [udbg0] enabled
setup_arch: bootmem
mpc85xx_ds_setup_arch()
Found FSL PCI host bridge at 0x00000000e0008000. Firmware bus number: 0->255
PCI host bridge /pci@e0008000 ranges:
MEM 0x00000000c0000000..0x00000000dfffffff -> 0x00000000c0000000
IO 0x00000000e1000000..0x00000000e100ffff -> 0x0000000000000000
/pci@e0008000: PCICSRBAR @ 0x0
/pci@e0008000: WARNING: Outbound window cfg leaves gaps in memory map. Adjusting the memory map could reduce unnecessary bounce buffering.
/pci@e0008000: DMA window size is 0x0
MPC85xx DS board from Freescale Semiconductor
arch: exit
Zone PFN ranges:
DMA 0x00000000 -> 0x00020000
Normal empty
HighMem empty
Movable zone start PFN for each node
early_node_map[1] active PFN ranges
0: 0x00000000 -> 0x00020000
MMU: Allocated 1088 bytes of context maps for 255 contexts
PERCPU: Embedded 8 pages/cpu @c0f06000 s8288 r8192 d16288 u32768
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 130048
Kernel command line: root=/dev/vda3 console=ttyS0 rw
PID hash table entries: 2048 (order: 1, 8192 bytes)
Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
Placing 64MB software IO TLB between c0f71000 - c4f71000
software IO TLB at phys 0xf71000 - 0x4f71000
Memory: 445668k/524288k available (6672k kernel code, 78620k reserved, 208k data, 1178k bss, 288k init)
Kernel virtual memory layout:
* 0xfffbf000..0xfffff000 : fixmap
* 0xffc00000..0xffe00000 : highmem PTEs
* 0xffbec000..0xffc00000 : early ioremap
* 0xe1000000..0xffbec000 : vmalloc & ioremap
SLUB: Genslabs, HWalign2, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
Hierarchical RCU implementation.
NR_IRQS:512 nr_irqs:512 16
mpic: Setting up MPIC " OpenPIC " version 1.2 at e0040000, max 1 CPUs
mpic: ISU size: 256, shift: 8, mask: ff
mpic: Initializing for 256 sources
clocksource: timebase mult[5000000] shift[22] registered
Console: colour dummy device 80x25
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 512
Brought up 1 CPUs
NET: Registered protocol family 16PCI: Probing PCI hardware
pci 0000:00:11.0: BAR 6: assigned [mem 0xc0000000-0xc000ffff pref]
pci 0000:00:12.0: BAR 0: assigned [io 0xffbee000-0xffbee03f]
pci 0000:00:12.0: BAR 0: set to [io 0xffbee000-0xffbee03f] (PCI address [0x1000-0x103f]) pci 0000:00:11.0: BAR 0: assigned [io 0xffbee040-0xffbee05f]
pci 0000:00:11.0: BAR 0: set to [io 0xffbee040-0xffbee05f] (PCI address [0x1040-0x105f])
bio: create slab <bio-0> at 0
vgaarb: loaded
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
Freescale Elo / Elo Plus DMA driver
Advanced Linux Sound Architecture Driver Version 1.0.24.
Switching to clocksource timebase
NET: Registered protocol family 2
IP route cache hash table entries: 4096 (order: 2, 16384 bytes)
TCP established hash table entries: 16384 (order: 5, 131072 bytes)
TCP bind hash table entries: 16384 (order: 5, 131072 bytes)
TCP: Hash tables configured (established 16384 bind 16384)
TCP reno registered
UDP hash table entries: 256 (order: 1, 8192 bytes)
UDP-Lite hash table entries: 256 (order: 1, 8192 bytes)
NET: Registered protocol family 1
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
audit: initializing netlink socket (disabled)
type 00 audit(0.000:1): initialized
Installing knfsd (copyright (C) 1996 [email protected]).
NTFS driver 2.1.30 [Flags: R/O].
msgmni has been set to 872
io scheduler noop registered
io scheduler deadline registered
io scheduler cfq registered (default)
Freescale DIU driver
virtio-pci 0000:00:11.0: enabling device (0000 -> 0001)
virtio-pci 0000:00:12.0: enabling device (0000 -> 0001)
Serial: 8250/16550 driver, 2 ports, IRQ sharing enabled
serial8250.0: ttyS0 at MMIO 0xe0004500 (irq = 42) is a 16550A
console [ttyS0] enabled, bootconsole disabled
console [ttyS0] enabled, bootconsole disabled
Generic non-volatile memory driver v1.1
brd: module loaded
loop: module loaded
nbd: registered device at major 43
QEMU 0.14.50 monitor - type 'help' for more information
(qemu) info registers
NIP c000e344 LR c0008f9c CTR c000e2b4 XER 00000000
MSR 00069002 HID0 00000000 HF 00000000 idx 1
TB 00000000 00000000 DECR 00000000
GPR00 00000000c000e2b4 00000000c06b3f90 00000000c0687330 0000000000800000 GPR04 0000000000800000 00000000c06b3f28 0000000000000000 0000000000069002 GPR08 00000000c06b64e8 0000000000000000 0000000000000000 0000000000000003 GPR12 00000000215ec844 0000000000000000 0000000000000000 0000000000000000 GPR16 0000000000000000 0000000000000000 0000000000000000 0000000000000000 GPR20 0000000000000000 0000000000000000 00000000c06b2000 0000000000000000 GPR24 0000000000000000 0000000000000000 00000000c0670e48 00000000c06c0000 GPR28 00000000c06b959c 00000000c06b959c 0000000000000008 00000000c06b2040
CR 24000028 [ E G - - - - E L ] RES ffffffff
FPR00 0000000000000000 0000000000000000 0000000000000000 0000000000000000 FPR04 0000000000000000 0000000000000000 0000000000000000 0000000000000000 FPR08 0000000000000000 0000000000000000 0000000000000000 0000000000000000 FPR12 0000000000000000 0000000000000000 0000000000000000 0000000000000000 FPR16 0000000000000000 0000000000000000 0000000000000000 0000000000000000 FPR20 0000000000000000 0000000000000000 0000000000000000 0000000000000000 FPR24 0000000000000000 0000000000000000 0000000000000000 0000000000000000 FPR28 0000000000000000 0000000000000000 0000000000000000 0000000000000000 FPSCR 00000000
SRR0 c000df0c SRR1 00029002 PVR 80210030 VRSAVE 00000000
SPRG0 00000001 SPRG1 00000003 SPRG2 00000000 SPRG3 c0687520 SPRG4 de401fe0 SPRG5 00000000 SPRG6 00000000 SPRG7 22000022
CSRR0 00000000 CSRR1 00000000 MCSRR0 00000000 MCSRR1 00000000
TCR 00000000 TSR 00000000 ESR 00000000 DEAR 00000000
PIR 00000000 DECAR 00000000 IVPR 00000000 EPCR 00000000
MCSR 00000000 SPRG8 00000000 EPR 00000000
MCAR 00000000 PID1 00000000 PID2 00000000 SVR 00000000 MAS0 00000000 MAS1 00000000 MAS2 00000000 MAS3 00000000 MAS4 00000000 MAS6 00000000 MAS7 00000000 PID 00000000
MMUCFG 00000000 TLB0CFG 04110200 TLB1CFG 101cc010
(qemu)
(gdb) l *0xc000e3440xc000e344 is at arch/powerpc/kernel/idle_e500.S:74.
69 oris r7,r7,MSR_WE@h
70 ori r7,r7,MSR_EE
71 msync
72 mtmsr r7
73 isync
74 2: b 2b
75
76 /*
77 * Return from NAP/DOZE mode, restore some CPU specific registers,
78 * r2 containing physical address of current.
Alex
Quoted 11 lines · On Sat, 4 Jun 2011 01:59:34 +0200 Alexander Graf <[email protected]> wrote:
Quoted 6 lines · Scott Wood
This patchset contains SPE state management for e500 KVM guests, as well as MMU enhancements (performance, userspace visibility, and support for mapping things that aren't standard kernel-managed pages).
They are combined into one patchset because they both touch the MSR update code.
I figured I'd try something new and just applied the whole patch set to see if it actually works. Of course it doesn't :). When I start a guest, it hangs at the point below in guest context and loops at 100%. Trying to dump the registers makes the whole process stall and drop down to 0% cpu usage. Only an external kill helps by then.
Works for me, with qemu d800040fb47fe4500d1f8bf604b9fd129bda9419 and the patchset applied to kernel f19ae5734c8d729edee7ad96179b507561541981, same kernel as guest. Dumping registers works without noticable delay.
Quoted 2 lines
root@e500:/dev/shm/qemu# ./ppc-softmmu/qemu-system-ppc -nographic -kernel /boot/uImage.autotest -append 'root=/dev/vda3 console=ttyS0 rw' -enable-kvm -m 512 -M mpc8544ds -drive file=/dev/shm/test.qcow2,index=0,if=virtio KVM: Couldn't find level irq capability. Expect the VM to stall at times!
Why couldn't it find level irq capability? What kernel tree/headers are you using?
Quoted 4 lines
(gdb) l *0xc000e344
0xc000e344is atarch/powerpc/kernel/idle_e500.S:74.
69 oris r7,r7,MSR_WE@h
70 ori r7,r7,MSR_EE
Quoted 8 lines
71 msync
72 mtmsr r7
73 isync
74 2: b 2b
75
76 /*
77 * Return from NAP/DOZE mode, restore some CPU specific registers,
78 * r2 containing physical address of current.
So, the guest is idle.
Are you using i/o thread? I had very similar problems without it, IIRC before making any of these changes.
-Scott
Quoted 19 lines · Scott Wood
Quoted 11 lines · On Sat, 4 Jun 2011 01:59:34 +0200 Alexander Graf <[email protected]> wrote:
Quoted 6 lines · Scott Wood
This patchset contains SPE state management for e500 KVM guests, as well as MMU enhancements (performance, userspace visibility, and support for mapping things that aren't standard kernel-managed pages).
They are combined into one patchset because they both touch the MSR update code.
I figured I'd try something new and just applied the whole patch set to see if it actually works. Of course it doesn't :). When I start a guest, it hangs at the point below in guest context and loops at 100%. Trying to dump the registers makes the whole process stall and drop down to 0% cpu usage. Only an external kill helps by then.
Works for me, with qemu
d800040fb47fe4500d1f8bf604b9fd129bda9419and the patchset applied to kernelf19ae5734c8d729edee7ad96179b507561541981, same kernel as guest. Dumping registers works without noticable delay.
Quoted 5 lines
Quoted 2 lines
root@e500:/dev/shm/qemu# ./ppc-softmmu/qemu-system-ppc -nographic -kernel /boot/uImage.autotest -append 'root=/dev/vda3 console=ttyS0 rw' -enable-kvm -m 512 -M mpc8544ds -drive file=/dev/shm/test.qcow2,index=0,if=virtio KVM: Couldn't find level irq capability. Expect the VM to stall at times!Why couldn't it find level irq capability? What kernel tree/headers are you using?
Ugh - I was building that one manually with old headers. No change with recent ones though. I hit the change in behavior through autotest, where I build everything with proper headers.
Quoted 14 lines
Quoted 13 lines
(gdb) l *0xc000e344
0xc000e344is atarch/powerpc/kernel/idle_e500.S:74.
69 oris r7,r7,MSR_WE@h
70 ori r7,r7,MSR_EE
71 msync
72 mtmsr r7
73 isync
74 2: b 2b
75
76 /*
77 * Return from NAP/DOZE mode, restore some CPU specific registers,
78 * r2 containing physical address of current.
Quoted 4 lines
So, the guest is idle.
Are you using i/o thread? I had very similar problems without it, IIRC before making any of these changes.
This is without i/o thread, as that one's still got shortcomings on PPC and is considered unstable :). My tests worked fine without iothread before your patches, now they break. This could however be related to us getting less exits from the VM. It could also be a bug in the magic page code. Still trying to debug it.
Alex
Quoted 44 lines · Alexander Graf
Quoted 19 lines · Scott Wood
Quoted 11 lines · On Sat, 4 Jun 2011 01:59:34 +0200 Alexander Graf <[email protected]> wrote:
Quoted 6 lines · Scott Wood
This patchset contains SPE state management for e500 KVM guests, as well as MMU enhancements (performance, userspace visibility, and support for mapping things that aren't standard kernel-managed pages).
They are combined into one patchset because they both touch the MSR update code.
I figured I'd try something new and just applied the whole patch set to see if it actually works. Of course it doesn't :). When I start a guest, it hangs at the point below in guest context and loops at 100%. Trying to dump the registers makes the whole process stall and drop down to 0% cpu usage. Only an external kill helps by then.
Works for me, with qemu
d800040fb47fe4500d1f8bf604b9fd129bda9419and the patchset applied to kernelf19ae5734c8d729edee7ad96179b507561541981, same kernel as guest. Dumping registers works without noticable delay.Quoted 5 lines
Quoted 2 lines
root@e500:/dev/shm/qemu# ./ppc-softmmu/qemu-system-ppc -nographic -kernel /boot/uImage.autotest -append 'root=/dev/vda3 console=ttyS0 rw' -enable-kvm -m 512 -M mpc8544ds -drive file=/dev/shm/test.qcow2,index=0,if=virtio KVM: Couldn't find level irq capability. Expect the VM to stall at times!Why couldn't it find level irq capability? What kernel tree/headers are you using?
Ugh - I was building that one manually with old headers. No change with recent ones though. I hit the change in behavior through autotest, where I build everything with proper headers.
Quoted 14 lines
Quoted 13 lines
(gdb) l *0xc000e344
0xc000e344is atarch/powerpc/kernel/idle_e500.S:74.
69 oris r7,r7,MSR_WE@h
70 ori r7,r7,MSR_EE
71 msync
72 mtmsr r7
73 isync
74 2: b 2b
75
76 /*
77 * Return from NAP/DOZE mode, restore some CPU specific registers,
78 * r2 containing physical address of current.
Quoted 6 lines
Quoted 4 lines
So, the guest is idle.
Are you using i/o thread? I had very similar problems without it, IIRC before making any of these changes.
This is without i/o thread, as that one's still got shortcomings on PPC and is considered unstable :). My tests worked fine without iothread before your patches, now they break. This could however be related to us getting less exits from the VM. It could also be a bug in the magic page code. Still trying to debug it.
Disabling the magic page doesn't change the picture, so that one's ruled out :).
Alex