[GIT PULL] KVM changes for 4.2-rc6

2015-08-05 Thread Paolo Bonzini
. Alex Williamson (1): KVM: MTRR: Use default type for non-MTRR-covered gfn before WARN_ON Christian Borntraeger (1): KVM: s390: Fix hang VCPU hang/loop regression Paolo Bonzini (1): Merge tag 'kvm-s390-master-20150730' of git

[PATCH 6/9] KVM: x86: Split the APIC from the rest of IRQCHIP.

2015-08-05 Thread Paolo Bonzini
-off-by: Steve Rutherford srutherf...@google.com Suggested-by: Andrew Honig aho...@google.com Signed-off-by: Paolo Bonzini pbonz...@redhat.com --- Documentation/virtual/kvm/api.txt | 17 + arch/x86/include/asm/kvm_host.h | 2 ++ arch/x86/kvm/i8254.c | 4 +++- arch/x86

[PATCH 9/9] KVM: x86: Add support for local interrupt requests from userspace

2015-08-05 Thread Paolo Bonzini
Unit Tests. Signed-off-by: Steve Rutherford srutherf...@google.com Signed-off-by: Paolo Bonzini pbonz...@redhat.com --- Documentation/virtual/kvm/api.txt | 14 + arch/x86/include/asm/kvm_host.h | 1 + arch/x86/kvm/irq.c| 32 +++-- arch/x86

[PATCH 8/9] KVM: x86: Add EOI exit bitmap inference

2015-08-05 Thread Paolo Bonzini
-off-by: Paolo Bonzini pbonz...@redhat.com --- Documentation/virtual/kvm/api.txt | 9 ++--- arch/x86/include/asm/kvm_host.h | 1 + arch/x86/kvm/ioapic.h | 2 ++ arch/x86/kvm/irq_comm.c | 42 +++ arch/x86/kvm/lapic.c | 3

[PATCH 7/9] KVM: x86: Add KVM exit for IOAPIC EOIs

2015-08-05 Thread Paolo Bonzini
tested for Intel x86. Signed-off-by: Steve Rutherford srutherf...@google.com Signed-off-by: Paolo Bonzini pbonz...@redhat.com --- Documentation/virtual/kvm/api.txt | 12 arch/x86/include/asm/kvm_host.h | 2 ++ arch/x86/kvm/lapic.c | 24 +--- arch/x86

[PATCH 4/9] KVM: x86: introduce lapic_in_kernel

2015-08-05 Thread Paolo Bonzini
Avoid pointer chasing and memory barriers, and simplify the code when split irqchip (LAPIC in kernel, IOAPIC/PIC in userspace) is introduced. Signed-off-by: Paolo Bonzini pbonz...@redhat.com --- arch/x86/kvm/irq.c | 6 +++--- arch/x86/kvm/irq.h | 8 arch/x86/kvm/lapic.c | 4

[PATCH 3/9] KVM: x86: replace vm_has_apicv hook with cpu_uses_apicv

2015-08-05 Thread Paolo Bonzini
This will avoid an unnecessary trip to -kvm and from there to the VPIC. Signed-off-by: Paolo Bonzini pbonz...@redhat.com --- arch/x86/include/asm/kvm_host.h | 2 +- arch/x86/kvm/irq.c | 2 +- arch/x86/kvm/lapic.c| 4 ++-- arch/x86/kvm/lapic.h| 4 ++-- arch

[PATCH 5/9] KVM: x86: unify handling of interrupt window

2015-08-05 Thread Paolo Bonzini
/KVM_EXIT_IRQ_WINDOW_OPEN for dm_request_for_irq_injection). However, dm_request_for_irq_injection is basically dead code! Revive it by removing the checks in vmx.c and svm.c's vmexit handlers, and fixing the returned values for the dm_request_for_irq_injection case. Signed-off-by: Paolo Bonzini pbonz

[PATCH 0/9] split irqchip series

2015-08-05 Thread Paolo Bonzini
I am going to push the memory barrier fixes to kvm/next. The rest of the series is here for review. This includes cleanups from myself and the bulk of the code from Steve. Paolo Paolo Bonzini (5): KVM: x86: set TMR when the interrupt is accepted KVM: x86: store IOAPIC-handled vectors

[PATCH 1/9] KVM: x86: set TMR when the interrupt is accepted

2015-08-05 Thread Paolo Bonzini
Do not compute TMR in advance. Instead, set the TMR just before the interrupt is accepted into the IRR. This limits the coupling between IOAPIC and LAPIC. Signed-off-by: Paolo Bonzini pbonz...@redhat.com --- arch/x86/kvm/ioapic.c | 9 ++--- arch/x86/kvm/ioapic.h | 3 +-- arch/x86/kvm

[PATCH 2/9] KVM: x86: store IOAPIC-handled vectors in each VCPU

2015-08-05 Thread Paolo Bonzini
for these interrupts anyway. This again limits the interactions between the IOAPIC and the LAPIC, making it easier to move the former to userspace. Inspired by a patch from Steve Rutherford. Signed-off-by: Paolo Bonzini pbonz...@redhat.com --- arch/x86/include/asm/kvm_host.h | 3 ++- arch/x86/kvm

Re: [PATCH v2 4/5] KVM: add KVM_USER_EXIT vcpu ioctl for userspace exit

2015-08-05 Thread Paolo Bonzini
On 05/08/2015 18:33, Radim Krčmář wrote: The guest can use KVM_USER_EXIT instead of a signal-based exiting to userspace. Availability depends on KVM_CAP_USER_EXIT. Only x86 is implemented so far. Signed-off-by: Radim Krčmář rkrc...@redhat.com --- v2: * use vcpu ioctl instead of vm

Re: [PATCH] kvm:arm:Fix error handling in the function vgic_v3_probe

2015-08-05 Thread Paolo Bonzini
On 05/08/2015 18:48, Nicholas Krause wrote: This fixes the error handling in the function vgic_v3_probe for when calling the function kvm_register_device_ops to check if the call to this function has returned a error code and if so jump to the label out with goto to cleanup no longer

Re: [PATCH 1/2] KVM: x86: set TMR when the interrupt is accepted

2015-08-04 Thread Paolo Bonzini
On 04/08/2015 02:46, Zhang, Yang Z wrote: It is a problem for split irqchip, where the EOI exit bitmap can be inferred from the IOAPIC routes but the TMR cannot. The hardware behavior on the other hand can be implemented purely within the LAPIC. So updating the TMR within LAPIC is the

Re: [kvm-unit-tests PATCH 11/14] powerpc/ppc64: add rtas_power_off

2015-08-04 Thread Paolo Bonzini
On 04/08/2015 09:47, Andrew Jones wrote: In early development we did have a hypercall mediated virtio model, but it was abandoned once we got PCI working. So I think by yours and Alex's responses, if we want testdev support then we should target using pci to expose it. I'm ok with that,

Re: [kvm-unit-tests PATCH 11/14] powerpc/ppc64: add rtas_power_off

2015-08-04 Thread Paolo Bonzini
On 04/08/2015 09:47, Andrew Jones wrote: In early development we did have a hypercall mediated virtio model, but it was abandoned once we got PCI working. So I think by yours and Alex's responses, if we want testdev support then we should target using pci to expose it. I'm ok with that,

Re: [PATCH 6/9] KVM: MMU: introduce the framework to check reserved bits on sptes

2015-08-04 Thread Paolo Bonzini
On 04/08/2015 12:59, Xiao Guangrong wrote: +/* + * the page table on host is the shadow page table for the page + * table in guest or amd nested guest, its mmu features completely + * follow the features in guest. + */ +void +reset_shadow_rsvds_bits_mask(struct kvm_vcpu *vcpu, struct

Re: [PATCH 6/9] KVM: MMU: introduce the framework to check reserved bits on sptes

2015-08-04 Thread Paolo Bonzini
On 04/08/2015 15:10, Xiao Guangrong wrote: This should be cpu_has_nx, I think. cpu_has_nx() checks the feature on host CPU, however, this is the shadow page table which completely follow guest's features. E.g, if guest does not execution-protect the physical page, then KVM does not do

Re: [PATCH 1/2] KVM: x86: set TMR when the interrupt is accepted

2015-08-03 Thread Paolo Bonzini
On 03/08/2015 04:37, Zhang, Yang Z wrote: Only virtualized APIC register reads use the virtual TMR registers (SDM 29.4.2 or 29.5), but these just read data from the corresponding field in the virtual APIC page. 24.11.4 Software Access to Related Structures In addition to data in the

Re: [PATCH 1/2] KVM: x86: set TMR when the interrupt is accepted

2015-08-03 Thread Paolo Bonzini
On 03/08/2015 12:23, Zhang, Yang Z wrote: In any case, the TMR behavior introduced by the APICv patches is completely different from the hardware behavior, so it has to be fixed. But any real problem with it? It is a problem for split irqchip, where the EOI exit bitmap can be inferred

Re: [kvm-unit-tests PATCH 11/14] powerpc/ppc64: add rtas_power_off

2015-08-03 Thread Paolo Bonzini
On 03/08/2015 16:41, Andrew Jones wrote: Add enough RTAS support to support power-off, and apply it to exit(). Signed-off-by: Andrew Jones drjo...@redhat.com Why not use virtio-mmio + testdev on ppc as well? Similar to how we're not using PSCI on ARM or ACPI on x86. Paolo -- To

Re: [kvm-unit-tests PATCH 11/14] powerpc/ppc64: add rtas_power_off

2015-08-03 Thread Paolo Bonzini
On 03/08/2015 16:41, Andrew Jones wrote: Add enough RTAS support to support power-off, and apply it to exit(). Signed-off-by: Andrew Jones drjo...@redhat.com Why not use virtio-mmio + testdev on ppc as well? Similar to how we're not using PSCI on ARM or ACPI on x86. Paolo -- To

Re: [kvm-unit-tests PATCH 00/14] ppc64: initial drop

2015-08-03 Thread Paolo Bonzini
On 03/08/2015 16:41, Andrew Jones wrote: This series is the first series of a series of series that will bring support to kvm-unit-tests for ppc64, and eventually ppc64le. (Yes, the word 'series' is four times in that sentence. And now I've typed 'series' five times! Wait, now six times! OK,

Re: [kvm-unit-tests PATCH 00/14] ppc64: initial drop

2015-08-03 Thread Paolo Bonzini
On 03/08/2015 16:41, Andrew Jones wrote: This series is the first series of a series of series that will bring support to kvm-unit-tests for ppc64, and eventually ppc64le. (Yes, the word 'series' is four times in that sentence. And now I've typed 'series' five times! Wait, now six times! OK,

Re: [PATCH kvm-unit-tests] x86: fix last commit

2015-08-02 Thread Paolo Bonzini
On 01/08/2015 23:20, Bandan Das wrote: Actually it should be using the RTC alarm to wake itself up. But the firmware changed recently and the ACPI PMBASE moved from 0xb000 to 0x600. Try this (untested): Ah thanks! your patch works for me. Is this one of the static entries in the ACPI

Re: [PATCH kvm-unit-tests] x86: fix last commit

2015-08-01 Thread Paolo Bonzini
On 01/08/2015 21:05, Bandan Das wrote: Shih-Wei Li shih...@cs.columbia.edu writes: Hi Paolo, I've tried to apply the patch, and found that it passed most of the problematic tests I mentioned earlier (IPI related, kvmclock_test). However, it stopped still at s3 and couldn't finish it. Do

Re: [kvm-unit-tests RFC PATCH] Add MAINTAINERS file

2015-07-31 Thread Paolo Bonzini
On 31/07/2015 17:06, Alex Bennée wrote: I haven't seen this upstream yet. Has this been pushed yet? Nope... Paolo -- 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

Re: 2 times more VMs withOUT KVM

2015-07-31 Thread Paolo Bonzini
On 31/07/2015 01:08, Pavel Shirshov wrote: Hello, Today I was very surprised to see that KVM with enabled HugePages uses much more memory versus KVM without HugePages enabled. I have a server with 386Gb memory. I have a VM image which allocate up to 3.2Gb memory (libvirt memory/ tag).

Re: [PATCH 1/2] KVM: x86: set TMR when the interrupt is accepted

2015-07-31 Thread Paolo Bonzini
On 31/07/2015 04:49, Steve Rutherford wrote: Oh... Yeah. That's a damn good point, given that the interrupt can be injected from another thread while one is in that guest vcpu. Easiest time to update the TMR should be on guest entry through vcpu_scan_ioapic, as before. The best way to

Re: [PATCH 1/2] KVM: x86: set TMR when the interrupt is accepted

2015-07-31 Thread Paolo Bonzini
On 31/07/2015 01:26, Zhang, Yang Z wrote: Do not compute TMR in advance. Instead, set the TMR just before the interrupt is accepted into the IRR. This limits the coupling between IOAPIC and LAPIC. Uh.., it back to original way which is wrong. You cannot modify the apic page(here is the

[PATCH kvm-unit-tests] x86: additional debug tests

2015-07-31 Thread Paolo Bonzini
Test the undocumented ICEBP (aka INT1 or INT01) opcode, and test that dr6.BS is not modified by neither watchpoints nor breakpoints. Signed-off-by: Paolo Bonzini pbonz...@redhat.com --- x86/debug.c | 51 --- 1 file changed, 44 insertions(+), 7

Re: kvm-unit-test failed to complete

2015-07-30 Thread Paolo Bonzini
On 30/07/2015 06:41, Bandan Das wrote: diff --git a/x86/cstart64.S b/x86/cstart64.S index 8d0d95d..8d5ee2d 100644 --- a/x86/cstart64.S +++ b/x86/cstart64.S @@ -213,7 +213,11 @@ idt_descr: load_tss: lidtq idt_descr - mov $0, %eax + mov $0x10, %eax + mov

Re: [PATCH 2/4] KVM: document memory barriers for kvm-vcpus/kvm-online_vcpus

2015-07-30 Thread Paolo Bonzini
On 30/07/2015 13:40, Christian Borntraeger wrote: + /* Pairs with smp_wmb() in kvm_vm_ioctl_create_vcpu, in case + * the caller has read kvm-online_vcpus before (as is the case + * for kvm_for_each_vcpu, for example). + */ smp_rmb(); Hmmm, wouldnt something like

[PATCH kvm-unit-tests] x86: fix last commit

2015-07-30 Thread Paolo Bonzini
-by: Shih-Wei Li shih...@cs.columbia.edu Signed-off-by: Paolo Bonzini pbonz...@redhat.com --- x86/cstart64.S | 6 -- 1 file changed, 6 deletions(-) diff --git a/x86/cstart64.S b/x86/cstart64.S index 8d5ee2d..e947888 100644 --- a/x86/cstart64.S +++ b/x86/cstart64.S @@ -213,12 +213,6 @@ idt_descr

Re: [PATCH 2/4] KVM: document memory barriers for kvm-vcpus/kvm-online_vcpus

2015-07-30 Thread Paolo Bonzini
On 30/07/2015 15:57, Christian Borntraeger wrote: + /* Pairs with smp_wmb() in kvm_vm_ioctl_create_vcpu, in case + * the caller has read kvm-online_vcpus before (as is the case + * for kvm_for_each_vcpu, for example). + */ is somewhat distracting because of read and before. So something

Re: [kvm:queue 25/26] include/linux/kvm_host.h:333:11: error: 'KVM_NR_IRQCHIPS' undeclared here (not in a function)

2015-07-30 Thread Paolo Bonzini
On 30/07/2015 13:51, kbuild test robot wrote: tree: git://git.kernel.org/pub/scm/virt/kvm/kvm.git queue head: 50079e2c9bcb2dd8ffe573c0edddbef9ad6fd809 commit: b7b0d2b2f35c0e6882ea0b342318bf06472ce756 [25/26] KVM: x86: Add EOI exit bitmap inference config: mips-jz4740 (attached as

Re: [GIT PULL 1/1] KVM: s390: Fix hang VCPU hang/loop regression

2015-07-30 Thread Paolo Bonzini
On 30/07/2015 13:22, Christian Borntraeger wrote: static int kvm_s390_handle_requests(struct kvm_vcpu *vcpu) { - if (!vcpu-requests) - return 0; retry: kvm_s390_vcpu_request_handled(vcpu); + if (!vcpu-requests) + return 0; /* Should

Re: [PATCH kvm-unit-tests] x86: ioapic: add tests around retriggering of level interrupts

2015-07-30 Thread Paolo Bonzini
On 30/07/2015 05:14, Steve Rutherford wrote: +static void test_ioapic_level_retrigger(void) +{ + handle_irq(0x9a, ioapic_isr_9a); + set_ioapic_redir(0x0e, 0x9a, LEVEL_TRIGGERED); + + asm volatile (cli); + set_irq_line(0x0e, 1); + while (g_isr_9a != 2) + asm

Re: [PATCH v8 3/4] KVM: x86: Add EOI exit bitmap inference

2015-07-30 Thread Paolo Bonzini
On 30/07/2015 08:32, Steve Rutherford wrote: +u8 kvm_arch_nr_userspace_ioapic_pins(struct kvm *kvm); #else static inline void kvm_vcpu_request_scan_ioapic(struct kvm *kvm) { } +static inline void kvm_arch_irq_routing_update(struct kvm *kvm) +{ +} +static inline u8

Re: [PATCH v7 1/4] KVM: x86: Split the APIC from the rest of IRQCHIP.

2015-07-30 Thread Paolo Bonzini
On 30/07/2015 08:21, Steve Rutherford wrote: First patch in a series which enables the relocation of the PIC/IOAPIC to userspace. Adds capability KVM_CAP_SPLIT_IRQCHIP; KVM_CAP_SPLIT_IRQCHIP enables the construction of LAPICs without the rest of the irqchip. Compile tested for x86.

Re: [PATCH v7 4/4] KVM: x86: Add support for local interrupt requests from userspace

2015-07-30 Thread Paolo Bonzini
On 30/07/2015 08:21, Steve Rutherford wrote: Architectures: x86, ppc, mips Type: vcpu ioctl Parameters: struct kvm_interrupt (in) -Returns: 0 on success, -1 on error +Returns: 0 on success, negative on failure. Really returns -1 because... -Queues a hardware interrupt vector to be

Re: [PATCH 2/2] KVM: x86: store IOAPIC-handled vectors in each VCPU

2015-07-30 Thread Paolo Bonzini
On 30/07/2015 05:55, Steve Rutherford wrote: static void vcpu_scan_ioapic(struct kvm_vcpu *vcpu) { - u64 eoi_exit_bitmap[4]; - if (!kvm_apic_hw_enabled(vcpu-arch.apic)) return; - memset(eoi_exit_bitmap, 0, 32); + memset(vcpu-arch.eoi_exit_bitmap, 0,

Re: [PATCH 4/4] KVM: x86: clean/fix memory barriers in irqchip_in_kernel

2015-07-30 Thread Paolo Bonzini
On 30/07/2015 05:32, Steve Rutherford wrote: + /* Write kvm-irq_routing before kvm-arch.vpic. */ + smp_wmb(); I assume this pairs with irqchip_in_kernel? Yes, see the comment added there by this same patch (read kvm-arch.vpic before kvm-irq_routing). Paolo -- To

Re: [edk2] [PATCH 2/3] KVM: MTRR: simplify kvm_mtrr_get_guest_memory_type

2015-07-30 Thread Paolo Bonzini
On 29/07/2015 21:07, Alex Williamson wrote: diff --git a/arch/x86/kvm/mtrr.c b/arch/x86/kvm/mtrr.c index e275013..dc0a84a 100644 --- a/arch/x86/kvm/mtrr.c +++ b/arch/x86/kvm/mtrr.c @@ -672,15 +672,16 @@ u8 kvm_mtrr_get_guest_memory_type(struct kvm_vcpu *vcpu, gfn_t gfn) if

Re: [PATCH 3/4] KVM: i8254: remove unnecessary irqchip_in_kernel check

2015-07-30 Thread Paolo Bonzini
On 30/07/2015 06:36, Steve Rutherford wrote: On Wed, Jul 29, 2015 at 03:28:57PM +0200, Paolo Bonzini wrote: The PIT is only created if irqchip_in_kernel returns true, so the check is superfluous. I poked around. Looks to me like the existence of an IOAPIC is not checked on the creation

Re: [PATCH v7 1/4] KVM: x86: Split the APIC from the rest of IRQCHIP.

2015-07-30 Thread Paolo Bonzini
On 30/07/2015 10:37, Steve Rutherford wrote: This looks a bit non-sensical, but is overprepared for the introduction IOAPIC hotplug, which two patches down the line. Changing it is fine, you'll just need to merge the very same change back. By IOAPIC hotplug you mean changing the number of

Re: [PATCH v7 4/4] KVM: x86: Add support for local interrupt requests from userspace

2015-07-30 Thread Paolo Bonzini
On 30/07/2015 08:21, Steve Rutherford wrote: */ int kvm_cpu_has_injectable_intr(struct kvm_vcpu *v) { - if (!irqchip_in_kernel(v-kvm)) + if (!pic_in_kernel(v-kvm)) return v-arch.interrupt.pending; if (kvm_cpu_has_extint(v)) @@ -75,7 +88,7 @@ int

[PATCH 0/2] KVM: x86: introduce lapic_in_kernel

2015-07-30 Thread Paolo Bonzini
This optimizes a little the code with split irqchip, by avoiding the need to check both vcpu-kvm-arch.vpic and vcpu-kvm-irqchip_split. No conflicts with Steve's patches, except for the irq.c hunks that I have commented on earlier. Paolo Paolo Bonzini (2): KVM: x86: replace vm_has_apicv hook

[PATCH 2/2] KVM: x86: introduce lapic_in_kernel

2015-07-30 Thread Paolo Bonzini
Avoid pointer chasing and memory barriers, and simplify the code when split irqchip (LAPIC in kernel, IOAPIC/PIC in userspace) is introduced. Signed-off-by: Paolo Bonzini pbonz...@redhat.com --- arch/x86/kvm/irq.c | 6 +++--- arch/x86/kvm/irq.h | 8 arch/x86/kvm/lapic.c | 4

[PATCH] KVM: x86: unify handling of interrupt window

2015-07-30 Thread Paolo Bonzini
/KVM_EXIT_IRQ_WINDOW_OPEN for dm_request_for_irq_injection). However, dm_request_for_irq_injection is basically dead code! Revive it by removing the checks in vmx.c and svm.c's vmexit handlers, and fixing the returned values for the dm_request_for_irq_injection case. Signed-off-by: Paolo Bonzini pbonz

[PATCH 1/2] KVM: x86: replace vm_has_apicv hook with cpu_uses_apicv

2015-07-30 Thread Paolo Bonzini
This will avoid an unnecessary trip to -kvm and from there to the VPIC. Signed-off-by: Paolo Bonzini pbonz...@redhat.com --- arch/x86/include/asm/kvm_host.h | 2 +- arch/x86/kvm/irq.c | 2 +- arch/x86/kvm/lapic.c| 4 ++-- arch/x86/kvm/lapic.h| 4 ++-- arch

Re: Should KVM_GUEST stop depending on PARAVIRT?

2015-07-29 Thread Paolo Bonzini
On 29/07/2015 06:49, Venkatesh Srinivas wrote: You can call it even feature^Wbug, I won't take it personal. :) It does not prevent scary messages (such as intel_rapl: no valid rapl domains found in package 0) in the logs for example. See https://bugzilla.redhat.com/show_bug.cgi?id=1178491

Re: Should KVM_GUEST stop depending on PARAVIRT?

2015-07-29 Thread Paolo Bonzini
On 29/07/2015 11:19, Peter Zijlstra wrote: On Tue, Jul 28, 2015 at 05:23:22PM -0700, Andy Lutomirski wrote: PeterZ, can we fix this for real instead of relying on CONFIG_PARAVIRT=y accidentally turning all msr accesses into safe accesses? We have the CPUID hypervisor bit, but I still don't

Re: Should KVM_GUEST stop depending on PARAVIRT?

2015-07-29 Thread Paolo Bonzini
On 29/07/2015 11:40, Peter Zijlstra wrote: Well, people have complained about it because it's KERN_ERR. Do you think it is okay to downgrade this (perhaps not even just on VMs) to info? Ah, do people really have nothing better to do? ;-) Seems like a petty complaint. Sure, it seems

Re: [PATCH v5 4/4] KVM: x86: Add support for local interrupt requests from userspace

2015-07-29 Thread Paolo Bonzini
On 28/07/2015 21:06, Steve Rutherford wrote: +static inline int pic_in_kernel(struct kvm *kvm) +{ + int ret; + + ret = (pic_irqchip(kvm) != NULL); + smp_rmb(); What does this memory barrier pair with? I don't think it's necessary. To be honest, it's

Re: [GIT PULL 00/16] KVM: s390: Fixes and features for kvm/next (4.3)

2015-07-29 Thread Paolo Bonzini
On 29/07/2015 11:05, Christian Borntraeger wrote: Paolo, this time only some small changes for s390, mostly serviceability changes and small fixes/optimizations. Christian The following changes since commit 5492830370171b6a4ede8a3bfba687a8d0f25fa5: KVM: svm: handle

Re: [PATCH v5 4/4] KVM: x86: Add support for local interrupt requests from userspace

2015-07-29 Thread Paolo Bonzini
On 28/07/2015 01:17, Steve Rutherford wrote: + + if (irqchip_in_kernel(vcpu-kvm) !pic_in_kernel(vcpu-kvm) + vcpu-arch.pending_external_vector == -1) { + vcpu-arch.pending_external_vector = irq-irq; + return 0; + } else if

[PATCH] KVM: move code related to KVM_SET_BOOT_CPU_ID to x86

2015-07-29 Thread Paolo Bonzini
This is another remnant of ia64 support. Signed-off-by: Paolo Bonzini pbonz...@redhat.com --- arch/x86/include/asm/kvm_host.h | 3 +++ arch/x86/kvm/x86.c | 20 include/linux/kvm_host.h| 16 virt/kvm/kvm_main.c | 14

Re: [PATCH v5 1/4] KVM: x86: Split the APIC from the rest of IRQCHIP.

2015-07-29 Thread Paolo Bonzini
On 28/07/2015 01:17, Steve Rutherford wrote: First patch in a series which enables the relocation of the PIC/IOAPIC to userspace. Adds capability KVM_CAP_SPLIT_IRQCHIP; KVM_CAP_SPLIT_IRQCHIP enables the construction of LAPICs without the rest of the irqchip. Compile tested for x86.

[PATCH 2/2] KVM: x86: store IOAPIC-handled vectors in each VCPU

2015-07-29 Thread Paolo Bonzini
for these interrupts anyway. This again limits the interactions between the IOAPIC and the LAPIC, making it easier to move the former to userspace. Inspired by a patch from Steve Rutherford. Signed-off-by: Paolo Bonzini pbonz...@redhat.com --- arch/x86/include/asm/kvm_host.h | 3 ++- arch/x86/kvm

[PATCH 0/4] KVM: cleanups around memory barriers and irqchip_in_kernel

2015-07-29 Thread Paolo Bonzini
of irqchip_in_kernel do not need the barrier and they could check vcpu-arch.apic instead of vcpu-kvm-arch.pic. I plan to change that by introducing lapic_in_kernel(struct kvm_vcpu *), after the split irqchip patches are in which will make irqchip_in_kernel more expensive. Paolo Paolo Bonzini (4

[PATCH kvm-unit-tests] x86: ioapic: add tests around retriggering of level interrupts

2015-07-29 Thread Paolo Bonzini
Test resampling of level interrupts after EOI, by leaving the IRQ line set in the ISR. One tests does reset the IRQ line after a while, the other uses masking instead in the ISR. Signed-off-by: Paolo Bonzini pbonz...@redhat.com --- x86/ioapic.c | 51

[PATCH 4/4] KVM: x86: clean/fix memory barriers in irqchip_in_kernel

2015-07-29 Thread Paolo Bonzini
kvm_pic* and reuse it if the IOAPIC creation fails. Signed-off-by: Paolo Bonzini pbonz...@redhat.com --- arch/x86/kvm/i8259.c | 15 +-- arch/x86/kvm/irq.h | 8 arch/x86/kvm/x86.c | 17 ++--- 3 files changed, 15 insertions(+), 25 deletions(-) diff --git a/arch/x86

[PATCH 1/4] KVM: x86: remove unnecessary memory barriers for shared MSRs

2015-07-29 Thread Paolo Bonzini
There is no smp_rmb matching the smp_wmb. shared_msr_update is called from hardware_enable, which in turn is called via on_each_cpu. on_each_cpu and must imply a read memory barrier (on x86 the rmb is achieved simply through asm volatile in native_apic_mem_write). Signed-off-by: Paolo Bonzini

[PATCH 2/4] KVM: document memory barriers for kvm-vcpus/kvm-online_vcpus

2015-07-29 Thread Paolo Bonzini
Signed-off-by: Paolo Bonzini pbonz...@redhat.com --- include/linux/kvm_host.h | 4 virt/kvm/kvm_main.c | 2 ++ 2 files changed, 6 insertions(+) diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index bd1097a95704..81089cf1f0c1 100644 --- a/include/linux/kvm_host.h +++ b

[PATCH 3/4] KVM: i8254: remove unnecessary irqchip_in_kernel check

2015-07-29 Thread Paolo Bonzini
The PIT is only created if irqchip_in_kernel returns true, so the check is superfluous. Signed-off-by: Paolo Bonzini pbonz...@redhat.com --- arch/x86/kvm/i8254.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kvm/i8254.c b/arch/x86/kvm/i8254.c index f90952f64e79

Re: [kvm-unit-tests RFC PATCH] Add MAINTAINERS file

2015-07-29 Thread Paolo Bonzini
Applied as follows: +Maintainers +--- +M: Paolo Bonzini pbonz...@redhat.com +M: Marcelo Tosatti mtosa...@redhat.com +L: kvm@vger.kernel.org +T: git://git.kernel.org/pub/scm/virt/kvm/kvm-unit-tests.git + +Architecture Specific Code: +--- + +ARM +M: Drew

Re: [PATCH 1/2] vhost: add ioctl to query nregions upper limit

2015-07-29 Thread Paolo Bonzini
On 29/07/2015 16:56, Michael S. Tsirkin wrote: Also, document our contract with legacy userspace: when running on an old kernel, you get -1 and you can assume at least 64 slots. Since 0 value's left unused, let's make that mean that the current userspace behaviour (trial and

Re: [kvm-unit-tests PATCH v2 0/6] Generate standalone tests

2015-07-29 Thread Paolo Bonzini
On 13/07/2015 19:02, Andrew Jones wrote: Add support to convert unit tests to standalone scripts that can be run outside the framework. This is almost an RFC, but it doesn't impact the current framework (except for 'make install', but was that ever used?). The scripting is ugly, but I see

Re: [kvm-unit-tests PATCH] alloc: only warn once if we run out of log entries

2015-07-29 Thread Paolo Bonzini
On 24/07/2015 14:07, Andrew Jones wrote: @@ -58,6 +59,7 @@ void phys_alloc_set_minimum_alignment(phys_addr_t align) static phys_addr_t phys_alloc_aligned_safe(phys_addr_t size, phys_addr_t align, bool safe) { + static bool not_warned = true; I

Re: [kvm-unit-tests RFC PATCH] arm/tlbflush.c: TLB flushing torture test [DEV]

2015-07-29 Thread Paolo Bonzini
On 27/07/2015 09:54, Andrew Jones wrote: Also, please rename to tlbflush-test.c to differentiate it from an implementation of tlbflush support, and to make the standalone test name (if we commit those patches) more descriptive. I disagree here. Support code would go in lib/arm. As we're

Re: [kvm-unit-tests PATCH v2 0/2] lib: devicetree: add stdout-path

2015-07-29 Thread Paolo Bonzini
On 29/07/2015 09:39, Andrew Jones wrote: Easy addition to the devicetree support that may come in handy for powerpc (and it may not - I have a ppc series ready to post that doesn't actually bother with stdout-path yet, but whatever...) For v2 I decided it's better to return

Re: [PATCH v5 3/4] KVM: x86: Add EOI exit bitmap inference

2015-07-29 Thread Paolo Bonzini
On 28/07/2015 01:17, Steve Rutherford wrote: diff --git a/arch/x86/kvm/ioapic.h b/arch/x86/kvm/ioapic.h index d8cc54b..f6ce112 100644 --- a/arch/x86/kvm/ioapic.h +++ b/arch/x86/kvm/ioapic.h @@ -9,6 +9,7 @@ struct kvm; struct kvm_vcpu; #define IOAPIC_NUM_PINS KVM_IOAPIC_NUM_PINS

[PATCH 1/2] KVM: x86: set TMR when the interrupt is accepted

2015-07-29 Thread Paolo Bonzini
Do not compute TMR in advance. Instead, set the TMR just before the interrupt is accepted into the IRR. This limits the coupling between IOAPIC and LAPIC. Signed-off-by: Paolo Bonzini pbonz...@redhat.com --- arch/x86/kvm/ioapic.c | 9 ++--- arch/x86/kvm/ioapic.h | 3 +-- arch/x86/kvm

[PATCH 0/2] KVM: x86: limit interactions between IOAPIC and LAPIC

2015-07-29 Thread Paolo Bonzini
a userspace IOAPIC. Tested with ioapic.flat for now, planning to do more complete tests tomorrow. The most interesting test to do here is an assigned device that uses INTX, so I am CCing Alex Williamson for a heads up. Paolo Paolo Bonzini (2): KVM: x86: set TMR when the interrupt is accepted

Re: [kvm-unit-tests RFC PATCH] Add MAINTAINERS file

2015-07-28 Thread Paolo Bonzini
On 28/07/2015 10:56, Alex Bennée wrote: +Architecture Specific Code: +--- + +ARM +M: Christoffer Dall christoffer.d...@linaro.org +L: linux-arm-ker...@lists.infradead.org (moderated for non-subscribers) +L: kvm...@lists.cs.columbia.edu +F: arm/* + Hmm, shouldn't

Re: Should KVM_GUEST stop depending on PARAVIRT?

2015-07-28 Thread Paolo Bonzini
On 27/07/2015 20:45, Andy Lutomirski wrote: On Mon, Jul 27, 2015 at 11:30 AM, Paolo Bonzini pbonz...@redhat.com wrote: On 27/07/2015 19:51, Andy Lutomirski wrote: I think I'm missing something. Does KVM_GUEST hook read_msr and write_msr? I don't see it. PARAVIRT does, and it's the main

Re: [PATCH v5 4/4] KVM: x86: Add support for local interrupt requests from userspace

2015-07-28 Thread Paolo Bonzini
On 28/07/2015 01:17, Steve Rutherford wrote: return kvm-arch.vpic; } +static inline int pic_in_kernel(struct kvm *kvm) +{ + int ret; + + ret = (pic_irqchip(kvm) != NULL); + smp_rmb(); What does this memory barrier pair with? I don't think it's necessary. +

Re: [PATCH v5 4/4] KVM: x86: Add support for local interrupt requests from userspace

2015-07-28 Thread Paolo Bonzini
On 28/07/2015 21:06, Steve Rutherford wrote: + if (!kvm_run-ready_for_interrupt_injection + ready_for_interrupt_injection) + kvm_make_request(KVM_REQ_PIC_UNMASK_EXIT, vcpu); + +

Re: Should KVM_GUEST stop depending on PARAVIRT?

2015-07-27 Thread Paolo Bonzini
On 24/07/2015 19:33, Andy Lutomirski wrote: PARAVIRT adds a fair amount of bloat and, AFAICT, KVM_GUEST doesn't really need any of it. Would it make sense to drop the dependency? I think the main reason for PARAVIRT is that pv kernels have by default .read_msr =

Re: Should KVM_GUEST stop depending on PARAVIRT?

2015-07-27 Thread Paolo Bonzini
On 27/07/2015 17:56, Andy Lutomirski wrote: On Mon, Jul 27, 2015 at 6:59 AM, Paolo Bonzini pbonz...@redhat.com wrote: On 24/07/2015 19:33, Andy Lutomirski wrote: PARAVIRT adds a fair amount of bloat and, AFAICT, KVM_GUEST doesn't really need any of it. Would it make sense to drop

Re: Should KVM_GUEST stop depending on PARAVIRT?

2015-07-27 Thread Paolo Bonzini
On 27/07/2015 19:51, Andy Lutomirski wrote: I think I'm missing something. Does KVM_GUEST hook read_msr and write_msr? I don't see it. PARAVIRT does, and it's the main reason why you'd want PARAVIRT for a KVM guest. Still confused. On a KVM guest (with PARAVIRT=y), doesn't

[GIT PULL] KVM changes for 4.2-rc4

2015-07-24 Thread Paolo Bonzini
to the quirks API * extending one of the quirks from just AMD to Intel as well, because 4.2 can show the same problem with problematic firmware on Intel too. Paolo Bonzini (2): KVM: x86: introduce kvm_check_has_quirk KVM: x86

Re: [PATCH 1/3] KVM: MTRR: fix memory type handling if MTRR is completely disabled

2015-07-23 Thread Paolo Bonzini
On 16/07/2015 06:10, Alex Williamson wrote: On Thu, 2015-07-16 at 03:25 +0800, Xiao Guangrong wrote: From: Xiao Guangrong guangrong.x...@intel.com Currently code uses default memory type if MTRR is fully disabled, fix it by using UC instead Signed-off-by: Xiao Guangrong

[PATCH] KVM: x86: rename quirk constants to KVM_X86_QUIRK_*

2015-07-23 Thread Paolo Bonzini
Make them clearly architecture-dependent; the capability is valid for all architectures, but the argument is not. Signed-off-by: Paolo Bonzini pbonz...@redhat.com --- arch/x86/include/uapi/asm/kvm.h | 4 ++-- arch/x86/kvm/lapic.c| 2 +- arch/x86/kvm/svm.c | 2 +- arch

Re: [PATCH 1/3] KVM: MTRR: fix memory type handling if MTRR is completely disabled

2015-07-23 Thread Paolo Bonzini
On 23/07/2015 08:29, Xiao Guangrong wrote: In fact this is the same quirk already implemented for SVM as KVM_QUIRK_CD_NW_CLEARED, so we can reuse the bit. Sounds good to me. I will drop the new bit and reuse as your suggestion. And i think we need document this whole staff in API.txt ...

[PATCH kvm-unit-tests] x86: load 64-bit segments into the segment registers

2015-07-23 Thread Paolo Bonzini
-bit mode, for both the BSP and the APs. Signed-off-by: Paolo Bonzini pbonz...@redhat.com --- x86/cstart64.S | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/x86/cstart64.S b/x86/cstart64.S index 8d0d95d..8d5ee2d 100644 --- a/x86/cstart64.S +++ b/x86/cstart64.S @@ -213,7

Re: [PATCH] mm: rename and document alloc_pages_exact_node

2015-07-22 Thread Paolo Bonzini
On 21/07/2015 15:55, Vlastimil Babka wrote: diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 2d73807..a8723a8 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -3158,7 +3158,7 @@ static struct vmcs *alloc_vmcs_cpu(int cpu) struct page *pages; struct vmcs

Re: [PATCH 3/3] KVM: x86: quirkily apply WB to all memory if cache is disabled

2015-07-22 Thread Paolo Bonzini
On 15/07/2015 21:25, Xiao Guangrong wrote: From: Xiao Guangrong guangrong.x...@intel.com Current firmware depends on WB to fast boot, please refer to https://lkml.org/lkml/2015/7/12/115 Let's us WB if CR0.CD is set to make this kind of firmware happy This quirk can be dropped by

Re: [PATCH v2 3/7] KVM: irqchip: convey devid to kvm_set_msi

2015-07-17 Thread Paolo Bonzini
On 17/07/2015 09:27, Pavel Fedin wrote: + } else if (!msi-flags) + return -EINVAL; Did you mean if (msg-flags) here (inverted condition)? Indeed, and also you need { } around the return for the QEMU coding standard. Paolo + + /* historically the route.type was not set */

[PULL 2/8] mips/kvm: Sign extend registers written to KVM

2015-07-16 Thread Paolo Bonzini
Bonzini pbonz...@redhat.com Cc: Leon Alrae leon.al...@imgtec.com Cc: Aurelien Jarno aurel...@aurel32.net Cc: kvm@vger.kernel.org Cc: qemu-sta...@nongnu.org Message-Id: 1429871214-23514-3-git-send-email-james.ho...@imgtec.com Signed-off-by: Paolo Bonzini pbonz...@redhat.com --- target-mips/kvm.c | 8

[PULL 1/8] mips/kvm: Fix Big endian 32-bit register access

2015-07-16 Thread Paolo Bonzini
Hogan james.ho...@imgtec.com Cc: Paolo Bonzini pbonz...@redhat.com Cc: Leon Alrae leon.al...@imgtec.com Cc: Aurelien Jarno aurel...@aurel32.net Cc: kvm@vger.kernel.org Cc: qemu-sta...@nongnu.org Message-Id: 1429871214-23514-2-git-send-email-james.ho...@imgtec.com Signed-off-by: Paolo Bonzini pbonz

Re: KVM slow LAMP guest

2015-07-16 Thread Paolo Bonzini
On 15/07/2015 22:02, C. Bröcker wrote: What OS is this? Is it RHEL/CentOS? If so, halt_poll_ns will be in 6.7 which will be out in a few days/weeks. Paolo OK. As said CentOS 6.6. But where do I put this parameter? You can add kvm.halt_poll_ns=50 to the kernel command line. If you

Re: [PATCH -mm v8 5/7] mmu-notifier: add clear_young callback

2015-07-16 Thread Paolo Bonzini
, PPC, etc). It seems like this problem is limited to pre-Haswell EPT. I'm okay with the patch. If we find problems later we can always add a parameter to kvm_age_hva so that it effectively doesn't do anything on clear_young. Acked-by: Paolo Bonzini pbonz...@redhat.com Paolo -- To unsubscribe

[PULL 01/11] mips/kvm: Fix Big endian 32-bit register access

2015-07-16 Thread Paolo Bonzini
Hogan james.ho...@imgtec.com Cc: Paolo Bonzini pbonz...@redhat.com Cc: Leon Alrae leon.al...@imgtec.com Cc: Aurelien Jarno aurel...@aurel32.net Cc: kvm@vger.kernel.org Cc: qemu-sta...@nongnu.org Message-Id: 1429871214-23514-2-git-send-email-james.ho...@imgtec.com Signed-off-by: Paolo Bonzini pbonz

[PULL 02/11] mips/kvm: Sign extend registers written to KVM

2015-07-16 Thread Paolo Bonzini
Bonzini pbonz...@redhat.com Cc: Leon Alrae leon.al...@imgtec.com Cc: Aurelien Jarno aurel...@aurel32.net Cc: kvm@vger.kernel.org Cc: qemu-sta...@nongnu.org Message-Id: 1429871214-23514-3-git-send-email-james.ho...@imgtec.com Signed-off-by: Paolo Bonzini pbonz...@redhat.com --- target-mips/kvm.c | 8

Re: [PATCH 2/4] KVM: SVM: use NPT page attributes

2015-07-16 Thread Paolo Bonzini
On 17/07/2015 02:35, Andy Lutomirski wrote: Right now, NPT page attributes are not used, and the final page attribute depends solely on gPAT (which however is not synced correctly), the guest MTRRs and the guest page attributes. However, we can do better by mimicking what is done for VMX.

[GIT PULL] KVM fixes for 4.2-rc3

2015-07-14 Thread Paolo Bonzini
. Jan Kiszka (1): KVM: SVM: Sync g_pat with guest-written PAT value Paolo Bonzini (5): x86: hyperv: add CPUID bit for crash handlers KVM: x86: reintroduce kvm_is_mmio_pfn KVM: count number of assigned devices KVM: SVM: use

Re: MTRR setup in OVMF [was: PATCH v3 01/10 KVM: MMU: fix decoding cache type from MTRR]

2015-07-14 Thread Paolo Bonzini
The long delay that Alex reported (for the case when all guest memory was set to UC up-front) is due to the fact that the SEC phase of OVMF decompresses an approximately 1712 KB sized, LZMA-compressed blob, to approx. 896 KB worth of PEI drivers and 8192 KB worth of DXE and UEFI drivers --

Re: Extensions for KVM MSI related ioctls

2015-07-13 Thread Paolo Bonzini
On 13/07/2015 12:25, Andre Przywara wrote: For using MSIs in a guest when running on an ARM(64) system using a GICv3 interrupt controller we need to have a device ID available. On real hardware this information is sampled from the bus by the ITS part of the interrupt controller. To make

<    2   3   4   5   6   7   8   9   10   11   >