With an initial mode installed by shadow_vcpu_init(), there's no need for sh_update_paging_modes() to deal with the "mode is still unset" case. Leave an assertion, though.
Signed-off-by: Jan Beulich <jbeul...@suse.com> --- a/xen/arch/x86/mm/shadow/common.c +++ b/xen/arch/x86/mm/shadow/common.c @@ -1864,6 +1864,8 @@ static void sh_update_paging_modes(struc make_cr3(v, mmfn); hvm_update_host_cr3(v); } + else if ( !old_mode ) + ASSERT_UNREACHABLE(); else if ( v->arch.paging.mode != old_mode ) { SHADOW_PRINTK("new paging mode: %pv pe=%d gl=%u " @@ -1872,11 +1874,10 @@ static void sh_update_paging_modes(struc hvm_paging_enabled(v), v->arch.paging.mode->guest_levels, v->arch.paging.mode->shadow.shadow_levels, - old_mode ? old_mode->guest_levels : 0, - old_mode ? old_mode->shadow.shadow_levels : 0); - if ( old_mode && - (v->arch.paging.mode->shadow.shadow_levels != - old_mode->shadow.shadow_levels) ) + old_mode->guest_levels, + old_mode->shadow.shadow_levels); + if ( v->arch.paging.mode->shadow.shadow_levels != + old_mode->shadow.shadow_levels ) { /* Need to make a new monitor table for the new mode */ mfn_t new_mfn, old_mfn;