lkml.org 
[lkml]   [2022]   [Jun]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 01/12] KVM: X86/MMU: Warn if sp->unsync_children > 0 in link_shadow_page()
    Date
    From: Lai Jiangshan <jiangshan.ljs@antgroup.com>

    The check for sp->unsync_children in link_shadow_page() can be removed
    since FNAME(fetch) ensures it is zero. (@sp is direct when
    link_shadow_page() is called from other places, which also means
    sp->unsync_children is zero.)

    link_shadow_page() is not a fast path, check it and warn instead.

    Signed-off-by: Lai Jiangshan <jiangshan.ljs@antgroup.com>
    ---
    arch/x86/kvm/mmu/mmu.c | 8 +++++++-
    1 file changed, 7 insertions(+), 1 deletion(-)

    diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
    index 086f32dffdbe..f61416818116 100644
    --- a/arch/x86/kvm/mmu/mmu.c
    +++ b/arch/x86/kvm/mmu/mmu.c
    @@ -2197,7 +2197,13 @@ static void link_shadow_page(struct kvm_vcpu *vcpu, u64 *sptep,

    mmu_page_add_parent_pte(vcpu, sp, sptep);

    - if (sp->unsync_children || sp->unsync)
    + /*
    + * Propagate the unsync bit when sp->unsync.
    + *
    + * The caller ensures the sp is synced when it has unsync children,
    + * so sp->unsync_children must be zero. See FNAME(fetch).
    + */
    + if (sp->unsync || WARN_ON_ONCE(sp->unsync_children))
    mark_unsync(sptep);
    }

    --
    2.19.1.6.gb485710b
    \
     
     \ /
      Last update: 2022-06-05 08:44    [W:4.022 / U:0.672 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site