Reading GDT base and limit value of guest VM on host

2015-05-22 Thread j w
I am trying to get the base address and the size of the GDT of the guest VM. When I read the value inside the Windows 7 64bit guest VM I get following values: gdt base 0xf80003b37000, gdt limit 0x7f. These values I read out with gdtr in kernel mode via a driver. However, when I read the value

[PATCH] KVM: PPC: Fix warnings from sparse

2015-05-22 Thread Thomas Huth
When compiling the KVM code for POWER with make C=1, sparse complains about functions missing proper prototypes and a 64-bit constant missing the ULL prefix. Let's fix this by making the functions static or by including the proper header with the prototypes, and by appending a ULL prefix to the

Re: [PATCH 22/23] userfaultfd: avoid mmap_sem read recursion in mcopy_atomic

2015-05-22 Thread Andrew Morton
On Thu, 14 May 2015 19:31:19 +0200 Andrea Arcangeli aarca...@redhat.com wrote: If the rwsem starves writers it wasn't strictly a bug but lockdep doesn't like it and this avoids depending on lowlevel implementation details of the lock. ... @@ -229,13 +246,33 @@ static __always_inline

Re: [PATCH 1/2] KVM: MMU: fix SMAP virtualization

2015-05-22 Thread Boris Ostrovsky
On 05/11/2015 10:55 AM, Xiao Guangrong wrote: KVM may turn a user page to a kernel page when kernel writes a readonly user page if CR0.WP = 1. This shadow page entry will be reused after SMAP is enabled so that kernel is allowed to access this user page Fix it by setting SMAP !CR0.WP into

Re: [PATCH 22/23] userfaultfd: avoid mmap_sem read recursion in mcopy_atomic

2015-05-22 Thread Andrea Arcangeli
On Fri, May 22, 2015 at 01:18:22PM -0700, Andrew Morton wrote: On Thu, 14 May 2015 19:31:19 +0200 Andrea Arcangeli aarca...@redhat.com wrote: If the rwsem starves writers it wasn't strictly a bug but lockdep doesn't like it and this avoids depending on lowlevel implementation details of

Re: [PATCH 22/23] userfaultfd: avoid mmap_sem read recursion in mcopy_atomic

2015-05-22 Thread Andrew Morton
There's a more serious failure with i386 allmodconfig: fs/userfaultfd.c:145:2: note: in expansion of macro 'BUILD_BUG_ON' BUILD_BUG_ON(sizeof(struct uffd_msg) != 32); I'm surprised the feature is even reachable on i386 builds? -- To unsubscribe from this list: send the line unsubscribe kvm in

Re: KVM: x86: zero kvmclock_offset when vcpu0 initializes kvmclock system MSR

2015-05-22 Thread Owen Hofmann
Change as described sounds good, however: @@ -2188,6 +2188,8 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info) vcpu-requests); ka-boot_vcpu_runs_old_kvmclock = tmp; + +

Re: [PATCH 1/2] KVM: MMU: fix SMAP virtualization

2015-05-22 Thread Bandan Das
Boris Ostrovsky boris.ostrov...@oracle.com writes: On 05/11/2015 10:55 AM, Xiao Guangrong wrote: KVM may turn a user page to a kernel page when kernel writes a readonly user page if CR0.WP = 1. This shadow page entry will be reused after SMAP is enabled so that kernel is allowed to access

Re: Announcing qboot, a minimal x86 firmware for QEMU

2015-05-22 Thread Kevin O'Connor
On Fri, May 22, 2015 at 07:23:27PM -0400, Kevin O'Connor wrote: On Thu, May 21, 2015 at 03:51:43PM +0200, Paolo Bonzini wrote: Some of you may have heard about the Clear Containers initiative from Intel, which couple KVM with various kernel tricks to create extremely lightweight virtual

Re: [PATCH 1/2] KVM: MMU: fix SMAP virtualization

2015-05-22 Thread Boris Ostrovsky
On 05/22/2015 07:54 PM, Bandan Das wrote: Boris Ostrovsky boris.ostrov...@oracle.com writes: On 05/11/2015 10:55 AM, Xiao Guangrong wrote: KVM may turn a user page to a kernel page when kernel writes a readonly user page if CR0.WP = 1. This shadow page entry will be reused after SMAP is

Re: Announcing qboot, a minimal x86 firmware for QEMU

2015-05-22 Thread Kevin O'Connor
On Thu, May 21, 2015 at 03:51:43PM +0200, Paolo Bonzini wrote: Some of you may have heard about the Clear Containers initiative from Intel, which couple KVM with various kernel tricks to create extremely lightweight virtual machines. The experimental Clear Containers setup requires only 18-20

Re: [PATCH 22/23] userfaultfd: avoid mmap_sem read recursion in mcopy_atomic

2015-05-22 Thread Andrea Arcangeli
On Fri, May 22, 2015 at 02:18:30PM -0700, Andrew Morton wrote: There's a more serious failure with i386 allmodconfig: fs/userfaultfd.c:145:2: note: in expansion of macro 'BUILD_BUG_ON' BUILD_BUG_ON(sizeof(struct uffd_msg) != 32); I'm surprised the feature is even reachable on i386

[PATCH] KVM: PPC: Remove PPC970 from KVM_BOOK3S_64_HV text in Kconfig

2015-05-22 Thread Thomas Huth
Since the PPC970 support has been removed from the kvm-hv kernel module recently, we should also reflect this change in the help text of the corresponding Kconfig option. Signed-off-by: Thomas Huth th...@redhat.com --- arch/powerpc/kvm/Kconfig | 8 1 file changed, 4 insertions(+), 4

Re: [Qemu-devel] Announcing qboot, a minimal x86 firmware for QEMU

2015-05-22 Thread Daniel P. Berrange
On Thu, May 21, 2015 at 03:51:43PM +0200, Paolo Bonzini wrote: Some of you may have heard about the Clear Containers initiative from Intel, which couple KVM with various kernel tricks to create extremely lightweight virtual machines. The experimental Clear Containers setup requires only 18-20

Re: [Qemu-devel] Announcing qboot, a minimal x86 firmware for QEMU

2015-05-22 Thread Peter Maydell
On 22 May 2015 at 12:01, Daniel P. Berrange berra...@redhat.com wrote: On the QEMU side of things I wonder if there is scope for taking AArch64's 'virt' machine type concept and duplicating it on all architectures. Experience suggests that holding the line on minimal is really quite tricky,

Re: [Qemu-devel] Announcing qboot, a minimal x86 firmware for QEMU

2015-05-22 Thread Gerd Hoffmann
On Fr, 2015-05-22 at 12:21 +0100, Peter Maydell wrote: On 22 May 2015 at 12:12, Daniel P. Berrange berra...@redhat.com wrote: Yep, it is hard saying no - but I'd think as long as it was possible to add the extra features using -device, it ought to be practical to keep a virt machine types

Re: [Qemu-devel] Announcing qboot, a minimal x86 firmware for QEMU

2015-05-22 Thread Peter Maydell
On 22 May 2015 at 12:12, Daniel P. Berrange berra...@redhat.com wrote: Yep, it is hard saying no - but I'd think as long as it was possible to add the extra features using -device, it ought to be practical to keep a virt machine types -nodefaults -nodefconfig base setup pretty minimal. Mmm,

Re: [Qemu-devel] Announcing qboot, a minimal x86 firmware for QEMU

2015-05-22 Thread Daniel P. Berrange
On Fri, May 22, 2015 at 12:04:54PM +0100, Peter Maydell wrote: On 22 May 2015 at 12:01, Daniel P. Berrange berra...@redhat.com wrote: On the QEMU side of things I wonder if there is scope for taking AArch64's 'virt' machine type concept and duplicating it on all architectures. Experience

Re: [Qemu-devel] Announcing qboot, a minimal x86 firmware for QEMU

2015-05-22 Thread Daniel P. Berrange
On Fri, May 22, 2015 at 12:21:27PM +0100, Peter Maydell wrote: On 22 May 2015 at 12:12, Daniel P. Berrange berra...@redhat.com wrote: Yep, it is hard saying no - but I'd think as long as it was possible to add the extra features using -device, it ought to be practical to keep a virt machine

Re: [Qemu-devel] Announcing qboot, a minimal x86 firmware for QEMU

2015-05-22 Thread Markus Armbruster
Peter Maydell peter.mayd...@linaro.org writes: On 22 May 2015 at 12:12, Daniel P. Berrange berra...@redhat.com wrote: Yep, it is hard saying no - but I'd think as long as it was possible to add the extra features using -device, it ought to be practical to keep a virt machine types -nodefaults

Re: [PATCH 08/12] KVM: x86: save/load state on SMM switch

2015-05-22 Thread Radim Krčmář
2015-05-21 22:24+0200, Paolo Bonzini: On 21/05/2015 18:33, Radim Krčmář wrote: Check the AMD architecture manual. I must be blind, is there more than Table 10-2? There's Table 10-1! :DDD :D I think I understand ... 10-1 says that amd64 doesn't shift the segment's attributes (they

Re: [Qemu-devel] Announcing qboot, a minimal x86 firmware for QEMU

2015-05-22 Thread Gerd Hoffmann
Hi, qboot is available at git://github.com/bonzini/qboot.git. Firmware repo has packages now. https://www.kraxel.org/repos/firmware.repo https://www.kraxel.org/repos/jenkins/qboot/ enjoy, Gerd -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to

Re: [PATCH 08/12] KVM: x86: save/load state on SMM switch

2015-05-22 Thread Radim Krčmář
2015-05-21 23:21+0200, Paolo Bonzini: On 21/05/2015 19:00, Radim Krčmář wrote: Potentially, an NMI could be latched (while in SMM or upon exit) and serviced upon exit [...] This Potentially could be in the sense that the whole 3rd paragraph is only applicable to some ancient SMM design

[PATCH][RFC] KVM: PPC: fix suspicious use of conditional operator

2015-05-22 Thread Laurentiu Tudor
This was signaled by a static code analysis tool. Signed-off-by: Laurentiu Tudor laurentiu.tu...@freescale.com --- arch/powerpc/kvm/e500_mmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/kvm/e500_mmu.c b/arch/powerpc/kvm/e500_mmu.c index 50860e9..29911a0

Re: [PATCH 00/23] userfaultfd v4

2015-05-22 Thread Kirill Smelkov
Hi Andrea, On Thu, May 21, 2015 at 05:52:51PM +0200, Andrea Arcangeli wrote: Hi Kirill, On Thu, May 21, 2015 at 04:11:11PM +0300, Kirill Smelkov wrote: Sorry for maybe speaking up too late, but here is additional real Not too late, in fact I don't think there's any change required for

[PATCH] KVM: x86: use correct APIC ID on x2APIC transition

2015-05-22 Thread Radim Krčmář
SDM April 2015, 10.12.5 State Changes From xAPIC Mode to x2APIC Mode • Any APIC ID value written to the memory-mapped local APIC ID register is not preserved. Fix it by sourcing vcpu_id (= initial APIC ID) instead of memory-mapped APIC ID. Proper use of apic functions would result in two calls

Re: [PATCH][RFC] KVM: PPC: fix suspicious use of conditional operator

2015-05-22 Thread Scott Wood
On Fri, 2015-05-22 at 17:46 +0300, Laurentiu Tudor wrote: This was signaled by a static code analysis tool. Signed-off-by: Laurentiu Tudor laurentiu.tu...@freescale.com --- arch/powerpc/kvm/e500_mmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git

[PATCH] KVM: x86: preserve x2APIC LDR on INIT

2015-05-22 Thread Radim Krčmář
Logical x2APIC stops working if we rewrite it with zeros. The best references are SDM April 2015: 10.12.10.1 Logical Destination Mode in x2APIC Mode [...], the LDR are initialized by hardware based on the value of x2APIC ID upon x2APIC state transitions. and SDM April 2015: 10.12.10.2

[PATCH] KVM: PPC: Fix warnings from sparse

2015-05-22 Thread Thomas Huth
When compiling the KVM code for POWER with make C=1, sparse complains about functions missing proper prototypes and a 64-bit constant missing the ULL prefix. Let's fix this by making the functions static or by including the proper header with the prototypes, and by appending a ULL prefix to the

[PATCH] KVM: PPC: Remove PPC970 from KVM_BOOK3S_64_HV text in Kconfig

2015-05-22 Thread Thomas Huth
Since the PPC970 support has been removed from the kvm-hv kernel module recently, we should also reflect this change in the help text of the corresponding Kconfig option. Signed-off-by: Thomas Huth th...@redhat.com --- arch/powerpc/kvm/Kconfig | 8 1 file changed, 4 insertions(+), 4

[PATCH][RFC] KVM: PPC: fix suspicious use of conditional operator

2015-05-22 Thread Laurentiu Tudor
This was signaled by a static code analysis tool. Signed-off-by: Laurentiu Tudor laurentiu.tu...@freescale.com --- arch/powerpc/kvm/e500_mmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/kvm/e500_mmu.c b/arch/powerpc/kvm/e500_mmu.c index 50860e9..29911a0

Re: [PATCH][RFC] KVM: PPC: fix suspicious use of conditional operator

2015-05-22 Thread Scott Wood
On Fri, 2015-05-22 at 17:46 +0300, Laurentiu Tudor wrote: This was signaled by a static code analysis tool. Signed-off-by: Laurentiu Tudor laurentiu.tu...@freescale.com --- arch/powerpc/kvm/e500_mmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git