[kvm-unit-tests PATCH v2 2/2] arm/arm64: uart0_init: check /chosen/stdout-path

2015-07-29 Thread Andrew Jones
Arguably all of uart0_init() is unnecessary, as we're pretty sure that the address we initialize uart0_base to is correct. We go through the motions of finding the uart anyway though, because it's easy. It's also easy to check chosen/stdout-path first, so let's do that too. But, just to make all th

[kvm-unit-tests PATCH v2 1/2] devicetree: add /chosen/stdout-path support

2015-07-29 Thread Andrew Jones
Signed-off-by: Andrew Jones --- lib/devicetree.c | 19 +++ lib/devicetree.h | 9 + 2 files changed, 28 insertions(+) diff --git a/lib/devicetree.c b/lib/devicetree.c index 0f9b4e9942736..36cb28610ff41 100644 --- a/lib/devicetree.c +++ b/lib/devicetree.c @@ -246,6 +246,25

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

2015-07-29 Thread Andrew Jones
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 -FDT_ERR_BADPATH from dt_get_default_console_node, if there's a

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.cg

Re: [Qemu-devel] [PATCH 00/16] implement vNVDIMM

2015-07-29 Thread Xiao Guangrong
On 07/03/2015 02:11 AM, Paolo Bonzini wrote: On 02/07/2015 20:01, Xiao Guangrong wrote: Thanks for your review, Stefan and Paolo! On 07/02/2015 05:52 PM, Paolo Bonzini wrote: On 02/07/2015 11:20, Stefan Hajnoczi wrote: Currently, the NVDIMM driver has been merged into upstream Linux Ke

[v3 5/5] KVM: eventfd: add irq bypass consumer management

2015-07-29 Thread Feng Wu
From: Eric Auger This patch adds the registration/unregistration of an irq_bypass_consumer on irqfd assignment/deassignment. v2 -> v3: - Use kvm_arch_irq_bypass_start - Remove kvm_arch_irq_bypass_update - Add member 'struct irq_bypass_producer *producer' in 'struct kvm_kernel_irqfd', it is nee

[v3 3/5] KVM: create kvm_irqfd.h

2015-07-29 Thread Feng Wu
From: Eric Auger Move _irqfd_resampler and _irqfd struct declarations in a new public header: kvm_irqfd.h. They are respectively renamed into kvm_kernel_irqfd_resampler and kvm_kernel_irqfd. Those datatypes will be used by architecture specific code, in the context of IRQ bypass manager integrati

[v3 1/5] KVM: x86: select IRQ_BYPASS_MANAGER

2015-07-29 Thread Feng Wu
Select IRQ_BYPASS_MANAGER for x86 when CONFIG_KVM is set Signed-off-by: Feng Wu --- arch/x86/kvm/Kconfig | 2 ++ arch/x86/kvm/Makefile | 3 +++ 2 files changed, 5 insertions(+) diff --git a/arch/x86/kvm/Kconfig b/arch/x86/kvm/Kconfig index d8a1d56..c951d44 100644 --- a/arch/x86/kvm/Kconfig +++

[v3 4/5] KVM: introduce kvm_arch functions for IRQ bypass

2015-07-29 Thread Feng Wu
From: Eric Auger This patch introduces - kvm_arch_irq_bypass_add_producer - kvm_arch_irq_bypass_del_producer - kvm_arch_irq_bypass_stop - kvm_arch_irq_bypass_start They make possible to specialize the KVM IRQ bypass consumer in case CONFIG_KVM_HAVE_IRQ_BYPASS is set. v2 -> v3: - use 'kvm_arch_i

[v3 0/5] KVM: irqfd consumer based on IRQ bypass manager

2015-07-29 Thread Feng Wu
This series is based on Eric's "https://lkml.org/lkml/2015/7/6/291";. Basically, I made the following chagnes: - Some changes based on Alex's irq bypass manager v2: https://lkml.org/lkml/2015/7/16/810 - Correct some minor erros and typo - Add something needed for posted-interrupts Since this ser

[v3 2/5] KVM: arm/arm64: select IRQ_BYPASS_MANAGER

2015-07-29 Thread Feng Wu
From: Eric Auger Select IRQ_BYPASS_MANAGER when CONFIG_KVM is set v2 -> v3: - Correct a typo in 'arch/arm64/kvm/Kconfig' v1 -> v2: - also set IRQ_BYPASS_MANAGER for arm64 Signed-off-by: Eric Auger Signed-off-by: Feng Wu --- arch/arm/kvm/Kconfig | 1 + arch/arm64/kvm/Kconfig | 1 + 2 files

[GIT PULL 06/16] KVM: s390: Improve vcpu event debugging for diagnoses

2015-07-29 Thread Christian Borntraeger
Let's add a vcpu event for the page reference handling and change the default debugging level for the ipl diagnose. Both are not frequent AND change the global state, so lets log them always. Signed-off-by: Christian Borntraeger --- arch/s390/kvm/diag.c | 4 +++- 1 file changed, 3 insertions(+),

[GIT PULL 03/16] KVM: s390: clean up cmma_enable check

2015-07-29 Thread Christian Borntraeger
From: Dominik Dingel As we already only enable CMMA when userspace requests it, we can safely move the additional checks to the request handler and avoid doing them multiple times. This also tells userspace if CMMA is available. Signed-off-by: Dominik Dingel Reviewed-by: David Hildenbrand Sign

[GIT PULL 04/16] KVM: s390: only reset CMMA state if it was enabled before

2015-07-29 Thread Christian Borntraeger
From: Dominik Dingel There is no point in resetting the CMMA state if it was never enabled. Signed-off-by: Dominik Dingel Reviewed-by: David Hildenbrand Signed-off-by: Christian Borntraeger --- arch/s390/kvm/kvm-s390.c | 4 1 file changed, 4 insertions(+) diff --git a/arch/s390/kvm/kvm

[GIT PULL 13/16] KVM: s390: improve debug feature usage

2015-07-29 Thread Christian Borntraeger
We do not use the exception logger, so the 2nd area is unused. Just have one area that is bigger (32 pages). At the same time we can limit the debug feature size to 7 longs, as the largest user has 3 parameters + string + boiler plate (vCPU, PSW mask, PSW addr) Signed-off-by: Christian Borntraeger

[GIT PULL 15/16] KVM: s390: Provide global debug log

2015-07-29 Thread Christian Borntraeger
In addition to the per VM debug logs, let's provide a global one for KVM-wide events, like new guests or fatal errors. Signed-off-by: Christian Borntraeger Reviewed-by: David Hildenbrand --- arch/s390/include/asm/kvm_host.h | 1 - arch/s390/kvm/kvm-s390.c | 20 +++- arc

[GIT PULL 02/16] KVM: s390: filter space-switch events when PER is enforced

2015-07-29 Thread Christian Borntraeger
From: David Hildenbrand When guest debugging is active, space-switch events might be enforced by PER. While the PER events are correctly filtered out, space-switch-events could be forwarded to the guest, although from a guest point of view, they should not have been reported. Therefore we have t

[GIT PULL 16/16] KVM: s390: log capability enablement and vm attribute changes

2015-07-29 Thread Christian Borntraeger
Depending on user space, some capabilities and vm attributes are enabled at runtime. Let's log those events and while we're at it, log querying the vm attributes as well. Signed-off-by: Christian Borntraeger --- arch/s390/kvm/kvm-s390.c | 19 +++ 1 file changed, 19 insertions(+)

[GIT PULL 07/16] KVM: s390: VCPU_EVENT cleanup for prefix changes

2015-07-29 Thread Christian Borntraeger
SPX (SET PREFIX) and SIGP (Set prefix) can change the prefix register of a CPU. As sigp set prefix may be handled in user space (KVM_CAP_S390_USER_SIGP), we would not log the changes triggered via SIGP in that case. Let's have just one VCPU_EVENT at the central location that tracks prefix changes.

[GIT PULL 08/16] KVM: s390: remove "from (user|kernel)" from irq injection messages

2015-07-29 Thread Christian Borntraeger
From: David Hildenbrand The "from user"/"from kernel" part of the log/trace messages is not always correct anymore and therefore not really helpful. Let's remove that part from the log + trace messages. For program interrupts, we can now move the logging/tracing part into the real injection func

[GIT PULL 10/16] KVM: s390: Fixup interrupt vcpu event messages and levels

2015-07-29 Thread Christian Borntraeger
This reworks the debug logging for interrupt related logs. Several changes: - unify program int/irq - improve decoding (e.g. use mcic instead of parm64 for machine check injection) - remove useless interrupt type number (the name is enough) - rename "interrupt:" to "deliver:" as the other side is

[GIT PULL 01/16] KVM: s390: propagate error from enable storage key

2015-07-29 Thread Christian Borntraeger
From: Dominik Dingel As enabling storage keys might fail, we should forward the error. Signed-off-by: Dominik Dingel Signed-off-by: Christian Borntraeger --- arch/s390/kvm/kvm-s390.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kv

[GIT PULL 05/16] KVM: s390: add kvm stat counter for all diagnoses

2015-07-29 Thread Christian Borntraeger
Sometimes kvm stat counters are the only performance metric to check after something went wrong. Let's add additional counters for some diagnoses. In addition do the count for diag 10 all the time, even if we inject a program interrupt. Signed-off-by: Christian Borntraeger Reviewed-by: Jens Frei

[GIT PULL 11/16] KVM: s390: more irq names for trace events

2015-07-29 Thread Christian Borntraeger
From: David Hildenbrand This patch adds names for missing irq types to the trace events. In order to identify adapter irqs, the define is moved from interrupt.c to the other basic irq defines in uapi/linux/kvm.h. Acked-by: Cornelia Huck Signed-off-by: David Hildenbrand Signed-off-by: Christian

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

2015-07-29 Thread Christian Borntraeger
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 KVM_X86_QUIRK_CD_NW_CLEARED in svm_get_mt_mask (2015-07-23 08:30:27 +0200)

[GIT PULL 09/16] KVM: s390: add more debug data for the pfault diagnoses

2015-07-29 Thread Christian Borntraeger
We're not only interested in the address of the control block, but also in the requested subcommand and for the token subcommand, in the specified token address and masks. Suggested-by: Cornelia Huck Signed-off-by: Christian Borntraeger Reviewed-by: Cornelia Huck Reviewed-by: David Hildenbrand

[GIT PULL 14/16] KVM: s390: adapt debug entries for instruction handling

2015-07-29 Thread Christian Borntraeger
Use the default log level 3 for state changing and/or seldom events, use 4 for others. Also change some numbers from %x to %d and vice versa to match documentation. If hex, let's prepend the numbers with 0x. Signed-off-by: Christian Borntraeger Acked-by: Cornelia Huck --- arch/s390/kvm/priv.c |

[GIT PULL 12/16] KVM: s390: remove outdated documentation

2015-07-29 Thread Christian Borntraeger
The old Documentation/s390/kvm.txt file is either outdated or described in Documentation/virtual/kvm/api.txt. Let's get rid of it. Signed-off-by: Christian Borntraeger Reviewed-by: David Hildenbrand --- Documentation/s390/00-INDEX | 2 - Documentation/s390/kvm.txt | 125 -

Re: Should KVM_GUEST stop depending on PARAVIRT?

2015-07-29 Thread Peter Zijlstra
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 fully > understand the problem. So a

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 st

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

2015-07-29 Thread Christoffer Dall
On Tue, Jul 28, 2015 at 2:51 PM, Marc Zyngier wrote: > On 28/07/15 13:44, Andrew Jones wrote: >> On Tue, Jul 28, 2015 at 12:41:38PM +0100, Alex Bennée wrote: >>> >>> Paolo Bonzini writes: >>> On 28/07/2015 10:56, Alex Bennée wrote: > +Architecture Specific Code: > +--

Re: Should KVM_GUEST stop depending on PARAVIRT?

2015-07-29 Thread Peter Zijlstra
On Wed, Jul 29, 2015 at 11:24:09AM +0200, Paolo Bonzini wrote: > > > 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 acce

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

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

2015-07-29 Thread Alex Bennée
Christoffer Dall writes: > On Tue, Jul 28, 2015 at 2:51 PM, Marc Zyngier wrote: >> On 28/07/15 13:44, Andrew Jones wrote: >>> On Tue, Jul 28, 2015 at 12:41:38PM +0100, Alex Bennée wrote: Paolo Bonzini writes: > On 28/07/2015 10:56, Alex Bennée wrote: >> +Architecture Spe

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 (irqchip_in_

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

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

2015-07-29 Thread Marc Zyngier
On 29/07/15 10:44, Alex Bennée wrote: > > Christoffer Dall writes: > >> On Tue, Jul 28, 2015 at 2:51 PM, Marc Zyngier wrote: >>> On 28/07/15 13:44, Andrew Jones wrote: On Tue, Jul 28, 2015 at 12:41:38PM +0100, Alex Bennée wrote: > > Paolo Bonzini writes: > >> On 28/07/2015

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 KVM_X

video/GPU passthrough, second monitor, shared keyboard/mouse

2015-07-29 Thread Daniel Pocock
Hi all, I'm looking at a setup that involves a Linux host and a non-Linux VM under KVM, on a workstation for a power-user. The non-Linux VM would have a dedicated video card/GPU, to maximize compatibility and performance for certain applications. It may be possible to interact with the VM usin

[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 --- 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 -- 4 files chang

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_PI

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 fo

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

2015-07-29 Thread Paolo Bonzini
I took a look at memory barriers in KVM and there are a few that are unjustified, underdocumented or wrong. While looking at irqchip_in_kernel uses (to understand the memory barriers) I also noticed one case where it is unnecessary to check for irqchip_in_kernel (patch 3). Most of the users of ir

[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 --- x86/ioapic.c | 51 +++ 1 file chang

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

2015-07-29 Thread Paolo Bonzini
The memory barriers are trying to protect against concurrent RCU-based interrupt injection, but the IRQ routing table is not valid at the time kvm->arch.vpic is written. Fix this by writing kvm->arch.vpic last. kvm_destroy_pic then need not set kvm->arch.vpic to NULL; modify it to take a struct kv

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

2015-07-29 Thread Paolo Bonzini
Signed-off-by: Paolo Bonzini --- 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/include/linux/kvm_ho

[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 --- 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..f588eb7bdf45 100644 --

[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/2] KVM: x86: store IOAPIC-handled vectors in each VCPU

2015-07-29 Thread Paolo Bonzini
We can reuse the algorithm that computes the EOI exit bitmap to figure out which vectors are handled by the IOAPIC. The only difference between the two is for edge-triggered interrupts other than IRQ8 that have no notifiers active; however, the IOAPIC does not have to do anything special for these

[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 --- arch/x86/kvm/ioapic.c | 9 ++--- arch/x86/kvm/ioapic.h | 3 +-- arch/x86/kvm/lapic.c | 19 +

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

2015-07-29 Thread Paolo Bonzini
Inspired by the split irqchip patches, this series limits the IOAPIC<->LAPIC to the EOI exit bitmap that is inferred from the redirection table. TMR is entirely handled within the local APIC, and no global copy of the IOAPIC-handled vectors is necessary anymore. This makes it simpler to introduce

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

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

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

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 -FDT_ERR_BA

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

[kvm-unit-tests PATCH] arm/arm64: fix mmu_enabled

2015-07-29 Thread Andrew Jones
We recently modified how mmu_enabled works in order to speed spinlocks up (see c33efcf3 and b141dbac). Unfortunately c33efcf3 was a bit hasty in removing mmu_set_enabled. I had forgotten one of the reasons I introduced it was because secondaries don't go through mmu_enable(), they go straight to as

Re: [RFC/RFT PATCH v3 0/4] KVM: x86: full virtualization of guest MTRR

2015-07-29 Thread Or Gerlitz
On 7/8/2015 6:18 PM, Paolo Bonzini wrote: This part of the MTRR patches was dropped by Xiao. Bring SVM on feature parity with VMX, and then do guest MTRR virtualization for both VMX and SVM. The IPAT bit of VMX extended page tables is emulated by mangling the guest PAT value. I do not have any

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

2015-07-29 Thread Andrew Jones
On Wed, Jul 29, 2015 at 03:52:51PM +0200, Paolo Bonzini wrote: > > > 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, > >

[PATCH 0/2] vhost: add ioctl to query nregions limit and rise default limit

2015-07-29 Thread Igor Mammedov
Igor Mammedov (1): vhost: increase default limit of nregions from 64 to 509 Michael S. Tsirkin (1): vhost: add ioctl to query nregions upper limit drivers/vhost/vhost.c | 7 ++- include/uapi/linux/vhost.h | 17 - 2 files changed, 22 insertions(+), 2 deletions(-) -

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

2015-07-29 Thread Igor Mammedov
From: "Michael S. Tsirkin" Userspace currently simply tries to give vhost as many regions as it happens to have, but you only have the mem table when you have initialized a large part of VM, so graceful failure is very hard to support. The result is that userspace tends to fail catastrophically.

[PATCH 2/2] vhost: increase default limit of nregions from 64 to 509

2015-07-29 Thread Igor Mammedov
although now there is vhost module max_mem_regions option to set custom limit it doesn't help for default setups, since it requires administrator manually set a higher limit on each host. Which complicates servers deployments and management. Rise limit to the same value as KVM has (509 slots max),

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

2015-07-29 Thread Andrew Jones
Signed-off-by: Andrew Jones --- lib/alloc.c | 13 - 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/lib/alloc.c b/lib/alloc.c index 1abe4961ae9dd..ad6761430c965 100644 --- a/lib/alloc.c +++ b/lib/alloc.c @@ -44,6 +44,7 @@ void phys_alloc_init(phys_addr_t base_addr, phys_

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

2015-07-29 Thread Andrew Jones
On Wed, Jul 29, 2015 at 03:58:59PM +0200, Paolo Bonzini wrote: > > > 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 >

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

2015-07-29 Thread Michael S. Tsirkin
On Wed, Jul 29, 2015 at 04:29:22PM +0200, Igor Mammedov wrote: > From: "Michael S. Tsirkin" > > Userspace currently simply tries to give vhost as many regions > as it happens to have, but you only have the mem table > when you have initialized a large part of VM, so graceful > failure is very har

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

2015-07-29 Thread Igor Mammedov
On Wed, 29 Jul 2015 17:43:17 +0300 "Michael S. Tsirkin" wrote: > On Wed, Jul 29, 2015 at 04:29:22PM +0200, Igor Mammedov wrote: > > From: "Michael S. Tsirkin" > > > > Userspace currently simply tries to give vhost as many regions > > as it happens to have, but you only have the mem table > > wh

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

2015-07-29 Thread Michael S. Tsirkin
On Wed, Jul 29, 2015 at 04:53:51PM +0200, Igor Mammedov wrote: > On Wed, 29 Jul 2015 17:43:17 +0300 > "Michael S. Tsirkin" wrote: > > > On Wed, Jul 29, 2015 at 04:29:22PM +0200, Igor Mammedov wrote: > > > From: "Michael S. Tsirkin" > > > > > > Userspace currently simply tries to give vhost as m

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 > >

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

2015-07-29 Thread Michael S. Tsirkin
On Wed, Jul 29, 2015 at 05:01:43PM +0200, Paolo Bonzini wrote: > > > 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. > >

Re: [PATCH 2/2] vhost: increase default limit of nregions from 64 to 509

2015-07-29 Thread Michael S. Tsirkin
On Wed, Jul 29, 2015 at 04:29:23PM +0200, Igor Mammedov wrote: > although now there is vhost module max_mem_regions option > to set custom limit it doesn't help for default setups, > since it requires administrator manually set a higher > limit on each host. Which complicates servers deployments >

[GIT PULL] VFIO fixes for v4.2-rc5

2015-07-29 Thread Alex Williamson
Hi Linus, The following changes since commit afdf0b91bdf04bc66ee64e1ac44f0979c55749b1: Merge tag 'regulator-fix-v4.2-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator (2015-07-24 13:14:06 -0700) are available in the git repository at: git://github.com/awilliam/linux

kvm-unit-test failed to complete

2015-07-29 Thread Shih-Wei Li
Hi all, This is Shih-Wei, I'm Christoffer's colleague at Columbia University. We have experienced some problems in running kvm-unit-tests in our environment. Here's what we did: ./configure make ./run_test.sh run_test.sh halted in some specific test items and couldn't finish the run. I managed to

Re: kvm-unit-test failed to complete

2015-07-29 Thread Christoffer Dall
Hi Shih-Wei, [Something weird happened when sending these e-mails, you sent two where one seems to be a slight modification of the other?] On Wed, Jul 29, 2015 at 02:18:23PM -0400, Shih-Wei Li wrote: > Hi all, > > This is Shih-Wei, I'm Christoffer's colleague at Columbia University. > We have ex

Re: kvm-unit-test failed to complete

2015-07-29 Thread Shih-Wei Li
On Wed, Jul 29, 2015 at 2:30 PM, Christoffer Dall wrote: > Hi Shih-Wei, > > [Something weird happened when sending these e-mails, you sent two where > one seems to be a slight modification of the other?] yes, the previous one just got rejected by the mailing list. sorry about the spam. > > On We

Re: video/GPU passthrough, second monitor, shared keyboard/mouse

2015-07-29 Thread Alex Williamson
On Wed, 2015-07-29 at 12:59 +0200, Daniel Pocock wrote: > > Hi all, > > I'm looking at a setup that involves a Linux host and a non-Linux VM > under KVM, on a workstation for a power-user. > > The non-Linux VM would have a dedicated video card/GPU, to maximize > compatibility and performance for

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

2015-07-29 Thread Alex Williamson
Hi Paolo, Something bad happened to this patch. This is the version I provided Tested-by for: On Thu, 2015-07-16 at 03:25 +0800, Xiao Guangrong wrote: > From: Xiao Guangrong > > kvm_mtrr_get_guest_memory_type never returns -1 which is implied > in the current code since if @type = -1 (means no

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

2015-07-29 Thread Alex Williamson
On Wed, 2015-07-29 at 15:37 +0200, Paolo Bonzini wrote: > Inspired by the split irqchip patches, this series limits the > IOAPIC<->LAPIC to the EOI exit bitmap that is inferred from the > redirection table. > > TMR is entirely handled within the local APIC, and no global copy > of the IOAPIC-handl

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

2015-07-29 Thread Steve Rutherford
On Wed, Jul 29, 2015 at 02:38:09PM +0200, Paolo Bonzini wrote: > > > 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 @@ st

Re: Should KVM_GUEST stop depending on PARAVIRT?

2015-07-29 Thread Andy Lutomirski
On Wed, Jul 29, 2015 at 2:41 AM, Paolo Bonzini wrote: > > > 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 b

Re: kvm-unit-test failed to complete

2015-07-29 Thread Shih-Wei Li
On Wed, Jul 29, 2015 at 2:38 PM, Shih-Wei Li wrote: > On Wed, Jul 29, 2015 at 2:30 PM, Christoffer Dall > wrote: >> Hi Shih-Wei, >> >> [Something weird happened when sending these e-mails, you sent two where >> one seems to be a slight modification of the other?] > > yes, the previous one just g

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

2015-07-29 Thread Steve Rutherford
On Wed, Jul 29, 2015 at 02:56:42PM +0200, Paolo Bonzini wrote: > > > + kvm_rtc_eoi_tracking_restore_one(vcpu); > > } > > > > void __kvm_migrate_apic_timer(struct kvm_vcpu *vcpu) > > @@ -1921,7 +1923,8 @@ static void apic_sync_pv_eoi_to_guest(struct kvm_vcpu > > *vcpu, > > /*

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

2015-07-29 Thread Steve Rutherford
On Wed, Jul 29, 2015 at 03:28:13PM +0200, Paolo Bonzini wrote: > 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 > --- > x86/io

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

2015-07-29 Thread Steve Rutherford
On Wed, Jul 29, 2015 at 03:28:58PM +0200, Paolo Bonzini wrote: > diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c > index 2d62229aac26..23e47a0b054b 100644 > --- a/arch/x86/kvm/x86.c > +++ b/arch/x86/kvm/x86.c > @@ -3626,30 +3626,25 @@ long kvm_arch_vm_ioctl(struct file *filp, >

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

2015-07-29 Thread Steve Rutherford
On Wed, Jul 29, 2015 at 03:37:34PM +0200, Paolo Bonzini 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. > > Signed-off-by: Paolo Bonzini > --- > arch/x86/kvm/ioapic.c | 9 ++--

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

2015-07-29 Thread Steve Rutherford
On Wed, Jul 29, 2015 at 03:37:35PM +0200, Paolo Bonzini wrote: > We can reuse the algorithm that computes the EOI exit bitmap to figure > out which vectors are handled by the IOAPIC. The only difference > between the two is for edge-triggered interrupts other than IRQ8 > that have no notifiers act

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

2015-07-29 Thread Steve Rutherford
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 of the in-kernel PIT. Userspace might limit itself to

Re: kvm-unit-test failed to complete

2015-07-29 Thread Bandan Das
Shih-Wei Li writes: > On Wed, Jul 29, 2015 at 2:38 PM, Shih-Wei Li wrote: >> On Wed, Jul 29, 2015 at 2:30 PM, Christoffer Dall >> wrote: >>> Hi Shih-Wei, >>> >>> [Something weird happened when sending these e-mails, you sent two where >>> one seems to be a slight modification of the other?] >>

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

2015-07-29 Thread Steve Rutherford
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. Signed-off-by: Steve Rutherford Suggested-by: Andrew Hon

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

2015-07-29 Thread Steve Rutherford
In order to support a userspace IOAPIC interacting with an in kernel APIC, the EOI exit bitmaps need to be configurable. If the IOAPIC is in userspace (i.e. the irqchip has been split), the EOI exit bitmaps will be set whenever the GSI Routes are configured. In particular, for the low MSI routes a

[PATCH v7 2/4] KVM: x86: Add KVM exit for IOAPIC EOIs

2015-07-29 Thread Steve Rutherford
Adds KVM_EXIT_IOAPIC_EOI which allows the kernel to EOI level-triggered IOAPIC interrupts. Uses a per VCPU exit bitmap to decide whether or not the IOAPIC needs to be informed (which is identical to the EOI_EXIT_BITMAP field used by modern x86 processors, but can also be used to elide kvm IOAPIC E

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

2015-07-29 Thread Steve Rutherford
In order to enable userspace PIC support, the userspace PIC needs to be able to inject local interrupts even when the APICs are in the kernel. KVM_INTERRUPT now supports sending local interrupts to an APIC when APICs are in the kernel. The ready_for_interrupt_request flag is now only set when the

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

2015-07-29 Thread Jan Kiszka
On 2015-07-29 22:27, Steve Rutherford wrote: > On Wed, Jul 29, 2015 at 02:38:09PM +0200, Paolo Bonzini wrote: >> >> >> 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 >>> ++

Re: [PATCH 2/2] vhost: increase default limit of nregions from 64 to 509

2015-07-29 Thread Igor Mammedov
On Wed, 29 Jul 2015 18:28:26 +0300 "Michael S. Tsirkin" wrote: > On Wed, Jul 29, 2015 at 04:29:23PM +0200, Igor Mammedov wrote: > > although now there is vhost module max_mem_regions option > > to set custom limit it doesn't help for default setups, > > since it requires administrator manually se

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

2015-07-29 Thread Steve Rutherford
On Thu, Jul 30, 2015 at 08:23:43AM +0200, Jan Kiszka wrote: > On 2015-07-29 22:27, Steve Rutherford wrote: > > On Wed, Jul 29, 2015 at 02:38:09PM +0200, Paolo Bonzini wrote: > >> > >> > >> On 28/07/2015 01:17, Steve Rutherford wrote: > >>> diff --git a/arch/x86/kvm/ioapic.h b/arch/x86/kvm/ioapic.h

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

2015-07-29 Thread Steve Rutherford
In order to support a userspace IOAPIC interacting with an in kernel APIC, the EOI exit bitmaps need to be configurable. If the IOAPIC is in userspace (i.e. the irqchip has been split), the EOI exit bitmaps will be set whenever the GSI Routes are configured. In particular, for the low MSI routes a

Re: [PATCH 2/2] vhost: increase default limit of nregions from 64 to 509

2015-07-29 Thread Michael S. Tsirkin
On Thu, Jul 30, 2015 at 08:26:03AM +0200, Igor Mammedov wrote: > On Wed, 29 Jul 2015 18:28:26 +0300 > "Michael S. Tsirkin" wrote: > > > On Wed, Jul 29, 2015 at 04:29:23PM +0200, Igor Mammedov wrote: > > > although now there is vhost module max_mem_regions option > > > to set custom limit it doesn