Re: What's the difference between EPT_MISCONFIG and EPT_VIOLATION?

2014-12-03 Thread Gleb Natapov
On Wed, Dec 03, 2014 at 05:50:33PM +0800, Zhang Haoyu wrote: Hi, EXIT_REASON_EPT_VIOLATION's corresponding handle is handle_ept_violation(), and EXIT_REASON_EPT_MISCONFIG's corresponding handle is handle_ept_misconfig(), what's the difference between them? I read the SDM-3C 28.2.3

Re: What's the difference between EPT_MISCONFIG and EPT_VIOLATION?

2014-12-03 Thread Gleb Natapov
On Wed, Dec 03, 2014 at 06:12:10PM +0800, Zhang Haoyu wrote: Hi, EXIT_REASON_EPT_VIOLATION's corresponding handle is handle_ept_violation(), and EXIT_REASON_EPT_MISCONFIG's corresponding handle is handle_ept_misconfig(), what's the difference between them? I read the

Re: [question] lots of interrupts injected to vm when pressing somekey w/o releasing

2014-11-19 Thread Gleb Natapov
On Thu, Nov 20, 2014 at 02:59:36PM +0800, Zhang Haoyu wrote: On 20/11/2014 03:20, Zhang Haoyu wrote: Hi all, If I press the one of Insert/Delete/Home/End/PageUp/PageDown/UpArrow/ DownArrow/LeftArrow/RightArrow key w/o releasing, then lots of interrupts will be injected to

Re: [PATCH] KVM: ia64: remove

2014-11-19 Thread Gleb Natapov
On Wed, Nov 19, 2014 at 10:05:43PM +0100, Paolo Bonzini wrote: KVM for ia64 has been marked as broken not just once, but twice even, and the last patch from the maintainer is now roughly 5 years old. Time for it to rest in piece. Acked-by: Gleb Natapov g...@kernel.org Next step is to move

Re: nested KVM slower than QEMU with gnumach guest kernel

2014-11-17 Thread Gleb Natapov
On Sun, Nov 16, 2014 at 11:18:28PM +0100, Samuel Thibault wrote: Hello, Jan Kiszka, le Wed 12 Nov 2014 00:42:52 +0100, a écrit : On 2014-11-11 19:55, Samuel Thibault wrote: jenkins.debian.net is running inside a KVM VM, and it runs nested KVM guests for its installation attempts. This

Re: nested KVM slower than QEMU with gnumach guest kernel

2014-11-17 Thread Gleb Natapov
On Mon, Nov 17, 2014 at 10:10:25AM +0100, Samuel Thibault wrote: Jan Kiszka, le Mon 17 Nov 2014 10:04:37 +0100, a écrit : On 2014-11-17 10:03, Samuel Thibault wrote: Gleb Natapov, le Mon 17 Nov 2014 10:58:45 +0200, a écrit : Do you know how gnumach timekeeping works? Does it have a timer

Re: vhost + multiqueue + RSS question.

2014-11-17 Thread Gleb Natapov
On Mon, Nov 17, 2014 at 12:38:16PM +0200, Michael S. Tsirkin wrote: On Mon, Nov 17, 2014 at 09:44:23AM +0200, Gleb Natapov wrote: On Sun, Nov 16, 2014 at 08:56:04PM +0200, Michael S. Tsirkin wrote: On Sun, Nov 16, 2014 at 06:18:18PM +0200, Gleb Natapov wrote: Hi Michael, I am

Re: vhost + multiqueue + RSS question.

2014-11-17 Thread Gleb Natapov
On Mon, Nov 17, 2014 at 01:58:20PM +0200, Michael S. Tsirkin wrote: On Mon, Nov 17, 2014 at 01:22:07PM +0200, Gleb Natapov wrote: On Mon, Nov 17, 2014 at 12:38:16PM +0200, Michael S. Tsirkin wrote: On Mon, Nov 17, 2014 at 09:44:23AM +0200, Gleb Natapov wrote: On Sun, Nov 16, 2014 at 08

Re: vhost + multiqueue + RSS question.

2014-11-17 Thread Gleb Natapov
On Tue, Nov 18, 2014 at 11:41:11AM +0800, Jason Wang wrote: On 11/18/2014 09:37 AM, Zhang Haoyu wrote: On Mon, Nov 17, 2014 at 01:58:20PM +0200, Michael S. Tsirkin wrote: On Mon, Nov 17, 2014 at 01:22:07PM +0200, Gleb Natapov wrote: On Mon, Nov 17, 2014 at 12:38:16PM +0200, Michael S

vhost + multiqueue + RSS question.

2014-11-16 Thread Gleb Natapov
Hi Michael, I am playing with vhost multiqueue capability and have a question about vhost multiqueue and RSS (receive side steering). My setup has Mellanox ConnectX-3 NIC which supports multiqueue and RSS. Network related parameters for qemu are: -netdev

Re: vhost + multiqueue + RSS question.

2014-11-16 Thread Gleb Natapov
On Mon, Nov 17, 2014 at 01:30:06PM +0800, Jason Wang wrote: On 11/17/2014 02:56 AM, Michael S. Tsirkin wrote: On Sun, Nov 16, 2014 at 06:18:18PM +0200, Gleb Natapov wrote: Hi Michael, I am playing with vhost multiqueue capability and have a question about vhost multiqueue and RSS

Re: vhost + multiqueue + RSS question.

2014-11-16 Thread Gleb Natapov
On Sun, Nov 16, 2014 at 08:56:04PM +0200, Michael S. Tsirkin wrote: On Sun, Nov 16, 2014 at 06:18:18PM +0200, Gleb Natapov wrote: Hi Michael, I am playing with vhost multiqueue capability and have a question about vhost multiqueue and RSS (receive side steering). My setup has Mellanox

Re: Seeking a KVM benchmark

2014-11-12 Thread Gleb Natapov
On Wed, Nov 12, 2014 at 12:33:32PM +0100, Paolo Bonzini wrote: On 10/11/2014 18:38, Gleb Natapov wrote: On Mon, Nov 10, 2014 at 06:28:25PM +0100, Paolo Bonzini wrote: On 10/11/2014 15:23, Avi Kivity wrote: It's not surprising [1]. Since the meaning of some PTE bits change [2

Re: Seeking a KVM benchmark

2014-11-12 Thread Gleb Natapov
On Wed, Nov 12, 2014 at 04:26:29PM +0100, Paolo Bonzini wrote: On 12/11/2014 16:22, Gleb Natapov wrote: Nehalem results: userspace exit, urn 17560 17726 17628 17572 17417 lightweight exit, urn 3316 3342 3342 3319 3328 userspace exit

Re: Seeking a KVM benchmark

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

Re: Seeking a KVM benchmark

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

Re: Seeking a KVM benchmark

2014-11-09 Thread Gleb Natapov
On Sat, Nov 08, 2014 at 08:44:42AM -0800, Andy Lutomirski wrote: On Sat, Nov 8, 2014 at 8:00 AM, Andy Lutomirski l...@amacapital.net wrote: On Nov 8, 2014 4:01 AM, Gleb Natapov g...@kernel.org wrote: On Fri, Nov 07, 2014 at 09:59:55AM -0800, Andy Lutomirski wrote: On Thu, Nov 6, 2014

Re: Seeking a KVM benchmark

2014-11-08 Thread Gleb Natapov
On Fri, Nov 07, 2014 at 09:59:55AM -0800, Andy Lutomirski wrote: On Thu, Nov 6, 2014 at 11:17 PM, Paolo Bonzini pbonz...@redhat.com wrote: On 07/11/2014 07:27, Andy Lutomirski wrote: Is there an easy benchmark that's sensitive to the time it takes to round-trip from userspace to guest

Re: [patch 3/4] KVM: MMU: reload request from GET_DIRTY_LOG path

2014-10-15 Thread Gleb Natapov
On Mon, Oct 13, 2014 at 05:52:38AM -0300, Marcelo Tosatti wrote: On Fri, Oct 10, 2014 at 04:09:29PM +0300, Gleb Natapov wrote: On Wed, Oct 08, 2014 at 04:22:31PM -0300, Marcelo Tosatti wrote: Argh, lets try again: skip_pinned = true -- mark

Re: [patch 3/4] KVM: MMU: reload request from GET_DIRTY_LOG path

2014-10-10 Thread Gleb Natapov
On Wed, Oct 08, 2014 at 04:22:31PM -0300, Marcelo Tosatti wrote: Argh, lets try again: skip_pinned = true -- mark page dirty, keep spte intact called from get dirty log path. skip_pinned = false --- reload remote mmu

Re: [patch 3/4] KVM: MMU: reload request from GET_DIRTY_LOG path

2014-10-08 Thread Gleb Natapov
On Mon, Oct 06, 2014 at 02:19:32PM -0300, Marcelo Tosatti wrote: On Sat, Oct 04, 2014 at 10:23:32AM +0300, Gleb Natapov wrote: On Tue, Sep 09, 2014 at 12:28:11PM -0300, Marcelo Tosatti wrote: On Mon, Jul 21, 2014 at 04:14:24PM +0300, Gleb Natapov wrote: On Wed, Jul 09, 2014 at 04:12:53PM

Re: [patch 3/4] KVM: MMU: reload request from GET_DIRTY_LOG path

2014-10-08 Thread Gleb Natapov
On Wed, Oct 08, 2014 at 02:15:34PM -0300, Marcelo Tosatti wrote: On Wed, Oct 08, 2014 at 09:56:36AM +0300, Gleb Natapov wrote: On Mon, Oct 06, 2014 at 02:19:32PM -0300, Marcelo Tosatti wrote: On Sat, Oct 04, 2014 at 10:23:32AM +0300, Gleb Natapov wrote: On Tue, Sep 09, 2014 at 12:28:11PM

Re: [PATCH 4/6] KVM: x86: Fix determining flat mode in recalculate_apic_map

2014-10-04 Thread Gleb Natapov
On Tue, Sep 30, 2014 at 08:49:17PM +0300, Nadav Amit wrote: Determining flat mode according to cid_mask is wrong, since currently KVM supports zero clusters in x2apic mode. Use ldr_bits instead. As a comment above the 'if' you are fixing says the code assumes all APICs are in the same mode (if

Re: [RFC] vPMU support for AMD system

2014-10-04 Thread Gleb Natapov
Hi, On Tue, Sep 30, 2014 at 09:07:22PM -0500, Wei Huang wrote: Hi Paolo and Gleb, The attached file is a preliminary version of AMD vPMU support for KVM. Currently I am working on a formal patch set; but realized that there are some design choice to make (see below). I thought it is better

Re: [patch 3/4] KVM: MMU: reload request from GET_DIRTY_LOG path

2014-10-04 Thread Gleb Natapov
On Tue, Sep 09, 2014 at 12:28:11PM -0300, Marcelo Tosatti wrote: On Mon, Jul 21, 2014 at 04:14:24PM +0300, Gleb Natapov wrote: On Wed, Jul 09, 2014 at 04:12:53PM -0300, mtosa...@redhat.com wrote: Reload remote vcpus MMU from GET_DIRTY_LOG codepath, before deleting a pinned spte

Re: [PATCH] kvm: don't take vcpu mutex for obviously invalid vcpu ioctls

2014-09-23 Thread Gleb Natapov
On Mon, Sep 22, 2014 at 09:29:19PM +0200, Paolo Bonzini wrote: Il 22/09/2014 21:20, Christian Borntraeger ha scritto: while using trinity to fuzz KVM, we noticed long stalls on invalid ioctls. Lets bail out early on invalid ioctls. or similar? Okay. David, can you explain how you found

Re: Standardizing an MSR or other hypercall to get an RNG seed?

2014-09-19 Thread Gleb Natapov
On Thu, Sep 18, 2014 at 03:00:05PM -0700, Andy Lutomirski wrote: On Thu, Sep 18, 2014 at 2:46 PM, David Hepkin david...@microsoft.com wrote: I suggest we come to consensus on a specific CPUID leaf where an OS needs to look to determine if a hypervisor supports this capability. We could

Re: Standardizing an MSR or other hypercall to get an RNG seed?

2014-09-19 Thread Gleb Natapov
On Fri, Sep 19, 2014 at 09:40:07AM -0700, H. Peter Anvin wrote: On 09/19/2014 09:37 AM, Gleb Natapov wrote: Linux detects what hypervior it runs on very early Not anywhere close to early enough. We're talking for uses like kASLR. Still to early to do: h = cpuid(HYPERVIOR_SIGNATURE

Re: Standardizing an MSR or other hypercall to get an RNG seed?

2014-09-19 Thread Gleb Natapov
On Fri, Sep 19, 2014 at 10:08:20AM -0700, H. Peter Anvin wrote: On 09/19/2014 09:53 AM, Gleb Natapov wrote: On Fri, Sep 19, 2014 at 09:40:07AM -0700, H. Peter Anvin wrote: On 09/19/2014 09:37 AM, Gleb Natapov wrote: Linux detects what hypervior it runs on very early Not anywhere close

Re: Standardizing an MSR or other hypercall to get an RNG seed?

2014-09-19 Thread Gleb Natapov
On Fri, Sep 19, 2014 at 10:18:37AM -0700, H. Peter Anvin wrote: On 09/19/2014 10:15 AM, Gleb Natapov wrote: On Fri, Sep 19, 2014 at 10:08:20AM -0700, H. Peter Anvin wrote: On 09/19/2014 09:53 AM, Gleb Natapov wrote: On Fri, Sep 19, 2014 at 09:40:07AM -0700, H. Peter Anvin wrote: On 09/19

Re: Standardizing an MSR or other hypercall to get an RNG seed?

2014-09-19 Thread Gleb Natapov
On Fri, Sep 19, 2014 at 10:21:27AM -0700, Andy Lutomirski wrote: On Sep 19, 2014 9:53 AM, Gleb Natapov g...@kernel.org wrote: On Fri, Sep 19, 2014 at 09:40:07AM -0700, H. Peter Anvin wrote: On 09/19/2014 09:37 AM, Gleb Natapov wrote: Linux detects what hypervior it runs on very

Re: Standardizing an MSR or other hypercall to get an RNG seed?

2014-09-19 Thread Gleb Natapov
On Fri, Sep 19, 2014 at 11:02:38AM -0700, Andy Lutomirski wrote: On Fri, Sep 19, 2014 at 10:49 AM, Gleb Natapov g...@kernel.org wrote: On Fri, Sep 19, 2014 at 10:18:37AM -0700, H. Peter Anvin wrote: On 09/19/2014 10:15 AM, Gleb Natapov wrote: On Fri, Sep 19, 2014 at 10:08:20AM -0700, H

Re: Standardizing an MSR or other hypercall to get an RNG seed?

2014-09-19 Thread Gleb Natapov
On Fri, Sep 19, 2014 at 11:20:49AM -0700, Andy Lutomirski wrote: [cc: Alok Kataria at VMware] On Fri, Sep 19, 2014 at 11:12 AM, Gleb Natapov g...@kernel.org wrote: On Fri, Sep 19, 2014 at 11:02:38AM -0700, Andy Lutomirski wrote: On Fri, Sep 19, 2014 at 10:49 AM, Gleb Natapov g

Re: [PATCH v2] kvm: Faults which trigger IO release the mmap_sem

2014-09-18 Thread Gleb Natapov
On Thu, Sep 18, 2014 at 08:29:17AM +0800, Wanpeng Li wrote: Hi Andres, On Wed, Sep 17, 2014 at 10:51:48AM -0700, Andres Lagar-Cavilla wrote: [...] static inline int check_user_page_hwpoison(unsigned long addr) { int rc, flags = FOLL_TOUCH | FOLL_HWPOISON | FOLL_WRITE; @@ -1177,9

Re: [PATCH v2] kvm: Faults which trigger IO release the mmap_sem

2014-09-18 Thread Gleb Natapov
on the IO. This is a bad thing, as other mmap semaphore users now stall as a function of swap or filemap latency. This patch ensures both the regular and async PF path re-enter the fault allowing for the mmap semaphore to be relinquished in the case of IO wait. Reviewed-by: Gleb Natapov g

Re: [PATCH] kvm: Faults which trigger IO release the mmap_sem

2014-09-17 Thread Gleb Natapov
On Mon, Sep 15, 2014 at 01:11:25PM -0700, Andres Lagar-Cavilla wrote: When KVM handles a tdp fault it uses FOLL_NOWAIT. If the guest memory has been swapped out or is behind a filemap, this will trigger async readahead and return immediately. The rationale is that KVM will kick back the guest

Re: [PATCH] kvm: Faults which trigger IO release the mmap_sem

2014-09-17 Thread Gleb Natapov
On Wed, Sep 17, 2014 at 01:27:14PM +0200, Radim Krčmář wrote: 2014-09-17 13:26+0300, Gleb Natapov: For async_pf_execute() you do not need to even retry. Next guest's page fault will retry it for you. Wouldn't that be a waste of vmentries? This is how it will work with or without

Re: [PATCH] kvm: Faults which trigger IO release the mmap_sem

2014-09-17 Thread Gleb Natapov
On Wed, Sep 17, 2014 at 10:00:32AM -0700, Andres Lagar-Cavilla wrote: On Wed, Sep 17, 2014 at 4:42 AM, Gleb Natapov g...@kernel.org wrote: On Wed, Sep 17, 2014 at 01:27:14PM +0200, Radim Krčmář wrote: 2014-09-17 13:26+0300, Gleb Natapov: For async_pf_execute() you do not need to even retry

Re: [PATCH] kvm: Faults which trigger IO release the mmap_sem

2014-09-17 Thread Gleb Natapov
On Wed, Sep 17, 2014 at 10:13:45AM -0700, Andres Lagar-Cavilla wrote: On Wed, Sep 17, 2014 at 10:08 AM, Gleb Natapov g...@kernel.org wrote: On Wed, Sep 17, 2014 at 10:00:32AM -0700, Andres Lagar-Cavilla wrote: On Wed, Sep 17, 2014 at 4:42 AM, Gleb Natapov g...@kernel.org wrote: On Wed, Sep

Re: [PATCH v5 4/7] kvm, mem-hotplug: Reload L1' apic access page on migration in vcpu_enter_guest().

2014-09-11 Thread Gleb Natapov
On Thu, Sep 11, 2014 at 11:21:49AM +0200, Paolo Bonzini wrote: Il 11/09/2014 07:38, Tang Chen ha scritto: diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 63c4c3e..da6d55d 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -7093,6 +7093,11 @@ static void

Re: [PATCH v5 4/7] kvm, mem-hotplug: Reload L1' apic access page on migration in vcpu_enter_guest().

2014-09-11 Thread Gleb Natapov
On Thu, Sep 11, 2014 at 12:47:16PM +0200, Paolo Bonzini wrote: Il 11/09/2014 12:12, Gleb Natapov ha scritto: On Thu, Sep 11, 2014 at 11:21:49AM +0200, Paolo Bonzini wrote: Il 11/09/2014 07:38, Tang Chen ha scritto: diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 63c4c3e

Re: [PATCH v5 4/7] kvm, mem-hotplug: Reload L1' apic access page on migration in vcpu_enter_guest().

2014-09-11 Thread Gleb Natapov
On Thu, Sep 11, 2014 at 03:05:05PM +0200, Paolo Bonzini wrote: Il 11/09/2014 13:30, Gleb Natapov ha scritto: +vmcs_write64(APIC_ACCESS_ADDR, page_to_phys(page)); +/* + * Do not pin apic access page in memory so

Re: [PATCH v5 4/7] kvm, mem-hotplug: Reload L1' apic access page on migration in vcpu_enter_guest().

2014-09-11 Thread Gleb Natapov
On Thu, Sep 11, 2014 at 04:06:58PM +0200, Paolo Bonzini wrote: Il 11/09/2014 15:59, Gleb Natapov ha scritto: Suppose vmcs01-APIC_ACCESS_ADDR = 0xf000. During L2 entry vmcs02-APIC_ACCESS_ADDR is set to 0xf000 too (by prepare_vmcs02). Now 0xf000 is migrated to 0x8000, mmu notifier

Re: [PATCH v5 4/7] kvm, mem-hotplug: Reload L1' apic access page on migration in vcpu_enter_guest().

2014-09-11 Thread Gleb Natapov
On Thu, Sep 11, 2014 at 04:24:04PM +0200, Paolo Bonzini wrote: Il 11/09/2014 16:21, Gleb Natapov ha scritto: As far as I can tell the if that is needed there is: if (!is_guest_mode() || !(vmcs12-secondary_vm_exec_control ECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES)) write

Re: [PATCH v5 4/7] kvm, mem-hotplug: Reload L1' apic access page on migration in vcpu_enter_guest().

2014-09-11 Thread Gleb Natapov
On Thu, Sep 11, 2014 at 04:37:39PM +0200, Paolo Bonzini wrote: Il 11/09/2014 16:31, Gleb Natapov ha scritto: What if the page being swapped out is L1's APIC access page? We don't run prepare_vmcs12 in that case because it's an L2-L0-L2 entry, so we need to do something. We will do

Re: [PATCH v4 1/6] kvm: Use APIC_DEFAULT_PHYS_BASE macro as the apic access page address.

2014-09-10 Thread Gleb Natapov
On Wed, Aug 27, 2014 at 06:17:36PM +0800, Tang Chen wrote: We have APIC_DEFAULT_PHYS_BASE defined as 0xfee0, which is also the address of apic access page. So use this macro. Reviewed-by: Gleb Natapov g...@kernel.org Signed-off-by: Tang Chen tangc...@cn.fujitsu.com --- arch/x86/kvm

Re: [PATCH v4 2/6] kvm: Remove ept_identity_pagetable from struct kvm_arch.

2014-09-10 Thread Gleb Natapov
, it cannot be migrated/hot-removed. After this patch, since kvm_arch-ept_identity_pagetable is removed, ept identity pagetable page is no longer pinned in memory. And it can be migrated/hot-removed. Reviewed-by: Gleb Natapov g...@kernel.org Signed-off-by: Tang Chen tangc

Re: [PATCH v4 4/6] kvm, mem-hotplug: Reload L1' apic access page on migration in vcpu_enter_guest().

2014-09-10 Thread Gleb Natapov
On Tue, Sep 09, 2014 at 03:13:07PM +0800, tangchen wrote: Hi Gleb, On 09/03/2014 11:04 PM, Gleb Natapov wrote: On Wed, Sep 03, 2014 at 09:42:30AM +0800, tangchen wrote: Hi Gleb, On 09/03/2014 12:00 AM, Gleb Natapov wrote: .. +static void vcpu_reload_apic_access_page(struct kvm_vcpu

Re: [PATCH 3/4] KVM: x86: inject nested page faults on emulated instructions

2014-09-05 Thread Gleb Natapov
On Thu, Sep 04, 2014 at 07:44:51PM +0200, Paolo Bonzini wrote: Il 04/09/2014 17:05, Gleb Natapov ha scritto: If you do that, KVM gets down to the if (writeback) and writes the ctxt-eip from L2 into the L1 EIP. Heh, that's a bummer. We should not write back if an instruction caused

Re: [PATCH 3/4] KVM: x86: inject nested page faults on emulated instructions

2014-09-04 Thread Gleb Natapov
On Tue, Sep 02, 2014 at 05:13:49PM +0200, Paolo Bonzini wrote: This is required for the following patch to work correctly. If a nested page fault happens during emulation, we must inject a vmexit, not a page fault. Luckily we already have the required machinery: it is enough to return

Re: [PATCH 3/4] KVM: x86: inject nested page faults on emulated instructions

2014-09-04 Thread Gleb Natapov
On Thu, Sep 04, 2014 at 04:12:19PM +0200, Paolo Bonzini wrote: Il 04/09/2014 09:02, Gleb Natapov ha scritto: On Tue, Sep 02, 2014 at 05:13:49PM +0200, Paolo Bonzini wrote: This is required for the following patch to work correctly. If a nested page fault happens during emulation, we

Re: [PATCH v4 4/6] kvm, mem-hotplug: Reload L1' apic access page on migration in vcpu_enter_guest().

2014-09-03 Thread Gleb Natapov
On Wed, Sep 03, 2014 at 09:42:30AM +0800, tangchen wrote: Hi Gleb, On 09/03/2014 12:00 AM, Gleb Natapov wrote: .. +static void vcpu_reload_apic_access_page(struct kvm_vcpu *vcpu) +{ +/* + * apic access page could be migrated. When the page is being migrated, + * GUP

Re: [PATCH v4 5/6] kvm, mem-hotplug: Reload L1's apic access page on migration when L2 is running.

2014-09-03 Thread Gleb Natapov
On Wed, Aug 27, 2014 at 06:17:40PM +0800, Tang Chen wrote: This patch only handle L1 and L2 vm share one apic access page situation. When L1 vm is running, if the shared apic access page is migrated, mmu_notifier will request all vcpus to exit to L0, and reload apic access page physical

Re: [PATCH v4 4/6] kvm, mem-hotplug: Reload L1' apic access page on migration in vcpu_enter_guest().

2014-09-02 Thread Gleb Natapov
On Wed, Aug 27, 2014 at 06:17:39PM +0800, Tang Chen wrote: apic access page is pinned in memory. As a result, it cannot be migrated/hot-removed. Actually, it is not necessary to be pinned. The hpa of apic access page is stored in VMCS APIC_ACCESS_ADDR pointer. When the page is migrated,

Re: GET_RNG_SEED hypercall ABI? (Re: [PATCH v5 0/5] random,x86,kvm: Rework arch RNG seeds and get some from kvm)

2014-08-28 Thread Gleb Natapov
On Tue, Aug 26, 2014 at 04:58:34PM -0700, Andy Lutomirski wrote: hpa pointed out that the ABI that I chose (an MSR from the KVM range and a KVM cpuid bit) is unnecessarily KVM-specific. It would be nice to allocate an MSR that everyone involved can agree on and, rather than relying on a cpuid

Re: [PATCH] KVM-Use value reading from MSR when construct the eptp in VMX mode

2014-08-25 Thread Gleb Natapov
On Mon, Aug 25, 2014 at 11:16:34AM +0800, Dennis Chen wrote: On Sun, Aug 24, 2014 at 5:38 PM, Gleb Natapov g...@kernel.org wrote: On Sun, Aug 24, 2014 at 11:54:32AM +0800, Dennis Chen wrote: This patch is used to construct the eptp in vmx mode with values readed from MSR according

Re: [patch 3/4] KVM: MMU: reload request from GET_DIRTY_LOG path

2014-07-21 Thread Gleb Natapov
On Wed, Jul 09, 2014 at 04:12:53PM -0300, mtosa...@redhat.com wrote: Reload remote vcpus MMU from GET_DIRTY_LOG codepath, before deleting a pinned spte. Signed-off-by: Marcelo Tosatti mtosa...@redhat.com --- arch/x86/kvm/mmu.c | 29 +++-- 1 file changed, 23

Re: [PATCH v2 5/5] kvm, mem-hotplug: Do not pin apic access page in memory.

2014-07-18 Thread Gleb Natapov
On Fri, Jul 18, 2014 at 05:05:20PM +0800, Tang Chen wrote: Hi Gleb, On 07/17/2014 09:57 PM, Gleb Natapov wrote: On Thu, Jul 17, 2014 at 09:34:20PM +0800, Tang Chen wrote: Hi Gleb, On 07/15/2014 08:40 PM, Gleb Natapov wrote: .. And yes, we have the problem you said here. We can

Re: [PATCH v2 5/5] kvm, mem-hotplug: Do not pin apic access page in memory.

2014-07-17 Thread Gleb Natapov
On Thu, Jul 17, 2014 at 09:34:20PM +0800, Tang Chen wrote: Hi Gleb, On 07/15/2014 08:40 PM, Gleb Natapov wrote: .. And yes, we have the problem you said here. We can migrate the page while L2 vm is running. So I think we should enforce L2 vm to exit to L1. Right ? We can request

Re: [PATCH 0/4] random,x86,kvm: Add and use MSR_KVM_GET_RNG_SEED

2014-07-16 Thread Gleb Natapov
On Tue, Jul 15, 2014 at 07:48:06PM -0700, Andy Lutomirski wrote: virtio-rng is both too complicated and insufficient for initial rng seeding. It's far too complicated to use for KASLR or any other early boot random number needs. It also provides /dev/random-style bits, which means that

Re: [PATCH 0/4] random,x86,kvm: Add and use MSR_KVM_GET_RNG_SEED

2014-07-16 Thread Gleb Natapov
On Wed, Jul 16, 2014 at 09:10:27AM +0200, Daniel Borkmann wrote: On 07/16/2014 08:41 AM, Gleb Natapov wrote: On Tue, Jul 15, 2014 at 07:48:06PM -0700, Andy Lutomirski wrote: virtio-rng is both too complicated and insufficient for initial rng seeding. It's far too complicated to use for KASLR

Re: [PATCH 0/4] random,x86,kvm: Add and use MSR_KVM_GET_RNG_SEED

2014-07-16 Thread Gleb Natapov
On Wed, Jul 16, 2014 at 04:32:19PM +0200, Paolo Bonzini wrote: Il 16/07/2014 16:07, Andy Lutomirski ha scritto: This patch has nothing whatsoever to do with how much I trust the CPU vs the hypervisor. It's for the enormous installed base of machines without RDRAND. Ok. I think an MSR is

Re: [PATCH 0/4] random,x86,kvm: Add and use MSR_KVM_GET_RNG_SEED

2014-07-16 Thread Gleb Natapov
On Wed, Jul 16, 2014 at 09:13:23AM -0700, H. Peter Anvin wrote: On 07/16/2014 09:08 AM, Paolo Bonzini wrote: Il 16/07/2014 18:03, H. Peter Anvin ha scritto: I suggested emulating RDRAND *but not set the CPUID bit*. We already developed a protocol in KVM/Qemu to enumerate emulated features

Re: [PATCH v2 5/5] kvm, mem-hotplug: Do not pin apic access page in memory.

2014-07-15 Thread Gleb Natapov
On Tue, Jul 15, 2014 at 01:52:40PM +0200, Jan Kiszka wrote: On 2014-07-14 16:58, Gleb Natapov wrote: diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index ffbe557..7080eda 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -5929,6 +5929,18 @@ static void vcpu_scan_ioapic

Re: [PATCH v2 5/5] kvm, mem-hotplug: Do not pin apic access page in memory.

2014-07-15 Thread Gleb Natapov
On Tue, Jul 15, 2014 at 08:28:22PM +0800, Tang Chen wrote: On 07/15/2014 08:09 PM, Gleb Natapov wrote: On Tue, Jul 15, 2014 at 01:52:40PM +0200, Jan Kiszka wrote: .. I cannot follow your concerns yet. Specifically, how should APIC_ACCESS_ADDR (the VMCS field, right?) change while L2

Re: [PATCH v2 5/5] kvm, mem-hotplug: Do not pin apic access page in memory.

2014-07-15 Thread Gleb Natapov
On Tue, Jul 15, 2014 at 03:10:15PM +0200, Jan Kiszka wrote: On 2014-07-15 14:40, Gleb Natapov wrote: .. 7922 if (!vmx-nested.apic_access_page) 7923 exec_control = 7924 ~SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES; 7925

Re: [PATCH v2 5/5] kvm, mem-hotplug: Do not pin apic access page in memory.

2014-07-15 Thread Gleb Natapov
On Tue, Jul 15, 2014 at 08:54:01PM +0800, Tang Chen wrote: On 07/15/2014 08:40 PM, Gleb Natapov wrote: On Tue, Jul 15, 2014 at 08:28:22PM +0800, Tang Chen wrote: On 07/15/2014 08:09 PM, Gleb Natapov wrote: On Tue, Jul 15, 2014 at 01:52:40PM +0200, Jan Kiszka wrote: .. I cannot follow

Re: [RESEND PATCH v2 4/5] kvm: Remove ept_identity_pagetable from struct kvm_arch.

2014-07-14 Thread Gleb Natapov
On Mon, Jul 14, 2014 at 05:17:04PM +0800, Tang Chen wrote: On 07/12/2014 03:44 PM, Gleb Natapov wrote: On Wed, Jul 09, 2014 at 10:08:03AM +0800, Tang Chen wrote: kvm_arch-ept_identity_pagetable holds the ept identity pagetable page. But it is never used to refer to the page at all. In vcpu

Re: [PATCH v2 5/5] kvm, mem-hotplug: Do not pin apic access page in memory.

2014-07-14 Thread Gleb Natapov
CCing Jan to check my nested kvm findings below. On Mon, Jul 14, 2014 at 03:57:09PM +0800, Tang Chen wrote: Hi Gleb, Thanks for the reply. Please see below. On 07/12/2014 04:04 PM, Gleb Natapov wrote: On Tue, Jul 08, 2014 at 09:01:32PM +0800, Tang Chen wrote: apic access page is pinned

Re: [RESEND PATCH v2 4/5] kvm: Remove ept_identity_pagetable from struct kvm_arch.

2014-07-12 Thread Gleb Natapov
On Wed, Jul 09, 2014 at 10:08:03AM +0800, Tang Chen wrote: kvm_arch-ept_identity_pagetable holds the ept identity pagetable page. But it is never used to refer to the page at all. In vcpu initialization, it indicates two things: 1. indicates if ept page is allocated 2. indicates if a memory

Re: [PATCH v2 5/5] kvm, mem-hotplug: Do not pin apic access page in memory.

2014-07-12 Thread Gleb Natapov
On Tue, Jul 08, 2014 at 09:01:32PM +0800, Tang Chen wrote: apic access page is pinned in memory. As a result, it cannot be migrated/hot-removed. Actually, it is not necessary to be pinned. The hpa of apic access page is stored in VMCS APIC_ACCESS_ADDR pointer. When the page is migrated,

Re: [PATCH 4/4] kvm, mem-hotplug: Update apic access page when it is migrated.

2014-07-07 Thread Gleb Natapov
On Mon, Jul 07, 2014 at 02:42:27PM +0300, Nadav Amit wrote: Tang, Running some (unrelated) tests I see that KVM does not handle APIC base relocation correctly. When the base is changed, kvm_lapic_set_base just changes lapic-base_address without taking further action (i.e., modifying the

Re: [PATCH 4/4] kvm, mem-hotplug: Update apic access page when it is migrated.

2014-07-07 Thread Gleb Natapov
On Mon, Jul 07, 2014 at 03:10:23PM +0300, Nadav Amit wrote: On 7/7/14, 2:54 PM, Gleb Natapov wrote: On Mon, Jul 07, 2014 at 02:42:27PM +0300, Nadav Amit wrote: Tang, Running some (unrelated) tests I see that KVM does not handle APIC base relocation correctly. When the base is changed

Re: [PATCH] x86: Make x2APIC support depend on interrupt remapping or guest support

2014-07-06 Thread Gleb Natapov
On Sat, Jul 05, 2014 at 09:47:54AM +0200, Jan Kiszka wrote: From: Jan Kiszka jan.kis...@siemens.com We are able to use x2APIC mode in the absence of interrupt remapping on certain hypervisors. So it if fine to disable IRQ_REMAP without having to give up x2APIC support. FWIW I did similar

Re: [PATCH] x86: Make x2APIC support depend on interrupt remapping or guest support

2014-07-06 Thread Gleb Natapov
On Sun, Jul 06, 2014 at 05:24:27PM +0200, Jan Kiszka wrote: On 2014-07-06 17:12, Gleb Natapov wrote: On Sat, Jul 05, 2014 at 09:47:54AM +0200, Jan Kiszka wrote: From: Jan Kiszka jan.kis...@siemens.com We are able to use x2APIC mode in the absence of interrupt remapping on certain

Re: [PATCH] x86: Make x2APIC support depend on interrupt remapping or guest support

2014-07-06 Thread Gleb Natapov
On Sun, Jul 06, 2014 at 05:49:09PM +0200, Jan Kiszka wrote: On 2014-07-06 17:41, Gleb Natapov wrote: On Sun, Jul 06, 2014 at 05:24:27PM +0200, Jan Kiszka wrote: On 2014-07-06 17:12, Gleb Natapov wrote: On Sat, Jul 05, 2014 at 09:47:54AM +0200, Jan Kiszka wrote: From: Jan Kiszka jan.kis

Re: [PATCH 3/4] kvm, memory-hotplug: Update ept identity pagetable when it is migrated.

2014-07-04 Thread Gleb Natapov
On Fri, Jul 04, 2014 at 10:36:06AM +0800, Tang Chen wrote: Hi Gleb, On 07/03/2014 12:34 AM, Gleb Natapov wrote: On Wed, Jul 02, 2014 at 05:00:36PM +0800, Tang Chen wrote: ept identity pagetable is pinned in memory, and as a result it cannot be migrated/hot-removed. But actually

Re: [PATCH 4/4] kvm, mem-hotplug: Update apic access page when it is migrated.

2014-07-04 Thread Gleb Natapov
On Fri, Jul 04, 2014 at 10:18:25AM +0800, Tang Chen wrote: Hi Gleb, Thanks for the advices. Please see below. On 07/03/2014 09:55 PM, Gleb Natapov wrote: .. @@ -575,6 +575,7 @@ struct kvm_arch { unsigned int tss_addr; struct page *apic_access_page; + bool

Re: [PATCH 0/4] kvm, mem-hotplug: Do not pin ept identity pagetable and apic access page.

2014-07-03 Thread Gleb Natapov
On Thu, Jul 03, 2014 at 09:17:59AM +0800, Tang Chen wrote: Hi Gleb, On 07/02/2014 05:00 PM, Tang Chen wrote: Hi Gleb, Marcelo, Please help to review this patch-set. NOTE: This patch-set doesn't work properly. ept identity pagetable and apic access page in kvm are pinned in memory.

Re: [PATCH 4/4] kvm, mem-hotplug: Update apic access page when it is migrated.

2014-07-03 Thread Gleb Natapov
On Wed, Jul 02, 2014 at 05:00:37PM +0800, Tang Chen wrote: apic access page is pinned in memory, and as a result it cannot be migrated/hot-removed. Actually it doesn't need to be pinned in memory. This patch introduces a new vcpu request: KVM_REQ_MIGRATE_EPT. This requet will be made when

Re: [PATCH 2/4] kvm: Add macro VMX_APIC_ACCESS_PAGE_ADDR

2014-07-02 Thread Gleb Natapov
On Wed, Jul 02, 2014 at 05:00:35PM +0800, Tang Chen wrote: Define guest phys_addr of apic access page. --- arch/x86/include/asm/vmx.h | 2 +- arch/x86/kvm/svm.c | 3 ++- arch/x86/kvm/vmx.c | 7 --- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git

Re: [PATCH 3/4] kvm, memory-hotplug: Update ept identity pagetable when it is migrated.

2014-07-02 Thread Gleb Natapov
On Wed, Jul 02, 2014 at 05:00:36PM +0800, Tang Chen wrote: ept identity pagetable is pinned in memory, and as a result it cannot be migrated/hot-removed. But actually it doesn't need to be pinned in memory. This patch introduces a new vcpu request: KVM_REQ_MIGRATE_EPT to reset ept

Re: [patch 4/5] KVM: MMU: reload request from GET_DIRTY_LOG path

2014-07-01 Thread Gleb Natapov
On Mon, Jun 30, 2014 at 05:59:02PM -0300, Marcelo Tosatti wrote: On Fri, Jun 20, 2014 at 01:46:10PM +0300, Gleb Natapov wrote: On Thu, Jun 19, 2014 at 03:40:31PM -0300, Marcelo Tosatti wrote: On Thu, Jun 19, 2014 at 11:17:19AM +0300, Gleb Natapov wrote: On Wed, Jun 18, 2014 at 08:12:07PM

Re: [RFC PATCH 1/1] Move two pinned pages to non-movable node in kvm.

2014-06-30 Thread Gleb Natapov
On Mon, Jun 30, 2014 at 09:45:32AM +0800, Tang Chen wrote: On 06/21/2014 04:39 AM, Marcelo Tosatti wrote: On Fri, Jun 20, 2014 at 05:31:46PM -0300, Marcelo Tosatti wrote: IIRC your shadow page pinning patch series support flushing of ptes by mmu notifier by forcing MMU reload and, as a result,

Re: [PATCH] KVM: x86: Pending interrupt may be delivered after INIT

2014-06-30 Thread Gleb Natapov
On Mon, Jun 30, 2014 at 11:35:27AM +0300, Nadav Amit wrote: We encountered a scenario in which after an INIT is delivered, a pending interrupt is delivered, although it was sent before the INIT. As the SDM states in section 10.4.7.1, the ISR and the IRR should be cleared after INIT as KVM

Re: [PATCH] KVM: SVM: Fix CPL export via SS.DPL

2014-06-30 Thread Gleb Natapov
On Mon, Jun 30, 2014 at 05:15:44PM +0200, Borislav Petkov wrote: On Mon, Jun 30, 2014 at 05:03:57PM +0200, Jan Kiszka wrote: 15.5.1: When examining segment attributes after a #VMEXIT: [...] • Retrieve the CPL from the CPL field in the VMCB, not from any segment DPL. Heey, it is

Re: __schedule #DF splat

2014-06-29 Thread Gleb Natapov
On Sat, Jun 28, 2014 at 01:44:31PM +0200, Borislav Petkov wrote: qemu-system-x86-20240 [006] ...1 9406.484134: kvm_page_fault: address 7fffb62ba318 error_code 2 qemu-system-x86-20240 [006] ...1 9406.484136: kvm_inj_exception: #PF (0x2)a kvm injects the #PF into the guest.

Re: __schedule #DF splat

2014-06-29 Thread Gleb Natapov
On Sun, Jun 29, 2014 at 11:56:03AM +0200, Jan Kiszka wrote: On 2014-06-29 08:46, Gleb Natapov wrote: On Sat, Jun 28, 2014 at 01:44:31PM +0200, Borislav Petkov wrote: qemu-system-x86-20240 [006] ...1 9406.484134: kvm_page_fault: address 7fffb62ba318 error_code 2 qemu-system-x86-20240

Re: __schedule #DF splat

2014-06-29 Thread Gleb Natapov
On Sun, Jun 29, 2014 at 12:31:50PM +0200, Jan Kiszka wrote: On 2014-06-29 12:24, Gleb Natapov wrote: On Sun, Jun 29, 2014 at 11:56:03AM +0200, Jan Kiszka wrote: On 2014-06-29 08:46, Gleb Natapov wrote: On Sat, Jun 28, 2014 at 01:44:31PM +0200, Borislav Petkov wrote: qemu-system-x86-20240

Re: __schedule #DF splat

2014-06-29 Thread Gleb Natapov
On Sun, Jun 29, 2014 at 03:14:43PM +0200, Borislav Petkov wrote: On Sun, Jun 29, 2014 at 02:22:35PM +0200, Jan Kiszka wrote: OK, looks like I won ;): I gladly let you win. :-P The issue was apparently introduced with KVM: x86: get CPL from SS.DPL (ae9fedc793). Maybe we are not properly

Re: __schedule #DF splat

2014-06-29 Thread Gleb Natapov
On Sun, Jun 29, 2014 at 04:01:04PM +0200, Borislav Petkov wrote: On Sun, Jun 29, 2014 at 04:42:47PM +0300, Gleb Natapov wrote: Please do so and let us know. Yep, just did. Reverting ae9fedc793 fixes the issue. reinj:1 means that previous injection failed due to another #PF

Re: [RFC PATCH 1/1] Move two pinned pages to non-movable node in kvm.

2014-06-22 Thread Gleb Natapov
On Fri, Jun 20, 2014 at 05:31:46PM -0300, Marcelo Tosatti wrote: Same with the APIC access page. APIC page is always mapped into guest's APIC base address 0xfee0. The way it works is that when vCPU accesses page at 0xfee0 the access is translated to APIC access page physical

Re: [patch 2/5] KVM: MMU: allow pinning spte translations (TDP-only)

2014-06-20 Thread Gleb Natapov
On Thu, Jun 19, 2014 at 04:22:57PM -0300, Marcelo Tosatti wrote: On Thu, Jun 19, 2014 at 10:21:16AM +0300, Gleb Natapov wrote: On Wed, Jun 18, 2014 at 08:12:05PM -0300, mtosa...@redhat.com wrote: Allow vcpus to pin spte translations by: 1) Creating a per-vcpu list of pinned ranges

Re: [patch 3/5] KVM: MMU: notifiers support for pinned sptes

2014-06-20 Thread Gleb Natapov
On Thu, Jun 19, 2014 at 03:28:25PM -0300, Marcelo Tosatti wrote: On Thu, Jun 19, 2014 at 09:48:50AM +0300, Gleb Natapov wrote: On Wed, Jun 18, 2014 at 08:12:06PM -0300, mtosa...@redhat.com wrote: Request KVM_REQ_MMU_RELOAD when deleting sptes from MMU notifiers. Keep pinned sptes

Re: [patch 4/5] KVM: MMU: reload request from GET_DIRTY_LOG path

2014-06-20 Thread Gleb Natapov
On Thu, Jun 19, 2014 at 03:40:31PM -0300, Marcelo Tosatti wrote: On Thu, Jun 19, 2014 at 11:17:19AM +0300, Gleb Natapov wrote: On Wed, Jun 18, 2014 at 08:12:07PM -0300, mtosa...@redhat.com wrote: Reload remote vcpus MMU from GET_DIRTY_LOG codepath, before deleting a pinned spte

Re: [RFC PATCH 1/1] Move two pinned pages to non-movable node in kvm.

2014-06-20 Thread Gleb Natapov
On Thu, Jun 19, 2014 at 04:00:24PM -0300, Marcelo Tosatti wrote: On Thu, Jun 19, 2014 at 12:20:32PM +0300, Gleb Natapov wrote: CCing Marcelo, On Wed, Jun 18, 2014 at 02:50:44PM +0800, Tang Chen wrote: Hi Gleb, Thanks for the quick reply. Please see below. On 06/18/2014 02

Re: [RFC PATCH 1/1] Move two pinned pages to non-movable node in kvm.

2014-06-20 Thread Gleb Natapov
On Fri, Jun 20, 2014 at 09:53:26AM -0300, Marcelo Tosatti wrote: On Fri, Jun 20, 2014 at 02:15:10PM +0300, Gleb Natapov wrote: On Thu, Jun 19, 2014 at 04:00:24PM -0300, Marcelo Tosatti wrote: On Thu, Jun 19, 2014 at 12:20:32PM +0300, Gleb Natapov wrote: CCing Marcelo, On Wed

Re: [patch 3/5] KVM: MMU: notifiers support for pinned sptes

2014-06-19 Thread Gleb Natapov
On Wed, Jun 18, 2014 at 08:12:06PM -0300, mtosa...@redhat.com wrote: Request KVM_REQ_MMU_RELOAD when deleting sptes from MMU notifiers. Keep pinned sptes intact if page aging. Signed-off-by: Marcelo Tosatti mtosa...@redhat.com --- arch/x86/kvm/mmu.c | 71

Re: [patch 2/5] KVM: MMU: allow pinning spte translations (TDP-only)

2014-06-19 Thread Gleb Natapov
On Wed, Jun 18, 2014 at 08:12:05PM -0300, mtosa...@redhat.com wrote: Allow vcpus to pin spte translations by: 1) Creating a per-vcpu list of pinned ranges. What if memory slot containing pinned range is going away? 2) On mmu reload request: - Fault ranges. - Mark sptes with a

Re: [patch 4/5] KVM: MMU: reload request from GET_DIRTY_LOG path

2014-06-19 Thread Gleb Natapov
On Wed, Jun 18, 2014 at 08:12:07PM -0300, mtosa...@redhat.com wrote: Reload remote vcpus MMU from GET_DIRTY_LOG codepath, before deleting a pinned spte. Signed-off-by: Marcelo Tosatti mtosa...@redhat.com --- arch/x86/kvm/mmu.c |3 +++ 1 file changed, 3 insertions(+) Index:

  1   2   3   4   5   6   7   8   9   10   >