Re: [PATCH] kvm: iommu: Add cond_resched to legacy device assignment code

2014-12-17 Thread Joerg Roedel
On Wed, Dec 17, 2014 at 09:38:57AM +0800, Chen, Tiejun wrote: On 2014/12/16 23:47, Joerg Roedel wrote: diff --git a/virt/kvm/iommu.c b/virt/kvm/iommu.c index c1e6ae9..ac427e8 100644 --- a/virt/kvm/iommu.c +++ b/virt/kvm/iommu.c This file is already gone after one latest commit

Re: [PATCH] kvm: iommu: Add cond_resched to legacy device assignment code

2014-12-17 Thread Paolo Bonzini
On 17/12/2014 11:35, Joerg Roedel wrote: This file is already gone after one latest commit c274e03af705, kvm: x86: move assigned-dev.c and iommu.c to arch/x86/ is introduced, so you need to pull your tree firstly :) Hmm, I based the patch on kvm/master, where the file is still present.

Re: [question] Why newer QEMU may lose irq when doing migration?

2014-12-17 Thread Paolo Bonzini
On 17/12/2014 04:46, Wincy Van wrote: Hi, all: The patchset (https://lkml.org/lkml/2014/3/18/309) fixed migration of Windows guests, but commit 0bc830b05c667218d703f2026ec866c49df974fc (KVM: ioapic: clear IRR for edge-triggered interrupts at delivery) introduced a bug (see

Re: [PATCH] kvm: iommu: Add cond_resched to legacy device assignment code

2014-12-17 Thread Joerg Roedel
On Wed, Dec 17, 2014 at 11:46:24AM +0100, Paolo Bonzini wrote: On 17/12/2014 11:35, Joerg Roedel wrote: This file is already gone after one latest commit c274e03af705, kvm: x86: move assigned-dev.c and iommu.c to arch/x86/ is introduced, so you need to pull your tree firstly :)

[PATCH v2 0/5] kvmtool: ARM: fixing initrd, serial IRQs and bzImage message

2014-12-17 Thread Andre Przywara
This is the fixed version of a part of my kvmtool patch queue. Patch 1 (fixing initrd for ARM) was already on the list, but hasn't been merged yet. Patch 2-4 let kvmtool describe the 8250 serial IRQs as level triggered and fix a stability problem. Patch 5 is an easy fix for a message that annoys

[PATCH v2 5/5] kvmtool: remove warning about bzImage on non-x86 architectures

2014-12-17 Thread Andre Przywara
Among the architectures supported by kvmtool, only x86 defines a bzImage format. So we shouldn't bother users of other architectures with a message about something that cannot work. Make the bzImage check dependent on compiling for x86. Signed-off-by: Andre Przywara andre.przyw...@arm.com ---

[PATCH v2 2/5] kvmtool: replace GIC specific IRQ type #defines

2014-12-17 Thread Andre Przywara
We had GIC specific defines for the IRQ type identifiers in kvmtool. But In fact the specification of being a level or edge interrupt is quite generic, with the GIC binding using the generic Linux defines. So lets replace the GIC specific names in favour of the general defines used in Linux.

[PATCH v2 1/5] kvmtool: ARM: fix initrd functionality

2014-12-17 Thread Andre Przywara
lkvm -i is currently broken on ARM/ARM64. We should not try to convert smaller-than-4GB addresses into 64-bit big endian and then stuff them into u32 variables if we expect to read anything other than 0 out of it. Adjust the type to u64 to write the proper address in BE format into the /chosen

[PATCH v2 3/5] kvmtool: ARM: allow level interrupts in device tree

2014-12-17 Thread Andre Przywara
Currently we describe every interrupt for each device in the FDT as being edge triggered. Add a parameter to the irq property generation to allow devices to specify their interrupts as level triggered if needed. Signed-off-by: Andre Przywara andre.przyw...@arm.com --- tools/kvm/arm/fdt.c

[PATCH v2 4/5] kvmtool: ARM: advertise 8250 IRQs as level-triggered

2014-12-17 Thread Andre Przywara
Both the 16550/8250 UART emulation in kvmtool as well as all the drivers and DTBs for real hardware use level triggered interrutpts. But the device tree currently describes them as being edge triggered, which can lead to hangs in guests. Use the new IRQ type parameter to properly describe the

Re: [PATCH v2 2/5] kvmtool: replace GIC specific IRQ type #defines

2014-12-17 Thread Will Deacon
On Wed, Dec 17, 2014 at 11:14:44AM +, Andre Przywara wrote: We had GIC specific defines for the IRQ type identifiers in kvmtool. But In fact the specification of being a level or edge interrupt is quite generic, with the GIC binding using the generic Linux defines. So lets replace the GIC

Re: [PATCH v2 5/5] kvmtool: remove warning about bzImage on non-x86 architectures

2014-12-17 Thread Will Deacon
On Wed, Dec 17, 2014 at 11:14:47AM +, Andre Przywara wrote: Among the architectures supported by kvmtool, only x86 defines a bzImage format. So we shouldn't bother users of other architectures with a message about something that cannot work. Make the bzImage check dependent on compiling

Re: [PATCH] arch: powerpc: kvm: book3s_paired_singles.c: Remove unused function

2014-12-17 Thread Alexander Graf
On 07.12.14 23:29, Rickard Strandqvist wrote: Remove the function inst_set_field() that is not used anywhere. This was partially found by using a static code analysis program called cppcheck. Signed-off-by: Rickard Strandqvist rickard_strandqv...@spectrumdigital.se Thanks, applied all

Re: [PATCH] KVM: PPC: Book3S HV: Simplify locking around stolen time calculations

2014-12-17 Thread Alexander Graf
On 04.12.14 06:43, Paul Mackerras wrote: Currently the calculations of stolen time for PPC Book3S HV guests uses fields in both the vcpu struct and the kvmppc_vcore struct. The fields in the kvmppc_vcore struct are protected by the vcpu-arch.tbacct_lock of the vcpu that has taken

Re: [PATCH] KVM: PPC: Book3S HV: Tracepoints for KVM HV guest interactions

2014-12-17 Thread Alexander Graf
On 04.12.14 01:48, Suresh E. Warrier wrote: This patch adds trace points in the guest entry and exit code and also for exceptions handled by the host in kernel mode - hypercalls and page faults. The new events are added to /sys/kernel/debug/tracing/events under a new subsystem called kvm_hv.

Re: [PATCH] powerpc: powernv: Return to cpu offline loop when finished in KVM guest

2014-12-17 Thread Alexander Graf
On 03.12.14 04:48, Paul Mackerras wrote: When a secondary hardware thread has finished running a KVM guest, we currently put that thread into nap mode using a nap instruction in the KVM code. This changes the code so that instead of doing a nap instruction directly, we instead cause the

Re: [PATCH 0/5] Fixes and improvements for HV KVM on PPC

2014-12-17 Thread Alexander Graf
On 03.12.14 03:30, Paul Mackerras wrote: This series of patches is based on Alex Graf's kvm-ppc-queue branch and is intended for the 3.19 merge window. It starts by removing the code to support HV KVM on PPC970 processors. This code is hardly used now since there are not many HV-capable

Re: [patch 1/3] KVM: x86: add method to test PIR bitmap vector

2014-12-17 Thread Radim Krcmar
2014-12-16 09:08-0500, Marcelo Tosatti: kvm_x86_ops-test_posted_interrupt() returns true/false depending whether 'vector' is set. Next patch makes use of this interface. Signed-off-by: Marcelo Tosatti mtosa...@redhat.com Reviewed-by: Radim Krčmář rkrc...@redhat.com -- To unsubscribe from

Re: [patch 2/3] KVM: x86: add option to advance tscdeadline hrtimer expiration

2014-12-17 Thread Radim Krcmar
2014-12-16 09:08-0500, Marcelo Tosatti: For the hrtimer which emulates the tscdeadline timer in the guest, add an option to advance expiration, and busy spin on VM-entry waiting for the actual expiration time to elapse. This allows achieving low latencies in cyclictest (or any scenario

Re: [patch 3/3] KVM: x86: add tracepoint to wait_lapic_expire

2014-12-17 Thread Radim Krcmar
2014-12-16 09:08-0500, Marcelo Tosatti: Add tracepoint to wait_lapic_expire. Signed-off-by: Marcelo Tosatti mtosa...@redhat.com Reviewed-by: Radim Krčmář rkrc...@redhat.com +++ kvm/arch/x86/kvm/lapic.c @@ -1120,7 +1120,7 @@ static bool lapic_timer_int_injected(str void

[PATCH v3 2/5] kvmtool: replace GIC specific IRQ type #defines

2014-12-17 Thread Andre Przywara
We had GIC specific defines for the IRQ type identifiers in kvmtool. But in fact the specification of being a level or edge interrupt is quite generic, with the GIC binding using the generic Linux defines. So lets replace the GIC specific #defines in favour of the more general names copied from

[PATCH v3 3/5] kvmtool: ARM: allow level interrupts in device tree

2014-12-17 Thread Andre Przywara
Currently we describe every interrupt for each device in the FDT as being edge triggered. Add a parameter to the irq property generation to allow devices to specify their interrupts as level triggered if needed. Signed-off-by: Andre Przywara andre.przyw...@arm.com --- tools/kvm/arm/fdt.c

[PATCH v3 4/5] kvmtool: ARM: advertise 8250 IRQs as level-triggered

2014-12-17 Thread Andre Przywara
Both the 16550/8250 UART emulation in kvmtool as well as all the drivers and DTBs for real hardware use level triggered interrutpts. But the device tree currently describes them as being edge triggered, which can lead to hangs in guests. Use the new IRQ type parameter to properly describe the

[PATCH v3 0/5] kvmtool: ARM: fixing initrd, serial IRQs and bzImage message

2014-12-17 Thread Andre Przywara
Since there were no comments on the last series for almost 4 hours, I thought it was about time for v3 (also that Will can go home with another bullet point in his weekly) ;-) This is a part of my kvmtool patch queue. Patch 1 (fixing initrd for ARM) was already on the list, but hasn't been merged

[PATCH v3 5/5] kvmtool: remove warning about bzImage on non-x86 architectures

2014-12-17 Thread Andre Przywara
Among the architectures supported by kvmtool, only x86 defines a bzImage format. So we shouldn't bother users of other architectures with a message about something that cannot work. Make the bzImage check dependent on compiling for x86. Signed-off-by: Andre Przywara andre.przyw...@arm.com ---

[PATCH v3 1/5] kvmtool: ARM: fix initrd functionality

2014-12-17 Thread Andre Przywara
lkvm -i is currently broken on ARM/ARM64. We should not try to convert smaller-than-4GB addresses into 64-bit big endian and then stuff them into u32 variables if we expect to read anything other than 0 out of it. Adjust the type to u64 to write the proper address in BE format into the /chosen

[GIT PULL] VFIO updates for 3.19-rc1

2014-12-17 Thread Alex Williamson
Hi Linus, The following changes since commit 0df1f2487d2f0d04703f142813d53615d62a1da4: Linux 3.18-rc3 (2014-11-02 15:01:51 -0800) are available in the git repository at: git://github.com/awilliam/linux-vfio.git tags/vfio-v3.19-rc1 for you to fetch changes up to

Re: [v3 24/26] KVM: Update Posted-Interrupts Descriptor when vCPU is blocked

2014-12-17 Thread Paolo Bonzini
On 12/12/2014 16:14, Feng Wu wrote: This patch updates the Posted-Interrupts Descriptor when vCPU is blocked. pre-block: - Add the vCPU to the blocked per-CPU list - Clear 'SN' Should SN be already clear (and NV set to POSTED_INTR_VECTOR)? Can it happen that you go from sched-out to

Re: [v3 23/26] KVM: Update Posted-Interrupts Descriptor when vCPU is preempted

2014-12-17 Thread Paolo Bonzini
On 12/12/2014 16:14, Feng Wu wrote: + if (irq_remapping_cap(IRQ_POSTING_CAP)) { + struct pi_desc *pi_desc = vcpu_to_pi_desc(vcpu); + struct pi_desc old, new; + unsigned int dest; + + memset(old, 0, sizeof(old)); + memset(new,

[PATCH] KVM: move APIC types to arch/x86/

2014-12-17 Thread Paolo Bonzini
They are not used anymore by IA64, move them away. Signed-off-by: Paolo Bonzini pbonz...@redhat.com --- arch/x86/include/asm/kvm_host.h | 10 ++ arch/x86/kvm/ioapic.h | 17 + include/linux/kvm_types.h | 27 --- 3 files changed, 27

Re: [v3 17/26] KVM: make kvm_set_msi_irq() public

2014-12-17 Thread Paolo Bonzini
On 12/12/2014 16:14, Feng Wu wrote: Make kvm_set_msi_irq() public, we can use this function outside. Signed-off-by: Feng Wu feng...@intel.com --- include/linux/kvm_host.h | 2 ++ virt/kvm/irq_comm.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git

Re: [patch 2/3] KVM: x86: add option to advance tscdeadline hrtimer expiration

2014-12-17 Thread Marcelo Tosatti
On Wed, Dec 17, 2014 at 03:58:13PM +0100, Radim Krcmar wrote: 2014-12-16 09:08-0500, Marcelo Tosatti: For the hrtimer which emulates the tscdeadline timer in the guest, add an option to advance expiration, and busy spin on VM-entry waiting for the actual expiration time to elapse. This

Re: [v3 25/26] KVM: Suppress posted-interrupt when 'SN' is set

2014-12-17 Thread Paolo Bonzini
On 12/12/2014 16:14, Feng Wu wrote: Currently, we don't support urgent interrupt, all interrupts are recognized as non-urgent interrupt, so we cannot send posted-interrupt when 'SN' is set. Can this happen? If the vcpu is in guest mode, it cannot have been scheduled out, and that's the only

Re: [v3 25/26] KVM: Suppress posted-interrupt when 'SN' is set

2014-12-17 Thread Paolo Bonzini
On 12/12/2014 16:14, Feng Wu wrote: Currently, we don't support urgent interrupt, all interrupts are recognized as non-urgent interrupt, so we cannot send posted-interrupt when 'SN' is set. Can this happen? If the vcpu is in guest mode, it cannot have been scheduled out, and that's the only

Re: [patch 2/3] KVM: x86: add option to advance tscdeadline hrtimer expiration

2014-12-17 Thread Paolo Bonzini
On 17/12/2014 18:41, Marcelo Tosatti wrote: Btw. simple automatic delta tuning had worse results? Haven't tried automatic tuning. So what happens on a realtime environment is this: you execute the fixed number of instructions from interrupt handling all the way to VM-entry. Well,

Again with same Cgroup issue :)

2014-12-17 Thread mad Engineer
Hello All, From the last couple of days i have been spamming this mailing list with request for configuring Cgroup with libvirtd on Centos systems. I still can not find a permanent solution to limit host RAM to particular value,tried creating a separate hierarchy mykvm

Re: [patch 2/3] KVM: x86: add option to advance tscdeadline hrtimer expiration

2014-12-17 Thread Radim Krcmar
2014-12-17 15:41-0200, Marcelo Tosatti: On Wed, Dec 17, 2014 at 03:58:13PM +0100, Radim Krcmar wrote: 2014-12-16 09:08-0500, Marcelo Tosatti: + tsc_deadline = apic-lapic_timer.expired_tscdeadline; + apic-lapic_timer.expired_tscdeadline = 0; + guest_tsc = kvm_x86_ops-read_l1_tsc(vcpu,

Re: [PATCH 4/5] KVM: PPC: Book3S HV: Add fast real-mode H_RANDOM implementation.

2014-12-17 Thread Alexander Graf
On 03.12.14 03:30, Paul Mackerras wrote: 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

Re: [PATCH] KVM: add KVM_CAP_VMX_APICV to advertise hardware apic-v support

2014-12-17 Thread Stefan Fritsch
On Thursday 11 December 2014 18:15:39, Paolo Bonzini wrote: On 11/12/2014 13:53, zhanghailiang wrote: I think it's a Windows bug---it should prefer x2apic to hv-vapic if both are available. No, i don't think it is a windows bug, it has nothing to do with x2apic, hv-vapic MSRs doesn't

[PULL 16/18] KVM: PPC: Book3S HV: Fix endianness of instruction obtained from HEIR register

2014-12-17 Thread Alexander Graf
From: Paul Mackerras pau...@samba.org There are two ways in which a guest instruction can be obtained from the guest in the guest exit code in book3s_hv_rmhandlers.S. If the exit was caused by a Hypervisor Emulation interrupt (i.e. an illegal instruction), the offending instruction is in the

[PULL 07/18] KVM: PPC: Book3S HV: ptes are big endian

2014-12-17 Thread Alexander Graf
From: Cédric Le Goater c...@fr.ibm.com When being restored from qemu, the kvm_get_htab_header are in native endian, but the ptes are big endian. This patch fixes restore on a KVM LE host. Qemu also needs a fix for this : http://lists.nongnu.org/archive/html/qemu-ppc/2014-11/msg8.html

[PULL 06/18] KVM: PPC: Book3S HV: Fix inaccuracies in ICP emulation for H_IPI

2014-12-17 Thread Alexander Graf
From: Suresh E. Warrier warr...@linux.vnet.ibm.com This fixes some inaccuracies in the state machine for the virtualized ICP when implementing the H_IPI hcall (Set_MFFR and related states): 1. The old code wipes out any pending interrupts when the new MFRR is more favored than the CPPR but

[PULL 13/18] KVM: PPC: Book3S HV: Simplify locking around stolen time calculations

2014-12-17 Thread Alexander Graf
From: Paul Mackerras pau...@samba.org Currently the calculations of stolen time for PPC Book3S HV guests uses fields in both the vcpu struct and the kvmppc_vcore struct. The fields in the kvmppc_vcore struct are protected by the vcpu-arch.tbacct_lock of the vcpu that has taken responsibility for

[PULL 18/18] KVM: PPC: Book3S: Enable in-kernel XICS emulation by default

2014-12-17 Thread Alexander Graf
From: Anton Blanchard an...@samba.org The in-kernel XICS emulation is faster than doing it all in QEMU and it has got a lot of testing, so enable it by default. Signed-off-by: Anton Blanchard an...@samba.org Signed-off-by: Paul Mackerras pau...@samba.org Signed-off-by: Alexander Graf

[PULL 03/18] KVM: PPC: Book3S HV: Fix computation of tlbie operand

2014-12-17 Thread Alexander Graf
From: Paul Mackerras pau...@samba.org The B (segment size) field in the RB operand for the tlbie instruction is two bits, which we get from the top two bits of the first doubleword of the HPT entry to be invalidated. These bits go in bits 8 and 9 of the RB operand (bits 54 and 55 in IBM bit

[PULL 01/18] KVM: PPC: BookE: Improve irq inject tracepoint

2014-12-17 Thread Alexander Graf
When injecting an IRQ, we only document which IRQ priority (which translates to IRQ type) gets injected. However, when reading traces you don't necessarily have all the numbers in your head to know which IRQ really is meant. This patch converts the IRQ number field to a symbolic name that is in

[PULL 12/18] arch: powerpc: kvm: book3s_paired_singles.c: Remove unused function

2014-12-17 Thread Alexander Graf
From: Rickard Strandqvist rickard_strandqv...@spectrumdigital.se Remove the function inst_set_field() that is not used anywhere. This was partially found by using a static code analysis program called cppcheck. Signed-off-by: Rickard Strandqvist rickard_strandqv...@spectrumdigital.se

[PULL 15/18] KVM: PPC: Book3S HV: Remove code for PPC970 processors

2014-12-17 Thread Alexander Graf
From: Paul Mackerras pau...@samba.org This removes the code that was added to enable HV KVM to work on PPC970 processors. The PPC970 is an old CPU that doesn't support virtualizing guest memory. Removing PPC970 support also lets us remove the code for allocating and managing contiguous

[PULL 05/18] KVM: PPC: Book3S HV: Fix KSM memory corruption

2014-12-17 Thread Alexander Graf
From: Paul Mackerras pau...@samba.org Testing with KSM active in the host showed occasional corruption of guest memory. Typically a page that should have contained zeroes would contain values that look like the contents of a user process stack (values such as 0x_3fff__xxx). Code

[PULL 09/18] arch: powerpc: kvm: book3s_32_mmu.c: Remove unused function

2014-12-17 Thread Alexander Graf
From: Rickard Strandqvist rickard_strandqv...@spectrumdigital.se Remove the function sr_nx() that is not used anywhere. This was partially found by using a static code analysis program called cppcheck. Signed-off-by: Rickard Strandqvist rickard_strandqv...@spectrumdigital.se Signed-off-by:

[PULL 10/18] arch: powerpc: kvm: book3s.c: Remove some unused functions

2014-12-17 Thread Alexander Graf
From: Rickard Strandqvist rickard_strandqv...@spectrumdigital.se Removes some functions that are not used anywhere: kvmppc_core_load_guest_debugstate() kvmppc_core_load_host_debugstate() This was partially found by using a static code analysis program called cppcheck. Signed-off-by: Rickard

[PULL 08/18] KVM: PPC: Book3S HV: Check wait conditions before sleeping in kvmppc_vcore_blocked

2014-12-17 Thread Alexander Graf
From: Suresh E. Warrier warr...@linux.vnet.ibm.com The kvmppc_vcore_blocked() code does not check for the wait condition after putting the process on the wait queue. This means that it is possible for an external interrupt to become pending, but the vcpu to remain asleep until the next

[PULL 17/18] KVM: PPC: Book3S HV: Improve H_CONFER implementation

2014-12-17 Thread Alexander Graf
From: Sam Bobroff sam.bobr...@au1.ibm.com Currently the H_CONFER hcall is implemented in kernel virtual mode, meaning that whenever a guest thread does an H_CONFER, all the threads in that virtual core have to exit the guest. This is bad for performance because it interrupts the other threads

[PULL 14/18] KVM: PPC: Book3S HV: Tracepoints for KVM HV guest interactions

2014-12-17 Thread Alexander Graf
From: Suresh E. Warrier warr...@linux.vnet.ibm.com This patch adds trace points in the guest entry and exit code and also for exceptions handled by the host in kernel mode - hypercalls and page faults. The new events are added to /sys/kernel/debug/tracing/events under a new subsystem called

[PULL 00/18] ppc patch queue 2014-12-18

2014-12-17 Thread Alexander Graf
Hi Paolo, This is my current patch queue for ppc. Please pull. After the merge with Linus' tree, e500v2 compilation will be broken because commit 69111bac42f5 broke it upstream. Could you please take care to apply the fix I CC'ed you on for it? Thanks! Alex The following changes since

[PULL 04/18] KVM: PPC: Book3S HV: Fix an issue where guest is paused on receiving HMI

2014-12-17 Thread Alexander Graf
From: Mahesh Salgaonkar mah...@linux.vnet.ibm.com When we get an HMI (hypervisor maintenance interrupt) while in a guest, we see that guest enters into paused state. The reason is, in kvmppc_handle_exit_hv it falls through default path and returns to host instead of resuming guest. This causes

[PULL 02/18] KVM: PPC: Book3S HV: Add missing HPTE unlock

2014-12-17 Thread Alexander Graf
From: Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com In kvm_test_clear_dirty(), if we find an invalid HPTE we move on to the next HPTE without unlocking the invalid one. In fact we should never find an invalid and unlocked HPTE in the rmap chain, but for robustness we should unlock it. This

[PULL 11/18] arch: powerpc: kvm: book3s_pr.c: Remove unused function

2014-12-17 Thread Alexander Graf
From: Rickard Strandqvist rickard_strandqv...@spectrumdigital.se Remove the function get_fpr_index() that is not used anywhere. This was partially found by using a static code analysis program called cppcheck. Signed-off-by: Rickard Strandqvist rickard_strandqv...@spectrumdigital.se

[RESEND PATCH v15 07/11] KVM: arm: page logging 2nd stage fault handling

2014-12-17 Thread Mario Smarduch
This patch is a followup to v15 patch series, with following changes: - When clearing/dissolving a huge, PMD mark huge page range dirty, since the state of whole range is unknown. After the huge page is dissolved dirty page logging is at page granularity. - Correct comment due to

RE: [v3 25/26] KVM: Suppress posted-interrupt when 'SN' is set

2014-12-17 Thread Wu, Feng
-Original Message- From: linux-kernel-ow...@vger.kernel.org [mailto:linux-kernel-ow...@vger.kernel.org] On Behalf Of Paolo Bonzini Sent: Thursday, December 18, 2014 1:43 AM To: Wu, Feng; Thomas Gleixner; Ingo Molnar; H. Peter Anvin; x...@kernel.org; Gleb Natapov; Paolo Bonzini;

RE: [v3 23/26] KVM: Update Posted-Interrupts Descriptor when vCPU is preempted

2014-12-17 Thread Wu, Feng
-Original Message- From: Paolo Bonzini [mailto:paolo.bonz...@gmail.com] On Behalf Of Paolo Bonzini Sent: Thursday, December 18, 2014 1:11 AM To: Wu, Feng; Thomas Gleixner; Ingo Molnar; H. Peter Anvin; x...@kernel.org; Gleb Natapov; Paolo Bonzini; dw...@infradead.org;

RE: [v3 24/26] KVM: Update Posted-Interrupts Descriptor when vCPU is blocked

2014-12-17 Thread Wu, Feng
-Original Message- From: kvm-ow...@vger.kernel.org [mailto:kvm-ow...@vger.kernel.org] On Behalf Of Paolo Bonzini Sent: Thursday, December 18, 2014 1:10 AM To: Wu, Feng; Thomas Gleixner; Ingo Molnar; H. Peter Anvin; x...@kernel.org; Gleb Natapov; Paolo Bonzini; dw...@infradead.org;

Re: [PATCH] KVM: add KVM_CAP_VMX_APICV to advertise hardware apic-v support

2014-12-17 Thread zhanghailiang
On 2014/12/18 6:17, Stefan Fritsch wrote: On Thursday 11 December 2014 18:15:39, Paolo Bonzini wrote: On 11/12/2014 13:53, zhanghailiang wrote: I think it's a Windows bug---it should prefer x2apic to hv-vapic if both are available. No, i don't think it is a windows bug, it has nothing to do

Re: [PATCH] arch: powerpc: kvm: book3s_paired_singles.c: Remove unused function

2014-12-17 Thread Alexander Graf
On 07.12.14 23:29, Rickard Strandqvist wrote: Remove the function inst_set_field() that is not used anywhere. This was partially found by using a static code analysis program called cppcheck. Signed-off-by: Rickard Strandqvist rickard_strandqv...@spectrumdigital.se Thanks, applied all

Re: [PATCH] KVM: PPC: Book3S HV: Simplify locking around stolen time calculations

2014-12-17 Thread Alexander Graf
On 04.12.14 06:43, Paul Mackerras wrote: Currently the calculations of stolen time for PPC Book3S HV guests uses fields in both the vcpu struct and the kvmppc_vcore struct. The fields in the kvmppc_vcore struct are protected by the vcpu-arch.tbacct_lock of the vcpu that has taken

Re: [PATCH] KVM: PPC: Book3S HV: Tracepoints for KVM HV guest interactions

2014-12-17 Thread Alexander Graf
On 04.12.14 01:48, Suresh E. Warrier wrote: This patch adds trace points in the guest entry and exit code and also for exceptions handled by the host in kernel mode - hypercalls and page faults. The new events are added to /sys/kernel/debug/tracing/events under a new subsystem called kvm_hv.

Re: [PATCH] powerpc: powernv: Return to cpu offline loop when finished in KVM guest

2014-12-17 Thread Alexander Graf
On 03.12.14 04:48, Paul Mackerras wrote: When a secondary hardware thread has finished running a KVM guest, we currently put that thread into nap mode using a nap instruction in the KVM code. This changes the code so that instead of doing a nap instruction directly, we instead cause the

Re: [PATCH 0/5] Fixes and improvements for HV KVM on PPC

2014-12-17 Thread Alexander Graf
On 03.12.14 03:30, Paul Mackerras wrote: This series of patches is based on Alex Graf's kvm-ppc-queue branch and is intended for the 3.19 merge window. It starts by removing the code to support HV KVM on PPC970 processors. This code is hardly used now since there are not many HV-capable

Re: [PATCH 4/5] KVM: PPC: Book3S HV: Add fast real-mode H_RANDOM implementation.

2014-12-17 Thread Alexander Graf
On 03.12.14 03:30, Paul Mackerras wrote: 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

[PULL 01/18] KVM: PPC: BookE: Improve irq inject tracepoint

2014-12-17 Thread Alexander Graf
When injecting an IRQ, we only document which IRQ priority (which translates to IRQ type) gets injected. However, when reading traces you don't necessarily have all the numbers in your head to know which IRQ really is meant. This patch converts the IRQ number field to a symbolic name that is in

[PULL 03/18] KVM: PPC: Book3S HV: Fix computation of tlbie operand

2014-12-17 Thread Alexander Graf
From: Paul Mackerras pau...@samba.org The B (segment size) field in the RB operand for the tlbie instruction is two bits, which we get from the top two bits of the first doubleword of the HPT entry to be invalidated. These bits go in bits 8 and 9 of the RB operand (bits 54 and 55 in IBM bit

[PULL 06/18] KVM: PPC: Book3S HV: Fix inaccuracies in ICP emulation for H_IPI

2014-12-17 Thread Alexander Graf
From: Suresh E. Warrier warr...@linux.vnet.ibm.com This fixes some inaccuracies in the state machine for the virtualized ICP when implementing the H_IPI hcall (Set_MFFR and related states): 1. The old code wipes out any pending interrupts when the new MFRR is more favored than the CPPR but

[PULL 07/18] KVM: PPC: Book3S HV: ptes are big endian

2014-12-17 Thread Alexander Graf
From: Cédric Le Goater c...@fr.ibm.com When being restored from qemu, the kvm_get_htab_header are in native endian, but the ptes are big endian. This patch fixes restore on a KVM LE host. Qemu also needs a fix for this : http://lists.nongnu.org/archive/html/qemu-ppc/2014-11/msg8.html

[PULL 08/18] KVM: PPC: Book3S HV: Check wait conditions before sleeping in kvmppc_vcore_blocked

2014-12-17 Thread Alexander Graf
From: Suresh E. Warrier warr...@linux.vnet.ibm.com The kvmppc_vcore_blocked() code does not check for the wait condition after putting the process on the wait queue. This means that it is possible for an external interrupt to become pending, but the vcpu to remain asleep until the next

[PULL 10/18] arch: powerpc: kvm: book3s.c: Remove some unused functions

2014-12-17 Thread Alexander Graf
From: Rickard Strandqvist rickard_strandqv...@spectrumdigital.se Removes some functions that are not used anywhere: kvmppc_core_load_guest_debugstate() kvmppc_core_load_host_debugstate() This was partially found by using a static code analysis program called cppcheck. Signed-off-by: Rickard

[PULL 18/18] KVM: PPC: Book3S: Enable in-kernel XICS emulation by default

2014-12-17 Thread Alexander Graf
From: Anton Blanchard an...@samba.org The in-kernel XICS emulation is faster than doing it all in QEMU and it has got a lot of testing, so enable it by default. Signed-off-by: Anton Blanchard an...@samba.org Signed-off-by: Paul Mackerras pau...@samba.org Signed-off-by: Alexander Graf

[PULL 12/18] arch: powerpc: kvm: book3s_paired_singles.c: Remove unused function

2014-12-17 Thread Alexander Graf
From: Rickard Strandqvist rickard_strandqv...@spectrumdigital.se Remove the function inst_set_field() that is not used anywhere. This was partially found by using a static code analysis program called cppcheck. Signed-off-by: Rickard Strandqvist rickard_strandqv...@spectrumdigital.se

[PULL 02/18] KVM: PPC: Book3S HV: Add missing HPTE unlock

2014-12-17 Thread Alexander Graf
From: Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com In kvm_test_clear_dirty(), if we find an invalid HPTE we move on to the next HPTE without unlocking the invalid one. In fact we should never find an invalid and unlocked HPTE in the rmap chain, but for robustness we should unlock it. This

[PULL 04/18] KVM: PPC: Book3S HV: Fix an issue where guest is paused on receiving HMI

2014-12-17 Thread Alexander Graf
From: Mahesh Salgaonkar mah...@linux.vnet.ibm.com When we get an HMI (hypervisor maintenance interrupt) while in a guest, we see that guest enters into paused state. The reason is, in kvmppc_handle_exit_hv it falls through default path and returns to host instead of resuming guest. This causes

[PULL 13/18] KVM: PPC: Book3S HV: Simplify locking around stolen time calculations

2014-12-17 Thread Alexander Graf
From: Paul Mackerras pau...@samba.org Currently the calculations of stolen time for PPC Book3S HV guests uses fields in both the vcpu struct and the kvmppc_vcore struct. The fields in the kvmppc_vcore struct are protected by the vcpu-arch.tbacct_lock of the vcpu that has taken responsibility for

[PULL 05/18] KVM: PPC: Book3S HV: Fix KSM memory corruption

2014-12-17 Thread Alexander Graf
From: Paul Mackerras pau...@samba.org Testing with KSM active in the host showed occasional corruption of guest memory. Typically a page that should have contained zeroes would contain values that look like the contents of a user process stack (values such as 0x_3fff__xxx). Code

[PULL 17/18] KVM: PPC: Book3S HV: Improve H_CONFER implementation

2014-12-17 Thread Alexander Graf
From: Sam Bobroff sam.bobr...@au1.ibm.com Currently the H_CONFER hcall is implemented in kernel virtual mode, meaning that whenever a guest thread does an H_CONFER, all the threads in that virtual core have to exit the guest. This is bad for performance because it interrupts the other threads

[PULL 11/18] arch: powerpc: kvm: book3s_pr.c: Remove unused function

2014-12-17 Thread Alexander Graf
From: Rickard Strandqvist rickard_strandqv...@spectrumdigital.se Remove the function get_fpr_index() that is not used anywhere. This was partially found by using a static code analysis program called cppcheck. Signed-off-by: Rickard Strandqvist rickard_strandqv...@spectrumdigital.se

[PULL 09/18] arch: powerpc: kvm: book3s_32_mmu.c: Remove unused function

2014-12-17 Thread Alexander Graf
From: Rickard Strandqvist rickard_strandqv...@spectrumdigital.se Remove the function sr_nx() that is not used anywhere. This was partially found by using a static code analysis program called cppcheck. Signed-off-by: Rickard Strandqvist rickard_strandqv...@spectrumdigital.se Signed-off-by:

[PULL 15/18] KVM: PPC: Book3S HV: Remove code for PPC970 processors

2014-12-17 Thread Alexander Graf
From: Paul Mackerras pau...@samba.org This removes the code that was added to enable HV KVM to work on PPC970 processors. The PPC970 is an old CPU that doesn't support virtualizing guest memory. Removing PPC970 support also lets us remove the code for allocating and managing contiguous

[PULL 16/18] KVM: PPC: Book3S HV: Fix endianness of instruction obtained from HEIR register

2014-12-17 Thread Alexander Graf
From: Paul Mackerras pau...@samba.org There are two ways in which a guest instruction can be obtained from the guest in the guest exit code in book3s_hv_rmhandlers.S. If the exit was caused by a Hypervisor Emulation interrupt (i.e. an illegal instruction), the offending instruction is in the

[PULL 00/18] ppc patch queue 2014-12-18

2014-12-17 Thread Alexander Graf
Hi Paolo, This is my current patch queue for ppc. Please pull. After the merge with Linus' tree, e500v2 compilation will be broken because commit 69111bac42f5 broke it upstream. Could you please take care to apply the fix I CC'ed you on for it? Thanks! Alex The following changes since

[PULL 14/18] KVM: PPC: Book3S HV: Tracepoints for KVM HV guest interactions

2014-12-17 Thread Alexander Graf
From: Suresh E. Warrier warr...@linux.vnet.ibm.com This patch adds trace points in the guest entry and exit code and also for exceptions handled by the host in kernel mode - hypercalls and page faults. The new events are added to /sys/kernel/debug/tracing/events under a new subsystem called