Re: [PATCH] powerpc-kvm: fixing page alignment for TCE

2012-09-20 Thread Alexander Graf
On 04.09.2012, at 09:36, Alexey Kardashevskiy wrote: From: Paul Mackerras pau...@samba.org TODO: ask Paul to make a proper message. TODO? Also, Ben or Paul, please ack if you think it's correct. Alex This is the fix for a host kernel compiled with a page size other than 4K (TCE page

[PATCH 03/10] KVM: PPC: Book3S HV: Fix updates of vcpu-cpu

2012-09-20 Thread Paul Mackerras
This removes the powerpc generic updates of vcpu-cpu in load and put, and moves them to the various backends. The reason is that HV KVM does its own sauce with that field and the generic updates might corrupt it. The field contains the CPU# of the -first- HW CPU of the core always for all the

[PATCH 02/10] KVM: PPC: Book3S HV: Allow KVM guests to stop secondary threads coming online

2012-09-20 Thread Paul Mackerras
When a Book3S HV KVM guest is running, we need the host to be in single-thread mode, that is, all of the cores (or at least all of the cores where the KVM guest could run) to be running only one active hardware thread. This is because of the hardware restriction in POWER processors that all of

[PATCH 01/10] KVM: PPC: Book3S HV: Provide a way for userspace to get/set per-vCPU areas

2012-09-20 Thread Paul Mackerras
The PAPR paravirtualization interface lets guests register three different types of per-vCPU buffer areas in its memory for communication with the hypervisor. These are called virtual processor areas (VPAs). Currently the hypercalls to register and unregister VPAs are handled by KVM in the

[PATCH 09/10] KVM: PPC: Book3S HV: Fix accounting of stolen time

2012-09-20 Thread Paul Mackerras
Currently the code that accounts stolen time tends to overestimate the stolen time, and will sometimes report more stolen time in a DTL (dispatch trace log) entry than has elapsed since the last DTL entry. This can cause guests to underflow the user or system time measured for some tasks, leading

[PATCH 05/10] KVM: PPC: Book3S HV: Fix some races in starting secondary threads

2012-09-20 Thread Paul Mackerras
Subsequent patches implementing in-kernel XICS emulation will make it possible for IPIs to arrive at secondary threads at arbitrary times. This fixes some races in how we start the secondary threads, which if not fixed could lead to occasional crashes of the host kernel. This makes sure that (a)

[PATCH 07/10] KVM: PPC: Book3S HV: Fixes for late-joining threads

2012-09-20 Thread Paul Mackerras
If a thread in a virtual core becomes runnable while other threads in the same virtual core are already running in the guest, it is possible for the latecomer to join the others on the core without first pulling them all out of the guest. Currently this only happens rarely, when a vcpu is first

[PATCH 10/10] KVM: PPC: Book3S HV: Fix calculation of guest phys address for MMIO emulation

2012-09-20 Thread Paul Mackerras
In the case where the host kernel is using a 64kB base page size and the guest uses a 4k HPTE (hashed page table entry) to map an emulated MMIO device, we were calculating the guest physical address wrongly. We were calculating a gfn as the guest physical address shifted right 16 bits (PAGE_SHIFT)

[PATCH 06/10] KVM: PPC: Book3s HV: Don't access runnable threads list without vcore lock

2012-09-20 Thread Paul Mackerras
There were a few places where we were traversing the list of runnable threads in a virtual core, i.e. vc-runnable_threads, without holding the vcore spinlock. This extends the places where we hold the vcore spinlock to cover everywhere that we traverse that list. Since we possibly need to sleep

[PATCH 04/10] KVM: PPC: Book3S HV: Remove bogus update of physical thread IDs

2012-09-20 Thread Paul Mackerras
When making a vcpu non-runnable we incorrectly changed the thread IDs of all other threads on the core, just remove that code. Signed-off-by: Benjamin Herrenschmidt b...@kernel.crashing.org Signed-off-by: Paul Mackerras pau...@samba.org --- arch/powerpc/kvm/book3s_hv.c |6 -- 1 file

[PATCH 0/10] HV KVM fixes, reposted

2012-09-20 Thread Paul Mackerras
This is a repost of 10 patches out of a series of 12 that I posted more than three weeks ago that have had no comments but have not yet been applied. They have been rediffed against Alex Graf's current kvm-ppc-next branch. This series contains various fixes collected during the process of

[PATCH 08/10] KVM: PPC: Book3S HV: Run virtual core whenever any vcpus in it can run

2012-09-20 Thread Paul Mackerras
Currently the Book3S HV code implements a policy on multi-threaded processors (i.e. POWER7) that requires all of the active vcpus in a virtual core to be ready to run before we run the virtual core. However, that causes problems on reset, because reset stops all vcpus except vcpu 0, and can also

[PATCH v3 1/2] KVM: PPC: Book3S: Get/set guest SPRs using the GET/SET_ONE_REG interface

2012-09-20 Thread Paul Mackerras
This enables userspace to get and set various SPRs (special-purpose registers) using the KVM_[GS]ET_ONE_REG ioctls. With this, userspace can get and set all the SPRs that are part of the guest state, either through the KVM_[GS]ET_REGS ioctls, the KVM_[GS]ET_SREGS ioctls, or the KVM_[GS]ET_ONE_REG

[PATCH v3 2/2] KVM: PPC: Book3S: Get/set guest FP regs using the GET/SET_ONE_REG interface

2012-09-20 Thread Paul Mackerras
This enables userspace to get and set all the guest floating-point state using the KVM_[GS]ET_ONE_REG ioctls. The floating-point state includes all of the traditional floating-point registers and the FPSCR (floating point status/control register), all the VMX/Altivec vector registers and the VSCR