Skip to contentSkip to conversation

x86/mm: Provide more useful information in diagnostics

PATCH In review Andrew Cooper 2 participants 2 messages Jul 16, 2019 – Jul 17, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/mm: Provide more useful information in diagnostics

* alloc_l?_table() should identify the failure, not just state that there is one.
* get_page() should use %pd for the two domains, to render system domains in a more obvious way.

---
CC: Jan Beulich <[email protected]>
CC: Wei Liu <[email protected]>
CC: Roger Pau Monné <[email protected]>

---
 xen/arch/x86/mm.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)
xen/arch/x86/mm.c +9 -7
index 138662e777..0f0761d624 100644
@@ -1407,7 +1407,8 @@ static int alloc_l1_table(struct page_info *page)
     return 0;
 
  fail:
-    gdprintk(XENLOG_WARNING, "Failure in alloc_l1_table: slot %#x\n", i);
+    gdprintk(XENLOG_WARNING,
+             "Failure in alloc_l1_table: slot %#x, ret %d\n", i, ret);
  out:
     while ( i-- > 0 )
         put_page_from_l1e(pl1e[i], d);
@@ -1505,7 +1506,8 @@ static int alloc_l2_table(struct page_info *page, unsigned long type)
         }
         else if ( rc < 0 && rc != -EINTR )
         {
-            gdprintk(XENLOG_WARNING, "Failure in alloc_l2_table: slot %#x\n", i);
+            gdprintk(XENLOG_WARNING,
+                     "Failure in alloc_l2_table: slot %#x, rc %d\n", i, rc);
             if ( i )
             {
                 page->nr_validated_ptes = i;
@@ -1599,7 +1601,8 @@ static int alloc_l3_table(struct page_info *page)
         rc = -EINVAL;
     if ( rc < 0 && rc != -ERESTART && rc != -EINTR )
     {
-        gdprintk(XENLOG_WARNING, "Failure in alloc_l3_table: slot %#x\n", i);
+        gdprintk(XENLOG_WARNING,
+                 "Failure in alloc_l3_table: slot %#x, rc %d\n", i, rc);
         if ( i )
         {
             page->nr_validated_ptes = i;
@@ -1767,7 +1770,7 @@ static int alloc_l4_table(struct page_info *page)
         {
             if ( rc != -EINTR )
                 gdprintk(XENLOG_WARNING,
-                         "Failure in alloc_l4_table: slot %#x\n", i);
+                         "Failure in alloc_l4_table: slot %#x, rc %d\n", i, rc);
             if ( i )
             {
                 page->nr_validated_ptes = i;
@@ -2482,9 +2485,8 @@ int get_page(struct page_info *page, struct domain *domain)
 
     if ( !paging_mode_refcounts(domain) && !domain->is_dying )
         gprintk(XENLOG_INFO,
-                "Error mfn %"PRI_mfn": rd=%d od=%d caf=%08lx taf=%" PRtype_info "\n",
-                mfn_x(page_to_mfn(page)), domain->domain_id,
-                owner ? owner->domain_id : DOMID_INVALID,
+                "Error mfn %"PRI_mfn": rd=%pd od=%pd caf=%08lx taf=%"PRtype_info"\n",
+                mfn_x(page_to_mfn(page)), domain, owner,
                 page->count_info - !!owner, page->u.inuse.type_info);
 
     if ( owner )
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Acked-by on v1 1/1
#1 lore raw

xen/arch/x86/mm.c static int alloc_l1_table(struct page_info *page) · line 1411

Quoted 9 lines · Andrew Cooper
xen/arch/x86/mm.c +2 -1
@@ -1407,7 +1407,8 @@ static int alloc_l1_table(struct page_info *page)
      return 0;
 
   fail:
-    gdprintk(XENLOG_WARNING, "Failure in alloc_l1_table: slot %#x\n", i);
+    gdprintk(XENLOG_WARNING,
+             "Failure in alloc_l1_table: slot %#x, ret %d\n", i, ret);

To make it slightly less output without losing information, in cases like this I generally prefer "Failure %d in alloc_l1_table: slot %#x\n". Seeing ...

xen/arch/x86/mm.c static int alloc_l2_table(struct page_info *page, unsigned long type) · line 1510

Quoted 7 lines
xen/arch/x86/mm.c +2 -1
@@ -1505,7 +1506,8 @@ static int alloc_l2_table(struct page_info *page, unsigned long type)
          }
          else if ( rc < 0 && rc != -EINTR )
          {
-            gdprintk(XENLOG_WARNING, "Failure in alloc_l2_table: slot %#x\n", i);
+            gdprintk(XENLOG_WARNING,
+                     "Failure in alloc_l2_table: slot %#x, rc %d\n", i, rc);

... this for comparison it is, imo, not relevant to actually have names of local variables in logged messages.

Preferably with this adjusted

Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel