Re: [PATCHv4] kvmppc: Implement H_LOGICAL_CI_{LOAD,STORE} in KVM

2015-04-21 Thread Thomas Huth
Am Tue, 21 Apr 2015 10:41:51 +1000 schrieb David Gibson da...@gibson.dropbear.id.au: On POWER, storage caching is usually configured via the MMU - attributes such as cache-inhibited are stored in the TLB and the hashed page table. This makes correctly performing cache inhibited IO accesses

Re: [PATCHv4] kvmppc: Implement H_LOGICAL_CI_{LOAD,STORE} in KVM

2015-04-21 Thread David Gibson
On Tue, Apr 21, 2015 at 08:37:02AM +0200, Thomas Huth wrote: Am Tue, 21 Apr 2015 10:41:51 +1000 schrieb David Gibson da...@gibson.dropbear.id.au: On POWER, storage caching is usually configured via the MMU - attributes such as cache-inhibited are stored in the TLB and the hashed page

[PULL 02/21] kvmppc: Implement H_LOGICAL_CI_{LOAD,STORE} in KVM

2015-04-21 Thread Alexander Graf
From: David Gibson da...@gibson.dropbear.id.au On POWER, storage caching is usually configured via the MMU - attributes such as cache-inhibited are stored in the TLB and the hashed page table. This makes correctly performing cache inhibited IO accesses awkward when the MMU is turned off (real

[PULL 00/21] ppc patch queue 2015-04-21 for 4.1

2015-04-21 Thread Alexander Graf
Hi Paolo / Marcelo, This is my current patch queue for ppc. Please pull. Alex The following changes since commit b79013b2449c23f1f505bdf39c5a6c330338b244: Merge tag 'staging-4.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging (2015-04-13 17:37:33 -0700) are

[PULL 08/21] KVM: PPC: Book3S HV: Move virtual mode ICP functions to real-mode

2015-04-21 Thread Alexander Graf
From: Suresh Warrier warr...@linux.vnet.ibm.com Interrupt-based hypercalls return H_TOO_HARD to inform KVM that it needs to switch to the host to complete the rest of hypercall function in virtual mode. This patch ports the virtual mode ICS/ICP reject and resend functions to be runnable in

[PULL 05/21] KVM: PPC: Book3S HV: Add helpers for lock/unlock hpte

2015-04-21 Thread Alexander Graf
From: Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com This adds helper routines for locking and unlocking HPTEs, and uses them in the rest of the code. We don't change any locking rules in this patch. Signed-off-by: Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com Signed-off-by: Paul Mackerras

[PULL 20/21] KVM: PPC: Book3S HV: Translate kvmhv_commence_exit to C

2015-04-21 Thread Alexander Graf
From: Paul Mackerras pau...@samba.org This replaces the assembler code for kvmhv_commence_exit() with C code in book3s_hv_builtin.c. It also moves the IPI sending code that was in book3s_hv_rm_xics.c into a new kvmhv_rm_send_ipi() function so it can be used by kvmhv_commence_exit() as well as

[PULL 16/21] KVM: PPC: Book3S HV: Don't wake thread with no vcpu on guest IPI

2015-04-21 Thread Alexander Graf
From: Paul Mackerras pau...@samba.org When running a multi-threaded guest and vcpu 0 in a virtual core is not running in the guest (i.e. it is busy elsewhere in the host), thread 0 of the physical core will switch the MMU to the guest and then go to nap mode in the code at kvm_do_nap. If the

[PULL 18/21] KVM: PPC: Book3S HV: Use bitmap of active threads rather than count

2015-04-21 Thread Alexander Graf
From: Paul Mackerras pau...@samba.org Currently, the entry_exit_count field in the kvmppc_vcore struct contains two 8-bit counts, one of the threads that have started entering the guest, and one of the threads that have started exiting the guest. This changes it to an entry_exit_map field which

[PULL 09/21] KVM: PPC: Book3S HV: Add ICP real mode counters

2015-04-21 Thread Alexander Graf
From: Suresh Warrier warr...@linux.vnet.ibm.com Add two counters to count how often we generate real-mode ICS resend and reject events. The counters provide some performance statistics that could be used in the future to consider if the real mode functions need further optimizing. The counters

[PULL 06/21] KVM: PPC: Book3S HV: Add guest-host real mode completion counters

2015-04-21 Thread Alexander Graf
From: Suresh E. Warrier warr...@linux.vnet.ibm.com Add counters to track number of times we switch from guest real mode to host virtual mode during an interrupt-related hyper call because the hypercall requires actions that cannot be completed in real mode. This will help when making

[PULL 12/21] KVM: PPC: Book3S HV: Simplify handling of VCPUs that need a VPA update

2015-04-21 Thread Alexander Graf
From: Paul Mackerras pau...@samba.org Previously, if kvmppc_run_core() was running a VCPU that needed a VPA update (i.e. one of its 3 virtual processor areas needed to be pinned in memory so the host real mode code can update it on guest entry and exit), we would drop the vcore lock and do the

[PULL 13/21] KVM: PPC: Book3S HV: Minor cleanups

2015-04-21 Thread Alexander Graf
From: Paul Mackerras pau...@samba.org * Remove unused kvmppc_vcore::n_busy field. * Remove setting of RMOR, since it was only used on PPC970 and the PPC970 KVM support has been removed. * Don't use r1 or r2 in setting the runlatch since they are conventionally reserved for other things; use

[PULL 03/21] KVM: PPC: Book3S HV: Add fast real-mode H_RANDOM implementation.

2015-04-21 Thread Alexander Graf
From: Michael Ellerman mich...@ellerman.id.au Some PowerNV systems include a hardware random-number generator. This HWRNG is present on POWER7+ and POWER8 chips and is capable of generating one 64-bit random number every microsecond. The random numbers are produced by sampling a set of 64

[PULL 15/21] KVM: PPC: Book3S HV: Get rid of vcore nap_count and n_woken

2015-04-21 Thread Alexander Graf
From: Paul Mackerras pau...@samba.org We can tell when a secondary thread has finished running a guest by the fact that it clears its kvm_hstate.kvm_vcpu pointer, so there is no real need for the nap_count field in the kvmppc_vcore struct. This changes kvmppc_wait_for_nap to poll the

[PULL 11/21] KVM: PPC: Book3S HV: Accumulate timing information for real-mode code

2015-04-21 Thread Alexander Graf
From: Paul Mackerras pau...@samba.org This reads the timebase at various points in the real-mode guest entry/exit code and uses that to accumulate total, minimum and maximum time spent in those parts of the code. Currently these times are accumulated per vcpu in 5 parts of the code: * rm_entry

[PULL 14/21] KVM: PPC: Book3S HV: Move vcore preemption point up into kvmppc_run_vcpu

2015-04-21 Thread Alexander Graf
From: Paul Mackerras pau...@samba.org Rather than calling cond_resched() in kvmppc_run_core() before doing the post-processing for the vcpus that we have just run (that is, calling kvmppc_handle_exit_hv(), kvmppc_set_timer(), etc.), we now do that post-processing before calling cond_resched(),

[PULL 07/21] KVM: PPC: Book3S HV: Convert ICS mutex lock to spin lock

2015-04-21 Thread Alexander Graf
From: Suresh Warrier warr...@linux.vnet.ibm.com Replaces the ICS mutex lock with a spin lock since we will be porting these routines to real mode. Note that we need to disable interrupts before we take the lock in anticipation of the fact that on the guest side, we are running in the context of a

[PULL 19/21] KVM: PPC: Book3S HV: Streamline guest entry and exit

2015-04-21 Thread Alexander Graf
From: Paul Mackerras pau...@samba.org On entry to the guest, secondary threads now wait for the primary to switch the MMU after loading up most of their state, rather than before. This means that the secondary threads get into the guest sooner, in the common case where the secondary threads get

[PULL 21/21] KVM: PPC: Book3S HV: Use msgsnd for signalling threads on POWER8

2015-04-21 Thread Alexander Graf
From: Paul Mackerras pau...@samba.org This uses msgsnd where possible for signalling other threads within the same core on POWER8 systems, rather than IPIs through the XICS interrupt controller. This includes waking secondary threads to run the guest, the interrupts generated by the virtual

[PULL 17/21] KVM: PPC: Book3S HV: Use decrementer to wake napping threads

2015-04-21 Thread Alexander Graf
From: Paul Mackerras pau...@samba.org This arranges for threads that are napping due to their vcpu having ceded or due to not having a vcpu to wake up at the end of the guest's timeslice without having to be poked with an IPI. We do that by arranging for the decrementer to contain a value no

[PULL 01/21] powerpc: Export __spin_yield

2015-04-21 Thread Alexander Graf
From: Suresh E. Warrier warr...@linux.vnet.ibm.com Export __spin_yield so that the arch_spin_unlock() function can be invoked from a module. This will be required for modules where we want to take a lock that is also is acquired in hypervisor real mode. Because we want to avoid running any

[PULL 10/21] KVM: PPC: Book3S HV: Create debugfs file for each guest's HPT

2015-04-21 Thread Alexander Graf
From: Paul Mackerras pau...@samba.org This creates a debugfs directory for each HV guest (assuming debugfs is enabled in the kernel config), and within that directory, a file by which the contents of the guest's HPT (hashed page table) can be read. The directory is named vm, where is

Re: [PATCHv4] kvmppc: Implement H_LOGICAL_CI_{LOAD,STORE} in KVM

2015-04-21 Thread Thomas Huth
Am Tue, 21 Apr 2015 16:51:21 +1000 schrieb David Gibson da...@gibson.dropbear.id.au: On Tue, Apr 21, 2015 at 08:37:02AM +0200, Thomas Huth wrote: Am Tue, 21 Apr 2015 10:41:51 +1000 schrieb David Gibson da...@gibson.dropbear.id.au: On POWER, storage caching is usually configured via the