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

[Xen-changelog] [xen staging] x86/mm: free_page_type() is PV-only



commit 738faba9d74736dc8e5d7c5d3be53776097f6af1
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Mon May 13 16:42:34 2019 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Mon May 13 16:42:34 2019 +0200

    x86/mm: free_page_type() is PV-only
    
    While it already has a CONFIG_PV wrapped around its entire body, it is
    still uselessly invoking mfn_to_gmfn(), which is about to be replaced.
    Avoid morphing this code into even more suspicious shape and remove the
    effectively dead code - translated mode has been made impossible for PV
    quite some time ago.
    
    Adjust and extend the assertions at the same time: The original
    ASSERT(!shadow_mode_refcounts(owner)) really means
    ASSERT(!shadow_mode_enabled(owner) || !paging_mode_refcounts(owner)),
    which isn't what we want here.
    
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Acked-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Reviewed-by: Wei Liu <wei.liu2@xxxxxxxxxx>
    Reviewed-by: George Dunlap <george.dunlap@xxxxxxxxxx>
---
 xen/arch/x86/mm.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index 5e1b061d2a..da3bcf7805 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -2630,7 +2630,6 @@ int free_page_type(struct page_info *page, unsigned long 
type,
 {
 #ifdef CONFIG_PV
     struct domain *owner = page_get_owner(page);
-    unsigned long gmfn;
     int rc;
 
     if ( likely(owner != NULL) && unlikely(paging_mode_enabled(owner)) )
@@ -2638,11 +2637,11 @@ int free_page_type(struct page_info *page, unsigned 
long type,
         /* A page table is dirtied when its type count becomes zero. */
         paging_mark_dirty(owner, page_to_mfn(page));
 
-        ASSERT(!shadow_mode_refcounts(owner));
+        ASSERT(shadow_mode_enabled(owner));
+        ASSERT(!paging_mode_refcounts(owner));
+        ASSERT(!paging_mode_translate(owner));
 
-        gmfn = mfn_to_gmfn(owner, mfn_x(page_to_mfn(page)));
-        if ( VALID_M2P(gmfn) )
-            shadow_remove_all_shadows(owner, _mfn(gmfn));
+        shadow_remove_all_shadows(owner, page_to_mfn(page));
     }
 
     if ( !(type & PGT_partial) )
--
generated by git-patchbot for /home/xen/git/xen.git#staging

_______________________________________________
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®.