]> xenbits.xensource.com Git - people/pauldu/xen.git/commitdiff
introduce gprintk()
authorJan Beulich <jbeulich@suse.com>
Thu, 26 Mar 2015 10:08:28 +0000 (11:08 +0100)
committerJan Beulich <jbeulich@suse.com>
Thu, 26 Mar 2015 10:08:28 +0000 (11:08 +0100)
... and convert several gdprintk()-s to it, as the next patch will make
them no-ops in non-debug builds.

Note that as a non-debug facility this does not print file name and
line number of the origin, to people are expected to use meaningful and
easily distinguishable messages (i.e. just like with plain printk()).

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
12 files changed:
xen/arch/x86/domain.c
xen/arch/x86/hvm/hvm.c
xen/arch/x86/hvm/vmx/vmx.c
xen/arch/x86/mm.c
xen/arch/x86/mm/p2m-ept.c
xen/arch/x86/traps.c
xen/arch/x86/x86_64/compat/traps.c
xen/arch/x86/x86_64/traps.c
xen/common/event_fifo.c
xen/common/page_alloc.c
xen/common/schedule.c
xen/include/xen/lib.h

index aaa9ff9a22772978cbb8338c588c67ffe55e3794..7bae90ecd47f7aa653fce352cdec026f7ea5fbee 100644 (file)
@@ -1251,8 +1251,8 @@ static void load_segments(struct vcpu *n)
                  put_user(uregs->es,           esp-6) |
                  put_user(uregs->ds,           esp-7) )
             {
-                gdprintk(XENLOG_ERR, "Error while creating compat "
-                         "failsafe callback frame.\n");
+                gprintk(XENLOG_ERR,
+                        "error while creating compat failsafe callback frame\n");
                 domain_crash(n->domain);
             }
 
@@ -1293,8 +1293,8 @@ static void load_segments(struct vcpu *n)
              put_user(regs->r11,           rsp-10) |
              put_user(regs->rcx,           rsp-11) )
         {
-            gdprintk(XENLOG_ERR, "Error while creating failsafe "
-                    "callback frame.\n");
+            gprintk(XENLOG_ERR,
+                    "error while creating failsafe callback frame\n");
             domain_crash(n->domain);
         }
 
index dd6b0d0e3d481b945412c717e2bbfb20ddd6f9bc..3ff87c6b75529b9393a535238dcf98544adc001c 100644 (file)
@@ -2613,17 +2613,15 @@ bool_t hvm_send_assist_req(struct hvm_ioreq_server *s, ioreq_t *proto_p)
 
             if ( unlikely(p->state != STATE_IOREQ_NONE) )
             {
-                gdprintk(XENLOG_ERR,
-                         "Device model set bad IO state %d.\n",
-                         p->state);
+                gprintk(XENLOG_ERR, "device model set bad IO state %d\n",
+                        p->state);
                 goto crash;
             }
 
             if ( unlikely(p->vp_eport != port) )
             {
-                gdprintk(XENLOG_ERR,
-                         "Device model set bad event channel %d.\n",
-                         p->vp_eport);
+                gprintk(XENLOG_ERR, "device model set bad event channel %d\n",
+                        p->vp_eport);
                 goto crash;
             }
 
@@ -2721,9 +2719,9 @@ void hvm_triple_fault(void)
     struct domain *d = v->domain;
     u8 reason = d->arch.hvm_domain.params[HVM_PARAM_TRIPLE_FAULT_REASON];
 
-    gdprintk(XENLOG_INFO, "Triple fault on VCPU%d - "
-             "invoking HVM shutdown action %"PRIu8".\n",
-             v->vcpu_id, reason);
+    gprintk(XENLOG_INFO,
+            "Triple fault - invoking HVM shutdown action %d\n",
+            reason);
     domain_shutdown(d, reason);
 }
 
index 36d829f3ab9fe3a96f00134f6b8f1fd36c588fc8..2ac14924d659644e4dc0b7565ee9c5946a8427d4 100644 (file)
@@ -2479,21 +2479,21 @@ static void ept_handle_violation(unsigned long qualification, paddr_t gpa)
 
     /* Everything else is an error. */
     mfn = get_gfn_query_unlocked(d, gfn, &p2mt);
-    gdprintk(XENLOG_ERR, "EPT violation %#lx (%c%c%c/%c%c%c), "
-             "gpa %#"PRIpaddr", mfn %#lx, type %i.\n", 
-             qualification, 
-             (qualification & EPT_READ_VIOLATION) ? 'r' : '-',
-             (qualification & EPT_WRITE_VIOLATION) ? 'w' : '-',
-             (qualification & EPT_EXEC_VIOLATION) ? 'x' : '-',
-             (qualification & EPT_EFFECTIVE_READ) ? 'r' : '-',
-             (qualification & EPT_EFFECTIVE_WRITE) ? 'w' : '-',
-             (qualification & EPT_EFFECTIVE_EXEC) ? 'x' : '-',
-             gpa, mfn_x(mfn), p2mt);
+    gprintk(XENLOG_ERR,
+            "EPT violation %#lx (%c%c%c/%c%c%c) gpa %#"PRIpaddr" mfn %#lx type %i\n",
+            qualification,
+            (qualification & EPT_READ_VIOLATION) ? 'r' : '-',
+            (qualification & EPT_WRITE_VIOLATION) ? 'w' : '-',
+            (qualification & EPT_EXEC_VIOLATION) ? 'x' : '-',
+            (qualification & EPT_EFFECTIVE_READ) ? 'r' : '-',
+            (qualification & EPT_EFFECTIVE_WRITE) ? 'w' : '-',
+            (qualification & EPT_EFFECTIVE_EXEC) ? 'x' : '-',
+            gpa, mfn_x(mfn), p2mt);
 
     ept_walk_table(d, gfn);
 
     if ( qualification & EPT_GLA_VALID )
-        gdprintk(XENLOG_ERR, " --- GLA %#lx\n", gla);
+        gprintk(XENLOG_ERR, " --- GLA %#lx\n", gla);
 
     domain_crash(d);
 }
index 786ed4733179121a3c89bb0abb7725871d641402..c92ac904e52686af2bdde5dd46046d05f58f0ba7 100644 (file)
@@ -2017,11 +2017,10 @@ int get_page(struct page_info *page, struct domain *domain)
         put_page(page);
 
     if ( !paging_mode_refcounts(domain) && !domain->is_dying )
-        gdprintk(XENLOG_INFO,
-                 "Error pfn %lx: rd=%p, od=%p, caf=%08lx, taf=%"
-                 PRtype_info "\n",
-                 page_to_mfn(page), domain, owner,
-                 page->count_info, page->u.inuse.type_info);
+        gprintk(XENLOG_INFO,
+                "Error pfn %lx: rd=%p, od=%p, caf=%08lx, taf=%" PRtype_info "\n",
+                page_to_mfn(page), domain, owner,
+                page->count_info, page->u.inuse.type_info);
     return 0;
 }
 
@@ -4066,9 +4065,8 @@ static int replace_grant_p2m_mapping(
     if ( !p2m_is_grant(type) || mfn_x(old_mfn) != frame )
     {
         put_gfn(d, gfn);
-        gdprintk(XENLOG_WARNING,
-                 "replace_grant_p2m_mapping: old mapping invalid (type %d, mfn %lx, frame %lx)\n",
-                 type, mfn_x(old_mfn), frame);
+        MEM_LOG("replace_grant_p2m_mapping: old mapping invalid (type %d, mfn %lx, frame %lx)",
+                type, mfn_x(old_mfn), frame);
         return GNTST_general_error;
     }
     guest_physmap_remove_page(d, gfn, frame, PAGE_ORDER_4K);
index c2d7720d15040579d0b7880b33c5a16f726e249c..5e95a8309a6da03ba755bfd4eee1f16c005e3f82 100644 (file)
@@ -912,14 +912,13 @@ void ept_walk_table(struct domain *d, unsigned long gfn)
 
     int i;
 
-    gdprintk(XENLOG_ERR, "Walking EPT tables for domain %d gfn %lx\n",
-           d->domain_id, gfn);
+    gprintk(XENLOG_ERR, "Walking EPT tables for GFN %lx:\n", gfn);
 
     /* This pfn is higher than the highest the p2m map currently holds */
     if ( gfn > p2m->max_mapped_pfn )
     {
-        gdprintk(XENLOG_ERR, " gfn exceeds max_mapped_pfn %lx\n",
-               p2m->max_mapped_pfn);
+        gprintk(XENLOG_ERR, " gfn exceeds max_mapped_pfn %lx\n",
+                p2m->max_mapped_pfn);
         goto out;
     }
 
@@ -932,7 +931,7 @@ void ept_walk_table(struct domain *d, unsigned long gfn)
         index = gfn_remainder >> (i*EPT_TABLE_ORDER);
         ept_entry = table + index;
 
-        gdprintk(XENLOG_ERR, " epte %"PRIx64"\n", ept_entry->epte);
+        gprintk(XENLOG_ERR, " epte %"PRIx64"\n", ept_entry->epte);
 
         if ( (i == 0) || !is_epte_present(ept_entry) ||
              is_epte_superpage(ept_entry) )
index ac96ad9a5cbdb97ba2e6e1ff34020d4d49f83d40..22cdfc48ae8e4e19d5d3a930d1266ce2baed735e 100644 (file)
@@ -519,9 +519,9 @@ static void do_guest_trap(
         tb->flags |= TBF_INTERRUPT;
 
     if ( unlikely(null_trap_bounce(v, tb)) )
-        gdprintk(XENLOG_WARNING, "Unhandled %s fault/trap [#%d] "
-                 "on VCPU %d [ec=%04x]\n",
-                 trapstr(trapnr), trapnr, v->vcpu_id, regs->error_code);
+        gprintk(XENLOG_WARNING,
+                "Unhandled %s fault/trap [#%d, ec=%04x]\n",
+                trapstr(trapnr), trapnr, regs->error_code);
 }
 
 static void instruction_done(
index b6c2563f2828aa6d8febdbe66583b2abc211393b..4b6b9001cddd142ef13964d940af5f014c0dfad4 100644 (file)
@@ -164,7 +164,7 @@ unsigned int compat_iret(void)
     return regs->_eax;
 
  exit_and_crash:
-    gdprintk(XENLOG_ERR, "Fatal error\n");
+    gprintk(XENLOG_ERR, "Fatal IRET error\n");
     domain_crash(v->domain);
     return 0;
 }
index 0040bef9868a5987065175391ed0fef132e39e23..f58e3d66e5cfaf07058f379975ddb19a4dacaf24 100644 (file)
@@ -291,8 +291,8 @@ unsigned long do_iret(void)
     if ( unlikely(copy_from_user(&iret_saved, (void *)regs->rsp,
                                  sizeof(iret_saved))) )
     {
-        gdprintk(XENLOG_ERR, "Fault while reading IRET context from "
-                "guest stack\n");
+        gprintk(XENLOG_ERR,
+                "Fault while reading IRET context from guest stack\n");
         goto exit_and_crash;
     }
 
@@ -301,8 +301,8 @@ unsigned long do_iret(void)
     {
         if ( unlikely(pagetable_is_null(v->arch.guest_table_user)) )
         {
-            gdprintk(XENLOG_ERR, "Guest switching to user mode with no "
-                    "user page tables\n");
+            gprintk(XENLOG_ERR,
+                    "Guest switching to user mode with no user page tables\n");
             goto exit_and_crash;
         }
         toggle_guest_mode(v);
@@ -331,7 +331,6 @@ unsigned long do_iret(void)
     return iret_saved.rax;
 
  exit_and_crash:
-    gdprintk(XENLOG_ERR, "Fatal error\n");
     domain_crash(v->domain);
     return 0;
 }
index b81fae402ef24e390b09dcf43044f7d516abe895..c9b788461e4234b70d74a635f76d705675138499 100644 (file)
@@ -74,9 +74,9 @@ static struct evtchn_fifo_queue *lock_old_queue(const struct domain *d,
         spin_unlock_irqrestore(&old_q->lock, *flags);
     }
 
-    gdprintk(XENLOG_WARNING,
-             "domain %d, port %d lost event (too many queue changes)\n",
-             d->domain_id, evtchn->port);
+    gprintk(XENLOG_WARNING,
+            "dom%d port %d lost event (too many queue changes)\n",
+            d->domain_id, evtchn->port);
     return NULL;
 }          
 
index bfb356e6d016c47cfae1096fa009e9f8b7239c0e..986895d5d0538d5f6c1532c1e7b2205dfeaa1bc3 100644 (file)
@@ -1645,9 +1645,9 @@ int assign_pages(
         if ( unlikely((d->tot_pages + (1 << order)) > d->max_pages) )
         {
             if ( !opt_tmem || order != 0 || d->tot_pages != d->max_pages )
-                gdprintk(XENLOG_INFO, "Over-allocation for domain %u: "
-                         "%u > %u\n", d->domain_id,
-                         d->tot_pages + (1 << order), d->max_pages);
+                gprintk(XENLOG_INFO, "Over-allocation for domain %u: "
+                        "%u > %u\n", d->domain_id,
+                        d->tot_pages + (1 << order), d->max_pages);
             goto fail;
         }
 
index ef79847bd551a70dd3188823f01d0da09d68cff2..462ff91766b780f9a6eb24dc5dac5214033085a7 100644 (file)
@@ -1063,9 +1063,8 @@ long do_set_timer_op(s_time_t timeout)
          * timeout in this case can burn a lot of CPU. We therefore go for a
          * reasonable middleground of triggering a timer event in 100ms.
          */
-        gdprintk(XENLOG_INFO,
-                 "Warning: huge timeout set by vcpu %d: %"PRIx64"\n",
-                 v->vcpu_id, (uint64_t)timeout);
+        gprintk(XENLOG_INFO, "Warning: huge timeout set: %"PRIx64"\n",
+                (uint64_t)timeout);
         set_timer(&v->singleshot_timer, NOW() + MILLISECS(100));
     }
     else
index 8fa95ac52a80c0ed44b361b7ccf3cf8eb5bfcacd..8d519aaa8bb6436e9493ae0fb110b694102013f0 100644 (file)
@@ -85,6 +85,9 @@ extern long vm_assist(struct domain *, unsigned int cmd, unsigned int type,
 extern int __printk_ratelimit(int ratelimit_ms, int ratelimit_burst);
 extern int printk_ratelimit(void);
 
+#define gprintk(lvl, fmt, args...) \
+    printk(XENLOG_GUEST lvl "%pv " fmt, current, ## args)
+
 /* vsprintf.c */
 #define sprintf __xen_has_no_sprintf__
 #define vsprintf __xen_has_no_vsprintf__