[PATCH 0/3] KVM: x86: Fixes for kvm/queue

Lai Jiangshan posted 3 patches 4 years, 6 months ago
arch/x86/kvm/vmx/nested.c | 11 +++--------
arch/x86/kvm/vmx/vmx.c    | 28 ++++++++++++++++++----------
arch/x86/kvm/vmx/vmx.h    |  5 +++--
arch/x86/kvm/x86.c        |  7 +++++++
4 files changed, 31 insertions(+), 20 deletions(-)
[PATCH 0/3] KVM: x86: Fixes for kvm/queue
Posted by Lai Jiangshan 4 years, 6 months ago
From: Lai Jiangshan <laijs@linux.alibaba.com>

Patch 1 and patch 2 are updated version of the original patches with
the same title.  The original patches need to be dequeued.  (Paolo has
sent the reverting patches to the mail list and done the work, but I
haven't seen the original patches dequeued or reverted in the public
kvm tree.  I need to learn a bit more how patches are managed in kvm
tree.)

Patch 3 fixes for commit c62c7bd4f95b ("KVM: VMX: Update vmcs.GUEST_CR3
only when the guest CR3 is dirty").  Patch 3 is better to be reordered
to before the commit since the commit has not yet into Linus' tree.


Lai Jiangshan (3):
  KVM: VMX: Save HOST_CR3 in vmx_prepare_switch_to_guest()
  KVM: X86: Ensure pae_root to be reconstructed for shadow paging if the
    guest PDPTEs is changed
  KVM: VMX: Mark VCPU_EXREG_CR3 dirty when !CR0_PG -> CR0_PG if EPT +
    !URG

 arch/x86/kvm/vmx/nested.c | 11 +++--------
 arch/x86/kvm/vmx/vmx.c    | 28 ++++++++++++++++++----------
 arch/x86/kvm/vmx/vmx.h    |  5 +++--
 arch/x86/kvm/x86.c        |  7 +++++++
 4 files changed, 31 insertions(+), 20 deletions(-)

-- 
2.19.1.6.gb485710b

Re: [PATCH 0/3] KVM: x86: Fixes for kvm/queue
Posted by Paolo Bonzini 4 years, 6 months ago
On 12/16/21 03:19, Lai Jiangshan wrote:
> From: Lai Jiangshan <laijs@linux.alibaba.com>
> 
> Patch 1 and patch 2 are updated version of the original patches with
> the same title.  The original patches need to be dequeued.  (Paolo has
> sent the reverting patches to the mail list and done the work, but I
> haven't seen the original patches dequeued or reverted in the public
> kvm tree.  I need to learn a bit more how patches are managed in kvm
> tree.)

This cycle has been a bit more disorganized than usual, due to me taking 
some time off and a very unusual amount of patches sent for -rc. 
Usually kvm/queue is updated about once a week and kvm/next once every 
1-2 weeks.

> Patch 3 fixes for commit c62c7bd4f95b ("KVM: VMX: Update vmcs.GUEST_CR3
> only when the guest CR3 is dirty").  Patch 3 is better to be reordered
> to before the commit since the commit has not yet into Linus' tree.
> 
> 
> Lai Jiangshan (3):
>    KVM: VMX: Save HOST_CR3 in vmx_prepare_switch_to_guest()
>    KVM: X86: Ensure pae_root to be reconstructed for shadow paging if the
>      guest PDPTEs is changed
>    KVM: VMX: Mark VCPU_EXREG_CR3 dirty when !CR0_PG -> CR0_PG if EPT +
>      !URG
> 
>   arch/x86/kvm/vmx/nested.c | 11 +++--------
>   arch/x86/kvm/vmx/vmx.c    | 28 ++++++++++++++++++----------
>   arch/x86/kvm/vmx/vmx.h    |  5 +++--
>   arch/x86/kvm/x86.c        |  7 +++++++
>   4 files changed, 31 insertions(+), 20 deletions(-)
> 

Queued, thanks.

Paolo
Re: [PATCH 0/3] KVM: x86: Fixes for kvm/queue
Posted by Wanpeng Li 4 years, 4 months ago
On Tue, 21 Dec 2021 at 04:13, Paolo Bonzini <pbonzini@redhat.com> wrote:
>
> On 12/16/21 03:19, Lai Jiangshan wrote:
> > From: Lai Jiangshan <laijs@linux.alibaba.com>
> >
> > Patch 1 and patch 2 are updated version of the original patches with
> > the same title.  The original patches need to be dequeued.  (Paolo has
> > sent the reverting patches to the mail list and done the work, but I
> > haven't seen the original patches dequeued or reverted in the public
> > kvm tree.  I need to learn a bit more how patches are managed in kvm
> > tree.)
>
> This cycle has been a bit more disorganized than usual, due to me taking
> some time off and a very unusual amount of patches sent for -rc.
> Usually kvm/queue is updated about once a week and kvm/next once every
> 1-2 weeks.

Maybe the patch "Revert "KVM: VMX: Save HOST_CR3 in
vmx_prepare_switch_to_guest()"" is still missing in the latest
kvm/queue, I saw the same warning.

    Wanpeng
Re: [PATCH 0/3] KVM: x86: Fixes for kvm/queue
Posted by Sean Christopherson 4 years, 4 months ago
On Fri, Feb 11, 2022, Wanpeng Li wrote:
> On Tue, 21 Dec 2021 at 04:13, Paolo Bonzini <pbonzini@redhat.com> wrote:
> >
> > On 12/16/21 03:19, Lai Jiangshan wrote:
> > > From: Lai Jiangshan <laijs@linux.alibaba.com>
> > >
> > > Patch 1 and patch 2 are updated version of the original patches with
> > > the same title.  The original patches need to be dequeued.  (Paolo has
> > > sent the reverting patches to the mail list and done the work, but I
> > > haven't seen the original patches dequeued or reverted in the public
> > > kvm tree.  I need to learn a bit more how patches are managed in kvm
> > > tree.)
> >
> > This cycle has been a bit more disorganized than usual, due to me taking
> > some time off and a very unusual amount of patches sent for -rc.
> > Usually kvm/queue is updated about once a week and kvm/next once every
> > 1-2 weeks.
> 
> Maybe the patch "Revert "KVM: VMX: Save HOST_CR3 in
> vmx_prepare_switch_to_guest()"" is still missing in the latest
> kvm/queue, I saw the same warning.

It hasn't made it way to Linus either.
Re: [PATCH 0/3] KVM: x86: Fixes for kvm/queue
Posted by Paolo Bonzini 4 years, 4 months ago
On 2/11/22 17:31, Sean Christopherson wrote:
>> Maybe the patch "Revert "KVM: VMX: Save HOST_CR3 in
>> vmx_prepare_switch_to_guest()"" is still missing in the latest
>> kvm/queue, I saw the same warning.
> 
> It hasn't made it way to Linus either.

This was supposed to fix the buggy patch, too:

     commit a9f2705ec84449e3b8d70c804766f8e97e23080d
     Author: Lai Jiangshan <laijs@linux.alibaba.com>
     Date:   Thu Dec 16 10:19:36 2021 +0800

     KVM: VMX: Save HOST_CR3 in vmx_set_host_fs_gs()
     
     The host CR3 in the vcpu thread can only be changed when scheduling,
     so commit 15ad9762d69f ("KVM: VMX: Save HOST_CR3 in vmx_prepare_switch_to_guest()")
     changed vmx.c to only save it in vmx_prepare_switch_to_guest().
     
     However, it also has to be synced in vmx_sync_vmcs_host_state() when switching VMCS.
     vmx_set_host_fs_gs() is called in both places, so rename it to
     vmx_set_vmcs_host_state() and make it update HOST_CR3.
     
     Fixes: 15ad9762d69f ("KVM: VMX: Save HOST_CR3 in vmx_prepare_switch_to_guest()")
     Signed-off-by: Lai Jiangshan <laijs@linux.alibaba.com>
     Message-Id: <20211216021938.11752-2-jiangshanlai@gmail.com>
     Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Paolo

Re: [PATCH 0/3] KVM: x86: Fixes for kvm/queue
Posted by Sean Christopherson 4 years, 4 months ago
On Fri, Feb 11, 2022, Paolo Bonzini wrote:
> On 2/11/22 17:31, Sean Christopherson wrote:
> > > Maybe the patch "Revert "KVM: VMX: Save HOST_CR3 in
> > > vmx_prepare_switch_to_guest()"" is still missing in the latest
> > > kvm/queue, I saw the same warning.
> > 
> > It hasn't made it way to Linus either.
> 
> This was supposed to fix the buggy patch, too:
> 
>     commit a9f2705ec84449e3b8d70c804766f8e97e23080d
>     Author: Lai Jiangshan <laijs@linux.alibaba.com>
>     Date:   Thu Dec 16 10:19:36 2021 +0800
> 
>     KVM: VMX: Save HOST_CR3 in vmx_set_host_fs_gs()
>     The host CR3 in the vcpu thread can only be changed when scheduling,
>     so commit 15ad9762d69f ("KVM: VMX: Save HOST_CR3 in vmx_prepare_switch_to_guest()")
>     changed vmx.c to only save it in vmx_prepare_switch_to_guest().
>     However, it also has to be synced in vmx_sync_vmcs_host_state() when switching VMCS.
>     vmx_set_host_fs_gs() is called in both places, so rename it to
>     vmx_set_vmcs_host_state() and make it update HOST_CR3.
>     Fixes: 15ad9762d69f ("KVM: VMX: Save HOST_CR3 in vmx_prepare_switch_to_guest()")
>     Signed-off-by: Lai Jiangshan <laijs@linux.alibaba.com>
>     Message-Id: <20211216021938.11752-2-jiangshanlai@gmail.com>
>     Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

The underlying premise that CR3 can change only when scheduling is wrong, reverts
incoming...