x86/mem-paging: further adjustments to p2m_mem_paging_prep()'s error handling
diff mbox series

Message ID 4543e93b-f861-ea0b-9de0-cba1aa938eb7@suse.com
State New
Headers show
Series
  • x86/mem-paging: further adjustments to p2m_mem_paging_prep()'s error handling
Related show

Commit Message

Jan Beulich May 19, 2020, 3:28 p.m. UTC
Address late comments on ecb913be4aaa ("x86/mem-paging: correct
p2m_mem_paging_prep()'s error handling"):
- insert a gprintk() ahead of domain_crash(),
- add a comment.

Requested-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>

Comments

Andrew Cooper May 19, 2020, 3:30 p.m. UTC | #1
On 19/05/2020 16:28, Jan Beulich wrote:
> Address late comments on ecb913be4aaa ("x86/mem-paging: correct
> p2m_mem_paging_prep()'s error handling"):
> - insert a gprintk() ahead of domain_crash(),
> - add a comment.
>
> Requested-by: Andrew Cooper <andrew.cooper3@citrix.com>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>

Patch
diff mbox series

--- a/xen/arch/x86/mm/mem_paging.c
+++ b/xen/arch/x86/mm/mem_paging.c
@@ -385,6 +385,9 @@  static int prepare(struct domain *d, gfn
              * The domain can't possibly know about this page yet, so failure
              * here is a clear indication of something fishy going on.
              */
+            gprintk(XENLOG_ERR,
+                    "%pd: fresh page for GFN %"PRI_gfn" in unexpected state\n",
+                    d, gfn_x(gfn));
             domain_crash(d);
             page = NULL;
             goto out;
@@ -423,6 +426,10 @@  static int prepare(struct domain *d, gfn
 
     if ( page )
     {
+        /*
+         * Free the page on error.  Drop our temporary reference in all
+         * cases.
+         */
         if ( ret )
             put_page_alloc_ref(page);
         put_page(page);