lkml.org 
[lkml]   [2021]   [Jun]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    SubjectRe: [PATCH 03/54] KVM: x86: Properly reset MMU context at vCPU RESET/INIT
    From
    Date
    On 22/06/21 19:56, Sean Christopherson wrote:
    > + /*
    > + * Reset the MMU context if paging was enabled prior to INIT (which is
    > + * implied if CR0.PG=1 as CR0 will be '0' prior to RESET). Unlike the
    > + * standard CR0/CR4/EFER modification paths, only CR0.PG needs to be
    > + * checked because it is unconditionally cleared on INIT and all other
    > + * paging related bits are ignored if paging is disabled, i.e. CR0.WP,
    > + * CR4, and EFER changes are all irrelevant if CR0.PG was '0'.
    > + */
    > + if (old_cr0 & X86_CR0_PG)
    > + kvm_mmu_reset_context(vcpu);

    Why not just check "if (init_event)", with a simple comment like

    /*
    * Reset the MMU context in case paging was enabled prior to INIT (CR0
    * will be '0' prior to RESET).
    */

    ?

    Paolo

    \
     
     \ /
      Last update: 2021-06-23 16:00    [W:4.123 / U:0.036 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site