[PATCH 2/2] kvm: fix kvm_is_mmio_pfn() and rename to kvm_is_reserved_pfn()

2014-11-10 Thread Ard Biesheuvel
This reverts commit 85c8555ff0 ("KVM: check for !is_zero_pfn() in kvm_is_mmio_pfn()") and renames the function to kvm_is_reserved_pfn. The problem being addressed by the patch above was that some ARM code based the memory mapping attributes of a pfn on the return value of kvm_is_mmio_pfn(), whose

[PATCH 1/2] arm/arm64: kvm: drop inappropriate use of kvm_is_mmio_pfn()

2014-11-10 Thread Ard Biesheuvel
Instead of using kvm_is_mmio_pfn() to decide whether a host region should be stage 2 mapped with device attributes, add a new static function kvm_is_device_pfn() that disregards RAM pages with the reserved bit set, as those should usually not be mapped as device memory. Signed-off-by: Ard Biesheuv

KVM call for agenda for 2014-11-11

2014-11-10 Thread Juan Quintela
Hi Please, send any topic that you are interested in covering. Thanks, Juan. Call details: 15:00 CEST 13:00 UTC 09:00 EDT Every two weeks By popular demand, a google calendar public entry with it https://www.google.com/calendar/embed?src=dG9iMXRqcXAzN3Y4ZXZwNzRoMHE4a3BqcXNAZ3JvdXAuY

Re: Seeking a KVM benchmark

2014-11-10 Thread Paolo Bonzini
On 09/11/2014 17:36, Andy Lutomirski wrote: >> The purpose of vmexit test is to show us various overheads, so why not >> measure EFER switch overhead by having two tests one with equal EFER >> another with different EFER, instead of hiding it. > > I'll try this. We might need three tests, thoug

[PATCH kvm-unit-tests] vmexit: add tests with EFER.SCE=1

2014-11-10 Thread Paolo Bonzini
These activate a faster path that does not set EFER in the user return notifier. Time the difference between the two. Signed-off-by: Paolo Bonzini --- x86/vmexit.c | 20 1 file changed, 20 insertions(+) diff --git a/x86/vmexit.c b/x86/vmexit.c index 3bd0c81..a0380ab 100644

Re: Seeking a KVM benchmark

2014-11-10 Thread Gleb Natapov
On Mon, Nov 10, 2014 at 11:03:35AM +0100, Paolo Bonzini wrote: > > > On 09/11/2014 17:36, Andy Lutomirski wrote: > >> The purpose of vmexit test is to show us various overheads, so why not > >> measure EFER switch overhead by having two tests one with equal EFER > >> another with different EFER,

Re: [PATCH 2/2] kvm: fix kvm_is_mmio_pfn() and rename to kvm_is_reserved_pfn()

2014-11-10 Thread Christoffer Dall
Hi Ard, On Mon, Nov 10, 2014 at 09:33:56AM +0100, Ard Biesheuvel wrote: > This reverts commit 85c8555ff0 ("KVM: check for !is_zero_pfn() in > kvm_is_mmio_pfn()") and renames the function to kvm_is_reserved_pfn. > > The problem being addressed by the patch above was that some ARM code > based the

Re: [PATCH 1/2] arm/arm64: kvm: drop inappropriate use of kvm_is_mmio_pfn()

2014-11-10 Thread Christoffer Dall
On Mon, Nov 10, 2014 at 09:33:55AM +0100, Ard Biesheuvel wrote: > Instead of using kvm_is_mmio_pfn() to decide whether a host region > should be stage 2 mapped with device attributes, add a new static > function kvm_is_device_pfn() that disregards RAM pages with the > reserved bit set, as those sho

Re: [PATCH 2/2] kvm: fix kvm_is_mmio_pfn() and rename to kvm_is_reserved_pfn()

2014-11-10 Thread Ard Biesheuvel
On 10 November 2014 11:53, Christoffer Dall wrote: > Hi Ard, > > On Mon, Nov 10, 2014 at 09:33:56AM +0100, Ard Biesheuvel wrote: >> This reverts commit 85c8555ff0 ("KVM: check for !is_zero_pfn() in >> kvm_is_mmio_pfn()") and renames the function to kvm_is_reserved_pfn. >> >> The problem being addr

Re: [PATCH 2/2] kvm: fix kvm_is_mmio_pfn() and rename to kvm_is_reserved_pfn()

2014-11-10 Thread Christoffer Dall
On Mon, Nov 10, 2014 at 12:05 PM, Ard Biesheuvel wrote: > On 10 November 2014 11:53, Christoffer Dall > wrote: >> Hi Ard, >> >> On Mon, Nov 10, 2014 at 09:33:56AM +0100, Ard Biesheuvel wrote: >>> This reverts commit 85c8555ff0 ("KVM: check for !is_zero_pfn() in >>> kvm_is_mmio_pfn()") and rename

Re: [PATCH 1/2] arm/arm64: kvm: drop inappropriate use of kvm_is_mmio_pfn()

2014-11-10 Thread Ard Biesheuvel
On 10 November 2014 11:57, Christoffer Dall wrote: > On Mon, Nov 10, 2014 at 09:33:55AM +0100, Ard Biesheuvel wrote: >> Instead of using kvm_is_mmio_pfn() to decide whether a host region >> should be stage 2 mapped with device attributes, add a new static >> function kvm_is_device_pfn() that disre

Re: Seeking a KVM benchmark

2014-11-10 Thread Paolo Bonzini
On 10/11/2014 11:45, Gleb Natapov wrote: > > I tried making also the other shared MSRs the same between guest and > > host (STAR, LSTAR, CSTAR, SYSCALL_MASK), so that the user return notifier > > has nothing to do. That saves about 4-500 cycles on inl_from_qemu. I > > do want to dig out my old

Re: [PATCH] kvm: Fix memory slot page alignment logic

2014-11-10 Thread Igor Mammedov
On Fri, 7 Nov 2014 22:18:45 +0100 Alexander Graf wrote: > Memory slots have to be page aligned to get entered into KVM. There > is existing logic that tries to ensure that we pad memory slots that > are not page aligned to the biggest region that would still fit in the > alignment requirements.

Re: [PATCH] kvm: Fix memory slot page alignment logic

2014-11-10 Thread Alexander Graf
On 10.11.14 13:31, Igor Mammedov wrote: > On Fri, 7 Nov 2014 22:18:45 +0100 > Alexander Graf wrote: > >> Memory slots have to be page aligned to get entered into KVM. There >> is existing logic that tries to ensure that we pad memory slots that >> are not page aligned to the biggest region tha

Re: [PATCH v4 4/6] hw_random: fix unregister race.

2014-11-10 Thread Herbert Xu
On Mon, Nov 03, 2014 at 11:56:24PM +0800, Amos Kong wrote: > > @@ -98,6 +99,8 @@ static inline void cleanup_rng(struct kref *kref) > > if (rng->cleanup) > rng->cleanup(rng); You need a compiler barrier here to prevent reordering. > + rng->cleanup_done = true; Thanks, --

Re: [PATCH] kvm: Fix memory slot page alignment logic

2014-11-10 Thread Paolo Bonzini
On 10/11/2014 14:16, Alexander Graf wrote: > No, because in that case you would map something as RAM that really > isn't RAM. > > Imagine you have the following memory layout: > > 0x1000 page size > > 1) 0x0 - 0x1 RAM > 2) 0x1 - 0x10100 MMIO > 3) 0x10100 - 0x2 RAM > > Then you

Re: [Qemu-devel] [PATCH] kvm: Fix memory slot page alignment logic

2014-11-10 Thread Peter Maydell
On 10 November 2014 13:16, Alexander Graf wrote: > Sorry, I don't understand this paragraph. Memory slots in general are > accelerations for memory access - for MMIO (RAM is usually aligned), KVM > can always exit to QEMU and just do a manual MMIO exit. ...you're a bit stuck if you were hoping to

Re: [PATCH] kvm: Fix memory slot page alignment logic

2014-11-10 Thread Igor Mammedov
On Mon, 10 Nov 2014 14:16:58 +0100 Alexander Graf wrote: > > > On 10.11.14 13:31, Igor Mammedov wrote: > > On Fri, 7 Nov 2014 22:18:45 +0100 > > Alexander Graf wrote: > > > >> Memory slots have to be page aligned to get entered into KVM. There > >> is existing logic that tries to ensure that

Re: Seeking a KVM benchmark

2014-11-10 Thread Avi Kivity
On 11/10/2014 02:15 PM, Paolo Bonzini wrote: On 10/11/2014 11:45, Gleb Natapov wrote: I tried making also the other shared MSRs the same between guest and host (STAR, LSTAR, CSTAR, SYSCALL_MASK), so that the user return notifier has nothing to do. That saves about 4-500 cycles on inl_from_qem

Re: [PATCH] kvm: Fix memory slot page alignment logic

2014-11-10 Thread Alexander Graf
On 10.11.14 14:55, Igor Mammedov wrote: > On Mon, 10 Nov 2014 14:16:58 +0100 > Alexander Graf wrote: > >> >> >> On 10.11.14 13:31, Igor Mammedov wrote: >>> On Fri, 7 Nov 2014 22:18:45 +0100 >>> Alexander Graf wrote: >>> Memory slots have to be page aligned to get entered into KVM. There

Re: [Qemu-devel] [PATCH] kvm: Fix memory slot page alignment logic

2014-11-10 Thread Alexander Graf
On 10.11.14 14:55, Peter Maydell wrote: > On 10 November 2014 13:16, Alexander Graf wrote: >> Sorry, I don't understand this paragraph. Memory slots in general are >> accelerations for memory access - for MMIO (RAM is usually aligned), KVM >> can always exit to QEMU and just do a manual MMIO exi

Re: [RFC PATCH 1/4] ARM: KVM: on unhandled IO mem abort, route the call to the KVM MMIO bus

2014-11-10 Thread Nikolay Nikolaev
Hello, On Fri, Mar 28, 2014 at 9:09 PM, Christoffer Dall wrote: > > On Thu, Mar 13, 2014 at 04:57:26PM +0100, Antonios Motakis wrote: > > On an unhandled IO memory abort, use the kvm_io_bus_* API in order to > > handle the MMIO access through any registered read/write callbacks. This > > is a dep

Re: [RFC PATCH 1/4] ARM: KVM: on unhandled IO mem abort, route the call to the KVM MMIO bus

2014-11-10 Thread Christoffer Dall
On Mon, Nov 10, 2014 at 05:09:07PM +0200, Nikolay Nikolaev wrote: > Hello, > > On Fri, Mar 28, 2014 at 9:09 PM, Christoffer Dall > wrote: > > > > On Thu, Mar 13, 2014 at 04:57:26PM +0100, Antonios Motakis wrote: > > > On an unhandled IO memory abort, use the kvm_io_bus_* API in order to > > > han

Re: Seeking a KVM benchmark

2014-11-10 Thread Paolo Bonzini
On 10/11/2014 15:23, Avi Kivity wrote: > It's not surprising [1]. Since the meaning of some PTE bits change [2], > the TLB has to be flushed. In VMX we have VPIDs, so we only need to flush > if EFER changed between two invocations of the same VPID, which isn't the > case. > > [1] after the fact

Re: [PATCH 14/21] KVM: x86: Software disabled APIC should still deliver NMIs

2014-11-10 Thread Paolo Bonzini
On 06/11/2014 17:45, Radim Krčmář wrote: > - } else if (kvm_apic_hw_enabled(apic)) { > + } else if (kvm_apic_get_reg(apic, APIC_LDR)) { > if (kvm_apic_get_reg(apic, APIC_DFR) == > APIC_DFR_CLUSTER) {

Re: Seeking a KVM benchmark

2014-11-10 Thread Gleb Natapov
On Mon, Nov 10, 2014 at 06:28:25PM +0100, Paolo Bonzini wrote: > On 10/11/2014 15:23, Avi Kivity wrote: > > It's not surprising [1]. Since the meaning of some PTE bits change [2], > > the TLB has to be flushed. In VMX we have VPIDs, so we only need to flush > > if EFER changed between two invocat

Re: [PATCH 14/21] KVM: x86: Software disabled APIC should still deliver NMIs

2014-11-10 Thread Radim Krčmář
2014-11-10 18:35+0100, Paolo Bonzini: > On 06/11/2014 17:45, Radim Krčmář wrote: > > - } else if (kvm_apic_hw_enabled(apic)) { > > + } else if (kvm_apic_get_reg(apic, APIC_LDR)) { > > if (kvm_apic_get_reg(apic, APIC_DFR) == > >

Re: several messages

2014-11-10 Thread Thomas Gleixner
On Mon, 10 Nov 2014, Feng Wu wrote: > VT-d Posted-Interrupts is an enhancement to CPU side Posted-Interrupt. > With VT-d Posted-Interrupts enabled, external interrupts from > direct-assigned devices can be delivered to guests without VMM > intervention when guest is running in non-root mode. Can

Re: Seeking a KVM benchmark

2014-11-10 Thread Andy Lutomirski
On Mon, Nov 10, 2014 at 2:45 AM, Gleb Natapov wrote: > On Mon, Nov 10, 2014 at 11:03:35AM +0100, Paolo Bonzini wrote: >> >> >> On 09/11/2014 17:36, Andy Lutomirski wrote: >> >> The purpose of vmexit test is to show us various overheads, so why not >> >> measure EFER switch overhead by having two t

[PATCH] x86, kvm, vmx: Don't set LOAD_IA32_EFER when host and guest match

2014-11-10 Thread Andy Lutomirski
There's nothing to switch if the host and guest values are the same. I am unable to find evidence that this makes any difference whatsoever. Signed-off-by: Andy Lutomirski --- arch/x86/kvm/vmx.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/

Re: [PATCH] x86, kvm, vmx: Always use LOAD_IA32_EFER if available

2014-11-10 Thread Andy Lutomirski
On Sun, Nov 9, 2014 at 8:33 PM, Wanpeng Li wrote: > Hi Andy, > On Fri, Nov 07, 2014 at 06:25:18PM -0800, Andy Lutomirski wrote: >>At least on Sandy Bridge, letting the CPU switch IA32_EFER is much >>faster than switching it manually. >> >>I benchmarked this using the vmexit kvm-unit-test (single r

compiler bug gcc4.6/4.7 with ACCESS_ONCE and workarounds

2014-11-10 Thread Christian Borntraeger
Linus, Last week I sent belows patch to Paolo for kvm/next. Heiko Carstens pointed out that the kernel often does not work around compiler bugs, instead we blacklist the compiler, make a buildbug on or similar when we cant be sure to catch all broken cases, e.g. Heiko mentioned the the x86 spe

Re: compiler bug gcc4.6/4.7 with ACCESS_ONCE and workarounds

2014-11-10 Thread Linus Torvalds
On Mon, Nov 10, 2014 at 12:18 PM, Christian Borntraeger wrote: > > Now: I can reproduces belows miscompile on gcc46 and gcc 47 > gcc 45 seems ok, gcc 48 is fixed. This makes blacklisting > a bit hard, especially since it is not limited to s390, but > covers all architectures. > In essence ACCESS_

Re: [PATCH 05/13] KVM: Update IRTE according to guest interrupt configuration changes

2014-11-10 Thread Alex Williamson
On Mon, 2014-11-10 at 14:26 +0800, Feng Wu wrote: > When guest changes its interrupt configuration (such as, vector, etc.) > for direct-assigned devices, we need to update the associated IRTE > with the new guest vector, so external interrupts from the assigned > devices can be injected to guests w

Re: [PATCH 02/13] KVM: Initialize VT-d Posted-Interrtups Descriptor

2014-11-10 Thread Alex Williamson
On Mon, 2014-11-10 at 14:26 +0800, Feng Wu wrote: > This patch initialize the VT-d Posted-interrupt Descritpor. > > Signed-off-by: Feng Wu > --- > arch/x86/include/asm/irq_remapping.h |1 + > arch/x86/kernel/apic/apic.c |1 + > arch/x86/kvm/vmx.c | 56 +++

Re: [PATCH] x86: Update VT-d Posted-Interrupts related information

2014-11-10 Thread Alex Williamson
On Mon, 2014-11-10 at 14:31 +0800, Feng Wu wrote: > VT-d Posted-Interrupts(PI) is an enhancement to CPU side Posted-Interrupt. > With VT-d Posted-Interrupts enabled, external interrupts from > direct-assigned devices can be delivered to guests without VMM > involvement when guest is running in non-

Re: [PATCH 13/13] iommu/vt-d: Add a command line parameter for VT-d posted-interrupts

2014-11-10 Thread Alex Williamson
On Mon, 2014-11-10 at 14:26 +0800, Feng Wu wrote: > Enable VT-d Posted-Interrtups and add a command line > parameter for it. > > Signed-off-by: Feng Wu > --- > drivers/iommu/irq_remapping.c |9 - > 1 files changed, 8 insertions(+), 1 deletions(-) > > diff --git a/drivers/iommu/irq_r

Hotplugging usb devices on guest boot

2014-11-10 Thread Elliot Hallmark
Hello list, The short version is: how do I best use an external deamon to hotplug all the usb devices for each guest when the guest boots? The solution needs to work for quests started through virt-manager (as folks with minimal knowledge of the system may need to start VM's). I thought there m

[PATCH] KVM: PPC: BookE: Improve irq inject tracepoint

2014-11-10 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 sy

Re: compiler bug gcc4.6/4.7 with ACCESS_ONCE and workarounds

2014-11-10 Thread Paul E. McKenney
On Mon, Nov 10, 2014 at 01:07:33PM -0800, Linus Torvalds wrote: > On Mon, Nov 10, 2014 at 12:18 PM, Christian Borntraeger > wrote: > > > > Now: I can reproduces belows miscompile on gcc46 and gcc 47 > > gcc 45 seems ok, gcc 48 is fixed. This makes blacklisting > > a bit hard, especially since it

Re: [PATCH v4 10/25] virtio: add API to enable VQs early

2014-11-10 Thread Andy Grover
Fedora 20, guest Fedora 20. my config is at: https://fedorapeople.org/~grover/config-20141110 [0.828494] [ cut here ] [0.829039] kernel BUG at /home/agrover/git/kernel/include/linux/virtio_config.h:125! [0.831266] invalid opcode: [#1] SMP DEBUG_PAGEALL

Re: [PATCH] kvm: x86: add trace event for pvclock updates

2014-11-10 Thread Marcelo Tosatti
On Wed, Nov 05, 2014 at 11:46:42AM -0800, David Matlack wrote: > The new trace event records: > * the id of vcpu being updated > * the pvclock_vcpu_time_info struct being written to guest memory > > This is useful for debugging pvclock bugs, such as the bug fixed by > "[PATCH] kvm: x86: Fix kv

Re: [PATCH] virtio_console: move early VQ enablement

2014-11-10 Thread Dave Airlie
On 21 October 2014 03:09, Josh Boyer wrote: > On Mon, Oct 20, 2014 at 10:05 AM, Michael S. Tsirkin wrote: >> On Mon, Oct 20, 2014 at 03:58:49PM +0200, Cornelia Huck wrote: >>> Commit f5866db6 (virtio_console: enable VQs early) tried to make >>> sure that DRIVER_OK was set when virtio_console star

Re: several messages

2014-11-10 Thread Jiang Liu
On 2014/11/11 2:15, Thomas Gleixner wrote: > On Mon, 10 Nov 2014, Feng Wu wrote: > >> VT-d Posted-Interrupts is an enhancement to CPU side Posted-Interrupt. >> With VT-d Posted-Interrupts enabled, external interrupts from >> direct-assigned devices can be delivered to guests without VMM >> interve

Re: [PATCH v4] KVM: x86: fix access memslots w/o hold srcu read lock

2014-11-10 Thread Tang Chen
Hi Wanpeng, I think I have totally missed this thread. I opened lockdep and RCU debug, and tried on 3.18-rc1. But I didn't get the warning. My steps are: 1. Use numactl to bind a qemu process to node1. 2. Offline all node1 memory. And the qemu process is still running. Would you please tell m

Re: [PATCH v4 10/25] virtio: add API to enable VQs early

2014-11-10 Thread Michael S. Tsirkin
* > >+ * Note: vqs are enabled automatically after probe returns. > >+ */ > >+static inline > >+void virtio_device_ready(struct virtio_device *dev) > >+{ > >+unsigned status = dev->config->get_status(dev); > >+ > >+BUG_ON(status & VIRTIO_CONFIG_S_DR

RE: several messages

2014-11-10 Thread Wu, Feng
> -Original Message- > From: Jiang Liu [mailto:jiang@linux.intel.com] > Sent: Tuesday, November 11, 2014 10:29 AM > To: Thomas Gleixner; Wu, Feng > Cc: g...@kernel.org; pbonz...@redhat.com; David Woodhouse; > j...@8bytes.org; mi...@redhat.com; H. Peter Anvin; x...@kernel.org; > kvm@vg