[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen staging-4.11] x86/shadow: don't enable shadow mode with too small a shadow allocation (part 2)



commit 8bbb3e900bb65dbb6bedb628ffc22af6bd7665e7
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Mon Sep 23 14:41:00 2019 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Mon Sep 23 14:41:00 2019 +0200

    x86/shadow: don't enable shadow mode with too small a shadow allocation 
(part 2)
    
    Commit 2634b997af ("x86/shadow: don't enable shadow mode with too small
    a shadow allocation") was incomplete: The adjustment done there to
    shadow_enable() is also needed in shadow_one_bit_enable(). The (new)
    problem report was (apparently) a failed PV guest migration followed by
    another migration attempt for that same guest. Disabling log-dirty mode
    after the first one had left a couple of shadow pages allocated (perhaps
    something that also wants fixing), and hence the second enabling of
    log-dirty mode wouldn't have allocated anything further.
    
    Reported-by: James Wang <jnwang@xxxxxxxx>
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Acked-by: Tim Deegan <tim@xxxxxxx>
    master commit: 8b25551baa3307af0aa1ef8f7f43403f01c2c5d7
    master date: 2019-09-05 09:56:42 +0200
---
 xen/arch/x86/mm/shadow/common.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/mm/shadow/common.c b/xen/arch/x86/mm/shadow/common.c
index d2946affe2..34913c1ade 100644
--- a/xen/arch/x86/mm/shadow/common.c
+++ b/xen/arch/x86/mm/shadow/common.c
@@ -3506,7 +3506,8 @@ static int shadow_one_bit_enable(struct domain *d, u32 
mode)
 
     mode |= PG_SH_enable;
 
-    if ( d->arch.paging.shadow.total_pages == 0 )
+    if ( d->arch.paging.shadow.total_pages <
+         sh_min_allocation(d) + d->arch.paging.shadow.p2m_pages )
     {
         /* Init the shadow memory allocation if the user hasn't done so */
         if ( shadow_set_allocation(d, 1, NULL) != 0 )
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.11

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.