[Bug 107561] 4.2 breaks PCI passthrough in QEMU/KVM

2015-11-12 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=107561 John Brooks changed: What|Removed |Added CC||k...@fastquake.com

[PATCH 0/3] KVM: x86: bug fixes for split IRQ chip

2015-11-12 Thread Matt Gingell
Hi, I've been working adding support for split IRQ chip mode in QEMU. http://lists.gnu.org/archive/html/qemu-devel/2015-11/msg00235.html That work uncovered a few problems in the KVM implementation: * There's a missing call to kvm_make_request in kvm_vcpu_ioctl_interrupt. * req_int_win

Re: [PATCH] KVM: PPC: Exit guest upon fatal machine check exception

2015-11-12 Thread Daniel Axtens
Aravinda Prasad writes: >> Yeah, it would be good not to break this. > > I am not familiar with CAPI. Does this affect CAPI? When a CAPI card experiences an EEH event, any cache lines it holds are filled with SUEs (Special UEs, interpreted by the kernel the same as

Re: [PATCH] vhost: move is_le setup to the backend

2015-11-12 Thread Greg Kurz
On Fri, 30 Oct 2015 12:42:35 +0100 Greg Kurz wrote: > The vq->is_le field is used to fix endianness when accessing the vring via > the cpu_to_vhost16() and vhost16_to_cpu() helpers in the following cases: > > 1) host is big endian and device is modern virtio > > 2)

Re: [PATCH v2 3/4] KVM: X86: Migration is supported

2015-11-12 Thread Paolo Bonzini
On 12/11/2015 08:06, Jian Zhou wrote: >> >> I think you can just do this in kvm_x86_ops->set_msr. The old >> implementation for DEBUGCTL MSR can be moved to svm.c. > > I think you mean "moved to vmx.c"? No, the old implementation is moved from x86.c to svm.c. The new implementation you

Re: [PATCH v2 0/4] KVM: VMX: enable LBR virtualization

2015-11-12 Thread Jian Zhou
On 2015/11/11 23:23, Paolo Bonzini wrote: On 23/10/2015 11:15, Jian Zhou wrote: Changelog in v2: (1) move the implementation into vmx.c (2) migraton is supported (3) add arrays in kvm_vcpu_arch struct to save/restore LBR MSRs at vm exit/entry time. (4) add a parameter of

Re: [GIT PULL] Please pull my kvm-ppc-fixes branch

2015-11-12 Thread Paolo Bonzini
On 12/11/2015 06:35, Paul Mackerras wrote: > Paolo, > > I have two fixes for HV KVM which I would like to have included in > v4.4-rc1. The first one is a fix for a bug identified by Red Hat > which causes occasional guest crashes. The second one fixes a bug > which causes host stalls and

[GIT PULL] Second batch of KVM changes for 4.4 (v2)

2015-11-12 Thread Paolo Bonzini
Linus, The following changes since commit a3eaa8649e4c6a6afdafaa04b9114fb230617bb1: KVM: VMX: Fix commit which broke PML (2015-11-05 11:34:11 +0100) are available in the git repository at: git://git.kernel.org/pub/scm/virt/kvm/kvm.git tags/for-linus for you to fetch changes up to

Shut up unhandled MSR warnings

2015-11-12 Thread Borislav Petkov
Hey Paolo, do we apply stuff like that below? When booting guests all the time here, dmesg gets filled up with those "unhandled rdmsr" useless warnings. The patch below shuts them up. The only problem is that the IC CFG MSR has those fields defined starting from F15h and I don't see a way to

[Bug 107561] 4.2 breaks PCI passthrough in QEMU/KVM

2015-11-12 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=107561 Aaron Campbell changed: What|Removed |Added CC||aa...@monkey.org ---

Re: [PATCH kvm-unit-tests] x86: tsc: add test for RDTSCP

2015-11-12 Thread Wanpeng Li
2015-11-12 19:12 GMT+08:00 Paolo Bonzini : > Signed-off-by: Paolo Bonzini > --- > lib/x86/processor.h | 16 > x86/tsc.c | 23 +++ > x86/unittests.cfg | 1 + > 3 files changed, 40 insertions(+) > > diff

Re: [PATCH kvm-unit-tests] x86: tsc: add test for RDTSCP

2015-11-12 Thread Wanpeng Li
2015-11-12 19:12 GMT+08:00 Paolo Bonzini : > > Signed-off-by: Paolo Bonzini > --- > lib/x86/processor.h | 16 > x86/tsc.c | 23 +++ > x86/unittests.cfg | 1 + > 3 files changed, 40 insertions(+) > > diff

[PATCH net-next RFC V3 3/3] vhost_net: basic polling support

2015-11-12 Thread Jason Wang
This patch tries to poll for new added tx buffer or socket receive queue for a while at the end of tx/rx processing. The maximum time spent on polling were specified through a new kind of vring ioctl. Signed-off-by: Jason Wang --- drivers/vhost/net.c| 77

[PATCH net-next RFC V3 0/3] basic busy polling support for vhost_net

2015-11-12 Thread Jason Wang
Hi all: This series tries to add basic busy polling for vhost net. The idea is simple: at the end of tx/rx processing, busy polling for new tx added descriptor and rx receive socket for a while. The maximum number of time (in us) could be spent on busy polling was specified ioctl. Test were done

[PATCH 03/10] KVM: x86: MMU: Make mmu_set_spte() return emulate value

2015-11-12 Thread Takuya Yoshikawa
mmu_set_spte()'s code is based on the assumption that the emulate parameter has a valid pointer value if set_spte() returns true and write_fault is not zero. In other cases, emulate may be NULL, so a NULL-check is needed. Stop passing emulate pointer and make mmu_set_spte() return the emulate

[PATCH 02/10] KVM: x86: MMU: Add helper function to clear a bit in unsync child bitmap

2015-11-12 Thread Takuya Yoshikawa
Both __mmu_unsync_walk() and mmu_pages_clear_parents() have three line code which clears a bit in the unsync child bitmap; the former places it inside a loop block and uses a few goto statements to jump to it. A new helper function, clear_unsync_child_bit(), makes the code cleaner.

[PATCH 10/10] KVM: x86: MMU: Remove unused parameter parent_pte from kvm_mmu_get_page()

2015-11-12 Thread Takuya Yoshikawa
Signed-off-by: Takuya Yoshikawa --- arch/x86/kvm/mmu.c | 20 +++- arch/x86/kvm/paging_tmpl.h | 4 ++-- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index 33fe720..101e77d 100644

[PATCH] KVM: arm/arm64: vgic: make vgic_io_ops static

2015-11-12 Thread Jisheng Zhang
vgic_io_ops is only referenced within vgic.c, so it can be declared static. Signed-off-by: Jisheng Zhang --- virt/kvm/arm/vgic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/virt/kvm/arm/vgic.c b/virt/kvm/arm/vgic.c index 5335383..8ef7279 100644 ---

[PATCH net-next RFC V3 1/3] vhost: introduce vhost_has_work()

2015-11-12 Thread Jason Wang
This path introduces a helper which can give a hint for whether or not there's a work queued in the work list. Signed-off-by: Jason Wang --- drivers/vhost/vhost.c | 7 +++ drivers/vhost/vhost.h | 1 + 2 files changed, 8 insertions(+) diff --git a/drivers/vhost/vhost.c

[PATCH net-next RFC V3 2/3] vhost: introduce vhost_vq_more_avail()

2015-11-12 Thread Jason Wang
Signed-off-by: Jason Wang --- drivers/vhost/vhost.c | 26 +- drivers/vhost/vhost.h | 1 + 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index 163b365..b86c5aa 100644 ---

Re: Shut up unhandled MSR warnings

2015-11-12 Thread Paolo Bonzini
On 12/11/2015 11:13, Borislav Petkov wrote: > Hey Paolo, > > do we apply stuff like that below? If we really need to, we do. > When booting guests all the time here, dmesg gets filled up with those > "unhandled rdmsr" useless warnings. The patch below shuts them up. > > The only problem is

[PATCH kvm-unit-tests] x86: tsc: add test for RDTSCP

2015-11-12 Thread Paolo Bonzini
Signed-off-by: Paolo Bonzini --- lib/x86/processor.h | 16 x86/tsc.c | 23 +++ x86/unittests.cfg | 1 + 3 files changed, 40 insertions(+) diff --git a/lib/x86/processor.h b/lib/x86/processor.h index 7973879..b9cb753 100644

[PATCH 04/10] KVM: x86: MMU: Remove is_rmap_spte() and use is_shadow_present_pte()

2015-11-12 Thread Takuya Yoshikawa
is_rmap_spte(), originally named is_rmap_pte(), was introduced when the simple reverse mapping was implemented by commit cd4a4e5374110444 ("[PATCH] KVM: MMU: Implement simple reverse mapping"). At that point, its role was clear and only rmap_add() and rmap_remove() were using it to select sptes

Re: [PATCH net-next RFC V3 0/3] basic busy polling support for vhost_net

2015-11-12 Thread Felipe Franciosi
Hi Jason, I understand your busy loop timeout is quite conservative at 50us. Did you try any other values? Also, did you measure how polling affects many VMs talking to each other (e.g. 20 VMs on each host, perhaps with several vNICs each, transmitting to a corresponding VM/vNIC pair on

Re: Shut up unhandled MSR warnings

2015-11-12 Thread Borislav Petkov
On Thu, Nov 12, 2015 at 11:59:58AM +0100, Borislav Petkov wrote: > On Thu, Nov 12, 2015 at 11:33:33AM +0100, Paolo Bonzini wrote: > > Yes, see guest_cpuid_has_* for an example of reading the CPUID values. > > > > But if it's defined for _all_ models starting at family 21, we can just > > do it

Re: Shut up unhandled MSR warnings

2015-11-12 Thread Paolo Bonzini
On 12/11/2015 13:16, Borislav Petkov wrote: >>> > > Yes, see guest_cpuid_has_* for an example of reading the CPUID values. >>> > > >>> > > But if it's defined for _all_ models starting at family 21, we can just >>> > > do it unconditionally. >> > >> > The thing is, those bits are Reserved

Re: [PATCH net-next RFC V3 0/3] basic busy polling support for vhost_net

2015-11-12 Thread Jason Wang
On 11/12/2015 06:16 PM, Jason Wang wrote: > Hi all: > > This series tries to add basic busy polling for vhost net. The idea is > simple: at the end of tx/rx processing, busy polling for new tx added > descriptor and rx receive socket for a while. The maximum number of > time (in us) could be

[PATCH 08/10] KVM: x86: MMU: Move initialization of parent_ptes out from kvm_mmu_alloc_page()

2015-11-12 Thread Takuya Yoshikawa
Make kvm_mmu_alloc_page() do just what its name tells to do, and remove the extra error check at its call site since the allocation cannot fail. Signed-off-by: Takuya Yoshikawa --- arch/x86/kvm/mmu.c | 15 --- 1 file changed, 8 insertions(+), 7

[PATCH 07/10] KVM: x86: MMU: Encapsulate the type of rmap-chain head in a new struct

2015-11-12 Thread Takuya Yoshikawa
New struct kvm_rmap_head makes the code type-safe to some extent. Signed-off-by: Takuya Yoshikawa --- arch/x86/include/asm/kvm_host.h | 8 +- arch/x86/kvm/mmu.c | 169 +--- arch/x86/kvm/mmu_audit.c|

Re: [PATCH 00/10 V2] KVM: x86: MMU: Clean up x86's mmu code for future work

2015-11-12 Thread Paolo Bonzini
On 12/11/2015 12:48, Takuya Yoshikawa wrote: > v1->v2: > Patch 5 and 7 are added based on Paolo's suggestions. > Patch 8-10 are new. > > Patch 1/2/3/4: no change. > Patch 5: Needed a bit more work than I had expected. > Patch 6: Removed extra comment of v1 (patch 5 made it inappropriate). >

Re: [PATCH v2 3/4] KVM: X86: Migration is supported

2015-11-12 Thread Jian Zhou
On 2015/11/12 17:00, Paolo Bonzini wrote: On 12/11/2015 08:06, Jian Zhou wrote: I think you can just do this in kvm_x86_ops->set_msr. The old implementation for DEBUGCTL MSR can be moved to svm.c. I think you mean "moved to vmx.c"? No, the old implementation is moved from x86.c to

Re: Shut up unhandled MSR warnings

2015-11-12 Thread Borislav Petkov
On Thu, Nov 12, 2015 at 11:33:33AM +0100, Paolo Bonzini wrote: > Yes, see guest_cpuid_has_* for an example of reading the CPUID values. > > But if it's defined for _all_ models starting at family 21, we can just > do it unconditionally. The thing is, those bits are Reserved again on the next

Re: [PATCH v3 0/3] virtio DMA API core stuff

2015-11-12 Thread Michael S. Tsirkin
On Wed, Nov 11, 2015 at 11:30:27PM +0100, David Woodhouse wrote: > On Wed, 2015-11-11 at 07:56 -0800, Andy Lutomirski wrote: > > > > Can you flesh out this trick? > > > > On x86 IIUC the IOMMU more-or-less defaults to passthrough. If the > > kernel wants, it can switch it to a non-passthrough

[PATCH 01/10] KVM: x86: MMU: Remove unused parameter of __direct_map()

2015-11-12 Thread Takuya Yoshikawa
Signed-off-by: Takuya Yoshikawa --- arch/x86/kvm/mmu.c | 12 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index e7c2c14..c3bbc82 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c @@

[PATCH 00/10 V2] KVM: x86: MMU: Clean up x86's mmu code for future work

2015-11-12 Thread Takuya Yoshikawa
v1->v2: Patch 5 and 7 are added based on Paolo's suggestions. Patch 8-10 are new. Patch 1/2/3/4: no change. Patch 5: Needed a bit more work than I had expected. Patch 6: Removed extra comment of v1 (patch 5 made it inappropriate). Patch 7: As expected, many places needed to be converted.

[PATCH 09/10 RFC] KVM: x86: MMU: Move parent_pte handling from kvm_mmu_get_page() to link_shadow_page()

2015-11-12 Thread Takuya Yoshikawa
Every time kvm_mmu_get_page() is called with a non-NULL parent_pte argument, link_shadow_page() follows that to set the parent entry so that the new mapping will point to the returned page table. Moving parent_pte handling there allows to clean up the code because parent_pte is passed to

Re: [PATCH] vhost: move is_le setup to the backend

2015-11-12 Thread Cornelia Huck
On Fri, 30 Oct 2015 12:42:35 +0100 Greg Kurz wrote: > The vq->is_le field is used to fix endianness when accessing the vring via > the cpu_to_vhost16() and vhost16_to_cpu() helpers in the following cases: > > 1) host is big endian and device is modern virtio > > 2)

[PATCH 05/10] KVM: x86: MMU: Use for_each_rmap_spte macro instead of pte_list_walk()

2015-11-12 Thread Takuya Yoshikawa
kvm_mmu_mark_parents_unsync() alone uses pte_list_walk(), witch does nearly the same as the for_each_rmap_spte macro. The only difference is that is_shadow_present_pte() checks cannot be placed there because kvm_mmu_mark_parents_unsync() can be called with a new parent pointer whose entry is not

[PATCH 06/10] KVM: x86: MMU: Consolidate WARN_ON/BUG_ON checks for reverse-mapped sptes

2015-11-12 Thread Takuya Yoshikawa
At some call sites of rmap_get_first() and rmap_get_next(), BUG_ON is placed right after the call to detect unrelated sptes which must not be found in the reverse-mapping list. Move this check in rmap_get_first/next() so that all call sites, not just the users of the for_each_rmap_spte() macro,

Re: [PATCH v3 0/3] virtio DMA API core stuff

2015-11-12 Thread David Woodhouse
On Thu, 2015-11-12 at 13:09 +0200, Michael S. Tsirkin wrote: > On Wed, Nov 11, 2015 at 11:30:27PM +0100, David Woodhouse wrote: > > > > If the IOMMU is exposed, and enabled, and telling the guest kernel that > > it *does* cover the virtio devices, then those virtio devices will > > *not* be in

Re: [PATCH] KVM: PPC: Exit guest upon fatal machine check exception

2015-11-12 Thread David Gibson
On Thu, Nov 12, 2015 at 11:22:29PM +0530, Aravinda Prasad wrote: > > > On Thursday 12 November 2015 10:13 AM, David Gibson wrote: > > On Thu, Nov 12, 2015 at 10:02:10AM +0530, Aravinda Prasad wrote: > >> > >> > >> On Thursday 12 November 2015 09:08 AM, David Gibson wrote: > >>> On Thu, Nov 12,

Re: [PATCH] KVM: PPC: Exit guest upon fatal machine check exception

2015-11-12 Thread Aravinda Prasad
On Friday 13 November 2015 07:20 AM, David Gibson wrote: > On Thu, Nov 12, 2015 at 11:22:29PM +0530, Aravinda Prasad wrote: [...] >> >> I overlooked it. I think I need to take into consideration whether guest >> issued "ibm, nmi-register". If the guest has issued "ibm, nmi-register" >> then we

Re: [PATCH] KVM: PPC: Exit guest upon fatal machine check exception

2015-11-12 Thread Thomas Huth
On 13/11/15 07:26, Aravinda Prasad wrote: > > On Friday 13 November 2015 07:20 AM, David Gibson wrote: >> On Thu, Nov 12, 2015 at 11:22:29PM +0530, Aravinda Prasad wrote: [...] >>> So thinking whether qemu should explicitly enable the new NMI >>> behavior. >> >> So, I think the reasoning above

Re: [PATCH] vhost: move is_le setup to the backend

2015-11-12 Thread Michael S. Tsirkin
On Fri, Oct 30, 2015 at 12:42:35PM +0100, Greg Kurz wrote: > The vq->is_le field is used to fix endianness when accessing the vring via > the cpu_to_vhost16() and vhost16_to_cpu() helpers in the following cases: > > 1) host is big endian and device is modern virtio > > 2) host has cross-endian

Re: [PATCH 0/3] Infinite loops in microcode while running guests

2015-11-12 Thread Jan Kiszka
On 2015-11-11 14:12, Austin S Hemmelgarn wrote: > On 2015-11-11 08:07, Paolo Bonzini wrote: >> >> >> On 11/11/2015 13:47, Austin S Hemmelgarn wrote: >>> I just finished running a couple of tests in a KVM instance running >>> nested on a Xen HVM instance, and found no issues, so for the set as

Re: [PATCH 09/10 RFC] KVM: x86: MMU: Move parent_pte handling from kvm_mmu_get_page() to link_shadow_page()

2015-11-12 Thread Paolo Bonzini
On 12/11/2015 12:56, Takuya Yoshikawa wrote: > diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h > index 9d21b44..f414ca6 100644 > --- a/arch/x86/kvm/paging_tmpl.h > +++ b/arch/x86/kvm/paging_tmpl.h > @@ -598,7 +598,7 @@ static int FNAME(fetch)(struct kvm_vcpu *vcpu, gva_t

Re: [PATCH] vhost: move is_le setup to the backend

2015-11-12 Thread Greg Kurz
On Thu, 12 Nov 2015 15:46:30 +0200 "Michael S. Tsirkin" wrote: > On Fri, Oct 30, 2015 at 12:42:35PM +0100, Greg Kurz wrote: > > The vq->is_le field is used to fix endianness when accessing the vring via > > the cpu_to_vhost16() and vhost16_to_cpu() helpers in the following

[PATCH] KVM: svm: add support for RDTSCP

2015-11-12 Thread Paolo Bonzini
RDTSCP was never supported for AMD CPUs, which nobody noticed because Linux does not use it. But exactly the fact that Linux does not use it makes the implementation very simple; we can freely trash MSR_TSC_AUX while running the guest. Cc: Joerg Roedel Signed-off-by: Paolo

Re: [PATCH 0/3] Infinite loops in microcode while running guests

2015-11-12 Thread Paolo Bonzini
On 12/11/2015 15:08, Jan Kiszka wrote: > On 2015-11-11 14:12, Austin S Hemmelgarn wrote: >> On 2015-11-11 08:07, Paolo Bonzini wrote: >>> >>> >>> On 11/11/2015 13:47, Austin S Hemmelgarn wrote: > I just finished running a couple of tests in a KVM instance running nested on a Xen

[PATCH] KVM: x86: expose MSR_TSC_AUX to userspace

2015-11-12 Thread Paolo Bonzini
If we do not do this, it is not properly saved and restored across migration. Windows notices due to its self-protection mechanisms, and is very upset about it (blue screen of death). Cc: Radim Krcmar Cc: sta...@vger.kernel.org Signed-off-by: Paolo Bonzini

Re: [PATCH] KVM: svm: add support for RDTSCP

2015-11-12 Thread Joerg Roedel
Hi Paolo, On Thu, Nov 12, 2015 at 02:49:16PM +0100, Paolo Bonzini wrote: > RDTSCP was never supported for AMD CPUs, which nobody noticed because > Linux does not use it. But exactly the fact that Linux does not > use it makes the implementation very simple; we can freely trash > MSR_TSC_AUX

Re: [PATCH 09/10 RFC] KVM: x86: MMU: Move parent_pte handling from kvm_mmu_get_page() to link_shadow_page()

2015-11-12 Thread Takuya Yoshikawa
On 2015/11/12 23:27, Paolo Bonzini wrote: On 12/11/2015 12:56, Takuya Yoshikawa wrote: diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h index 9d21b44..f414ca6 100644 --- a/arch/x86/kvm/paging_tmpl.h +++ b/arch/x86/kvm/paging_tmpl.h @@ -598,7 +598,7 @@ static int

Re: [PATCH] KVM: PPC: Exit guest upon fatal machine check exception

2015-11-12 Thread Aravinda Prasad
On Friday 13 November 2015 03:07 AM, Daniel Axtens wrote: > Aravinda Prasad writes: > >>> Yeah, it would be good not to break this. >> >> I am not familiar with CAPI. Does this affect CAPI? > > When a CAPI card experiences an EEH event, any cache lines it holds

Re: [Qemu-devel] [PATCH v3 1/3] target-i386: add a subsection for migrating vcpu's TSC rate

2015-11-12 Thread Haozhong Zhang
On 11/11/15 22:27, Haozhong Zhang wrote: > On 11/11/15 12:16, Eduardo Habkost wrote: [...] > > > diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c > > > index 2f8f396..858ed69 100644 > > > --- a/hw/i386/pc_q35.c > > > +++ b/hw/i386/pc_q35.c > > > @@ -385,6 +385,7 @@ static void

[PATCH] KVM: x86: correctly print #AC in traces

2015-11-12 Thread Paolo Bonzini
Poor #AC was so unimportant until a few days ago that we were not even tracing its name correctly. But now it's all over the place. Cc: sta...@vger.kernel.org Signed-off-by: Paolo Bonzini --- arch/x86/kvm/trace.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff

[PULL 03/11] KVM: add support for any length io eventfd

2015-11-12 Thread Michael S. Tsirkin
From: Jason Wang Signed-off-by: Jason Wang Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Acked-by: Paolo Bonzini --- include/sysemu/kvm.h | 8 kvm-all.c|

Re: [PATCH] KVM: PPC: Exit guest upon fatal machine check exception

2015-11-12 Thread Aravinda Prasad
On Thursday 12 November 2015 10:13 AM, David Gibson wrote: > On Thu, Nov 12, 2015 at 10:02:10AM +0530, Aravinda Prasad wrote: >> >> >> On Thursday 12 November 2015 09:08 AM, David Gibson wrote: >>> On Thu, Nov 12, 2015 at 01:24:19PM +1100, Daniel Axtens wrote: Aravinda Prasad

Re: [PATCH 09/10 RFC] KVM: x86: MMU: Move parent_pte handling from kvm_mmu_get_page() to link_shadow_page()

2015-11-12 Thread Paolo Bonzini
On 12/11/2015 15:27, Paolo Bonzini wrote: > Here I think you can remove completely the > > if (sp) > kvm_mmu_put_page(sp, it.sptep); > > later in FNAME(fetch). Apart from this nit, it's okay. Removing this is of course not possible anymore if the other suggestion works

Re: [PATCH] KVM: PPC: Exit guest upon fatal machine check exception

2015-11-12 Thread Aravinda Prasad
On Thursday 12 November 2015 10:28 AM, Daniel Axtens wrote: > >> So, IIUC. Once the qemu pieces are in place as well it shouldn't >> change this behaviour: KVM will exit to qemu, qemu will log the error >> information (new), then reinject the MC to the guest which can still >> handle it as you

[PATCH v9 6/6] tests/guest-debug: introduce basic gdbstub tests

2015-11-12 Thread Alex Bennée
From: Alex Bennée The aim of these tests is to combine with an appropriate kernel image (with symbol-file vmlinux) and check it behaves as it should. Given a kernel it checks: - single step - software breakpoint - hardware breakpoint - access, read and write watchpoints

[PATCH v9 4/6] target-arm: kvm - add support for HW assisted debug

2015-11-12 Thread Alex Bennée
This adds basic support for HW assisted debug. The ioctl interface to KVM allows us to pass an implementation defined number of break and watch point registers. When KVM_GUESTDBG_USE_HW is specified these debug registers will be installed in place on the world switch into the guest. The hardware

[PATCH v9 3/6] target-arm: kvm - support for single step

2015-11-12 Thread Alex Bennée
This adds support for single-step. There isn't much to do on the QEMU side as after we set-up the request for single step via the debug ioctl it is all handled within the kernel. Signed-off-by: Alex Bennée --- v2 - convert to using HSR_EC v3 - use internals.h

[PATCH v9 2/6] target-arm: kvm - implement software breakpoints

2015-11-12 Thread Alex Bennée
These don't involve messing around with debug registers, just setting the breakpoint instruction in memory. GDB will not use this mechanism if it can't access the memory to write the breakpoint. All the kernel has to do is ensure the hypervisor traps the breakpoint exceptions and returns to

[PATCH v9 5/6] target-arm: kvm - re-inject guest debug exceptions

2015-11-12 Thread Alex Bennée
From: Alex Bennée If we can't find details for the debug exception in our debug state then we can assume the exception is due to debugging inside the guest. To inject the exception into the guest state we re-use the TCG exception code (do_interupt). However while guest

[PATCH v9 1/6] target-arm: kvm64 - introduce kvm_arm_init_debug()

2015-11-12 Thread Alex Bennée
As we haven't always had guest debug support we need to probe for it. Additionally we don't do this in the start-up capability code so we don't fall over on old kernels. Signed-off-by: Alex Bennée --- target-arm/kvm64.c | 18 ++ 1 file changed, 18

[PATCH v9 0/6] QEMU support for KVM Guest Debug on arm64

2015-11-12 Thread Alex Bennée
Hi, Here is the latest patch set to support debugging of KVM guests on arm64. The main changes since the last post are that the kernel patches have now been mainlined. As the recent master has synced up headers they are no longer needed for this series. I've add a GDB Python based test into

Re: [PATCH] KVM: svm: add support for RDTSCP

2015-11-12 Thread Paolo Bonzini
On 12/11/2015 15:45, Joerg Roedel wrote: > Hi Paolo, > > On Thu, Nov 12, 2015 at 02:49:16PM +0100, Paolo Bonzini wrote: >> RDTSCP was never supported for AMD CPUs, which nobody noticed because >> Linux does not use it. But exactly the fact that Linux does not >> use it makes the implementation

[PATCH 3/3] KVM: x86: fix ready_for_interrupt reporting in split IRQ chip case

2015-11-12 Thread Matt Gingell
This patch adds a call to kvm_arch_interrupt_allowed to ensure ready for interrupt is reported to user space correctly. This addresses a problem observed in QEMU when kvm->ready_for_interrupt is set but the x86 interrupt flag is clear. Additionally, test that the APIC is ready to accept an

[PATCH 2/3] KVM: x86: request interrupt window when IRQ chip is split

2015-11-12 Thread Matt Gingell
Before this patch we incorrectly enter the guest without requesting an interrupt window if the IRQ chip is split between user space and the kernel. Because lapic_in_kernel no longer implies the PIC is in the kernel, this patch tests pic_in_kernel to determining whether an interrupt window should

[PATCH 1/3] KVM: x86: set KVM_REQ_EVENT on local interupt request from user space

2015-11-12 Thread Matt Gingell
Set KVM_REQ_EVENT when a PIC in user space injects a local interrupt. Currently a request is only made when neither the PIC nor the APIC is in the kernel, which is not sufficient in the split IRQ chip case. This addresses a problem in QEMU where interrupts are delayed until another path invokes

Re: [PATCH] KVM: PPC: Exit guest upon fatal machine check exception

2015-11-12 Thread Daniel Axtens
Aravinda Prasad writes: >> Yeah, it would be good not to break this. > > I am not familiar with CAPI. Does this affect CAPI? When a CAPI card experiences an EEH event, any cache lines it holds are filled with SUEs (Special UEs, interpreted by the kernel the same as

Re: [GIT PULL] Please pull my kvm-ppc-fixes branch

2015-11-12 Thread Paolo Bonzini
On 12/11/2015 06:35, Paul Mackerras wrote: > Paolo, > > I have two fixes for HV KVM which I would like to have included in > v4.4-rc1. The first one is a fix for a bug identified by Red Hat > which causes occasional guest crashes. The second one fixes a bug > which causes host stalls and

Re: [PATCH] KVM: PPC: Exit guest upon fatal machine check exception

2015-11-12 Thread David Gibson
On Thu, Nov 12, 2015 at 11:22:29PM +0530, Aravinda Prasad wrote: > > > On Thursday 12 November 2015 10:13 AM, David Gibson wrote: > > On Thu, Nov 12, 2015 at 10:02:10AM +0530, Aravinda Prasad wrote: > >> > >> > >> On Thursday 12 November 2015 09:08 AM, David Gibson wrote: > >>> On Thu, Nov 12,

Re: [PATCH] KVM: PPC: Exit guest upon fatal machine check exception

2015-11-12 Thread Aravinda Prasad
On Friday 13 November 2015 07:20 AM, David Gibson wrote: > On Thu, Nov 12, 2015 at 11:22:29PM +0530, Aravinda Prasad wrote: [...] >> >> I overlooked it. I think I need to take into consideration whether guest >> issued "ibm, nmi-register". If the guest has issued "ibm, nmi-register" >> then we

Re: [PATCH] KVM: PPC: Exit guest upon fatal machine check exception

2015-11-12 Thread Thomas Huth
On 13/11/15 07:26, Aravinda Prasad wrote: > > On Friday 13 November 2015 07:20 AM, David Gibson wrote: >> On Thu, Nov 12, 2015 at 11:22:29PM +0530, Aravinda Prasad wrote: [...] >>> So thinking whether qemu should explicitly enable the new NMI >>> behavior. >> >> So, I think the reasoning above

Re: [PATCH] KVM: PPC: Exit guest upon fatal machine check exception

2015-11-12 Thread Aravinda Prasad
On Friday 13 November 2015 03:07 AM, Daniel Axtens wrote: > Aravinda Prasad writes: > >>> Yeah, it would be good not to break this. >> >> I am not familiar with CAPI. Does this affect CAPI? > > When a CAPI card experiences an EEH event, any cache lines it holds

Re: [PATCH] KVM: PPC: Exit guest upon fatal machine check exception

2015-11-12 Thread Aravinda Prasad
On Thursday 12 November 2015 10:13 AM, David Gibson wrote: > On Thu, Nov 12, 2015 at 10:02:10AM +0530, Aravinda Prasad wrote: >> >> >> On Thursday 12 November 2015 09:08 AM, David Gibson wrote: >>> On Thu, Nov 12, 2015 at 01:24:19PM +1100, Daniel Axtens wrote: Aravinda Prasad

Re: [PATCH] KVM: PPC: Exit guest upon fatal machine check exception

2015-11-12 Thread Aravinda Prasad
On Thursday 12 November 2015 10:28 AM, Daniel Axtens wrote: > >> So, IIUC. Once the qemu pieces are in place as well it shouldn't >> change this behaviour: KVM will exit to qemu, qemu will log the error >> information (new), then reinject the MC to the guest which can still >> handle it as you