Re: sanitizing kvmtool

2015-10-15 Thread Dmitry Vyukov
removed bad email address On Thu, Oct 15, 2015 at 12:21 PM, Dmitry Vyukov wrote: > Hello, > > I've run a set of sanitizers on > git://git.kernel.org/pub/scm/linux/kernel/git/will/kvmtool.git commit > 3695adeb227813d96d9c41850703fb53a23845eb. I've just booted a VM and > shut

Re: [PATCH] VFIO: platform: AMD xgbe reset module

2015-10-15 Thread Christoffer Dall
On Thu, Oct 15, 2015 at 01:21:55PM +0200, Arnd Bergmann wrote: > On Thursday 15 October 2015 10:08:02 Eric Auger wrote: > > Hi Arnd, > > On 10/14/2015 05:38 PM, Arnd Bergmann wrote: > > > On Wednesday 14 October 2015 15:33:12 Eric Auger wrote: > > >> ---

[PATCH 1/5] KVM: x86: MMU: Make force_pt_level bool

2015-10-15 Thread Takuya Yoshikawa
This will be passed to a function later. Signed-off-by: Takuya Yoshikawa --- arch/x86/kvm/mmu.c |8 arch/x86/kvm/paging_tmpl.h |4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/arch/x86/kvm/mmu.c

[PATCH 0/5] KVM: x86: MMU: Eliminate extra memory slot searches in page fault handlers

2015-10-15 Thread Takuya Yoshikawa
In page fault handlers, both mapping_level_dirty_bitmap() and mapping_level() do a memory slot search, binary search, through kvm_vcpu_gfn_to_memslot(), which may not be negligible especially for virtual machines with many memory slots. With a bit of cleanup effort, the patch set reduces this

[PATCH 2/5] KVM: x86: MMU: Simplify force_pt_level calculation code in FNAME(page_fault)()

2015-10-15 Thread Takuya Yoshikawa
As a bonus, an extra memory slot search can be eliminated when is_self_change_mapping is true. Signed-off-by: Takuya Yoshikawa --- arch/x86/kvm/paging_tmpl.h | 15 +++ 1 file changed, 7 insertions(+), 8 deletions(-) diff --git

[PATCH 3/5] KVM: x86: MMU: Merge mapping_level_dirty_bitmap() into mapping_level()

2015-10-15 Thread Takuya Yoshikawa
This is necessary to eliminate an extra memory slot search later. Signed-off-by: Takuya Yoshikawa --- arch/x86/kvm/mmu.c | 29 ++--- arch/x86/kvm/paging_tmpl.h |6 +++--- 2 files changed, 17 insertions(+), 18 deletions(-)

[PATCH 4/5] KVM: x86: MMU: Remove mapping_level_dirty_bitmap()

2015-10-15 Thread Takuya Yoshikawa
Now that it has only one caller, and its name is not so helpful for readers, just remove it. Signed-off-by: Takuya Yoshikawa --- arch/x86/kvm/mmu.c | 21 + 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/arch/x86/kvm/mmu.c

Re: [PATCH] VFIO: platform: AMD xgbe reset module

2015-10-15 Thread Arnd Bergmann
On Thursday 15 October 2015 10:08:02 Eric Auger wrote: > Hi Arnd, > On 10/14/2015 05:38 PM, Arnd Bergmann wrote: > > On Wednesday 14 October 2015 15:33:12 Eric Auger wrote: > >> --- a/drivers/vfio/platform/vfio_platform_common.c > >> +++ b/drivers/vfio/platform/vfio_platform_common.c > >> @@ -31,6

[PATCH 5/5] KVM: x86: MMU: Eliminate an extra memory slot search in mapping_level()

2015-10-15 Thread Takuya Yoshikawa
Calling kvm_vcpu_gfn_to_memslot() twice in mapping_level() should be avoided since getting a slot by binary search may not be negligible, especially for virtual machines with many memory slots. Signed-off-by: Takuya Yoshikawa --- arch/x86/kvm/mmu.c | 17

Re: [PATCH v3 0/4] KVM: arm/arm64: guest synchronous halt/resume

2015-10-15 Thread Christoffer Dall
On Fri, Sep 25, 2015 at 11:41:13PM +0200, Eric Auger wrote: > This series introduces the capability to synchronously exit the guest > and prevent it from being re-entered. This modality will be used by > IRQ forwarding series when changing the state of the IRQ. > > Former pause flag used when

Re: [edk2] KVM: MTRR: fix memory type handling if MTRR is completely disabled

2015-10-15 Thread Janusz
W dniu 15.10.2015 o 06:19, Xiao Guangrong pisze: > > > > Well, the bug may be not in KVM. When this bug happened, i saw OVMF > only checked 1 CPU out, there is the log from OVMF's debug input: > > Flushing GCD > Flushing GCD > Flushing GCD > Flushing GCD > Flushing GCD > Flushing GCD >

Re: [edk2] KVM: MTRR: fix memory type handling if MTRR is completely disabled

2015-10-15 Thread Xiao Guangrong
On 10/15/2015 02:58 PM, Janusz wrote: W dniu 15.10.2015 o 08:41, Xiao Guangrong pisze: On 10/15/2015 02:19 PM, Janusz wrote: W dniu 15.10.2015 o 06:19, Xiao Guangrong pisze: Well, the bug may be not in KVM. When this bug happened, i saw OVMF only checked 1 CPU out, there is the log

Re: [edk2] KVM: MTRR: fix memory type handling if MTRR is completely disabled

2015-10-15 Thread Xiao Guangrong
On 10/15/2015 02:19 PM, Janusz wrote: W dniu 15.10.2015 o 06:19, Xiao Guangrong pisze: Well, the bug may be not in KVM. When this bug happened, i saw OVMF only checked 1 CPU out, there is the log from OVMF's debug input: Flushing GCD Flushing GCD Flushing GCD Flushing GCD

Re: [edk2] KVM: MTRR: fix memory type handling if MTRR is completely disabled

2015-10-15 Thread Janusz
W dniu 15.10.2015 o 09:10, Xiao Guangrong pisze: > > > On 10/15/2015 02:58 PM, Janusz wrote: >> W dniu 15.10.2015 o 08:41, Xiao Guangrong pisze: >>> >>> >>> On 10/15/2015 02:19 PM, Janusz wrote: W dniu 15.10.2015 o 06:19, Xiao Guangrong pisze: > > > > Well, the bug may be not

Re: [PATCH] VFIO: platform: AMD xgbe reset module

2015-10-15 Thread Eric Auger
Hi Arnd, On 10/14/2015 05:38 PM, Arnd Bergmann wrote: > On Wednesday 14 October 2015 15:33:12 Eric Auger wrote: >> --- a/drivers/vfio/platform/vfio_platform_common.c >> +++ b/drivers/vfio/platform/vfio_platform_common.c >> @@ -31,6 +31,11 @@ static const struct vfio_platform_reset_combo >>

Re: [edk2] KVM: MTRR: fix memory type handling if MTRR is completely disabled

2015-10-15 Thread Janusz
W dniu 15.10.2015 o 08:41, Xiao Guangrong pisze: > > > On 10/15/2015 02:19 PM, Janusz wrote: >> W dniu 15.10.2015 o 06:19, Xiao Guangrong pisze: >>> >>> >>> >>> Well, the bug may be not in KVM. When this bug happened, i saw OVMF >>> only checked 1 CPU out, there is the log from OVMF's debug input:

Re: [PATCH] KVM: VMX: enable LBR virtualization

2015-10-15 Thread Jian Zhou
On 2015/10/14 19:30, Paolo Bonzini wrote: On 14/10/2015 13:26, Jian Zhou wrote: On 12/10/2015 20:44, Paolo Bonzini wrote: In addition, the MSR numbers may differ between the guest and the host, because it is possible to emulate e.g. a Core CPU on a Core 2 CPU. So I recommend against using

Re: [PATCH] VFIO: platform: AMD xgbe reset module

2015-10-15 Thread Arnd Bergmann
On Thursday 15 October 2015 17:03:21 Christoffer Dall wrote: > On Thu, Oct 15, 2015 at 04:55:13PM +0200, Arnd Bergmann wrote: > > On Thursday 15 October 2015 16:46:09 Eric Auger wrote: > > > > > > > > This is where we'd need a little more changes for this approach. Instead > > > > of unbinding

Re: [PATCH v3 27/32] nvdimm: support DSM_CMD_IMPLEMENTED function

2015-10-15 Thread Stefan Hajnoczi
On Wed, Oct 14, 2015 at 10:50:40PM +0800, Xiao Guangrong wrote: > On 10/14/2015 05:40 PM, Stefan Hajnoczi wrote: > >On Sun, Oct 11, 2015 at 11:52:59AM +0800, Xiao Guangrong wrote: > >>+out = (dsm_out *)in; > >>+ > >>+revision = in->arg1; > >>+function = in->arg2; > >>+handle =

Re: [PATCH 4/5] KVM: x86: MMU: Remove mapping_level_dirty_bitmap()

2015-10-15 Thread Paolo Bonzini
On 15/10/2015 12:43, Takuya Yoshikawa wrote: > +static inline bool memslot_invalid(struct kvm_memory_slot *slot) Can you make this function memslot_valid_for_gpte(struct kvm_memory_slot *slot, bool no_dirty_log), and have it return slot && !(slot->flags & KVM_MEMSLOT_INVALID) &&

Re: [PATCH v3 27/32] nvdimm: support DSM_CMD_IMPLEMENTED function

2015-10-15 Thread Stefan Hajnoczi
On Wed, Oct 14, 2015 at 10:52:15PM +0800, Xiao Guangrong wrote: > On 10/14/2015 05:41 PM, Stefan Hajnoczi wrote: > >On Sun, Oct 11, 2015 at 11:52:59AM +0800, Xiao Guangrong wrote: > >>+out->len = sizeof(out->status); > > > >out->len is uint16_t, it needs cpu_to_le16(). There may be other >

Re: [edk2] KVM: MTRR: fix memory type handling if MTRR is completely disabled

2015-10-15 Thread Laszlo Ersek
CC'ing Jordan and Chen Fan. On 10/15/15 09:10, Xiao Guangrong wrote: > > > On 10/15/2015 02:58 PM, Janusz wrote: >> W dniu 15.10.2015 o 08:41, Xiao Guangrong pisze: >>> >>> >>> On 10/15/2015 02:19 PM, Janusz wrote: W dniu 15.10.2015 o 06:19, Xiao Guangrong pisze: > > > >

Re: [PATCH] VFIO: platform: AMD xgbe reset module

2015-10-15 Thread Arnd Bergmann
On Thursday 15 October 2015 14:12:28 Christoffer Dall wrote: > > > > enum vfio_platform_op { > > VFIO_PLATFORM_BIND, > > VFIO_PLATFORM_UNBIND, > > VFIO_PLATFORM_RESET, > > }; > > > > struct platform_driver { > > int (*probe)(struct platform_device *); > > int

Re: [PATCH] VFIO: platform: AMD xgbe reset module

2015-10-15 Thread Eric Auger
Hi Arnd, On 10/15/2015 03:59 PM, Arnd Bergmann wrote: > On Thursday 15 October 2015 14:12:28 Christoffer Dall wrote: >>> >>> enum vfio_platform_op { >>> VFIO_PLATFORM_BIND, >>> VFIO_PLATFORM_UNBIND, >>> VFIO_PLATFORM_RESET, >>> }; >>> >>> struct platform_driver { >>> int

Re: [PATCH] VFIO: platform: AMD xgbe reset module

2015-10-15 Thread Arnd Bergmann
On Thursday 15 October 2015 16:46:09 Eric Auger wrote: > > > > This is where we'd need a little more changes for this approach. Instead > > of unbinding the device from its driver, the idea would be that the > > driver remains bound as far as the driver model is concerned, but > > it would be in

Re: [PATCH] VFIO: platform: AMD xgbe reset module

2015-10-15 Thread Arnd Bergmann
On Thursday 15 October 2015 16:20:46 Eric Auger wrote: > On 10/15/2015 02:12 PM, Christoffer Dall wrote: > > On Thu, Oct 15, 2015 at 01:21:55PM +0200, Arnd Bergmann wrote: > >> On Thursday 15 October 2015 10:08:02 Eric Auger wrote: > >>> On 10/14/2015 05:38 PM, Arnd Bergmann wrote: > On

Re: [PATCH] VFIO: platform: AMD xgbe reset module

2015-10-15 Thread Christoffer Dall
On Thu, Oct 15, 2015 at 04:55:13PM +0200, Arnd Bergmann wrote: > On Thursday 15 October 2015 16:46:09 Eric Auger wrote: > > > > > > This is where we'd need a little more changes for this approach. Instead > > > of unbinding the device from its driver, the idea would be that the > > > driver

Re: [PATCH] KVM: VMX: enable LBR virtualization

2015-10-15 Thread Paolo Bonzini
On 15/10/2015 15:51, Jian Zhou wrote: > > > On 2015/10/14 19:30, Paolo Bonzini wrote: >> >> >> On 14/10/2015 13:26, Jian Zhou wrote: >>> On 12/10/2015 20:44, Paolo Bonzini wrote: In addition, the MSR numbers may differ between the guest and the host, because it is possible to emulate

Re: [PATCH] VFIO: platform: AMD xgbe reset module

2015-10-15 Thread Eric Auger
Hi Arnd, On 10/15/2015 02:12 PM, Christoffer Dall wrote: > On Thu, Oct 15, 2015 at 01:21:55PM +0200, Arnd Bergmann wrote: >> On Thursday 15 October 2015 10:08:02 Eric Auger wrote: >>> Hi Arnd, >>> On 10/14/2015 05:38 PM, Arnd Bergmann wrote: On Wednesday 14 October 2015 15:33:12 Eric Auger

Re: [PATCH v3 27/32] nvdimm: support DSM_CMD_IMPLEMENTED function

2015-10-15 Thread Xiao Guangrong
On 10/15/2015 11:07 PM, Stefan Hajnoczi wrote: On Wed, Oct 14, 2015 at 10:50:40PM +0800, Xiao Guangrong wrote: On 10/14/2015 05:40 PM, Stefan Hajnoczi wrote: On Sun, Oct 11, 2015 at 11:52:59AM +0800, Xiao Guangrong wrote: +out = (dsm_out *)in; + +revision = in->arg1; +function =

RE: [PATCH v9 17/18] KVM: Update Posted-Interrupts Descriptor when vCPU is blocked

2015-10-15 Thread Wu, Feng
> -Original Message- > From: Paolo Bonzini [mailto:paolo.bonz...@gmail.com] On Behalf Of Paolo > Bonzini > Sent: Friday, October 16, 2015 2:13 AM > To: David Matlack ; Wu, Feng > Cc: alex.william...@redhat.com; Joerg Roedel ;

linux-next: manual merge of the kvm-arm tree with the kvm tree

2015-10-15 Thread Stephen Rothwell
Hi all, Today's linux-next merge of the kvm-arm tree got a conflict in: arch/x86/include/asm/kvm_host.h between commit: d84f1e0755ba ("KVM: make kvm_set_msi_irq() public") from the kvm tree and commits: 8feb4a04dc75 ("KVM: Define a new interface kvm_intr_is_single_vcpu()")

Re: [PATCH] KVM: VMX: enable LBR virtualization

2015-10-15 Thread Jian Zhou
Does it depend on vPMU _for Linux guests_ or in general? My impression is that LBR can be used by the guest independent of the PMU. I think only for Linux guests. I googled how to enable LBR on other guests(except Linux guests), e.g. Windows, and got no developer manuals about it.

Re: [PATCH v3 27/32] nvdimm: support DSM_CMD_IMPLEMENTED function

2015-10-15 Thread Xiao Guangrong
On 10/15/2015 11:01 PM, Stefan Hajnoczi wrote: On Wed, Oct 14, 2015 at 10:52:15PM +0800, Xiao Guangrong wrote: On 10/14/2015 05:41 PM, Stefan Hajnoczi wrote: On Sun, Oct 11, 2015 at 11:52:59AM +0800, Xiao Guangrong wrote: +out->len = sizeof(out->status); out->len is uint16_t, it needs

[RESEND PATCH] kvm: Allow the Hyper-V vendor ID to be specified

2015-10-15 Thread Alex Williamson
According to Microsoft documentation, the signature in the standard hypervisor CPUID leaf at 0x4000 identifies the Vendor ID and is for reporting and diagnostic purposes only. We can therefore allow the user to change it to whatever they want, within the 12 character limit. Add a new

Network hangs when communicating with host

2015-10-15 Thread Dmitry Vyukov
Hello, I am trying to run a program in lkvm sandbox so that it communicates with a program on host. I run lkvm as: ./lkvm sandbox --disk sandbox-test --mem=2048 --cpus=4 --kernel /arch/x86/boot/bzImage --network mode=user -- /my_prog /my_prog then connects to a program on host over a tcp

Re: [PATCH] VFIO: platform: AMD xgbe reset module

2015-10-15 Thread Alex Williamson
On Thu, 2015-10-15 at 21:42 +0200, Christoffer Dall wrote: > On Thu, Oct 15, 2015 at 10:53:17AM -0600, Alex Williamson wrote: > > On Thu, 2015-10-15 at 16:46 +0200, Eric Auger wrote: > > > Hi Arnd, > > > On 10/15/2015 03:59 PM, Arnd Bergmann wrote: > > > > On Thursday 15 October 2015 14:12:28

[RFC PATCH] vfio/type1: Do not support IOMMUs that allow bypass

2015-10-15 Thread Alex Williamson
We can only provide isolation if DMA is forced through the IOMMU aperture. Don't allow type1 to be used if this is not the case. Signed-off-by: Alex Williamson --- Eric, I see a number of IOMMU drivers enable this, do the ones you care about for ARM set

[PATCH] vfio/pci: Use kernel VPD access functions

2015-10-15 Thread Alex Williamson
The PCI VPD capability operates on a set of window registers in PCI config space. Writing to the address register triggers either a read or write, depending on the setting of the PCI_VPD_ADDR_F bit within the address register. The data register provides either the source for writes or the target

RE: linux-next: manual merge of the kvm-arm tree with the kvm tree

2015-10-15 Thread Wu, Feng
> -Original Message- > From: Stephen Rothwell [mailto:s...@canb.auug.org.au] > Sent: Friday, October 16, 2015 11:53 AM > To: Christoffer Dall ; Marc Zyngier > ; Marcelo Tosatti ; Gleb > Natapov ;

Re: [PATCH v3 00/20] KVM: ARM64: Add guest PMU support

2015-10-15 Thread Wei Huang
On 09/24/2015 05:31 PM, Shannon Zhao wrote: > This patchset adds guest PMU support for KVM on ARM64. It takes > trap-and-emulate approach. When guest wants to monitor one event, it > will be trapped by KVM and KVM will call perf_event API to create a perf > event and call relevant perf_event

Re: [PATCH v3 04/20] KVM: ARM64: Add reset and access handlers for PMCR_EL0 register

2015-10-15 Thread Wei Huang
On 09/24/2015 05:31 PM, Shannon Zhao wrote: > Add reset handler which gets host value of PMCR_EL0 and make writable > bits architecturally UNKNOWN. Add a common access handler for PMU > registers which emulates writing and reading register and add emulation > for PMCR. > > Signed-off-by:

[PATCH] KVM: PPC: Implement extension to report number of memslots

2015-10-15 Thread Nikunj A Dadhania
QEMU assumes 32 memslots if this extension is not implemented. Although, current value of KVM_USER_MEM_SLOTS is 32, once KVM_USER_MEM_SLOTS changes QEMU would take a wrong value. Signed-off-by: Nikunj A Dadhania --- arch/powerpc/kvm/powerpc.c | 3 +++ 1 file changed,

Re: [PATCH] VFIO: platform: AMD xgbe reset module

2015-10-15 Thread Alex Williamson
On Thu, 2015-10-15 at 16:46 +0200, Eric Auger wrote: > Hi Arnd, > On 10/15/2015 03:59 PM, Arnd Bergmann wrote: > > On Thursday 15 October 2015 14:12:28 Christoffer Dall wrote: > >>> > >>> enum vfio_platform_op { > >>> VFIO_PLATFORM_BIND, > >>> VFIO_PLATFORM_UNBIND, > >>>

Re: [PATCH] VFIO: platform: AMD xgbe reset module

2015-10-15 Thread Christoffer Dall
On Thu, Oct 15, 2015 at 5:49 PM, Arnd Bergmann wrote: > On Thursday 15 October 2015 17:03:21 Christoffer Dall wrote: >> On Thu, Oct 15, 2015 at 04:55:13PM +0200, Arnd Bergmann wrote: >> > On Thursday 15 October 2015 16:46:09 Eric Auger wrote: >> > > > >> > > > This is where we'd

RE: [edk2] KVM: MTRR: fix memory type handling if MTRR is completely disabled

2015-10-15 Thread Kinney, Michael D
Laszlo, There is already a PCD for this timeout that is used by CpuMpPei. gUefiCpuPkgTokenSpaceGuid.PcdCpuApInitTimeOutInMicroSeconds I noticed that CpuDxe is using a hard coded AP timeout. I think we should just use this same PCD for both the PEI and DXE CPU module and then set it

Re: [PATCH] KVM: x86: move steal time initialization to vcpu entry time

2015-10-15 Thread David Matlack
On Wed, Oct 14, 2015 at 3:33 PM, Marcelo Tosatti wrote: > > As reported at https://bugs.launchpad.net/qemu/+bug/1494350, > it is possible to have vcpu->arch.st.last_steal initialized > from a thread other than vcpu thread, say the iothread, via > KVM_SET_MSRS. > > Which can

Re: [PATCH] VFIO: platform: AMD xgbe reset module

2015-10-15 Thread Christoffer Dall
On Thu, Oct 15, 2015 at 10:53:17AM -0600, Alex Williamson wrote: > On Thu, 2015-10-15 at 16:46 +0200, Eric Auger wrote: > > Hi Arnd, > > On 10/15/2015 03:59 PM, Arnd Bergmann wrote: > > > On Thursday 15 October 2015 14:12:28 Christoffer Dall wrote: > > >>> > > >>> enum vfio_platform_op { > > >>>

[PATCH] book3s_hv: Handle H_DOORBELL on the guest exit path

2015-10-15 Thread Gautham R. Shenoy
Currently a CPU running a guest can receive a H_DOORBELL in the following two cases: 1) When the CPU is napping due to CEDE or there not being a guest vcpu. 2) The CPU is running the guest vcpu. Case 1), the doorbell message is not cleared since we were waking up from nap. Hence when the EE bit

Re: [PATCH v9 17/18] KVM: Update Posted-Interrupts Descriptor when vCPU is blocked

2015-10-15 Thread David Matlack
On Wed, Oct 14, 2015 at 6:33 PM, Wu, Feng wrote: > >> -Original Message- >> From: David Matlack [mailto:dmatl...@google.com] >> Sent: Thursday, October 15, 2015 7:41 AM >> To: Wu, Feng >> Cc: Paolo Bonzini ;

Re: [PATCH v9 17/18] KVM: Update Posted-Interrupts Descriptor when vCPU is blocked

2015-10-15 Thread Paolo Bonzini
On 15/10/2015 19:39, David Matlack wrote: > But after spending more time reading the source code this morning I > found that kvm_vcpu_check_block() eventually calls into > vmx_sync_pir_to_irr(), which copies PIR to IRR and clears ON. And then > apic_find_highest_irr() detects the pending posted

Re: [edk2] KVM: MTRR: fix memory type handling if MTRR is completely disabled

2015-10-15 Thread Laszlo Ersek
On 10/15/15 18:53, Kinney, Michael D wrote: > Laszlo, > > There is already a PCD for this timeout that is used by CpuMpPei. > > gUefiCpuPkgTokenSpaceGuid.PcdCpuApInitTimeOutInMicroSeconds > > I noticed that CpuDxe is using a hard coded AP timeout. I think we should > just use this same

[PATCH] KVM: PPC: Implement extension to report number of memslots

2015-10-15 Thread Nikunj A Dadhania
QEMU assumes 32 memslots if this extension is not implemented. Although, current value of KVM_USER_MEM_SLOTS is 32, once KVM_USER_MEM_SLOTS changes QEMU would take a wrong value. Signed-off-by: Nikunj A Dadhania --- arch/powerpc/kvm/powerpc.c | 3 +++ 1 file changed,

[PATCH] book3s_hv: Handle H_DOORBELL on the guest exit path

2015-10-15 Thread Gautham R. Shenoy
Currently a CPU running a guest can receive a H_DOORBELL in the following two cases: 1) When the CPU is napping due to CEDE or there not being a guest vcpu. 2) The CPU is running the guest vcpu. Case 1), the doorbell message is not cleared since we were waking up from nap. Hence when the EE bit