[PATCH] KVM: nVMX: Fix IRQs inject to L2 which belong to L1 since race

2014-07-01 Thread Wanpeng Li
introduced a l1_events_blocked field in nested_vmx which indicates there is still-pending event which blocked by nested_run_pending, and smart request a KVM_REQ_EVENT if there is a still-pending event which blocked by nested_run_pending. Signed-off-by: Wanpeng Li --- arch/x86/kvm/

Re: [PATCH] KVM: nVMX: Fix IRQs inject to L2 which belong to L1 since race

2014-07-02 Thread Wanpeng Li
Hi Jan, On Wed, Jul 02, 2014 at 11:01:30AM +0200, Jan Kiszka wrote: >On 2014-07-02 08:54, Wanpeng Li wrote: >> This patch fix bug https://bugzilla.kernel.org/show_bug.cgi?id=72381 >> >> If we didn't inject a still-pending event to L1 since nested_run_pending, >> K

Re: [PATCH] KVM: nVMX: Fix IRQs inject to L2 which belong to L1 since race

2014-07-02 Thread Wanpeng Li
Hi Bandan, On Wed, Jul 02, 2014 at 12:27:59PM -0400, Bandan Das wrote: >Wanpeng Li writes: > >> This patch fix bug https://bugzilla.kernel.org/show_bug.cgi?id=72381 >I can also reproduce this easily with Linux as L1 by "slowing it down" >eg. running with ept = 0 >

Re: [PATCH] KVM: nVMX: Fix IRQs inject to L2 which belong to L1 since race

2014-07-03 Thread Wanpeng Li
On Thu, Jul 03, 2014 at 01:15:26AM -0400, Bandan Das wrote: >Jan Kiszka writes: > >> On 2014-07-02 08:54, Wanpeng Li wrote: >>> This patch fix bug https://bugzilla.kernel.org/show_bug.cgi?id=72381 >>> >>> If we didn't inject a still-

Re: copy_huge_page: unable to handle kernel NULL pointer dereference at 0000000000000008

2014-07-03 Thread Wanpeng Li
You should also Cc mm ML On Thu, Jul 03, 2014 at 12:57:04AM -0700, jipan yang wrote: >Hi, > >I've seen the problem quite a few times. Before spending more time on >it, I'd like to have a quick check here to see if anyone ever saw the >same problem? Hope it is a relevant question with this mail li

Re: [PATCH] KVM: nVMX: Fix IRQs inject to L2 which belong to L1 since race

2014-07-03 Thread Wanpeng Li
eventinj.flat and w/o my patch applied SUMMARY: 13 tests, 0 failures w/ eventinj.flat and w/ my patch applied SUMMARY: 13 tests, 0 failures I'm not sure if the bug you mentioned has any relationship with "Fail: intercepted interrupt + hlt" which has already present before my patc

Re: [PATCH] KVM: nVMX: Fix IRQs inject to L2 which belong to L1 since race

2014-07-03 Thread Wanpeng Li
On Fri, Jul 04, 2014 at 07:43:14AM +0200, Jan Kiszka wrote: >On 2014-07-04 04:52, Wanpeng Li wrote: >> On Thu, Jul 03, 2014 at 01:27:05PM -0400, Bandan Das wrote: >> [...] >>> # modprobe kvm_intel ept=0 nested=1 enable_shadow_vmcs=0 >>> >>> The Host CPU

Re: [PATCH] KVM: nVMX: Fix IRQs inject to L2 which belong to L1 since race

2014-07-03 Thread Wanpeng Li
On Thu, Jul 03, 2014 at 01:15:26AM -0400, Bandan Das wrote: >Jan Kiszka writes: > >> On 2014-07-02 08:54, Wanpeng Li wrote: >>> This patch fix bug https://bugzilla.kernel.org/show_bug.cgi?id=72381 >>> >>> If we didn't inject a still-

[PATCH] KVM: nVMX: Fix vmptrld fail and vmwrite error when L1 goes down w/ enable_shadow_vmcs

2014-07-03 Thread Wanpeng Li
mcs in nested_free_all_saved_vmcss() and kfree it after free_loaded_vmcs(). This can also avoid use after free bug. Signed-off-by: Wanpeng Li --- arch/x86/kvm/vmx.c | 15 +++ 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 0

Re: [PATCH] KVM: nVMX: Fix IRQs inject to L2 which belong to L1 since race

2014-07-04 Thread Wanpeng Li
On Fri, Jul 04, 2014 at 09:19:54AM +0200, Jan Kiszka wrote: >On 2014-07-04 08:08, Wanpeng Li wrote: >> On Fri, Jul 04, 2014 at 07:43:14AM +0200, Jan Kiszka wrote: >>> On 2014-07-04 04:52, Wanpeng Li wrote: >>>> On Thu, Jul 03, 2014 at 01:27:05PM -0400, Bandan Das wrot

Re: [PATCH] KVM: nVMX: Fix IRQs inject to L2 which belong to L1 since race

2014-07-04 Thread Wanpeng Li
On Fri, Jul 04, 2014 at 09:46:38AM +0200, Paolo Bonzini wrote: >Il 04/07/2014 09:39, Wanpeng Li ha scritto: >>PASS: test vmxon with FEATURE_CONTROL cleared >>PASS: test vmxon without FEATURE_CONTROL lock >>PASS: test enable VMX in FEATURE_CONTROL >>PASS: test FEATURE_CO

Re: [PATCH] KVM: nVMX: Fix IRQs inject to L2 which belong to L1 since race

2014-07-04 Thread Wanpeng Li
On Fri, Jul 04, 2014 at 10:14:34AM +0200, Paolo Bonzini wrote: >Il 04/07/2014 09:59, Wanpeng Li ha scritto: >>>>You are not running the latest versions of the tests. >>>> >>The last commit in my tree is >> >>commit daeec9795d3e6d4e9636588b6cb5fcd6e00d6

Re: [PATCH] KVM: nVMX: Fix IRQs inject to L2 which belong to L1 since race

2014-07-07 Thread Wanpeng Li
>I do think this patch is doing the right thing, but it's just exposing another >bug somewhere else :) Agreed. Hi Paolo, Is it ok for you to apply this patch and then more effort should be taken to figure out the other bug which don't have any relationship with the race that this patch fixed? Regards, Wanpeng Li > >Bandan -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html

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

2014-07-07 Thread Wanpeng Li
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 s/KVM_REQ_MIGRATE_

Re: [PATCH] KVM: nVMX: Fix IRQs inject to L2 which belong to L1 since race

2014-07-07 Thread Wanpeng Li
ged." Your trick still keep the unconditionally setting KVM_REQ_EVENT which is the root cause of the race there, anyway, I focus on fix the hang currently and a patch will be submitted soon. Regards, Wanpeng Li > >> Paolo >> >>> I think that will take care of >

Re: [PATCH] KVM: nVMX: Fix IRQs inject to L2 which belong to L1 since race

2014-07-07 Thread Wanpeng Li
On Mon, Jul 07, 2014 at 03:03:13PM +0200, Paolo Bonzini wrote: >Il 07/07/2014 10:46, Wanpeng Li ha scritto: >>Hi Paolo, >> >>Is it ok for you to apply this patch and then more effort should be taken >>to figure out the other bug which don't have any relationship

Re: [PATCH] KVM: x86: Check for nested events if there is an injectable interrupt

2014-07-08 Thread Wanpeng Li
; >Thinking more about it, I think this is the right fix. Not setting >KVM_REQ_EVENT in some cases can be an optimization, but it's not >necessary. Definitely there are other cases in which KVM_REQ_EVENT >is set even though no event is pending---most notably during >emulation of in

Re: [PATCH] KVM: nVMX: Fix vmptrld fail and vmwrite error when L1 goes down w/ enable_shadow_vmcs

2014-07-08 Thread Wanpeng Li
Ping, On Fri, Jul 04, 2014 at 02:52:38PM +0800, Wanpeng Li wrote: >This bug can be trigger by L1 goes down directly w/ enable_shadow_vmcs. > >[ 6413.158950] kvm: vmptrld (null)/7800 failed >[ 6413.158954] vmwrite error: reg 401e value 4 (err 1) >[ 6413.158957] C

[PATCH][RESEND] KVM: nVMX: Fix vmptrld fail and vmwrite error when L1 goes down

2014-07-10 Thread Wanpeng Li
mcs in nested_free_all_saved_vmcss() and kfree it after free_loaded_vmcs(). This can also avoid use after free bug. Signed-off-by: Wanpeng Li --- arch/x86/kvm/vmx.c | 15 +++ 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 0

Re: [PATCH][RESEND] KVM: nVMX: Fix vmptrld fail and vmwrite error when L1 goes down

2014-07-13 Thread Wanpeng Li
Hi Marcelo, On Fri, Jul 11, 2014 at 05:03:34PM -0300, Marcelo Tosatti wrote: >On Fri, Jul 11, 2014 at 12:22:17PM +0800, Wanpeng Li wrote: >> This bug can be trigger by L1 goes down directly w/ enable_shadow_vmcs. >> >> [ 6413.158950] kvm: vmptrld (null

[PATCH 2/3] KVM: nVMX: Fix fail to get nested ack intr's vector during nested vmexit

2014-07-16 Thread Wanpeng Li
after sync pir to irr. Signed-off-by: Wanpeng Li --- arch/x86/kvm/lapic.c | 1 + arch/x86/kvm/vmx.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c index 0069118..b7d45dc 100644 --- a/arch/x86/kvm/lapic.c +++ b/arch/x86/kvm/lapic.c @@ -1637,6

[PATCH 3/3] KVM: nVMX: Fix vmptrld fail and vmwrite error when L1 goes down

2014-07-16 Thread Wanpeng Li
for L1 destroy since they will be reinitialized after L1 recreate. Signed-off-by: Wanpeng Li --- arch/x86/kvm/vmx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index fbce89e..2b28da7 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm

[PATCH 1/3] KVM: nVMX: Fix virtual interrupt delivery injection

2014-07-16 Thread Wanpeng Li
ntr to L1 if current is L1 or L2 through old injection way if L1 doen't have VM_EXIT_ACK_INTR_ON_EXIT set. Signed-off-by: Wanpeng Li Signed-off-by: "Zhang, Yang Z" --- arch/x86/kvm/vmx.c | 18 -- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/arch

Re: [PATCH 1/3] KVM: nVMX: Fix virtual interrupt delivery injection

2014-07-17 Thread Wanpeng Li
On Thu, Jul 17, 2014 at 09:03:01AM +, Zhang, Yang Z wrote: >Paolo Bonzini wrote on 2014-07-17: >> Il 17/07/2014 06:56, Wanpeng Li ha scritto: >>> This patch fix bug reported in >>> https://bugzilla.kernel.org/show_bug.cgi?id=73331, after the patch >>> http:/

Re: [PATCH 2/3] KVM: nVMX: Fix fail to get nested ack intr's vector during nested vmexit

2014-07-17 Thread Wanpeng Li
On Thu, Jul 17, 2014 at 09:13:56AM +, Zhang, Yang Z wrote: >Paolo Bonzini wrote on 2014-07-17: >> Il 17/07/2014 06:56, Wanpeng Li ha scritto: >>> && nested_exit_intr_ack_set(vcpu)) { >>> int irq = kvm_cpu_get_interrupt(vcpu)

Re: [PATCH 2/3] KVM: nVMX: Fix fail to get nested ack intr's vector during nested vmexit

2014-07-17 Thread Wanpeng Li
On Thu, Jul 17, 2014 at 09:13:56AM +, Zhang, Yang Z wrote: >Paolo Bonzini wrote on 2014-07-17: >> Il 17/07/2014 06:56, Wanpeng Li ha scritto: >>> && nested_exit_intr_ack_set(vcpu)) { >>> int irq = kvm_cpu_get_interrupt(vcpu)

[PATCH v2 2/2] KVM: nVMX: Fix fail to get nested ack intr's vector during nested vmexit

2014-07-17 Thread Wanpeng Li
sync pir to irr. Reviewed-by: Yang Zhang Signed-off-by: Wanpeng Li --- v1 -> v2: * replace kvm_get_apic_interrupt() by kvm_lapic_find_highest_irr() arch/x86/kvm/lapic.c | 1 + arch/x86/kvm/vmx.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lap

[PATCH v2 1/2] KVM: nVMX: Fix virtual interrupt delivery injection

2014-07-17 Thread Wanpeng Li
From: Wanpeng Li This patch fix bug reported in https://bugzilla.kernel.org/show_bug.cgi?id=73331, after the patch http://www.spinics.net/lists/kvm/msg105230.html applied, there is some progress and the L2 can boot up, however, slowly. The original idea of this fix vid injection patch is

Re: [PATCH 1/3] KVM: nVMX: Fix virtual interrupt delivery injection

2014-07-17 Thread Wanpeng Li
On Thu, Jul 17, 2014 at 12:43:58PM +0200, Paolo Bonzini wrote: >Il 17/07/2014 11:11, Wanpeng Li ha scritto: >>>>>> What hypervisor did you test with? nested_exit_on_intr(vcpu) will >>>> >>>>Jailhouse will clear External-interrupt exiting bit. Am I rig

Re: [PATCH v2 1/2] KVM: nVMX: Fix virtual interrupt delivery injection

2014-07-17 Thread Wanpeng Li
On Thu, Jul 17, 2014 at 01:31:06PM +0200, Paolo Bonzini wrote: >Il 17/07/2014 13:03, Wanpeng Li ha scritto: >>+ /* >>+ * Fall back to old way to inject the interrupt since there >>+ * is no vAPIC-v for L2. >>+

Re: [PATCH v2 2/2] KVM: nVMX: Fix fail to get nested ack intr's vector during nested vmexit

2014-07-17 Thread Wanpeng Li
On Thu, Jul 17, 2014 at 02:04:11PM +0200, Paolo Bonzini wrote: >Il 17/07/2014 13:28, Paolo Bonzini ha scritto: >> Il 17/07/2014 13:03, Wanpeng Li ha scritto: >>> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c >>> index 4ae5ad8..a704f71 100644 >>> --- a/a

[PATCH] KVM: nVMX: nested TPR shadow/threshold emulation

2014-07-30 Thread Wanpeng Li
triggered by L2 guest and L1 interested in, we inject it into L1 VMM for handling. Signed-off-by: Wanpeng Li --- arch/x86/kvm/vmx.c | 22 ++ 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index a3845b8..f60846c 100644 --- a

Re: [PATCH] KVM: nVMX: nested TPR shadow/threshold emulation

2014-07-31 Thread Wanpeng Li
Hi Paolo, On Wed, Jul 30, 2014 at 05:20:58PM +0200, Paolo Bonzini wrote: >Il 30/07/2014 14:04, Wanpeng Li ha scritto: >> @@ -7962,14 +7965,14 @@ static void prepare_vmcs02(struct kvm_vcpu *vcpu, >> struct vmcs12 *vmcs12) >> if

[PATCH v2] KVM: nVMX: nested TPR shadow/threshold emulation

2014-08-01 Thread Wanpeng Li
triggered by L2 guest and L1 interested in, we inject it into L1 VMM for handling. Signed-off-by: Wanpeng Li --- v1 -> v2: * don't take L0's "virtualize APIC accesses" setting into account * virtual_apic_page do exactly the same thing that is done for apic_access_page * add the

[PATCH 1/2] KVM: nVMX: Fix nested vmexit ack intr before load vmcs01

2014-08-01 Thread Wanpeng Li
vmcs01 which is wrong, especially this lead to the obvious L1 ack APICv behavior weired since APICv is for L1 instead of L2. This patch fix it by ack intr after load vmcs01. Signed-off-by: Wanpeng Li --- arch/x86/kvm/vmx.c | 16 1 file changed, 8 insertions(+), 8 deletions

[PATCH 2/2] KVM: nVMX: fix acknowledge interrupt on exit when APICv is in use

2014-08-01 Thread Wanpeng Li
Also, since interrupt is delivered through vmcs12, so APIC-v hardware will not cleare vIRR and hypervisor need to clear it before L1 running. Suggested-by: Paolo Bonzini Suggested-by: "Zhang, Yang Z" Signed-off-by: Wanpeng Li --- arch/x86/kvm/lapic.c | 18 ++

[PATCH 2/2] KVM: nVMX: fix acknowledge interrupt on exit when APICv is in use

2014-08-01 Thread Wanpeng Li
Also, since interrupt is delivered through vmcs12, so APIC-v hardware will not cleare vIRR and hypervisor need to clear it before L1 running. Suggested-by: Paolo Bonzini Suggested-by: "Zhang, Yang Z" Signed-off-by: Wanpeng Li --- arch/x86/kvm/lapic.c | 18 ++

Re: [PATCH 2/2] KVM: nVMX: fix acknowledge interrupt on exit when APICv is in use

2014-08-01 Thread Wanpeng Li
Please ignore this duplicate one. 于 14-8-1 下午4:13, Wanpeng Li 写道: > After commit 77b0f5d (KVM: nVMX: Ack and write vector info to intr_info > if L1 asks us to), "Acknowledge interrupt on exit" behavior can be > emulated. To do so, KVM will ask the APIC for the interrupt vector i

Re: [PATCH v2] KVM: nVMX: nested TPR shadow/threshold emulation

2014-08-04 Thread Wanpeng Li
Hi Paolo, On Fri, Aug 01, 2014 at 11:05:13AM +0200, Paolo Bonzini wrote: >Il 01/08/2014 10:09, Wanpeng Li ha scritto: >> This patch fix bug https://bugzilla.kernel.org/show_bug.cgi?id=61411 >> >> TPR shadow/threshold feature is important to speed up the Windows guest. >

[PATCH v3] KVM: nVMX: nested TPR shadow/threshold emulation

2014-08-04 Thread Wanpeng Li
triggered by L2 guest and L1 interested in, we inject it into L1 VMM for handling. Signed-off-by: Wanpeng Li --- v2 -> v3: * nested vm entry failure if both tpr shadow and cr8 exiting bits are not set v1 -> v2: * don't take L0's "virtualize APIC accesses" setting into accou

Re: [PATCH v2] KVM: nVMX: nested TPR shadow/threshold emulation

2014-08-04 Thread Wanpeng Li
On Mon, Aug 04, 2014 at 12:13:13PM +0200, Paolo Bonzini wrote: >Il 04/08/2014 12:11, Wanpeng Li ha scritto: >> Hi Paolo, >> On Fri, Aug 01, 2014 at 11:05:13AM +0200, Paolo Bonzini wrote: >>> Il 01/08/2014 10:09, Wanpeng Li ha scritto: >>>> This patch

Re: [PATCH v2] kvm: x86: fix stale mmio cache bug

2014-08-04 Thread Wanpeng Li
will be created just after first mmio #PF? Regards, Wanpeng Li >(3) Guest attempts to read or write to gpa X again. On Intel, this >generates an EPT_MISCONFIG. The memory slot generation number that >was incremented in (2) would normally take care of this but we fast >path mmio fault

[PATCH v2 2/2] KVM: nVMX: fix acknowledge interrupt on exit when APICv is in use

2014-08-04 Thread Wanpeng Li
Also, since interrupt is delivered through vmcs12, so APIC-v hardware will not cleare vIRR and hypervisor need to clear it before L1 running. Suggested-by: Paolo Bonzini Suggested-by: "Zhang, Yang Z" Tested-by: Liu, RongrongX Signed-off-by: Wanpeng Li --- v1 -> v2: * reusing

[PATCH v2 1/2] KVM: nVMX: Fix nested vmexit ack intr before load vmcs01

2014-08-04 Thread Wanpeng Li
vmcs01 which is wrong, especially this lead to the obvious L1 ack APICv behavior weired since APICv is for L1 instead of L2. This patch fix it by ack intr after load vmcs01. Reviewed-by: Paolo Bonzini Tested-by: Liu, RongrongX Signed-off-by: Wanpeng Li --- arch/x86/kvm/vmx.c | 16

Re: [PATCH 1/2] KVM: nVMX: Fix nested vmexit ack intr before load vmcs01

2014-08-04 Thread Wanpeng Li
Hi Davidlohr, On Mon, Aug 04, 2014 at 12:56:36PM -0700, Davidlohr Bueso wrote: >On Fri, 2014-08-01 at 16:12 +0800, Wanpeng Li wrote: >> External interrupt will cause L1 vmexit w/ reason external interrupt when L2 >> is >> running. Then L1 will pick up the interrupt through

Re: [PATCH v2 2/2] KVM: nVMX: fix acknowledge interrupt on exit when APICv is in use

2014-08-05 Thread Wanpeng Li
On Tue, Aug 05, 2014 at 02:39:05PM +0200, Felipe Reyes wrote: >Hi, > >On 08/05/2014 01:04 PM, Paolo Bonzini wrote: >>Il 05/08/2014 06:42, Wanpeng Li ha scritto: >>>After commit 77b0f5d (KVM: nVMX: Ack and write vector info to intr_info >>>if L1 asks us to), "A

Re: [PATCH v3] KVM: nVMX: nested TPR shadow/threshold emulation

2014-08-06 Thread Wanpeng Li
n and pinned. >> >>>> + >>>> + vmcs_write32(TPR_THRESHOLD, vmcs12->tpr_threshold); >>>> + } >>> >>> Miss else here: >>> If L2 owns the APIC and doesn't use TPR_SHADOW, we need to setup the >>> vmcs02

Re: EPT Accessed bit

2014-08-12 Thread Wanpeng Li
cks the EPT A bit through mmu notifier. Regards, Wanpeng Li >Thanks, >Umesh >-- >To unsubscribe from this list: send the line "unsubscribe kvm" in >the body of a message to majord...@vger.kernel.org >More majordomo info at http://vger.kernel.org/majordomo-info.html -- T

Re: [PATCH v2] KVM: x86: check ISR and TMR to construct eoi exit bitmap

2014-08-13 Thread Wanpeng Li
is to check ISR + TMR to construct the EOI exit bitmap. > >This patch is a better fixing for the issue that commit "0f6c0a740b" >tries to solve. > I think you miss the changlog. Regards, Wanpeng Li >Tested-by: Alex Williamson >Signed-off-by: Yang Zhang >Signed-

Re: [PATCH] KVM: x86: Increase the number of fixed MTRR regs to 10

2014-08-17 Thread Wanpeng Li
IXED_MTRR_REGION 88 >-#define KVM_NR_VAR_MTRR 8 >+#define KVM_NR_VAR_MTRR 10 > We observed that there is obvious regression caused by this commit, 32bit win7 guest show blue screen during boot. Regards, Wanpeng Li > #define ASYNC_PF_PER_VCPU 64 > >-- >1.9.1 > >

Re: [PATCH/RFC] KVM: track pid for VCPU only on KVM_RUN ioctl

2014-08-17 Thread Wanpeng Li
mp;vcpu->mutex)) > return -EINTR; One question: >- if (unlikely(vcpu->pid != current->pids[PIDTYPE_PID].pid)) { When vcpu->pid and current->pids[PIDTYPE_PID].pid will be different? Regards, Wanpeng Li >- /* The thread running this VCPU changed. */

Re: [PATCH] KVM: x86: Increase the number of fixed MTRR regs to 10

2014-08-18 Thread Wanpeng Li
On Mon, Aug 18, 2014 at 09:39:39AM +0300, Nadav Amit wrote: >This should have been a benign patch. I'll try to get windows 7 installation >disk and check ASAP. > In addition, it just can be reproduced on 32bit win7 w/ MP enabled, in case UP can't be reproduced. Regards,

[PATCH 3/5] KVM: vmx: don't vmx_segment_cache_clear twice in enter_pmode

2014-08-18 Thread Wanpeng Li
vmx_segment_cache_clear() will be called by vmx_set_segment() which lead to vmx_segment_cache_clear() is called twice in enter_pmode(). This patch remove the duplicate call site. Reviewed-by: Yang Zhang Signed-off-by: Wanpeng Li --- arch/x86/kvm/vmx.c | 2 -- 1 file changed, 2 deletions

[PATCH 4/5] KVM: x86: fix check legal type of Variable Range MTRRs

2014-08-18 Thread Wanpeng Li
, IA32_MTRR_PHYSMASKn don't have type field. This patch avoid check if the type field is legal for IA32_MTRR_PHYSMASKn. Signed-off-by: Wanpeng Li --- arch/x86/kvm/x86.c | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 204422d..30

[PATCH 2/5] KVM: x86: drop fpu_activate hook

2014-08-18 Thread Wanpeng Li
fpu_activate hook is introduced by commit 6b52d186 (KVM: Activate fpu on clts), however, there is no user currently, this patch drop it. Reviewed-by: Yang Zhang Signed-off-by: Wanpeng Li --- arch/x86/include/asm/kvm_host.h | 1 - arch/x86/kvm/svm.c | 1 - arch/x86/kvm/vmx.c

[PATCH 1/5] KVM: vmx: fix ept reserved bits for 1-GByte page

2014-08-18 Thread Wanpeng Li
bits for 1-GByte page are configured, since PDPTE which point to 1-GByte page will reserve bits 29:12 instead of bits 7:3 which are reserved for PDPTE that references an EPT Page Directory. This patch fix it by reserve bits 29:12 for 1-GByte page. Signed-off-by: Wanpeng Li --- arch/x86/kvm/

[PATCH 5/5] KVM: x86: #GP when attempts to write reserved bits of Variable Range MTRRs

2014-08-18 Thread Wanpeng Li
Section 11.11.2.3 of the SDM mentions "All other bits in the IA32_MTRR_PHYSBASEn and IA32_MTRR_PHYSMASKn registers are reserved; the processor generates a general-protection exception(#GP) if software attempts to write to them". This patch do it in kvm. Signed-off-by: Wanpeng Li

Re: [PATCH 5/5] KVM: x86: #GP when attempts to write reserved bits of Variable Range MTRRs

2014-08-18 Thread Wanpeng Li
Hi Paolo, On Mon, Aug 18, 2014 at 05:50:31PM +0800, Wanpeng Li wrote: >Section 11.11.2.3 of the SDM mentions "All other bits in the >IA32_MTRR_PHYSBASEn >and IA32_MTRR_PHYSMASKn registers are reserved; the processor generates a >general-protection exception(#GP) if software att

Re: [PATCH 1/5] KVM: vmx: fix ept reserved bits for 1-GByte page

2014-08-18 Thread Wanpeng Li
Hi Paolo, On Mon, Aug 18, 2014 at 12:18:59PM +0200, Paolo Bonzini wrote: >Il 18/08/2014 11:50, Wanpeng Li ha scritto: >> EPT misconfig handler in kvm will check which reason lead to EPT >> misconfiguration after vmexit. One of the reasons is that an EPT >> paging-structur

[PATCH v4] KVM: nVMX: nested TPR shadow/threshold emulation

2014-08-19 Thread Wanpeng Li
triggered by L2 guest and L1 interested in, we inject it into L1 VMM for handling. Reviewed-by: Paolo Bonzini Signed-off-by: Wanpeng Li --- v3 -> v4: * add Paolo's Reviewed-by * unconditionally fail the vmentry, with a comment * setup the TPR_SHADOW/virtual_apic_page of vmcs02 based on vmcs

[PATCH v2 1/3] KVM: vmx: fix ept reserved bits for 1-GByte page

2014-08-19 Thread Wanpeng Li
bits for 1-GByte page are configured, since PDPTE which point to 1-GByte page will reserve bits 29:12 instead of bits 7:3 which are reserved for PDPTE that references an EPT Page Directory. This patch fix it by reserve bits 29:12 for 1-GByte page. Signed-off-by: Wanpeng Li --- v1 -> v2:

[PATCH v2 3/3] KVM: x86: #GP when attempts to write reserved bits of Variable Range MTRRs

2014-08-19 Thread Wanpeng Li
Section 11.11.2.3 of the SDM mentions "All other bits in the IA32_MTRR_PHYSBASEn and IA32_MTRR_PHYSMASKn registers are reserved; the processor generates a general-protection exception(#GP) if software attempts to write to them". This patch do it in kvm. Signed-off-by: Wanpeng Li

[PATCH v2 2/3] KVM: x86: fix check legal type of Variable Range MTRRs

2014-08-19 Thread Wanpeng Li
, IA32_MTRR_PHYSMASKn don't have type field. This patch avoid check if the type field is legal for IA32_MTRR_PHYSMASKn. Signed-off-by: Wanpeng Li --- v1 -> v2: * WARN_ON if not fall in variable Range MTRRs * the base/mask can be separated just with an "&" arch/x86/kvm/x86.c | 8 ++

Re: [PATCH v2 1/3] KVM: vmx: fix ept reserved bits for 1-GByte page

2014-08-19 Thread Wanpeng Li
On Tue, Aug 19, 2014 at 11:09:49AM +0200, Paolo Bonzini wrote: >Il 19/08/2014 11:04, Wanpeng Li ha scritto: >> EPT misconfig handler in kvm will check which reason lead to EPT >> misconfiguration after vmexit. One of the reasons is that an EPT >> paging-structure ent

Re: [PATCH/RFC] KVM: track pid for VCPU only on KVM_RUN ioctl

2014-08-19 Thread Wanpeng Li
On Tue, Aug 19, 2014 at 04:04:03PM +0200, Christian Borntraeger wrote: >On 18/08/14 07:02, Wanpeng Li wrote: >> Hi Christian, >> On Tue, Aug 05, 2014 at 04:44:14PM +0200, Christian Borntraeger wrote: >>> We currently track the pid of the task that runs the VCPU in >

[PATCH v3] KVM: vmx: fix ept reserved bits for 1-GByte page

2014-08-19 Thread Wanpeng Li
s for 1-GByte page are configured, since PDPTE which point to 1-GByte page will reserve bits 29:12 instead of bits 7:3 which are reserved for PDPTE that references an EPT Page Directory. This patch fix it by reserve bits 29:12 for 1-GByte page. Signed-off-by: Wanpeng Li --- v2 -> v3: * return

Re: [PATCH v2 1/3] KVM: vmx: fix ept reserved bits for 1-GByte page

2014-08-19 Thread Wanpeng Li
Hi Paolo, On Tue, Aug 19, 2014 at 11:09:49AM +0200, Paolo Bonzini wrote: [...] >I suggest that you write a testcase for kvm-unit-tests. > Just send out v3. The testcase will be written later since I'm not familiar with kvm-unit-tests before and time is still needed. Regards, Wanpeng

Re: [PATCH v4] KVM: nVMX: nested TPR shadow/threshold emulation

2014-08-19 Thread Wanpeng Li
Hi Paolo, On Tue, Aug 19, 2014 at 10:34:20AM +0200, Paolo Bonzini wrote: >Il 19/08/2014 10:30, Wanpeng Li ha scritto: >> +if (vmx->nested.virtual_apic_page) >> +nested_release_page(vmx->nested.virtual_apic_page); >> +vm

[PATCH v4] KVM: vmx: fix ept reserved bits for 1-GByte page

2014-08-20 Thread Wanpeng Li
s for 1-GByte page are configured, since PDPTE which point to 1-GByte page will reserve bits 29:12 instead of bits 7:3 which are reserved for PDPTE that references an EPT Page Directory. This patch fix it by reserve bits 29:12 for 1-GByte page. Signed-off-by: Wanpeng Li --- v3 -> v4: * don

Re: [PATCH v3] KVM: vmx: fix ept reserved bits for 1-GByte page

2014-08-20 Thread Wanpeng Li
On Wed, Aug 20, 2014 at 08:51:38AM +0200, Paolo Bonzini wrote: >Il 20/08/2014 05:17, Wanpeng Li ha scritto: >> +else if (spte & (1ULL << 7)) > >You have to check level == 1 specifically here, or add... > >> +/* >> + * 1G

Re: [PATCH v4] KVM: vmx: fix ept reserved bits for 1-GByte page

2014-08-20 Thread Wanpeng Li
On Wed, Aug 20, 2014 at 10:13:07AM +0200, Paolo Bonzini wrote: >Il 20/08/2014 09:31, Wanpeng Li ha scritto: >> EPT misconfig handler in kvm will check which reason lead to EPT >> misconfiguration after vmexit. One of the reasons is that an EPT >> paging-structure entry is con

[PATCH v5 2/2] KVM: nVMX: introduce apic_access_and_virtual_page_valid

2014-08-20 Thread Wanpeng Li
Introduce apic_access_and_virtual_page_valid() to check the valid of nested apic access page and virtual apic page earlier. Signed-off-by: Wanpeng Li --- arch/x86/kvm/vmx.c | 82 ++ 1 file changed, 46 insertions(+), 36 deletions(-) diff

[PATCH v5 1/2] KVM: nVMX: nested TPR shadow/threshold emulation

2014-08-20 Thread Wanpeng Li
triggered by L2 guest and L1 interested in, we inject it into L1 VMM for handling. Reviewed-by: Paolo Bonzini Signed-off-by: Wanpeng Li --- v4 -> v5: * moving the nested_vmx_failValid call inside the "if (!vmx->nested.virtual_apic_page)" v3 -> v4: * add Paolo's Reviewed-by *

Re: [PATCH] KVM: x86: Keep masked bits unmodified on kvm_set_shared_msr

2014-08-21 Thread Wanpeng Li
ied" instead of "keeps the masked bits unmodified"? Regards, Wanpeng Li >Signed-off-by: Nadav Amit >--- > arch/x86/kvm/x86.c | 1 + > 1 file changed, 1 insertion(+) > >diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c >index 5f5edb6..ee42410 100644 >---

Re: [PATCH v5 2/2] KVM: nVMX: introduce apic_access_and_virtual_page_valid

2014-08-21 Thread Wanpeng Li
Hi Paolo, On Wed, Aug 20, 2014 at 12:50:38PM +0200, Paolo Bonzini wrote: >Il 20/08/2014 11:45, Wanpeng Li ha scritto: >> Introduce apic_access_and_virtual_page_valid() to check the valid >> of nested apic access page and virtual apic page earlier. >> >> Signed-off-by:

[PATCH v6 2/2] KVM: nVMX: nested TPR shadow/threshold emulation

2014-08-21 Thread Wanpeng Li
triggered by L2 guest and L1 interested in, we inject it into L1 VMM for handling. Reviewed-by: Paolo Bonzini Signed-off-by: Wanpeng Li --- v5 -> v6: * fix bisect issue v4 -> v5: * moving the nested_vmx_failValid call inside the "if (!vmx->nested.virtual_apic_page)" v3 -> v4:

[PATCH v6 1/2] KVM: nVMX: introduce nested_get_vmcs12_pages

2014-08-21 Thread Wanpeng Li
Introduce function nested_get_vmcs12_pages() to check the valid of nested apic access page and virtual apic page earlier. Signed-off-by: Wanpeng Li --- v5 -> v6: * replace the name apic_access_and_virtual_page_valid by nested_get_vmcs12_pages arch/x86/kvm/vmx.c |

Re: [PATCH v6 2/2] KVM: nVMX: nested TPR shadow/threshold emulation

2014-08-21 Thread Wanpeng Li
d your comments "On real hardware you could point the virtual-APIC page to an invalid address." http://lists.openwall.net/linux-kernel/2014/08/07/344 >Thanks for your persistence! > Thanks for your great help. ;-) Regards, Wanpeng Li >Paolo -- To unsubscribe from this list:

Re: [PATCH] KVM: x86: Keep masked bits unmodified on kvm_set_shared_msr

2014-08-21 Thread Wanpeng Li
Hi Paolo, On Thu, Aug 21, 2014 at 01:56:46PM +0200, Paolo Bonzini wrote: >Il 21/08/2014 10:05, Wanpeng Li ha scritto: >> Hi Nadav, >> On Wed, Aug 20, 2014 at 03:11:51PM +0300, Nadav Amit wrote: >>> Currently, when an msr is updated using kvm_set_shared_msr the masked

Re: [PATCH v3 0/7] Dynamic Pause Loop Exiting window.

2014-08-21 Thread Wanpeng Li
unkyard branch in case it's going to be useful >> in some scenario I didn't think of. > >I've been using it to benchmark different values, because it is more Is there any benchmark data for this patchset? Regards, Wanpeng Li >convenient than reloading the module after

Re: [PATCH v6 2/2] KVM: nVMX: nested TPR shadow/threshold emulation

2014-08-22 Thread Wanpeng Li
On Fri, Aug 22, 2014 at 10:36:07AM +0200, Paolo Bonzini wrote: >Il 22/08/2014 01:30, Wanpeng Li ha scritto: >> Maybe I misunderstand your comments "On real hardware you could point >> the virtual-APIC page to an invalid address." >> http://lists.openwall.net/linux-ke

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

2014-08-24 Thread Wanpeng Li
Please Cc kvm ml. 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 to the intel x86 software developer's >manual. > >Signed-off-by: Dennis Chen >--- > arch/x86/include/asm/vmx.h |1 + > arch

[PATCH] KVM: x86: fix xen guest panic due to lack of KVM_REQ_EVENT

2014-08-25 Thread Wanpeng Li
fix it by set a KVM_REQ_EVENT if both the first and the second instructions are not sti. Signed-off-by: Wanpeng Li --- arch/x86/kvm/x86.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index c10408e..b7c0073 100644 --- a/arch/x86/kvm/x86.c +++ b/arc

Re: [PATCH] KVM: x86: fix xen guest panic due to lack of KVM_REQ_EVENT

2014-08-25 Thread Wanpeng Li
Hi Paolo, On Mon, Aug 25, 2014 at 11:01:07AM +0200, Paolo Bonzini wrote: >Il 25/08/2014 09:58, Wanpeng Li ha scritto: >> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c >> index c10408e..b7c0073 100644 >> --- a/arch/x86/kvm/x86.c >> +++ b/arch/x86/kvm/x86.c >

Re: [PATCH] KVM: x86: fix xen guest panic due to lack of KVM_REQ_EVENT

2014-08-25 Thread Wanpeng Li
Hi Paolo, On Mon, Aug 25, 2014 at 11:16:16AM +0200, Paolo Bonzini wrote: >Il 25/08/2014 11:08, Wanpeng Li ha scritto: >> Hi Paolo, >> On Mon, Aug 25, 2014 at 11:01:07AM +0200, Paolo Bonzini wrote: >>> Il 25/08/2014 09:58, Wanpeng Li ha scritto: >>>> diff --git

Re: [PATCH] KVM: x86: fix xen guest panic due to lack of KVM_REQ_EVENT

2014-08-25 Thread Wanpeng Li
On Mon, Aug 25, 2014 at 11:16:16AM +0200, Paolo Bonzini wrote: >Il 25/08/2014 11:08, Wanpeng Li ha scritto: >> Hi Paolo, >> On Mon, Aug 25, 2014 at 11:01:07AM +0200, Paolo Bonzini wrote: >>> Il 25/08/2014 09:58, Wanpeng Li ha scritto: >>>> diff --git a/arc

Re: [PATCH v2 3/3] KVM: x86: #GP when attempts to write reserved bits of Variable Range MTRRs

2014-08-31 Thread Wanpeng Li
On Fri, Aug 29, 2014 at 06:47:54PM +0200, Paolo Bonzini wrote: >Il 19/08/2014 11:04, Wanpeng Li ha scritto: >> Section 11.11.2.3 of the SDM mentions "All other bits in the >> IA32_MTRR_PHYSBASEn >> and IA32_MTRR_PHYSMASKn registers are reserved; the processor generate

Re: kvm-unit-test failures

2014-09-04 Thread Wanpeng Li
000 > >x86: kvm: Make kvm_get_time_and_clockread() nanoseconds based > >Convert the relevant base data right away to nanoseconds instead of >doing the conversion on every readout. Reduces text size by 160 >bytes. > >Signed-off-by: Thomas Gleixner >Cc: G

Re: [PATCH] Using the tlb flush util function where applicable

2014-09-16 Thread Wanpeng Li
--- 8< --- >KVM: x86: count actual tlb flushes > >- we count KVM_REQ_TLB_FLUSH requests, not actual flushes So there maybe multiple requests accumulated at the point of kvm_check_request, if your patch account these accumulations correctly? Regards, Wanpeng Li > (KVM can have multiple requ

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

2014-09-17 Thread Wanpeng Li
n_to_pfn async = false __gfn_to_pfn_memslot hva_to_pfn hva_to_pfn_fast hva_to_pfn_slow kvm_get_user_page_io page will always be ready after kvm_get_user_page_io which leads to APF don't need to work any more. Regards, Wanpeng Li &

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

2014-09-18 Thread Wanpeng Li
On Thu, Sep 18, 2014 at 09:13:26AM +0300, Gleb Natapov wrote: >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_pa

Re: [PATCH v4] kvm: Fix page ageing bugs

2014-09-23 Thread Wanpeng Li
clear_bit((ffs(shadow_accessed_mask) - 1), >(unsigned long *)sptep); > } >+ trace_kvm_age_page(gfn, slot, young); IIUC, all the rmapps in this for loop are against the same gfn which results in the above trace point dump

Re: [PATCH v4] kvm: Fix page ageing bugs

2014-09-24 Thread Wanpeng Li
Hi Paolo, 于 9/24/14, 3:04 PM, Paolo Bonzini 写道: Il 24/09/2014 04:27, Wanpeng Li ha scritto: Hi Andres, On Mon, Sep 22, 2014 at 02:54:42PM -0700, Andres Lagar-Cavilla wrote: 1. We were calling clear_flush_young_notify in unmap_one, but we are within an mmu notifier invalidate range scope. The

Re: Query with respect to VCPU scheduling

2014-10-07 Thread Wanpeng Li
> >Is cgroups the only option?. Any pointers to this would help. How about CFS bandwidth control? Regards, Wanpeng Li > >Thanks, >Mohan >-- >To unsubscribe from this list: send the line "unsubscribe kvm" in >the body of a message to majord...@vger.kernel.org >

Re: [PATCH v2] KVM: x86: some apic broadcast modes does not work

2014-10-07 Thread Wanpeng Li
ot rely on it. >Since it is a rare case, it is unoptimized and done on the slow-path. > >--- > >Changes v1->v2: >- Follow Radim's review: setting constants, preferring simplicity to marginal > performance gain, etc. >- Combine the cluster mode and x2apic mod

Re: nVMX: Shadowing of CPU_BASED_VM_EXEC_CONTROL broken

2014-10-08 Thread Wanpeng Li
;= ~CPU_BASED_TPR_SHADOW; exec_control |= vmcs12->cpu_based_vm_exec_control; Could you point out where the other places L0 sets CPU_BASED_VIRTUAL_INTR_PENDING before entering L2? Regards, Wanpeng Li >entering L2, and then we transfer it from the hardware state to vmc12 on >exit

Re: nVMX: Shadowing of CPU_BASED_VM_EXEC_CONTROL broken

2014-10-08 Thread Wanpeng Li
mporarily >load a vmcs without updating loaded_vmcs->vmcs. Now, if some other VCPU >is scheduling in right in the middle of this, the wrong vmcs will be >flushed and then reloaded - e.g. a non-shadow vmcs with that interrupt >window flag set... If non-shadow vmcs and shadow vmcs can

Re: nVMX: Shadowing of CPU_BASED_VM_EXEC_CONTROL broken

2014-10-08 Thread Wanpeng Li
On Thu, Oct 09, 2014 at 07:34:47AM +0800, Wanpeng Li wrote: >On Wed, Oct 08, 2014 at 05:07:48PM +0200, Jan Kiszka wrote: >>On 2014-10-08 12:34, Paolo Bonzini wrote: >>> Il 08/10/2014 12:29, Jan Kiszka ha scritto: >>>>>> But it would write to the vmcs02

Re: [PATCH] KVM: nVMX: Disable preemption while reading from shadow VMCS

2014-10-08 Thread Wanpeng Li
y disabled before vmentry. > >Signed-off-by: Jan Kiszka >--- Reviewed-by: Wanpeng Li Regards, Wanpeng Li > >This fixes specifically Jailhouse in KVM on CPUs with shadow VMCS >support. > > arch/x86/kvm/vmx.c | 4 > 1 file changed, 4 insertions(+) > >diff --

[PATCH] kvm: vfio: fix unregister kvm_device_ops of vfio

2014-10-09 Thread Wanpeng Li
unregister kvm_device_ops of vfio dynamically during rmmod kvm-intel module. Reported-by: Liu Rongrong Signed-off-by: Wanpeng Li --- include/linux/kvm_host.h |1 + virt/kvm/kvm_main.c |7 +++ virt/kvm/vfio.c |5 + virt/kvm/vfio.h |4 4 files

  1   2   3   4   >