Re: [PATCH] KVM: PPC: elide struct thread_struct instances from stack

2010-05-31 Thread Paul Mackerras
On Mon, May 31, 2010 at 09:59:13PM +0200, Andreas Schwab wrote: Instead of instantiating a whole thread_struct on the stack use only the required parts of it. ... +_GLOBAL(kvm_cvt_fd) + lfd 0,0(r5) /* load up fpscr value */ + MTFSF_L(0) + lfs 0,0(r3) +

[PATCH 8/8] KVM: PPC: Book3S HV: Fix thinko in try_lock_hpte()

2012-10-15 Thread Paul Mackerras
. Nevertheless it should still be fixed. Signed-off-by: Paul Mackerras pau...@samba.org --- arch/powerpc/include/asm/kvm_book3s_64.h |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/include/asm/kvm_book3s_64.h b/arch/powerpc/include/asm/kvm_book3s_64.h index 0dd1d86

[PATCH 0/8] Various Book3s HV fixes that haven't been picked up yet

2012-10-15 Thread Paul Mackerras
This is a set of 8 patches of which the first 7 have been posted previously and have had no comments. The 8th is new, but is quite trivial. They fix a series of issues with HV-style KVM on ppc. They only touch code that is specific to Book3S HV KVM. The patches are against the next branch of the

[PATCH 7/8] KVM: PPC: Book3S HV: Allow DTL to be set to address 0, length 0

2012-10-15 Thread Paul Mackerras
existing buffer to be unregistered by specifying a zero address. In this case the length check is not appropriate. This makes the check conditional on the address being non-zero. Signed-off-by: Paul Mackerras pau...@samba.org --- arch/powerpc/kvm/book3s_hv.c |5 ++--- 1 file changed, 2

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

2012-10-15 Thread Paul Mackerras
. Signed-off-by: Paul Mackerras pau...@samba.org Acked-by: Benjamin Herrenschmidt b...@kernel.crashing.org --- arch/powerpc/include/asm/smp.h |8 +++ arch/powerpc/kernel/smp.c | 46 arch/powerpc/kvm/book3s_hv.c | 12 +-- 3 files

[PATCH 4/8] KVM: PPC: Book3S HV: Fixes for late-joining threads

2012-10-15 Thread Paul Mackerras
it, and therefore never increment the nap_count, leading to messages about wait_for_nap timeouts. Signed-off-by: Paul Mackerras pau...@samba.org --- arch/powerpc/include/asm/kvm_host.h |7 --- arch/powerpc/kvm/book3s_hv.c| 14 +++--- 2 files changed, 15 insertions(+), 6 deletions

[PATCH 6/8] KVM: PPC: Book3S HV: Fix accounting of stolen time

2012-10-15 Thread Paul Mackerras
be genuinely stopped. Since we have no way of dividing up the time between these cases, we don't count any of it as stolen. Signed-off-by: Paul Mackerras pau...@samba.org --- arch/powerpc/include/asm/kvm_host.h |5 ++ arch/powerpc/kvm/book3s_hv.c| 127

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

2012-10-15 Thread Paul Mackerras
pointer before incrementing the nap count. It also removes unnecessary setting of the vcpu and vcore pointers in the paca in kvmppc_core_vcpu_load. Signed-off-by: Paul Mackerras pau...@samba.org --- arch/powerpc/kvm/book3s_hv.c| 41 ++- arch/powerpc/kvm

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

2012-10-15 Thread Paul Mackerras
done that. The caller (kvmppc_run_vcpu) wasn't actually checking for pending exceptions, so we add that. The change of if to while in kvmppc_run_vcpu is to make sure that we never call kvmppc_remove_runnable() when the vcore state is RUNNING or EXITING. Signed-off-by: Paul Mackerras pau

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

2012-10-15 Thread Paul Mackerras
state have been combined into a single KVMPPC_VCPU_NOTREADY state, since we no longer need to distinguish between them. Signed-off-by: Paul Mackerras pau...@samba.org --- arch/powerpc/include/asm/kvm_host.h |5 +-- arch/powerpc/kvm/book3s_hv.c| 74

[PATCH 3/5] KVM: PPC: Book3S HV: Add a mechanism for recording modified HPTEs

2012-10-15 Thread Paul Mackerras
by setting kvm-arch.hpte_mod_interest to a non-zero value. Signed-off-by: Paul Mackerras pau...@samba.org --- arch/powerpc/include/asm/kvm_book3s_64.h |6 ++ arch/powerpc/include/asm/kvm_host.h |1 + arch/powerpc/kvm/book3s_hv_rm_mmu.c | 25 ++--- 3 files

[PATCH 2/5] KVM: PPC: Book3S HV: Restructure HPT entry creation code

2012-10-15 Thread Paul Mackerras
with the address of a dummy word as the place to store the HPTE index, thus avoiding corrupting the guest R4. Signed-off-by: Paul Mackerras pau...@samba.org --- arch/powerpc/include/asm/kvm_book3s.h |5 +++-- arch/powerpc/kvm/book3s_64_mmu_hv.c | 36 +++-- arch

[PATCH 0/5] KVM: PPC: Book3S HV: HPT read/write functions for userspace

2012-10-15 Thread Paul Mackerras
This series of patches provides an interface by which userspace can read and write the hashed page table (HPT) of a Book3S HV guest. The interface is an ioctl which provides a file descriptor which can be accessed with the read() and write() system calls. The data read and written is the guest

[PATCH 1/5] KVM: Provide mmu notifier retry test based on struct kvm

2012-10-15 Thread Paul Mackerras
kvm pointer is available but a struct vcpu pointer isn't. Therefore this creates a variant of mmu_notifier_retry called kvm_mmu_notifier_retry that takes a struct kvm pointer, and implements mmu_notifier_retry in terms of it. Signed-off-by: Paul Mackerras pau...@samba.org --- include/linux

[PATCH 5/5] KVM: PPC: Book3S HV: Provide a method for userspace to read and write the HPT

2012-10-15 Thread Paul Mackerras
changed since they were last read. A read that finds no changed HPTEs in the HPT following where the last read finished will return 0 bytes. Signed-off-by: Paul Mackerras pau...@samba.org --- Documentation/virtual/kvm/api.txt| 53 + arch/powerpc/include/asm/kvm.h | 24

[PATCH 4/5] KVM: PPC: Book3S HV: Make a HPTE removal function available

2012-10-15 Thread Paul Mackerras
This makes a HPTE removal function, kvmppc_do_h_remove(), available outside book3s_hv_rm_mmu.c. This will be used by the HPT writing code. Signed-off-by: Paul Mackerras pau...@samba.org --- arch/powerpc/include/asm/kvm_book3s.h |3 +++ arch/powerpc/kvm/book3s_hv_rm_mmu.c | 19

Re: [PATCH 5/5] KVM: PPC: Book3S HV: Provide a method for userspace to read and write the HPT

2012-10-16 Thread Paul Mackerras
On Tue, Oct 16, 2012 at 12:06:58PM +0200, Avi Kivity wrote: On 10/16/2012 06:01 AM, Paul Mackerras wrote: +4.78 KVM_PPC_GET_HTAB_FD + +Capability: KVM_CAP_PPC_HTAB_FD +Architectures: powerpc +Type: vm ioctl +Parameters: Pointer to struct kvm_get_htab_fd (in) +Returns: file

Re: [PATCH 5/5] KVM: PPC: Book3S HV: Provide a method for userspace to read and write the HPT

2012-10-16 Thread Paul Mackerras
On Tue, Oct 16, 2012 at 03:06:33PM +0200, Avi Kivity wrote: On 10/16/2012 01:58 PM, Paul Mackerras wrote: On Tue, Oct 16, 2012 at 12:06:58PM +0200, Avi Kivity wrote: Does/should the fd support O_NONBLOCK and poll? (=waiting for an entry to change). No. This forces userspace

Re: [kvmarm] [RFC PATCH 0/3] KVM: ARM: Get rid of hardcoded VGIC addresses

2012-10-17 Thread Paul Mackerras
On Wed, Oct 17, 2012 at 04:39:57PM -0400, Christoffer Dall wrote: On Wed, Oct 17, 2012 at 4:38 PM, Alexander Graf ag...@suse.de wrote: On 10/14/2012 02:04 AM, Christoffer Dall wrote: *** warning: this RFC patch series is only compile-tested *** We need a way to specify the address at

Re: [kvmarm] [RFC PATCH 0/3] KVM: ARM: Get rid of hardcoded VGIC addresses

2012-10-23 Thread Paul Mackerras
On Tue, Oct 23, 2012 at 12:48:28PM +0200, Jan Kiszka wrote: The current irqchip API is like this: KVM_CREATE_IRQCHIP (without any parameters) ... KVM_CREATE_VCPU KVM_SET_IRQCHIP (or the other way around) ... KVM_RUN The arguments you cannot pass via KVM_CREATE_IRQCHIP - which is more

Re: [PATCH 0/3] KVM: PPC: Book3S HV: More flexible allocator for linear memory

2012-10-25 Thread Paul Mackerras
On Fri, Sep 14, 2012 at 03:15:32PM +0200, Alexander Graf wrote: On 14.09.2012, at 14:45, Paul Mackerras wrote: On Fri, Sep 14, 2012 at 02:13:37PM +0200, Alexander Graf wrote: So do you think it makes more sense to reimplement a large page allocator in KVM, as this patch set does

[RFC PATCH 1/9] KVM: PPC: Remove unused argument to kvmppc_core_dequeue_external

2012-11-04 Thread Paul Mackerras
Currently kvmppc_core_dequeue_external() takes a struct kvm_interrupt * argument and does nothing with it, in any of its implementations. This removes it in order to make things easier for forthcoming in-kernel interrupt controller emulation code. Signed-off-by: Paul Mackerras pau...@samba.org

[RFC PATCH 8/9] KVM: PPC: Book3S: Facilities to save/restore XICS presentation ctrler state

2012-11-04 Thread Paul Mackerras
the CPU priority setting, the pending IPI priority, and the priority and source number of any pending external interrupt. Signed-off-by: Paul Mackerras pau...@samba.org --- arch/powerpc/include/asm/kvm_ppc.h |2 + arch/powerpc/include/uapi/asm/kvm.h | 11 + arch/powerpc/kvm/book3s.c

[RFC PATCH 4/9] KVM: PPC: Book3S HV: Speed up wakeups of CPUs on HV KVM

2012-11-04 Thread Paul Mackerras
Herrenschmidt b...@kernel.crashing.org Signed-off-by: Paul Mackerras pau...@samba.org --- arch/powerpc/include/asm/kvm_book3s_asm.h |8 ++- arch/powerpc/include/asm/kvm_ppc.h| 29 arch/powerpc/kernel/asm-offsets.c |2 + arch/powerpc/kvm/book3s_hv.c | 26

[RFC PATCH 2/9] KVM: PPC: Book3S: Add infrastructure to implement kernel-side RTAS calls

2012-11-04 Thread Paul Mackerras
as at present. Signed-off-by: Michael Ellerman mich...@ellerman.id.au Signed-off-by: Benjamin Herrenschmidt b...@kernel.crashing.org Signed-off-by: Paul Mackerras pau...@samba.org --- Documentation/virtual/kvm/api.txt | 19 arch/powerpc/include/asm/hvcall.h |3 + arch/powerpc/include/asm

[RFC PATCH 5/9] KVM: PPC: Book3S HV: Add support for real mode ICP in XICS emulation

2012-11-04 Thread Paul Mackerras
. For debugging purposes, the use of the real mode implementation can be disabled by setting the KVM_ICP_FLAG_NOREALMODE bit in the icp.flags field of struct kvm_irqchip_args. Signed-off-by: Benjamin Herrenschmidt b...@kernel.crashing.org Signed-off-by: Paul Mackerras pau...@samba.org --- arch/powerpc

[RFC PATCH 0/9] KVM: PPC: In-kernel PAPR interrupt controller emulation

2012-11-04 Thread Paul Mackerras
This series implements in-kernel emulation of the XICS interrupt controller specified in the PAPR specification and used by pseries guests. Since the XICS is organized a bit differently to the interrupt controllers used on x86 machines, I have defined some new ioctls for setting up the XICS and

[RFC PATCH 7/9] KVM: PPC: Book3S: Add support for ibm,int-on/off RTAS calls

2012-11-04 Thread Paul Mackerras
(the least favoured value). ibm,int-on restores the saved_priority to the priority field, and ibm,set-xive sets both the priority and the saved_priority to the specified priority value. Signed-off-by: Paul Mackerras pau...@samba.org --- arch/powerpc/include/asm/kvm_ppc.h |2 + arch/powerpc/kvm

[RFC PATCH 6/9] KVM: PPC: Book3S HV: Improve real-mode handling of external interrupts

2012-11-04 Thread Paul Mackerras
request). This also makes sure that we clear the ceded flag when we handle a wakeup from cede in real mode, and fixes a potential infinite loop in kvmppc_run_vcpu() which can occur if we ever end up with the ceded flag set but MSR[EE] off. Signed-off-by: Paul Mackerras pau...@samba.org --- arch

[RFC PATCH 3/9] KVM: PPC: Book3S: Add kernel emulation for the XICS interrupt controller

2012-11-04 Thread Paul Mackerras
...@ellerman.id.au reworked by myself. Signed-off-by: Benjamin Herrenschmidt b...@kernel.crashing.org Signed-off-by: Paul Mackerras pau...@samba.org --- Documentation/virtual/kvm/api.txt | 17 + arch/powerpc/include/asm/kvm_book3s.h |1 + arch/powerpc/include/asm/kvm_host.h |8 + arch/powerpc

[RFC PATCH 9/9] KVM: PPC: Book 3S: Facilities to save/restore XICS source controller state

2012-11-04 Thread Paul Mackerras
sources to be processed, and a pointer to an array with space for 64 bits per source where the state of the interrupt sources are to be stored or loaded. The interrupt sources are required to all be within one ICS. Signed-off-by: Paul Mackerras pau...@samba.org --- Documentation/virtual/kvm/api.txt

[PATCH 3/3] KVM: PPC: Book3S PR: MSR_DE doesn't exist on Book 3S

2012-11-04 Thread Paul Mackerras
-off-by: Paul Mackerras pau...@samba.org --- arch/powerpc/kvm/book3s_pr.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/kvm/book3s_pr.c b/arch/powerpc/kvm/book3s_pr.c index 15d74e5..71b7988 100644 --- a/arch/powerpc/kvm/book3s_pr.c +++ b/arch/powerpc/kvm

[PATCH 0/3] KVM: PPC: Fixes for PR-KVM on POWER7

2012-11-04 Thread Paul Mackerras
Here are some fixes for PR-style KVM. With these I can successfully run a pseries (PAPR) guest under PR KVM on a POWER7. (This is all running inside a HV KVM virtual machine.) The patches are against Alex Graf's kvm-ppc-next branch. Paul. -- To unsubscribe from this list: send the line

[PATCH 1/3] KVM: PPC: Book3S PR: Emulate PURR, SPURR and DSCR registers

2012-11-04 Thread Paul Mackerras
on accessing them. This also adds a very minimal emulation of the DSCR (data stream control register). Writes are ignored and reads return zero. Signed-off-by: Paul Mackerras pau...@samba.org --- This adds these registers for all CPUs; currently we don't seem to make the presence or absence of SPRs

[PATCH 2/3] KVM: PPC: Book3S PR: Fix VSX handling

2012-11-04 Thread Paul Mackerras
of if statements. Similarly kvmppc_handle_ext needs to be able to load up more than one set of registers. Signed-off-by: Paul Mackerras pau...@samba.org --- arch/powerpc/include/asm/reg.h |1 + arch/powerpc/kvm/book3s_exports.c|3 - arch/powerpc/kvm/book3s_pr.c | 112

[PATCH] KVM: PPC: Book3S HV: Reset reverse-map chains when resetting the HPT

2012-11-11 Thread Paul Mackerras
() and kvm_test_age_hva()). Signed-off-by: Paul Mackerras pau...@samba.org Cc: sta...@vger.kernel.org --- Since this can cause the host to hang, it should go into Linus' tree ASAP and be backported to 3.6. arch/powerpc/kvm/book3s_64_mmu_hv.c | 25 + 1 file changed, 25 insertions(+) diff

[PATCH] KVM: PPC: Book3S HV: Handle guest-caused machine checks without panicking

2012-11-11 Thread Paul Mackerras
it up to kvmppc_handle_exit() to handle the condition, which it doesn't, so the situation is no better -- but no worse -- on PPC970 now.) Signed-off-by: Paul Mackerras pau...@samba.org --- This patch is against the kvm tree's next branch. arch/powerpc/kvm/Makefile |1 + arch

[PATCH 4/4] KVM: PPC: Book3S HV: Provide a method for userspace to read and write the HPT

2012-11-13 Thread Paul Mackerras
-by: Paul Mackerras pau...@samba.org --- Documentation/virtual/kvm/api.txt| 53 + arch/powerpc/include/asm/kvm_book3s_64.h | 18 ++ arch/powerpc/include/asm/kvm_ppc.h |2 + arch/powerpc/include/uapi/asm/kvm.h | 24 +++ arch/powerpc/kvm/book3s_64_mmu_hv.c | 344

[PATCH 3/4] KVM: PPC: Book3S HV: Make a HPTE removal function available

2012-11-13 Thread Paul Mackerras
This makes a HPTE removal function, kvmppc_do_h_remove(), available outside book3s_hv_rm_mmu.c. This will be used by the HPT writing code. Signed-off-by: Paul Mackerras pau...@samba.org --- arch/powerpc/include/asm/kvm_book3s.h |3 +++ arch/powerpc/kvm/book3s_hv_rm_mmu.c | 19

[PATCH 1/4] KVM: PPC: Book3S HV: Restructure HPT entry creation code

2012-11-13 Thread Paul Mackerras
with the address of a dummy word as the place to store the HPTE index, thus avoiding corrupting the guest R4. Signed-off-by: Paul Mackerras pau...@samba.org --- arch/powerpc/include/asm/kvm_book3s.h |5 +++-- arch/powerpc/kvm/book3s_64_mmu_hv.c | 36 +++-- arch

[PATCH 2/4] KVM: PPC: Book3S HV: Add a mechanism for recording modified HPTEs

2012-11-13 Thread Paul Mackerras
by setting kvm-arch.hpte_mod_interest to a non-zero value. Signed-off-by: Paul Mackerras pau...@samba.org --- arch/powerpc/include/asm/kvm_book3s_64.h |6 ++ arch/powerpc/include/asm/kvm_host.h |1 + arch/powerpc/kvm/book3s_hv_rm_mmu.c | 25 ++--- 3 files

[PATCH 0/4] KVM: PPC: Book3S HV: HPT read/write functions for userspace

2012-11-13 Thread Paul Mackerras
This series of patches provides an interface by which userspace can read and write the hashed page table (HPT) of a Book3S HV guest. The interface is an ioctl which provides a file descriptor which can be accessed with the read() and write() system calls. The data read and written is the guest

Re: [PATCH 2/4] KVM: PPC: Book3S HV: Add a mechanism for recording modified HPTEs

2012-11-19 Thread Paul Mackerras
On Mon, Nov 19, 2012 at 01:36:42PM +0100, Alexander Graf wrote: Aren't atomic reads expensive? Doing one on every guest HPTE modification (when nobody is listening) sounds quite excessive. Wouldn't it be cheaper to just always update the bit? As Scott said, it's just an ordinary load. The

Re: [PATCH 4/4] KVM: PPC: Book3S HV: Provide a method for userspace to read and write the HPT

2012-11-19 Thread Paul Mackerras
On Mon, Nov 19, 2012 at 01:53:44PM +0100, Alexander Graf wrote: +static inline unsigned long slb_pgsize_encoding(unsigned long psize) +{ + unsigned long senc = 0; + + if (psize 0x1000) { + senc = SLB_VSID_L; + if (psize == 0x1) + senc

[PATCH v2 2/3] KVM: PPC: Book3S HV: Make a HPTE removal function available

2012-11-20 Thread Paul Mackerras
This makes a HPTE removal function, kvmppc_do_h_remove(), available outside book3s_hv_rm_mmu.c. This will be used by the HPT writing code. Signed-off-by: Paul Mackerras pau...@samba.org --- v2: basically unchanged from v1, just rediffed arch/powerpc/include/asm/kvm_book3s.h |3 +++ arch

[PATCH v2 1/3] KVM: PPC: Book3S HV: Add a mechanism for recording modified HPTEs

2012-11-20 Thread Paul Mackerras
as modified. Signed-off-by: Paul Mackerras pau...@samba.org --- v2: added HPTE_GR_RESERVED, clear those bits in H_ENTER arch/powerpc/include/asm/kvm_book3s_64.h |9 + arch/powerpc/include/asm/kvm_host.h |1 + arch/powerpc/kvm/book3s_hv_rm_mmu.c | 28

[PATCH v2 3/3] KVM: PPC: Book3S HV: Provide a method for userspace to read and write the HPT

2012-11-20 Thread Paul Mackerras
-by: Paul Mackerras pau...@samba.org --- v2: added comments, added reserved field in struct kvm_get_htab_fd Documentation/virtual/kvm/api.txt| 53 + arch/powerpc/include/asm/kvm_book3s_64.h | 22 ++ arch/powerpc/include/asm/kvm_ppc.h |2 + arch/powerpc/include/uapi/asm/kvm.h

[PATCH] KVM: PPC: Book3S HV: Fix bug causing loss of page dirty state

2012-11-20 Thread Paul Mackerras
by the guest. This fixes it by only modifying the index and present bits in the reverse map entry, thus preserving the reference and change bits. We were also unnecessarily setting the reference bit, and this fixes that too. Signed-off-by: Paul Mackerras pau...@samba.org --- This is against Alex Graf's

Re: [PATCH v2 3/3] KVM: PPC: Book3S HV: Provide a method for userspace to read and write the HPT

2012-11-20 Thread Paul Mackerras
On Tue, Nov 20, 2012 at 10:16:24AM +0100, Alexander Graf wrote: Documentation is out of sync :). Oops, sorry... :) Applied all 3 with fixed documentation. Great, thanks. Regards, Paul. -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to

[PATCH 1/5] KVM: PPC: Book3S HV: Handle guest-caused machine checks on POWER7 without panicking

2012-11-22 Thread Paul Mackerras
it up to kvmppc_handle_exit() to handle the condition, which it doesn't, so the situation is no better -- but no worse -- on PPC970 now.) Signed-off-by: Paul Mackerras pau...@samba.org --- arch/powerpc/kvm/Makefile |1 + arch/powerpc/kvm/book3s_hv_ras.c| 115

[PATCH 4/5] KVM: PPC: Book3S HV: Don't give the guest RW access to RO pages

2012-11-22 Thread Paul Mackerras
reduce the HPTE permissions to read-only. Signed-off-by: Paul Mackerras pau...@samba.org --- arch/powerpc/kvm/book3s_hv_rm_mmu.c | 22 ++ 1 file changed, 22 insertions(+) diff --git a/arch/powerpc/kvm/book3s_hv_rm_mmu.c b/arch/powerpc/kvm/book3s_hv_rm_mmu.c index 7e1f7e2

[PATCH 2/5] KVM: PPC: Book3S HV: Reset reverse-map chains when resetting the HPT

2012-11-22 Thread Paul Mackerras
() and kvm_test_age_hva()). Signed-off-by: Paul Mackerras pau...@samba.org --- arch/powerpc/kvm/book3s_64_mmu_hv.c | 24 1 file changed, 24 insertions(+) diff --git a/arch/powerpc/kvm/book3s_64_mmu_hv.c b/arch/powerpc/kvm/book3s_64_mmu_hv.c index 0aa4073..1029e22 100644 --- a/arch/powerpc

[PATCH 0/5] KVM: PPC: Fix various bugs and vulnerabilities in HV KVM

2012-11-22 Thread Paul Mackerras
This series of patches fixes various bugs that we have found recently. The bugs fixed in patches 1, 3 and 4 are also vulnerabilities where the guest could cause the host to crash or could access host memory inappropriately. The bug fixed in patch 2 could cause the host to hang or crash after the

[PATCH 5/5] KVM: PPC: Book3S HV: Report correct HPT entry index when reading HPT

2012-11-22 Thread Paul Mackerras
with the index of the first entry we skipped rather than the first changed entry. This fixes it. Signed-off-by: Paul Mackerras pau...@samba.org --- arch/powerpc/kvm/book3s_64_mmu_hv.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/kvm/book3s_64_mmu_hv.c b/arch

[PATCH 3/5] KVM: PPC: Book3S HV: Improve handling of local vs. global TLB invalidations

2012-11-22 Thread Paul Mackerras
do local invalidations regardless of the H_LOCAL flag. Signed-off-by: Paul Mackerras pau...@samba.org --- arch/powerpc/include/asm/kvm_host.h |5 +-- arch/powerpc/kernel/asm-offsets.c |4 +-- arch/powerpc/kvm/book3s_64_mmu_hv.c |7 ++-- arch/powerpc/kvm/book3s_hv.c

Re: [PATCH 3/5] KVM: PPC: Book3S HV: Improve handling of local vs. global TLB invalidations

2012-11-23 Thread Paul Mackerras
On Fri, Nov 23, 2012 at 04:43:03PM +0100, Alexander Graf wrote: On 22.11.2012, at 10:28, Paul Mackerras wrote: - With the possibility of the host paging out guest pages, the use of H_LOCAL by an SMP guest is dangerous since the guest could possibly retain and use a stale TLB entry

Re: [PATCH 1/5] KVM: PPC: Book3S HV: Handle guest-caused machine checks on POWER7 without panicking

2012-11-23 Thread Paul Mackerras
On Fri, Nov 23, 2012 at 03:13:09PM +0100, Alexander Graf wrote: On 22.11.2012, at 10:25, Paul Mackerras wrote: + /* Do they have an SLB shadow buffer registered? */ + slb = vcpu-arch.slb_shadow.pinned_addr; + if (!slb) + return; Mind to explain this case? What

Re: [PATCH 4/5] KVM: PPC: Book3S HV: Don't give the guest RW access to RO pages

2012-11-23 Thread Paul Mackerras
On Fri, Nov 23, 2012 at 04:47:45PM +0100, Alexander Graf wrote: On 22.11.2012, at 10:28, Paul Mackerras wrote: Currently, if the guest does an H_PROTECT hcall requesting that the permissions on a HPT entry be changed to allow writing, we make the requested change even if the page

[PATCH v2] KVM: PPC: Book3S HV: Handle guest-caused machine checks on POWER7 without panicking

2012-11-24 Thread Paul Mackerras
machine check handler decides that the system can continue executing, kvmppc_handle_exit() delivers a machine check interrupt to the guest -- once again to let the guest know that SRR0/1 have been modified. Signed-off-by: Paul Mackerras pau...@samba.org --- Alex: let me know if you want me to redo 3/5

Re: [PATCH 4/5] KVM: PPC: Book3S HV: Don't give the guest RW access to RO pages

2012-11-24 Thread Paul Mackerras
On Sat, Nov 24, 2012 at 10:05:37AM +0100, Alexander Graf wrote: On 23.11.2012, at 23:13, Paul Mackerras pau...@samba.org wrote: On Fri, Nov 23, 2012 at 04:47:45PM +0100, Alexander Graf wrote: On 22.11.2012, at 10:28, Paul Mackerras wrote: Currently, if the guest does

Re: [PATCH 3/5] KVM: PPC: Book3S HV: Improve handling of local vs. global TLB invalidations

2012-11-26 Thread Paul Mackerras
On Mon, Nov 26, 2012 at 02:10:33PM +0100, Alexander Graf wrote: On 23.11.2012, at 23:07, Paul Mackerras wrote: On Fri, Nov 23, 2012 at 04:43:03PM +0100, Alexander Graf wrote: On 22.11.2012, at 10:28, Paul Mackerras wrote: - With the possibility of the host paging out guest pages

Re: [PATCH 1/5] KVM: PPC: Book3S HV: Handle guest-caused machine checks on POWER7 without panicking

2012-11-26 Thread Paul Mackerras
On Mon, Nov 26, 2012 at 02:15:16PM +0100, Alexander Graf wrote: On 23.11.2012, at 22:42, Paul Mackerras wrote: On Fri, Nov 23, 2012 at 03:13:09PM +0100, Alexander Graf wrote: On 22.11.2012, at 10:25, Paul Mackerras wrote: + /* Do they have an SLB shadow buffer registered

Re: [PATCH 1/5] KVM: PPC: Book3S HV: Handle guest-caused machine checks on POWER7 without panicking

2012-11-26 Thread Paul Mackerras
On Mon, Nov 26, 2012 at 11:03:48PM +0100, Alexander Graf wrote: On 26.11.2012, at 22:55, Alexander Graf wrote: On 26.11.2012, at 22:33, Paul Mackerras wrote: On Mon, Nov 26, 2012 at 02:15:16PM +0100, Alexander Graf wrote: On 23.11.2012, at 22:42, Paul Mackerras wrote

Re: [PATCH 3/5] KVM: PPC: Book3S HV: Improve handling of local vs. global TLB invalidations

2012-11-26 Thread Paul Mackerras
On Mon, Nov 26, 2012 at 11:03:19PM +0100, Alexander Graf wrote: On 26.11.2012, at 22:48, Paul Mackerras wrote: On Mon, Nov 26, 2012 at 02:10:33PM +0100, Alexander Graf wrote: On 23.11.2012, at 23:07, Paul Mackerras wrote: On Fri, Nov 23, 2012 at 04:43:03PM +0100, Alexander Graf

Re: [PATCH v2] KVM: PPC: Book3S HV: Handle guest-caused machine checks on POWER7 without panicking

2012-11-26 Thread Paul Mackerras
On Tue, Nov 27, 2012 at 12:16:28AM +0100, Alexander Graf wrote: On 24.11.2012, at 09:37, Paul Mackerras wrote: Currently, if a machine check interrupt happens while we are in the guest, we exit the guest and call the host's machine check handler, which tends to cause the host to panic

Re: [PATCH v2] KVM: PPC: Book3S HV: Handle guest-caused machine checks on POWER7 without panicking

2012-11-26 Thread Paul Mackerras
On Tue, Nov 27, 2012 at 12:20:08AM +0100, Alexander Graf wrote: Hrm. Promise to run checkpatch yourself next time and I'll fix it up for you this time ;) OK, will do, thanks. :) Paul. -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to

Re: [RFC PATCH 17/17] KVM: PPC: Add an ioctl for userspace to select which platform to emulate

2011-07-01 Thread Paul Mackerras
On Thu, Jun 30, 2011 at 05:04:23PM +0200, Alexander Graf wrote: On 06/29/2011 12:41 PM, Paul Mackerras wrote: +struct kvm_ppc_set_platform { +__u16 platform; /* defines the OS/hypervisor ABI */ +__u16 guest_arch; /* e.g. decimal 206 for v2.06 */ +__u32 flags

Re: [PATCH 10/17] KVM: PPC: Add support for Book3S processors in hypervisor mode

2011-07-04 Thread Paul Mackerras
On Fri, Jul 01, 2011 at 11:37:42AM -0700, Dave Hansen wrote: On Wed, 2011-06-29 at 20:21 +1000, Paul Mackerras wrote: +struct kvmppc_pginfo { + unsigned long pfn; + atomic_t refcnt; +}; I only see this refcnt inc'd in one spot and never decremented or read. Is the refcnt just

Re: [PATCH 10/10] KVM: PPC: Enable the PAPR CAP for Book3S

2011-08-09 Thread Paul Mackerras
On Tue, Aug 09, 2011 at 06:31:48PM +0200, Alexander Graf wrote: Now that Book3S PV mode can also run PAPR guests, we can add a PAPR cap and enable it for all Book3S targets. Enabling that CAP switches KVM into PAPR mode. Don't we want to enable it only for 64-bit hosts? Trying to run a PAPR

Re: [PATCH 10/10] KVM: PPC: Enable the PAPR CAP for Book3S

2011-08-10 Thread Paul Mackerras
On Wed, Aug 10, 2011 at 09:59:41AM +0200, Alexander Graf wrote: Am 10.08.2011 um 06:42 schrieb Paul Mackerras pau...@samba.org: On Tue, Aug 09, 2011 at 06:31:48PM +0200, Alexander Graf wrote: Now that Book3S PV mode can also run PAPR guests, we can add a PAPR cap and enable

Re: [PATCH 6/8] KVM: PPC: E500: Implement MMU notifiers

2012-08-08 Thread Paul Mackerras
On Tue, Aug 07, 2012 at 12:57:14PM +0200, Alexander Graf wrote: The e500 target has lived without mmu notifiers ever since it got introduced, but fails for the user space check on them with hugetlbfs. Ironically that user space check isn't necessary any more since David Gibson's fix for the

Re: [RFC PATCH 5/5] KVM: PPC: Take the SRCU lock around memslot use

2012-08-09 Thread Paul Mackerras
On Thu, Aug 09, 2012 at 03:27:17PM -0300, Marcelo Tosatti wrote: On Mon, Aug 06, 2012 at 08:08:16PM +1000, Paul Mackerras wrote: The generic KVM code uses SRCU (sleeping RCU) to protect accesses to the memslots data structures against updates due to userspace adding, modifying or removing

Re: [PATCH 4/5] KVM: PPC: Book3S HV: Take the SRCU read lock before looking up memslots

2012-08-09 Thread Paul Mackerras
On Thu, Aug 09, 2012 at 03:22:38PM -0300, Marcelo Tosatti wrote: On Mon, Aug 06, 2012 at 08:06:55PM +1000, Paul Mackerras wrote: The generic KVM code uses SRCU (sleeping RCU) to protect accesses to the memslots data structures against updates due to userspace adding, modifying or removing

Re: [PATCH 3/5] KVM: PPC: Book3S HV: Handle memory slot deletion and modification correctly

2012-08-09 Thread Paul Mackerras
On Thu, Aug 09, 2012 at 03:16:12PM -0300, Marcelo Tosatti wrote: The !memslot-npages case is handled in __kvm_set_memory_region (please read that part, before kvm_arch_prepare_memory_region() call). kvm_arch_flush_shadow should be implemented. Book3S HV doesn't have shadow page tables per

Re: [PATCH 3/5] KVM: PPC: Book3S HV: Handle memory slot deletion and modification correctly

2012-08-10 Thread Paul Mackerras
On Fri, Aug 10, 2012 at 03:35:53PM -0300, Marcelo Tosatti wrote: There's no plan. I just wanted to confirm this before converting to per-memslot flush. 1) __kvm_set_memory_region line 807: * - gfn_to_hva (kvm_read_guest, gfn_to_pfn) * -

Re: [PATCH 3/5] KVM: PPC: Book3S HV: Handle memory slot deletion and modification correctly

2012-08-15 Thread Paul Mackerras
On Mon, Aug 13, 2012 at 01:34:11PM -0300, Marcelo Tosatti wrote: On Sat, Aug 11, 2012 at 10:37:54AM +1000, Paul Mackerras wrote: In fact I need to remove any translations in the old range *before* the new memslot gets committed, whereas this happens after that. This is why I was doing

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

2012-08-17 Thread Paul Mackerras
, leading to an oops when unregistering the VPA. Signed-off-by: Paul Mackerras pau...@samba.org --- arch/powerpc/include/asm/kvm_ppc.h |2 ++ arch/powerpc/kvm/book3s_hv.c | 54 +++- arch/powerpc/kvm/powerpc.c | 23 +++ include/linux

Re: [PATCH 2/7] powerpc/kvm: Remove bogus update of thread IDs in HV KVM

2012-08-17 Thread Paul Mackerras
On Fri, Aug 17, 2012 at 06:38:29PM +1000, Benjamin Herrenschmidt wrote: 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 Acked-by: Paul Mackerras pau

Re: [PATCH 1/7] powerpc/kvm: Fix updates of vcpu-cpu on HV KVM

2012-08-17 Thread Paul Mackerras
waitqueue) causing unload to be called, potentially clobbering the value. Signed-off-by: Benjamin Herrenschmidt b...@kernel.crashing.org Acked-by: Paul Mackerras pau...@samba.org -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to majord

Re: [PATCH] kvm/book3s: fix build error caused by gfn_to_hva_memslot()

2012-08-24 Thread Paul Mackerras
On Thu, Aug 23, 2012 at 05:24:00PM +0900, Takuya Yoshikawa wrote: On Thu, 23 Aug 2012 15:42:49 +0800 Gavin Shan sha...@linux.vnet.ibm.com wrote: The build error was caused by that builtin functions are calling the functions implemented in modules. That was introduced by the following

Re: [PATCH v2] kvm/book3s: fix build error caused by gfn_to_hva_memslot()

2012-08-24 Thread Paul Mackerras
by moving function __gfn_to_hva_memslot() from kvm_main.c to kvm_host.h and making that inline so that the builtin function (kvmppc_h_enter) can use that. Signed-off-by: Gavin Shan sha...@linux.vnet.ibm.com Acked-by: Paul Mackerras pau...@samba.org By the way, when you give a commit ID it's

Re: [PATCH 3/5] KVM: PPC: Book3S HV: Handle memory slot deletion and modification correctly

2012-08-24 Thread Paul Mackerras
On Thu, Aug 23, 2012 at 10:55:37AM -0300, Marcelo Tosatti wrote: There are a number of options to consider: 1) Merge the current patchset from Paul, which has two downsides: 1-1) It contains an unfixable race. The race being that new HTPEs using the old base address could get inserted

Re: [patch 0/3] kvm: split kvm_arch_flush_shadow and move mmio spte invalidation to x86

2012-08-25 Thread Paul Mackerras
On Fri, Aug 24, 2012 at 03:54:56PM -0300, Marcelo Tosatti wrote: Paul, does that work for you. Yes, looks great, thanks. Paul. -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to majord...@vger.kernel.org More majordomo info at

[PATCH RFC 2/2] KVM: PPC: Book3S HV: Handle memory slot deletion and modification correctly

2012-08-25 Thread Paul Mackerras
obviously don't care about the dirty bits any more. Signed-off-by: Paul Mackerras pau...@samba.org --- This is on top of Alex's kvm-ppc-next branch with the KVM tree's next branch merged in and then Marcelo's set of 3 patches on that. This needs more testing, but I thought I would get the code

[PATCH RFC 1/2] KVM: PPC: Move kvm-arch.slot_phys into memslot.arch

2012-08-25 Thread Paul Mackerras
in to kvmppc_core_prepare_memory_region, since we need to initialize its arch.slot_phys member on Book3S HV. Signed-off-by: Paul Mackerras pau...@samba.org --- This is on top of Alex's kvm-ppc-next branch with the KVM tree's next branch merged in and then Marcelo's set of 3 patches on that. arch/powerpc/include/asm

[PATCH 06/12] KVM: PPC: Book3S HV: Remove bogus update of thread IDs in HV KVM

2012-08-28 Thread Paul Mackerras
From: Benjamin Herrenschmidt b...@kernel.crashing.org 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

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

2012-08-28 Thread Paul Mackerras
pointer before incrementing the nap count. It also removes unnecessary setting of the vcpu and vcore pointers in the paca in kvmppc_core_vcpu_load. Signed-off-by: Paul Mackerras pau...@samba.org --- arch/powerpc/kvm/book3s_hv.c| 41 ++- arch/powerpc/kvm

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

2012-08-28 Thread Paul Mackerras
. Signed-off-by: Paul Mackerras pau...@samba.org --- arch/powerpc/include/asm/smp.h |8 arch/powerpc/kernel/smp.c | 44 arch/powerpc/kvm/book3s_hv.c | 12 +-- 3 files changed, 62 insertions(+), 2 deletions(-) diff --git a/arch

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

2012-08-28 Thread Paul Mackerras
state have been combined into a single KVMPPC_VCPU_NOTREADY state, since we no longer need to distinguish between them. Signed-off-by: Paul Mackerras pau...@samba.org --- arch/powerpc/include/asm/kvm_host.h |5 +-- arch/powerpc/kvm/book3s_hv.c| 74

[PATCH 02/12] KVM: PPC: Book3S HV: Take the SRCU read lock before looking up memslots

2012-08-28 Thread Paul Mackerras
/H_REMOVE/H_BULK_REMOVE are performance-critical hot paths. Signed-off-by: Paul Mackerras pau...@samba.org --- arch/powerpc/kvm/book3s_64_mmu_hv.c | 17 + arch/powerpc/kvm/book3s_hv.c| 27 +++ 2 files changed, 36 insertions(+), 8 deletions(-) diff

[PATCH 0/12] Sundry fixes for Book3S HV

2012-08-28 Thread Paul Mackerras
This set of 12 patches contains various fixes collected during the process of getting reboot of Book3S HV guests to work correctly, plus some needed for Ben H's forthcoming series to implement in-kernel XICS (interrupt controller) emulation, plus two patches around handling memslots properly.

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

2012-08-28 Thread Paul Mackerras
the gpa right PAGE_SHIFT bits. Reported-by: Alexey Kardashevskiy a...@ozlabs.ru Signed-off-by: Paul Mackerras pau...@samba.org --- arch/powerpc/kvm/book3s_64_mmu_hv.c |9 - 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/arch/powerpc/kvm/book3s_64_mmu_hv.c b/arch

[PATCH 09/12] KVM: PPC: Book3S HV: Fixes for late-joining threads

2012-08-28 Thread Paul Mackerras
it, and therefore never increment the nap_count, leading to messages about wait_for_nap timeouts. Signed-off-by: Paul Mackerras pau...@samba.org --- arch/powerpc/include/asm/kvm_host.h |7 --- arch/powerpc/kvm/book3s_hv.c| 14 +++--- 2 files changed, 15 insertions(+), 6 deletions

[PATCH 11/12] KVM: PPC: Book3S HV: Fix accounting of stolen time

2012-08-28 Thread Paul Mackerras
be genuinely stopped. Since we have no way of dividing up the time between these cases, we don't count any of it as stolen. Signed-off-by: Paul Mackerras pau...@samba.org --- arch/powerpc/include/asm/kvm_host.h |5 ++ arch/powerpc/kvm/book3s_hv.c| 127

[PATCH 05/12] KVM: PPC: Fix updates of vcpu-cpu on HV KVM

2012-08-28 Thread Paul Mackerras
to be called, potentially clobbering the value. Signed-off-by: Benjamin Herrenschmidt b...@kernel.crashing.org Signed-off-by: Paul Mackerras pau...@samba.org --- arch/powerpc/kvm/book3s_pr.c |3 ++- arch/powerpc/kvm/booke.c |2 ++ arch/powerpc/kvm/powerpc.c |2 -- 3 files changed, 4

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

2012-08-28 Thread Paul Mackerras
, leading to an oops when unregistering the VPA. Signed-off-by: Paul Mackerras pau...@samba.org --- arch/powerpc/include/asm/kvm_ppc.h |2 ++ arch/powerpc/kvm/book3s_hv.c | 54 +++- arch/powerpc/kvm/powerpc.c | 23 +++ include/linux

[PATCH 01/12] KVM: PPC: Move kvm-arch.slot_phys into memslot.arch

2012-08-28 Thread Paul Mackerras
in to kvmppc_core_prepare_memory_region, since we need to initialize its arch.slot_phys member on Book3S HV. Signed-off-by: Paul Mackerras pau...@samba.org --- arch/powerpc/include/asm/kvm_host.h |9 +-- arch/powerpc/include/asm/kvm_ppc.h |5 ++ arch/powerpc/kvm/book3s_64_mmu_hv.c |6 +- arch/powerpc/kvm

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

2012-08-28 Thread Paul Mackerras
done that. The caller (kvmppc_run_vcpu) wasn't actually checking for pending exceptions, so we add that. The change of if to while in kvmppc_run_vcpu is to make sure that we never call kvmppc_remove_runnable() when the vcore state is RUNNING or EXITING. Signed-off-by: Paul Mackerras pau

[PATCH v2 04/12] KVM: PPC: Book3S HV: Allow KVM guests to stop secondary threads coming online

2012-08-28 Thread Paul Mackerras
. Signed-off-by: Paul Mackerras pau...@samba.org --- v2: export {,un}inhibit_secondary_onlining for the case where KVM is a module. arch/powerpc/include/asm/smp.h |8 +++ arch/powerpc/kernel/smp.c | 46 arch/powerpc/kvm/book3s_hv.c | 12

[PATCH 0/3] KVM: PPC: Memslot handling improvements

2012-09-11 Thread Paul Mackerras
This series of 3 patches fixes up the memslot handling for Book3S HV style KVM on powerpc, making slot deletion and modification work and making sure we have the appropriate SRCU synchronization against updates. The series is against the next branch of the kvm tree. These patches have all been

  1   2   3   4   5   6   7   8   9   10   >