lkml.org 
[lkml]   [2020]   [May]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 21/24] KVM: x86: always update CR3 in VMCB
On Wed, May 20, 2020 at 10:14:47PM +0200, Paolo Bonzini wrote:
> On 20/05/20 20:22, Sean Christopherson wrote:
> > As an alternative fix, what about marking VCPU_EXREG_CR3 dirty in
> > __set_sregs()? E.g.
> >
> > /*
> > * Loading vmcs02.GUEST_CR3 is handled by nested VM-Enter, but
> > * it can be explicitly dirtied by KVM_SET_SREGS.
> > */
> > if (is_guest_mode(vcpu) &&
> > !test_bit(VCPU_EXREG_CR3, (ulong *)&vcpu->arch.regs_dirty))
> >
> > There's already a dependency on __set_sregs() doing
> > kvm_register_mark_available() before kvm_mmu_reset_context(), i.e. the
> > code is already a bit kludgy. The dirty check would make the kludge less
> > subtle and provide explicit documentation.
>
> A comment in __set_sregs is certainly a good idea. But checking for
> dirty seems worse since the caching of CR3 is a bit special in this
> respect (it's never marked dirty).

That's why I thought it was so clever :-)

> This patch should probably be split too, so that the Fixes tags are
> separate for Intel and AMD.

That would be nice.

\
 
 \ /
  Last update: 2020-05-23 00:48    [W:0.090 / U:3.792 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site