WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH][RFC] addition of loglevel for printf in Xen HV

To: xen-devel@xxxxxxxxxxxxxxxxxxx, Keir.Fraser@xxxxxxxxxxxx, "Stephen C. Tweedie" <sct@xxxxxxxxxx>, Chris Wright <chrisw@xxxxxxxxxx>
Subject: [Xen-devel] [PATCH][RFC] addition of loglevel for printf in Xen HV
From: Steven Rostedt <srostedt@xxxxxxxxxx>
Date: Mon, 02 Oct 2006 12:26:43 -0400
Delivery-date: Mon, 02 Oct 2006 09:26:48 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Thunderbird 1.5.0.4 (X11/20060614)
In the current implementation, the logging in the Hypervisor is basically at two levels. The developer can print "always" or "verbose". The always print is when the developer uses "printk/printf" in the hypervisor. The "verbose" is when the developer uses DPRINTK, since the DPRINTK macro is only defined when the "verbose" flag is set.

Now the problem we are having, is that when we send out a distribution, we want enough information to be printed if one of our customers has a problem. But we also don't want to have so much printed that it affects the performance of the system. Or worst yet, if the system has a serial console attached, one of the DomU's could in essence cause a DoS attack on the whole system by causing the DomU to do certain errors that causes a thousand prints to the serial console. These prints are done with interrupts disabled, so the system suffers large latencies for each print.

Since it would be helpful to have prints for different environments, I've introduced with this patch a Linux like loglevel from 0-7. When the user sets the loglevel to 0, only emergency prints are preformed, and when 7 is selected, all prints are done.

Here's the list of levels that I have added:

#define XEN_EMERG   "<0>"
#define XEN_ALERT   "<1>"
#define XEN_CRIT    "<2>"
#define XEN_ERR     "<3>"
#define XEN_WARNING "<4>"
#define XEN_GUEST   "<5>"
#define XEN_INFO    "<6>"
#define XEN_DEBUG   "<7>"

Basically, these correspond to their Linux equivalents. The one difference, is that the KERN_NOTICE was replaced by XEN_GUEST. The XEN_GUEST is the level that a guest can "at will" cause this print. So a distribution can set the print log level to 4 (XEN_WARNING) and all prints that are of errors and can be used for debugging are now available, without the prints that allow a Guest to cause a DoS.

I also added the keyhandlers '0' to '7' to allow the user to change the loglevel on a running system to the corresponding key. This is similar to the way Linux uses sysrq to change its log levels.

Two things that are not implemented with this patch but should be, and thus the RFC in the subject.

1. How to default the log level on build. Should the verbose now be a number, and not a config? i.e. VERBOSE=4

2. How the user in Linux can change the log level (from dom0). Should we add a hypercall or some other method to allow the user to change the logging?

Also, I made a pass though to assign all DPRINTK a log level. I may not have done this correctly. But a loglevel of 7 is now the same a VERBOSE=y and a loglevel of 0 is almost the same of a VERBOSE=n. There was a couple of places where XEN_EMERG was used.

This patch really does need to go in. Whether in its current form, or modified greatly. The ability to give the developer a level of printing is a great asset. That is why Linux has this ability.

-- Steve
diff -r 96a77ef725b8 xen/arch/ia64/vmx/vlsapic.c
--- a/xen/arch/ia64/vmx/vlsapic.c       Mon Oct 02 13:45:44 2006 +0100
+++ b/xen/arch/ia64/vmx/vlsapic.c       Mon Oct 02 11:47:44 2006 -0400
@@ -389,7 +389,7 @@ void vlsapic_reset(VCPU *vcpu)
     vcpu->arch.arch_vmx.vlapic.vcpu = vcpu;
     hvm_vioapic_add_lapic(&vcpu->arch.arch_vmx.vlapic, vcpu);
 #endif
-    DPRINTK("VLSAPIC inservice base=%p\n", &VLSAPIC_INSVC(vcpu,0) );
+    DPRINTK(XEN_INFO "VLSAPIC inservice base=%p\n", &VLSAPIC_INSVC(vcpu,0) );
 }
 
 /*
@@ -518,7 +518,7 @@ int vmx_vcpu_pend_interrupt(VCPU *vcpu, 
     int ret;
 
     if (vector & ~0xff) {
-        DPRINTK("vmx_vcpu_pend_interrupt: bad vector\n");
+        DPRINTK(XEN_GUEST "vmx_vcpu_pend_interrupt: bad vector\n");
         return -1;
     }
     local_irq_save(spsr);
diff -r 96a77ef725b8 xen/arch/ia64/vmx/vmx_hypercall.c
--- a/xen/arch/ia64/vmx/vmx_hypercall.c Mon Oct 02 13:45:44 2006 +0100
+++ b/xen/arch/ia64/vmx/vmx_hypercall.c Mon Oct 02 11:47:44 2006 -0400
@@ -79,7 +79,7 @@ do_hvm_op(unsigned long op, XEN_GUEST_HA
     }
 
     default:
-        DPRINTK("Bad HVM op %ld.\n", op);
+        DPRINTK(XEN_GUEST "Bad HVM op %ld.\n", op);
         rc = -ENOSYS;
     }
     return rc;
diff -r 96a77ef725b8 xen/arch/ia64/vmx/vmx_init.c
--- a/xen/arch/ia64/vmx/vmx_init.c      Mon Oct 02 13:45:44 2006 +0100
+++ b/xen/arch/ia64/vmx/vmx_init.c      Mon Oct 02 11:47:44 2006 -0400
@@ -277,7 +277,7 @@ static void vmx_create_event_channels(st
                        p = get_vio(v->domain, o->vcpu_id);
                        o->arch.arch_vmx.xen_port = p->vp_eport =
                                        alloc_unbound_xen_event_channel(o, 0);
-                       DPRINTK("Allocated port %d for hvm.\n",
+                       DPRINTK(XEN_GUEST "Allocated port %d for hvm.\n",
                                o->arch.arch_vmx.xen_port);
                }
        }
diff -r 96a77ef725b8 xen/arch/ia64/xen/dom0_ops.c
--- a/xen/arch/ia64/xen/dom0_ops.c      Mon Oct 02 13:45:44 2006 +0100
+++ b/xen/arch/ia64/xen/dom0_ops.c      Mon Oct 02 11:47:44 2006 -0400
@@ -252,7 +252,8 @@ do_dom0vp_op(unsigned long cmd,
     case IA64_DOM0VP_phystomach:
         ret = ____lookup_domain_mpa(d, arg0 << PAGE_SHIFT);
         if (ret == INVALID_MFN) {
-            DPRINTK("%s:%d INVALID_MFN ret: 0x%lx\n", __func__, __LINE__, ret);
+            DPRINTK(XEN_INFO "%s:%d INVALID_MFN ret: 0x%lx\n",
+                     __func__, __LINE__, ret);
         } else {
             ret = (ret & _PFN_MASK) >> PAGE_SHIFT;//XXX pte_pfn()
         }
diff -r 96a77ef725b8 xen/arch/ia64/xen/domain.c
--- a/xen/arch/ia64/xen/domain.c        Mon Oct 02 13:45:44 2006 +0100
+++ b/xen/arch/ia64/xen/domain.c        Mon Oct 02 11:47:44 2006 -0400
@@ -625,7 +625,7 @@ int shadow_mode_control(struct domain *d
        //struct vcpu *v;
 
        if (unlikely(d == current->domain)) {
-               DPRINTK("Don't try to do a shadow op on yourself!\n");
+               DPRINTK(XEN_GUEST "Don't try to do a shadow op on yourself!\n");
                return -EINVAL;
        }   
 
diff -r 96a77ef725b8 xen/arch/ia64/xen/irq.c
--- a/xen/arch/ia64/xen/irq.c   Mon Oct 02 13:45:44 2006 +0100
+++ b/xen/arch/ia64/xen/irq.c   Mon Oct 02 11:47:44 2006 -0400
@@ -377,7 +377,7 @@ int pirq_guest_bind(struct vcpu *v, int 
     {
         if ( desc->action != NULL )
         {
-            DPRINTK("Cannot bind IRQ %d to guest. In use by '%s'.\n",
+            DPRINTK(XEN_GUEST "Cannot bind IRQ %d to guest. In use by '%s'.\n",
                     irq, desc->action->name);
             rc = -EBUSY;
             goto out;
@@ -386,7 +386,8 @@ int pirq_guest_bind(struct vcpu *v, int 
         action = xmalloc(irq_guest_action_t);
         if ( (desc->action = (struct irqaction *)action) == NULL )
         {
-            DPRINTK("Cannot bind IRQ %d to guest. Out of memory.\n", irq);
+            DPRINTK(XEN_GUEST "Cannot bind IRQ %d to guest. Out of memory.\n",
+                    irq);
             rc = -ENOMEM;
             goto out;
         }
@@ -410,7 +411,8 @@ int pirq_guest_bind(struct vcpu *v, int 
     }
     else if ( !will_share || !action->shareable )
     {
-        DPRINTK("Cannot bind IRQ %d to guest. Will not share with others.\n",
+        DPRINTK(XEN_GUEST "Cannot bind IRQ %d to guest. "
+                           "Will not share with others.\n",
                 irq);
         rc = -EBUSY;
         goto out;
@@ -418,7 +420,9 @@ int pirq_guest_bind(struct vcpu *v, int 
 
     if ( action->nr_guests == IRQ_MAX_GUESTS )
     {
-        DPRINTK("Cannot bind IRQ %d to guest. Already at max share.\n", irq);
+        DPRINTK(XEN_GUEST "Cannot bind IRQ %d to guest. "
+                           "Already at max share.\n",
+                            irq);
         rc = -EBUSY;
         goto out;
     }
diff -r 96a77ef725b8 xen/arch/ia64/xen/mm.c
--- a/xen/arch/ia64/xen/mm.c    Mon Oct 02 13:45:44 2006 +0100
+++ b/xen/arch/ia64/xen/mm.c    Mon Oct 02 11:47:44 2006 -0400
@@ -227,7 +227,8 @@ try_to_clear_PGC_allocate(struct domain*
         if (unlikely(!(x & PGC_allocated)) || unlikely(_nd != _d)) {
             struct domain* nd = unpickle_domptr(_nd);
             if (nd == NULL) {
-                DPRINTK("gnttab_transfer: Bad page %p: ed=%p(%u) 0x%x, "
+                DPRINTK(XEN_GUEST "gnttab_transfer: "
+                        "Bad page %p: ed=%p(%u) 0x%x, "
                         "sd=%p 0x%x,"
                         " caf=%016lx, taf=%" PRtype_info "\n",
                         (void *) page_to_mfn(page),
@@ -933,7 +934,7 @@ efi_mmio(unsigned long physaddr, unsigne
 
         if (start <= physaddr && physaddr < end) {
             if ((physaddr + size) > end) {
-                DPRINTK("%s:%d physaddr 0x%lx size = 0x%lx\n",
+                DPRINTK(XEN_INFO "%s:%d physaddr 0x%lx size = 0x%lx\n",
                         __func__, __LINE__, physaddr, size);
                 return 0;
             }
@@ -968,12 +969,12 @@ assign_domain_mmio_page(struct domain *d
                         unsigned long mpaddr, unsigned long size)
 {
     if (size == 0) {
-        DPRINTK("%s: domain %p mpaddr 0x%lx size = 0x%lx\n",
+        DPRINTK(XEN_INFO "%s: domain %p mpaddr 0x%lx size = 0x%lx\n",
                 __func__, d, mpaddr, size);
     }
     if (!efi_mmio(mpaddr, size)) {
 #ifndef NDEBUG
-        DPRINTK("%s:%d domain %p mpaddr 0x%lx size = 0x%lx\n",
+        DPRINTK(XEN_INFO "%s:%d domain %p mpaddr 0x%lx size = 0x%lx\n",
                 __func__, __LINE__, d, mpaddr, size);
 #endif
         return -EINVAL;
@@ -1062,7 +1063,7 @@ assign_domain_page_cmpxchg_rel(struct do
     old_mfn = page_to_mfn(old_page);
     old_pte = pfn_pte(old_mfn, __pgprot(old_arflags));
     if (!pte_present(old_pte)) {
-        DPRINTK("%s: old_pte 0x%lx old_arflags 0x%lx old_mfn 0x%lx\n",
+        DPRINTK(XEN_INFO "%s: old_pte 0x%lx old_arflags 0x%lx old_mfn 0x%lx\n",
                 __func__, pte_val(old_pte), old_arflags, old_mfn);
         return -EINVAL;
     }
@@ -1078,7 +1079,7 @@ assign_domain_page_cmpxchg_rel(struct do
             goto again;
         }
 
-        DPRINTK("%s: old_pte 0x%lx old_arflags 0x%lx old_mfn 0x%lx "
+        DPRINTK(XEN_INFO "%s: old_pte 0x%lx old_arflags 0x%lx old_mfn 0x%lx "
                 "ret_pte 0x%lx ret_mfn 0x%lx\n",
                 __func__,
                 pte_val(old_pte), old_arflags, old_mfn,
@@ -1137,7 +1138,7 @@ zap_domain_page_one(struct domain *d, un
                 goto again;
             }
 
-            DPRINTK("%s: old_pte 0x%lx old_arflags 0x%lx mfn 0x%lx "
+            DPRINTK(XEN_INFO "%s: old_pte 0x%lx old_arflags 0x%lx mfn 0x%lx "
                     "ret_pte 0x%lx ret_mfn 0x%lx\n",
                     __func__,
                     pte_val(old_pte), old_arflags, mfn,
@@ -1203,7 +1204,7 @@ dom0vp_add_physmap(struct domain* d, uns
             rd = dom_io;
             break;
         default:
-            DPRINTK("d 0x%p domid %d "
+            DPRINTK(XEN_INFO "d 0x%p domid %d "
                     "pgfn 0x%lx mfn 0x%lx flags 0x%lx domid %d\n",
                     d, d->domain_id, gpfn, mfn, flags, domid);
             return -ESRCH;
@@ -1243,7 +1244,7 @@ create_grant_host_mapping(unsigned long 
 
     if (flags & (GNTMAP_device_map |
                  GNTMAP_application_map | GNTMAP_contains_pte)) {
-        DPRINTK("%s: flags 0x%x\n", __func__, flags);
+        DPRINTK(XEN_INFO "%s: flags 0x%x\n", __func__, flags);
         return GNTST_general_error;
     }
 
@@ -1272,13 +1273,13 @@ destroy_grant_host_mapping(unsigned long
     struct page_info* page;
 
     if (flags & (GNTMAP_application_map | GNTMAP_contains_pte)) {
-        DPRINTK("%s: flags 0x%x\n", __func__, flags);
+        DPRINTK(XEN_INFO "%s: flags 0x%x\n", __func__, flags);
         return GNTST_general_error;
     }
 
     pte = lookup_noalloc_domain_pte(d, gpaddr);
     if (pte == NULL) {
-        DPRINTK("%s: gpaddr 0x%lx mfn 0x%lx\n", __func__, gpaddr, mfn);
+        DPRINTK(XEN_INFO "%s: gpaddr 0x%lx mfn 0x%lx\n", __func__, gpaddr, 
mfn);
         return GNTST_general_error;
     }
 
@@ -1286,7 +1287,7 @@ destroy_grant_host_mapping(unsigned long
     cur_arflags = pte_val(*pte) & ~_PAGE_PPN_MASK;
     cur_pte = pfn_pte(mfn, __pgprot(cur_arflags));
     if (!pte_present(cur_pte)) {
-        DPRINTK("%s: gpaddr 0x%lx mfn 0x%lx cur_pte 0x%lx\n",
+        DPRINTK(XEN_INFO "%s: gpaddr 0x%lx mfn 0x%lx cur_pte 0x%lx\n",
                 __func__, gpaddr, mfn, pte_val(cur_pte));
         return GNTST_general_error;
     }
@@ -1294,7 +1295,8 @@ destroy_grant_host_mapping(unsigned long
 
     old_pte = ptep_cmpxchg_rel(&d->arch.mm, gpaddr, pte, cur_pte, new_pte);
     if (unlikely(!pte_present(old_pte))) {
-        DPRINTK("%s: gpaddr 0x%lx mfn 0x%lx cur_pte 0x%lx old_pte 0x%lx\n",
+        DPRINTK(XEN_INFO "%s: gpaddr 0x%lx mfn 0x%lx"
+                         " cur_pte 0x%lx old_pte 0x%lx\n",
                 __func__, gpaddr, mfn, pte_val(cur_pte), pte_val(old_pte));
         return GNTST_general_error;
     }
@@ -1302,7 +1304,8 @@ destroy_grant_host_mapping(unsigned long
         if (pte_pfn(old_pte) == mfn) {
             goto again;
         }
-        DPRINTK("%s gpaddr 0x%lx mfn 0x%lx cur_pte 0x%lx old_pte 0x%lx\n",
+        DPRINTK(XEN_INFO "%s gpaddr 0x%lx mfn 0x%lx cur_pte "
+                "0x%lx old_pte 0x%lx\n",
                 __func__, gpaddr, mfn, pte_val(cur_pte), pte_val(old_pte));
         return GNTST_general_error;
     }
@@ -1333,7 +1336,8 @@ steal_page(struct domain *d, struct page
     u64 x, nx, y;
 
     if (page_get_owner(page) != d) {
-        DPRINTK("%s d 0x%p owner 0x%p\n", __func__, d, page_get_owner(page));
+        DPRINTK(XEN_GUEST "%s d 0x%p owner 0x%p\n",
+                __func__, d, page_get_owner(page));
         return -1;
     }
     
@@ -1345,7 +1349,7 @@ steal_page(struct domain *d, struct page
 
         new = alloc_domheap_page(d);
         if (new == NULL) {
-            DPRINTK("alloc_domheap_page() failed\n");
+            DPRINTK(XEN_GUEST "alloc_domheap_page() failed\n");
             return -1;
         }
         // zero out pages for security reasons
@@ -1369,7 +1373,8 @@ steal_page(struct domain *d, struct page
         ret = assign_domain_page_cmpxchg_rel(d, gpfn << PAGE_SHIFT, page, new,
                                              ASSIGN_writable);
         if (ret < 0) {
-            DPRINTK("assign_domain_page_cmpxchg_rel failed %d\n", ret);
+            DPRINTK(XEN_GUEST "assign_domain_page_cmpxchg_rel failed %d\n",
+                    ret);
             set_gpfn_from_mfn(new_mfn, INVALID_M2P_ENTRY);
             free_domheap_page(new);
             return -1;
@@ -1405,7 +1410,8 @@ steal_page(struct domain *d, struct page
             unlikely(_nd != _d)) {
             struct domain* nd = unpickle_domptr(_nd);
             if (nd == NULL) {
-                DPRINTK("gnttab_transfer: Bad page %p: ed=%p(%u) 0x%x, "
+                DPRINTK(XEN_GUEST "gnttab_transfer: "
+                        "Bad page %p: ed=%p(%u) 0x%x, "
                         "sd=%p 0x%x,"
                         " caf=%016lx, taf=%" PRtype_info
                         " memflags 0x%x\n",
@@ -1416,7 +1422,8 @@ steal_page(struct domain *d, struct page
                         page->u.inuse.type_info,
                         memflags);
             } else {
-                DPRINTK("gnttab_transfer: Bad page %p: ed=%p(%u) 0x%x, "
+                DPRINTK(XEN_GUEST "gnttab_transfer: "
+                        "Bad page %p: ed=%p(%u) 0x%x, "
                         "sd=%p(%u) 0x%x,"
                         " caf=%016lx, taf=%" PRtype_info
                         " memflags 0x%x\n",
diff -r 96a77ef725b8 xen/arch/ia64/xen/vcpu.c
--- a/xen/arch/ia64/xen/vcpu.c  Mon Oct 02 13:45:44 2006 +0100
+++ b/xen/arch/ia64/xen/vcpu.c  Mon Oct 02 11:47:44 2006 -0400
@@ -1442,7 +1442,7 @@ again:
                        set_metaphysical_rr0();
                }
                if (bundle->i64[0] == 0 && bundle->i64[1] == 0) {
-                       DPRINTK("%s gip 0x%lx\n", __func__, gip);
+                       DPRINTK(XEN_INFO "%s gip 0x%lx\n", __func__, gip);
                        return 0;
                }
                return 1;
diff -r 96a77ef725b8 xen/arch/powerpc/mm.c
--- a/xen/arch/powerpc/mm.c     Mon Oct 02 13:45:44 2006 +0100
+++ b/xen/arch/powerpc/mm.c     Mon Oct 02 11:47:44 2006 -0400
@@ -268,7 +268,7 @@ int allocate_rma(struct domain *d, unsig
 
     d->arch.rma_page = alloc_domheap_pages(d, order, 0);
     if (d->arch.rma_page == NULL) {
-        DPRINTK("Could not allocate order=%d RMA for domain %u\n",
+        DPRINTK(XEN_GUEST "Could not allocate order=%d RMA for domain %u\n",
                 order, d->domain_id);
         return -ENOMEM;
     }
diff -r 96a77ef725b8 xen/arch/powerpc/shadow.c
--- a/xen/arch/powerpc/shadow.c Mon Oct 02 13:45:44 2006 +0100
+++ b/xen/arch/powerpc/shadow.c Mon Oct 02 11:47:44 2006 -0400
@@ -120,14 +120,14 @@ int shadow_domctl(struct domain *d,
 {
     if ( unlikely(d == current->domain) )
     {
-        DPRINTK("Don't try to do a shadow op on yourself!\n");
+        DPRINTK(XEN_GUEST "Don't try to do a shadow op on yourself!\n");
         return -EINVAL;
     }
 
     switch ( sc->op )
     {
     case XEN_DOMCTL_SHADOW_OP_OFF:
-         DPRINTK("Shadow is mandatory!\n");
+         DPRINTK(XEN_GUEST "Shadow is mandatory!\n");
          return -EINVAL;
 
     case XEN_DOMCTL_SHADOW_OP_GET_ALLOCATION:
diff -r 96a77ef725b8 xen/arch/x86/domain.c
--- a/xen/arch/x86/domain.c     Mon Oct 02 13:45:44 2006 +0100
+++ b/xen/arch/x86/domain.c     Mon Oct 02 11:47:44 2006 -0400
@@ -556,7 +556,8 @@ static void load_segments(struct vcpu *n
              put_user(regs->r11,           rsp-10) |
              put_user(regs->rcx,           rsp-11) )
         {
-            DPRINTK("Error while creating failsafe callback frame.\n");
+            DPRINTK(XEN_GUEST "Error while creating failsafe "
+                    "callback frame.\n");
             domain_crash(n->domain);
         }
 
diff -r 96a77ef725b8 xen/arch/x86/extable.c
--- a/xen/arch/x86/extable.c    Mon Oct 02 13:45:44 2006 +0100
+++ b/xen/arch/x86/extable.c    Mon Oct 02 11:47:44 2006 -0400
@@ -74,7 +74,7 @@ search_pre_exception_table(struct cpu_us
     unsigned long addr = (unsigned long)regs->eip;
     unsigned long fixup = search_one_table(
         __start___pre_ex_table, __stop___pre_ex_table-1, addr);
-    DPRINTK("Pre-exception: %p -> %p\n", _p(addr), _p(fixup));
+    DPRINTK(XEN_INFO "Pre-exception: %p -> %p\n", _p(addr), _p(fixup));
 #ifdef PERF_COUNTERS
     if ( fixup )
         perfc_incrc(exception_fixed);
diff -r 96a77ef725b8 xen/arch/x86/hvm/hvm.c
--- a/xen/arch/x86/hvm/hvm.c    Mon Oct 02 13:45:44 2006 +0100
+++ b/xen/arch/x86/hvm/hvm.c    Mon Oct 02 11:47:44 2006 -0400
@@ -192,7 +192,8 @@ void hvm_create_event_channels(struct vc
             p = get_vio(v->domain, o->vcpu_id);
             o->arch.hvm_vcpu.xen_port = p->vp_eport =
                 alloc_unbound_xen_event_channel(o, 0);
-            DPRINTK("Allocated port %d for hvm.\n", o->arch.hvm_vcpu.xen_port);
+            DPRINTK(XEN_INFO "Allocated port %d for hvm.\n",
+                    o->arch.hvm_vcpu.xen_port);
         }
     }
 }
@@ -343,7 +344,8 @@ static void hvm_vcpu_down(void)
     struct domain *d = v->domain;
     int online_count = 0;
 
-    DPRINTK("DOM%d/VCPU%d: going offline.\n", d->domain_id, v->vcpu_id);
+    DPRINTK(XEN_GUEST "DOM%d/VCPU%d: going offline.\n",
+           d->domain_id, v->vcpu_id);
 
     /* Doesn't halt us immediately, but we'll never return to guest context. */
     set_bit(_VCPUF_down, &v->vcpu_flags);
@@ -359,7 +361,8 @@ static void hvm_vcpu_down(void)
     /* ... Shut down the domain if not. */
     if ( online_count == 0 )
     {
-        DPRINTK("DOM%d: all CPUs offline -- powering off.\n", d->domain_id);
+        DPRINTK(XEN_GUEST "DOM%d: all CPUs offline -- powering off.\n",
+                d->domain_id);
         domain_shutdown(d, SHUTDOWN_poweroff);
     }
 }
@@ -499,7 +502,7 @@ void hvm_do_hypercall(struct cpu_user_re
 
     if ( (pregs->eax >= NR_hypercalls) || !hvm_hypercall_table[pregs->eax] )
     {
-        DPRINTK("HVM vcpu %d:%d did a bad hypercall %d.\n",
+        DPRINTK(XEN_GUEST "HVM vcpu %d:%d did a bad hypercall %d.\n",
                 current->domain->domain_id, current->vcpu_id,
                 pregs->eax);
         pregs->eax = -ENOSYS;
@@ -545,7 +548,7 @@ static long do_memory_op_compat32(int cm
     }
 
     default:
-        DPRINTK("memory_op %d.\n", cmd);
+        DPRINTK(XEN_GUEST "memory_op %d.\n", cmd);
         rc = -ENOSYS;
         break;
     }
@@ -578,7 +581,7 @@ void hvm_do_hypercall(struct cpu_user_re
     pregs->rax = (uint32_t)pregs->eax; /* mask in case compat32 caller */
     if ( (pregs->rax >= NR_hypercalls) || !hvm_hypercall64_table[pregs->rax] )
     {
-        DPRINTK("HVM vcpu %d:%d did a bad hypercall %ld.\n",
+        DPRINTK(XEN_GUEST "HVM vcpu %d:%d did a bad hypercall %ld.\n",
                 current->domain->domain_id, current->vcpu_id,
                 pregs->rax);
         pregs->rax = -ENOSYS;
@@ -629,7 +632,7 @@ int hvm_bringup_ap(int vcpuid, int tramp
 
     if ( bsp->vcpu_id != 0 )
     {
-        DPRINTK("Not calling hvm_bringup_ap from BSP context.\n");
+        DPRINTK(XEN_GUEST "Not calling hvm_bringup_ap from BSP context.\n");
         domain_crash_synchronous();
     }
 
@@ -638,7 +641,7 @@ int hvm_bringup_ap(int vcpuid, int tramp
 
     if ( (ctxt = xmalloc(struct vcpu_guest_context)) == NULL )
     {
-        DPRINTK("Failed to allocate memory in hvm_bringup_ap.\n");
+        DPRINTK(XEN_GUEST "Failed to allocate memory in hvm_bringup_ap.\n");
         return -ENOMEM;
     }
 
@@ -652,13 +655,13 @@ int hvm_bringup_ap(int vcpuid, int tramp
 
     if ( rc != 0 )
     {
-        DPRINTK("AP %d bringup failed in boot_vcpu %x.\n", vcpuid, rc);
+        DPRINTK(XEN_GUEST "AP %d bringup failed in boot_vcpu %x.\n", vcpuid, 
rc);
         return rc;
     }
 
     if ( test_and_clear_bit(_VCPUF_down, &d->vcpu[vcpuid]->vcpu_flags) )
         vcpu_wake(d->vcpu[vcpuid]);
-    DPRINTK("AP %d bringup suceeded.\n", vcpuid);
+    DPRINTK(XEN_INFO "AP %d bringup suceeded.\n", vcpuid);
 
     xfree(ctxt);
 
@@ -717,7 +720,7 @@ long do_hvm_op(unsigned long op, XEN_GUE
 
     default:
     {
-        DPRINTK("Bad HVM op %ld.\n", op);
+        DPRINTK(XEN_GUEST "Bad HVM op %ld.\n", op);
         rc = -ENOSYS;
         break;
     }
diff -r 96a77ef725b8 xen/arch/x86/hvm/instrlen.c
--- a/xen/arch/x86/hvm/instrlen.c       Mon Oct 02 13:45:44 2006 +0100
+++ b/xen/arch/x86/hvm/instrlen.c       Mon Oct 02 11:47:44 2006 -0400
@@ -317,7 +317,7 @@ done_prefixes:
 
         if ( modrm_mod == 3 )
         {
-            DPRINTK("Cannot parse ModRM.mod == 3.\n");
+            DPRINTK(XEN_GUEST "Cannot parse ModRM.mod == 3.\n");
             goto cannot_emulate;
         }
 
@@ -444,7 +444,7 @@ done:
     return length;
 
 cannot_emulate:
-    DPRINTK("Cannot emulate %02x at address %lx (eip %lx, mode %d)\n",
+    DPRINTK(XEN_GUEST "Cannot emulate %02x at address %lx (eip %lx, mode 
%d)\n",
             b, (unsigned long)_regs.eip, (unsigned long)regs->eip, mode);
     return -1;
 }
diff -r 96a77ef725b8 xen/arch/x86/hvm/svm/svm.c
--- a/xen/arch/x86/hvm/svm/svm.c        Mon Oct 02 13:45:44 2006 +0100
+++ b/xen/arch/x86/hvm/svm/svm.c        Mon Oct 02 11:47:44 2006 -0400
@@ -806,7 +806,7 @@ static void svm_final_setup_guest(struct
 
     if ( !shadow_mode_external(d) )
     {
-        DPRINTK("Can't init HVM for dom %u vcpu %u: "
+        DPRINTK(XEN_WARNING "Can't init HVM for dom %u vcpu %u: "
                 "not in shadow external mode\n", d->domain_id, v->vcpu_id);
         domain_crash(d);
     }
diff -r 96a77ef725b8 xen/arch/x86/hvm/vmx/vmcs.c
--- a/xen/arch/x86/hvm/vmx/vmcs.c       Mon Oct 02 13:45:44 2006 +0100
+++ b/xen/arch/x86/hvm/vmx/vmcs.c       Mon Oct 02 11:47:44 2006 -0400
@@ -145,7 +145,7 @@ static struct vmcs_struct *vmx_alloc_vmc
 
     if ( (vmcs = alloc_xenheap_page()) == NULL )
     {
-        DPRINTK("Failed to allocate VMCS.\n");
+        DPRINTK(XEN_GUEST "Failed to allocate VMCS.\n");
         return NULL;
     }
 
diff -r 96a77ef725b8 xen/arch/x86/hvm/vmx/vmx.c
--- a/xen/arch/x86/hvm/vmx/vmx.c        Mon Oct 02 13:45:44 2006 +0100
+++ b/xen/arch/x86/hvm/vmx/vmx.c        Mon Oct 02 11:47:44 2006 -0400
@@ -71,7 +71,7 @@ static int vmx_initialize_guest_resource
 
     if ( !shadow_mode_external(d) )
     {
-        DPRINTK("Can't init HVM for dom %u vcpu %u: "
+        DPRINTK(XEN_WARNING "Can't init HVM for dom %u vcpu %u: "
                 "not in shadow external mode\n", 
                 d->domain_id, v->vcpu_id);
         domain_crash(d);
@@ -83,7 +83,7 @@ static int vmx_initialize_guest_resource
 
         if ( (rc = vmx_create_vmcs(vc)) != 0 )
         {
-            DPRINTK("Failed to create VMCS for vcpu %d: err=%d.\n",
+            DPRINTK(XEN_WARNING "Failed to create VMCS for vcpu %d: err=%d.\n",
                     vc->vcpu_id, rc);
             return 0;
         }
@@ -92,14 +92,14 @@ static int vmx_initialize_guest_resource
 
         if ( (io_bitmap_a = alloc_xenheap_pages(IO_BITMAP_ORDER)) == NULL )
         {
-            DPRINTK("Failed to allocate io bitmap b for vcpu %d.\n",
+            DPRINTK(XEN_WARNING "Failed to allocate io bitmap b for vcpu 
%d.\n",
                     vc->vcpu_id);
             return 0;
         }
 
         if ( (io_bitmap_b = alloc_xenheap_pages(IO_BITMAP_ORDER)) == NULL )
         {
-            DPRINTK("Failed to allocate io bitmap b for vcpu %d.\n",
+            DPRINTK(XEN_WARNING "Failed to allocate io bitmap b for vcpu 
%d.\n",
                     vc->vcpu_id);
             return 0;
         }
diff -r 96a77ef725b8 xen/arch/x86/io_apic.c
--- a/xen/arch/x86/io_apic.c    Mon Oct 02 13:45:44 2006 +0100
+++ b/xen/arch/x86/io_apic.c    Mon Oct 02 11:47:44 2006 -0400
@@ -1983,7 +1983,8 @@ int ioapic_guest_read(unsigned long phys
 }
 
 #define WARN_BOGUS_WRITE(f, a...)                                       \
-    DPRINTK("\n%s: apic=%d, pin=%d, old_irq=%d, new_irq=%d\n"           \
+    DPRINTK(XEN_INFO "\n%s: "                                           \
+            "apic=%d, pin=%d, old_irq=%d, new_irq=%d\n"                 \
             "%s: old_entry=%08x, new_entry=%08x\n"                      \
             "%s: " f, __FUNCTION__, apic, pin, old_irq, new_irq,        \
             __FUNCTION__, *(u32 *)&old_rte, *(u32 *)&new_rte,           \
diff -r 96a77ef725b8 xen/arch/x86/irq.c
--- a/xen/arch/x86/irq.c        Mon Oct 02 13:45:44 2006 +0100
+++ b/xen/arch/x86/irq.c        Mon Oct 02 11:47:44 2006 -0400
@@ -432,7 +432,7 @@ int pirq_guest_bind(struct vcpu *v, int 
     {
         if ( desc->action != NULL )
         {
-            DPRINTK("Cannot bind IRQ %d to guest. In use by '%s'.\n",
+            DPRINTK(XEN_GUEST "Cannot bind IRQ %d to guest. In use by '%s'.\n",
                     irq, desc->action->name);
             rc = -EBUSY;
             goto out;
@@ -441,7 +441,8 @@ int pirq_guest_bind(struct vcpu *v, int 
         action = xmalloc(irq_guest_action_t);
         if ( (desc->action = (struct irqaction *)action) == NULL )
         {
-            DPRINTK("Cannot bind IRQ %d to guest. Out of memory.\n", irq);
+            DPRINTK(XEN_GUEST "Cannot bind IRQ %d to guest. Out of memory.\n",
+                    irq);
             rc = -ENOMEM;
             goto out;
         }
@@ -464,7 +465,8 @@ int pirq_guest_bind(struct vcpu *v, int 
     }
     else if ( !will_share || !action->shareable )
     {
-        DPRINTK("Cannot bind IRQ %d to guest. Will not share with others.\n",
+        DPRINTK(XEN_GUEST "Cannot bind IRQ %d to guest. "
+               "Will not share with others.\n",
                 irq);
         rc = -EBUSY;
         goto out;
@@ -484,7 +486,8 @@ int pirq_guest_bind(struct vcpu *v, int 
 
     if ( action->nr_guests == IRQ_MAX_GUESTS )
     {
-        DPRINTK("Cannot bind IRQ %d to guest. Already at max share.\n", irq);
+        DPRINTK(XEN_GUEST "Cannot bind IRQ %d to guest. "
+               "Already at max share.\n", irq);
         rc = -EBUSY;
         goto out;
     }
diff -r 96a77ef725b8 xen/arch/x86/mm.c
--- a/xen/arch/x86/mm.c Mon Oct 02 13:45:44 2006 +0100
+++ b/xen/arch/x86/mm.c Mon Oct 02 11:47:44 2006 -0400
@@ -2258,7 +2258,7 @@ int do_mmu_update(
             {
                 if ( shadow_mode_refcounts(d) )
                 {
-                    DPRINTK("mmu update on shadow-refcounted domain!");
+                    DPRINTK(XEN_INFO "mmu update on shadow-refcounted 
domain!");
                     break;
                 }
 
@@ -2622,7 +2622,7 @@ int steal_page(
         x = y;
         if (unlikely((x & (PGC_count_mask|PGC_allocated)) !=
                      (1 | PGC_allocated)) || unlikely(_nd != _d)) { 
-            DPRINTK("gnttab_transfer: Bad page %p: ed=%p(%u), sd=%p,"
+            DPRINTK(XEN_GUEST "gnttab_transfer: Bad page %p: ed=%p(%u), sd=%p,"
                     " caf=%08x, taf=%" PRtype_info "\n", 
                     (void *) page_to_mfn(page),
                     d, d->domain_id, unpickle_domptr(_nd), x, 
diff -r 96a77ef725b8 xen/arch/x86/mm/shadow/common.c
--- a/xen/arch/x86/mm/shadow/common.c   Mon Oct 02 13:45:44 2006 +0100
+++ b/xen/arch/x86/mm/shadow/common.c   Mon Oct 02 11:47:44 2006 -0400
@@ -3041,7 +3041,7 @@ int shadow_domctl(struct domain *d,
 
     if ( unlikely(d == current->domain) )
     {
-        DPRINTK("Don't try to do a shadow op on yourself!\n");
+        DPRINTK(XEN_GUEST "Don't try to do a shadow op on yourself!\n");
         return -EINVAL;
     }
 
diff -r 96a77ef725b8 xen/arch/x86/platform_hypercall.c
--- a/xen/arch/x86/platform_hypercall.c Mon Oct 02 13:45:44 2006 +0100
+++ b/xen/arch/x86/platform_hypercall.c Mon Oct 02 11:47:44 2006 -0400
@@ -125,7 +125,7 @@ long do_platform_op(XEN_GUEST_HANDLE(xen
         case QUIRK_IOAPIC_GOOD_REGSEL:
 #ifndef sis_apic_bug
             sis_apic_bug = (quirk_id == QUIRK_IOAPIC_BAD_REGSEL);
-            DPRINTK("Domain 0 says that IO-APIC REGSEL is %s\n",
+            DPRINTK(XEN_INFO "Domain 0 says that IO-APIC REGSEL is %s\n",
                     sis_apic_bug ? "bad" : "good");
 #else
             BUG_ON(sis_apic_bug != (quirk_id == QUIRK_IOAPIC_BAD_REGSEL));
diff -r 96a77ef725b8 xen/arch/x86/traps.c
--- a/xen/arch/x86/traps.c      Mon Oct 02 13:45:44 2006 +0100
+++ b/xen/arch/x86/traps.c      Mon Oct 02 11:47:44 2006 -0400
@@ -407,7 +407,8 @@ static inline int do_trap(int trapnr, ch
 
     if ( likely((fixup = search_exception_table(regs->eip)) != 0) )
     {
-        DPRINTK("Trap %d: %p -> %p\n", trapnr, _p(regs->eip), _p(fixup));
+        DPRINTK(XEN_EMERG "Trap %d: %p -> %p\n",
+                trapnr, _p(regs->eip), _p(fixup));
         regs->eip = fixup;
         return 0;
     }
@@ -475,7 +476,7 @@ int wrmsr_hypervisor_regs(
 
         if ( idx > 0 )
         {
-            DPRINTK("Dom%d: Out of range index %u to MSR %08x\n",
+            DPRINTK(XEN_GUEST "Dom%d: Out of range index %u to MSR %08x\n",
                     d->domain_id, idx, 0x40000000);
             return 0;
         }
@@ -485,7 +486,7 @@ int wrmsr_hypervisor_regs(
         if ( !mfn_valid(mfn) ||
              !get_page_and_type(mfn_to_page(mfn), d, PGT_writable_page) )
         {
-            DPRINTK("Dom%d: Bad GMFN %lx (MFN %lx) to MSR %08x\n",
+            DPRINTK(XEN_GUEST "Dom%d: Bad GMFN %lx (MFN %lx) to MSR %08x\n",
                     d->domain_id, gmfn, mfn, 0x40000000);
             return 0;
         }
@@ -832,17 +833,18 @@ static int __spurious_page_fault(
         return 0;
 
  spurious:
-    DPRINTK("Spurious fault in domain %u:%u at addr %lx, e/c %04x\n",
+    DPRINTK(XEN_WARNING "Spurious fault in domain %u:%u "
+            "at addr %lx, e/c %04x\n",
             current->domain->domain_id, current->vcpu_id,
             addr, regs->error_code);
 #if CONFIG_PAGING_LEVELS >= 4
-    DPRINTK(" l4e = %"PRIpte"\n", l4e_get_intpte(l4e));
+    DPRINTK(XEN_WARNING " l4e = %"PRIpte"\n", l4e_get_intpte(l4e));
 #endif
 #if CONFIG_PAGING_LEVELS >= 3
-    DPRINTK(" l3e = %"PRIpte"\n", l3e_get_intpte(l3e));
-#endif
-    DPRINTK(" l2e = %"PRIpte"\n", l2e_get_intpte(l2e));
-    DPRINTK(" l1e = %"PRIpte"\n", l1e_get_intpte(l1e));
+    DPRINTK(XEN_WARNING " l3e = %"PRIpte"\n", l3e_get_intpte(l3e));
+#endif
+    DPRINTK(XEN_WARNING " l2e = %"PRIpte"\n", l2e_get_intpte(l2e));
+    DPRINTK(XEN_WARNING " l1e = %"PRIpte"\n", l1e_get_intpte(l1e));
 #ifndef NDEBUG
     show_registers(regs);
 #endif
@@ -1313,7 +1315,7 @@ static int emulate_privileged_op(struct 
         case 0: /* Write CR0 */
             if ( (*reg ^ read_cr0()) & ~X86_CR0_TS )
             {
-                DPRINTK("Attempt to change unmodifiable CR0 flags.\n");
+                DPRINTK(XEN_GUEST "Attempt to change unmodifiable CR0 
flags.\n");
                 goto fail;
             }
             (void)do_fpu_taskswitch(!!(*reg & X86_CR0_TS));
@@ -1333,7 +1335,7 @@ static int emulate_privileged_op(struct 
         case 4:
             if ( *reg != (read_cr4() & ~(X86_CR4_PGE|X86_CR4_PSE)) )
             {
-                DPRINTK("Attempt to change CR4 flags.\n");
+                DPRINTK(XEN_GUEST "Attempt to change CR4 flags.\n");
                 goto fail;
             }
             break;
@@ -1381,7 +1383,7 @@ static int emulate_privileged_op(struct 
 
             if ( (rdmsr_safe(regs->ecx, l, h) != 0) ||
                  (regs->eax != l) || (regs->edx != h) )
-                DPRINTK("Domain attempted WRMSR %p from "
+                DPRINTK(XEN_GUEST "Domain attempted WRMSR %p from "
                         "%08x:%08x to %08lx:%08lx.\n",
                         _p(regs->ecx), h, l, (long)regs->edx, (long)regs->eax);
             break;
@@ -1510,7 +1512,7 @@ asmlinkage int do_general_protection(str
 
     if ( likely((fixup = search_exception_table(regs->eip)) != 0) )
     {
-        DPRINTK("GPF (%04x): %p -> %p\n",
+        DPRINTK(XEN_WARNING "GPF (%04x): %p -> %p\n",
                 regs->error_code, _p(regs->eip), _p(fixup));
         regs->eip = fixup;
         return 0;
diff -r 96a77ef725b8 xen/arch/x86/x86_32/seg_fixup.c
--- a/xen/arch/x86/x86_32/seg_fixup.c   Mon Oct 02 13:45:44 2006 +0100
+++ b/xen/arch/x86/x86_32/seg_fixup.c   Mon Oct 02 11:47:44 2006 -0400
@@ -31,10 +31,6 @@
 #include <asm/processor.h>
 #include <asm/regs.h>
 #include <asm/x86_emulate.h>
-
-/* Make the scary benign errors go away. */
-#undef  DPRINTK
-#define DPRINTK(_f, _a...) ((void)0)
 
 /* General instruction properties. */
 #define INSN_SUFFIX_BYTES (7)
@@ -185,7 +181,7 @@ int fixup_seg(u16 seg, unsigned long off
         table = (unsigned long *)LDT_VIRT_START(d);
         if ( idx >= d->arch.guest_context.ldt_ents )
         {
-            DPRINTK("Segment %04x out of LDT range (%ld)\n",
+            DPRINTK(XEN_DEBUG "Segment %04x out of LDT range (%ld)\n",
                     seg, d->arch.guest_context.ldt_ents);
             goto fail;
         }
@@ -195,7 +191,7 @@ int fixup_seg(u16 seg, unsigned long off
         table = (unsigned long *)GDT_VIRT_START(d);
         if ( idx >= d->arch.guest_context.gdt_ents )
         {
-            DPRINTK("Segment %04x out of GDT range (%ld)\n",
+            DPRINTK(XEN_DEBUG "Segment %04x out of GDT range (%ld)\n",
                     seg, d->arch.guest_context.gdt_ents);
             goto fail;
         }
@@ -205,7 +201,7 @@ int fixup_seg(u16 seg, unsigned long off
     if ( __get_user(a, &table[2*idx+0]) ||
          __get_user(b, &table[2*idx+1]) )
     {
-        DPRINTK("Fault while reading segment %04x\n", seg);
+        DPRINTK(XEN_DEBUG "Fault while reading segment %04x\n", seg);
         goto fail; /* Barking up the wrong tree. Decode needs a page fault.*/
     }
 
@@ -214,7 +210,7 @@ int fixup_seg(u16 seg, unsigned long off
                _SEGMENT_G|_SEGMENT_CODE|_SEGMENT_DPL)) != 
          (_SEGMENT_P|_SEGMENT_S|_SEGMENT_DB|_SEGMENT_G|_SEGMENT_DPL) )
     {
-        DPRINTK("Bad segment %08lx:%08lx\n", a, b);
+        DPRINTK(XEN_DEBUG "Bad segment %08lx:%08lx\n", a, b);
         goto fail;
     }
 
@@ -244,7 +240,8 @@ int fixup_seg(u16 seg, unsigned long off
         }
     }
 
-    DPRINTK("None of the above! (%08lx:%08lx, %08lx, %08lx, %08lx)\n", 
+    DPRINTK(XEN_DEBUG "None of the above! "
+            "(%08lx:%08lx, %08lx, %08lx, %08lx)\n",
             a, b, base, limit, base+limit);
 
  fail:
@@ -282,13 +279,13 @@ int gpf_emulate_4gb(struct cpu_user_regs
     /* WARNING: We only work for ring-3 segments. */
     if ( unlikely(vm86_mode(regs)) || unlikely(!ring_3(regs)) )
     {
-        DPRINTK("Taken fault at bad CS %04x\n", regs->cs);
+        DPRINTK(XEN_DEBUG "Taken fault at bad CS %04x\n", regs->cs);
         goto fail;
     }
 
     if ( !linearise_address((u16)regs->cs, regs->eip, (unsigned long *)&eip) )
     {
-        DPRINTK("Cannot linearise %04x:%08x\n", regs->cs, regs->eip);
+        DPRINTK(XEN_DEBUG "Cannot linearise %04x:%08x\n", regs->cs, regs->eip);
         goto fail;
     }
 
@@ -297,13 +294,15 @@ int gpf_emulate_4gb(struct cpu_user_regs
     {
         if ( get_user(b, pb) )
         {
-            DPRINTK("Fault while accessing byte %d of instruction\n", pb-eip);
+            DPRINTK(XEN_DEBUG "Fault while accessing byte %d of instruction\n",
+                    pb-eip);
             goto page_fault;
         }
 
         if ( (pb - eip) >= 15 )
         {
-            DPRINTK("Too many instruction prefixes for a legal instruction\n");
+            DPRINTK(XEN_DEBUG "Too many instruction prefixes for a "
+                    "legal instruction\n");
             goto fail;
         }
 
@@ -315,7 +314,7 @@ int gpf_emulate_4gb(struct cpu_user_regs
         case 0x26: /* ES override */
         case 0x64: /* FS override */
         case 0x36: /* SS override */
-            DPRINTK("Unhandled prefix %02x\n", b);
+            DPRINTK(XEN_DEBUG "Unhandled prefix %02x\n", b);
             goto fail;
         case 0x66: /* Operand-size override */
         case 0xf0: /* LOCK */
@@ -333,7 +332,7 @@ int gpf_emulate_4gb(struct cpu_user_regs
 
     if ( !gs_override )
     {
-        DPRINTK("Only instructions with GS override\n");
+        DPRINTK(XEN_DEBUG "Only instructions with GS override\n");
         goto fail;
     }
 
@@ -341,7 +340,7 @@ int gpf_emulate_4gb(struct cpu_user_regs
     pb++;
     if ( decode == 0 )
     {
-        DPRINTK("Unsupported opcode %02x\n", b);
+        DPRINTK(XEN_DEBUG "Unsupported opcode %02x\n", b);
         goto fail;
     }
     
@@ -353,7 +352,7 @@ int gpf_emulate_4gb(struct cpu_user_regs
 
         if ( get_user(offset, (u32 *)pb) )
         {
-            DPRINTK("Fault while extracting <disp32>.\n");
+            DPRINTK(XEN_DEBUG "Fault while extracting <disp32>.\n");
             goto page_fault;
         }
         pb += 4;
@@ -367,7 +366,7 @@ int gpf_emulate_4gb(struct cpu_user_regs
 
     if ( get_user(modrm, pb) )
     {
-        DPRINTK("Fault while extracting modrm byte\n");
+        DPRINTK(XEN_DEBUG "Fault while extracting modrm byte\n");
         goto page_fault;
     }
 
@@ -379,7 +378,7 @@ int gpf_emulate_4gb(struct cpu_user_regs
 
     if ( rm == 4 )
     {
-        DPRINTK("FIXME: Add decoding for the SIB byte.\n");
+        DPRINTK(XEN_DEBUG "FIXME: Add decoding for the SIB byte.\n");
         goto fixme;
     }
 
@@ -397,7 +396,7 @@ int gpf_emulate_4gb(struct cpu_user_regs
             memreg = NULL;
             if ( get_user(disp32, (u32 *)pb) )
             {
-                DPRINTK("Fault while extracting <disp8>.\n");
+                DPRINTK(XEN_DEBUG "Fault while extracting <disp8>.\n");
                 goto page_fault;
             }
             pb += 4;
@@ -407,7 +406,7 @@ int gpf_emulate_4gb(struct cpu_user_regs
     case 1:
         if ( get_user(disp8, pb) )
         {
-            DPRINTK("Fault while extracting <disp8>.\n");
+            DPRINTK(XEN_DEBUG "Fault while extracting <disp8>.\n");
             goto page_fault;
         }
         pb++;
@@ -417,14 +416,14 @@ int gpf_emulate_4gb(struct cpu_user_regs
     case 2:
         if ( get_user(disp32, (u32 *)pb) )
         {
-            DPRINTK("Fault while extracting <disp8>.\n");
+            DPRINTK(XEN_DEBUG "Fault while extracting <disp8>.\n");
             goto page_fault;
         }
         pb += 4;
         break;
 
     case 3:
-        DPRINTK("Not a memory operand!\n");
+        DPRINTK(XEN_DEBUG "Not a memory operand!\n");
         goto fail;
     }
 
@@ -455,7 +454,8 @@ int gpf_emulate_4gb(struct cpu_user_regs
     return EXCRET_fault_fixed;
 
  fixme:
-    DPRINTK("Undecodable instruction %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x "
+    DPRINTK(XEN_DEBUG "Undecodable instruction "
+            "%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x "
             "caused GPF(0) at %04x:%08x\n",
             eip[0], eip[1], eip[2], eip[3],
             eip[4], eip[5], eip[6], eip[7],
diff -r 96a77ef725b8 xen/arch/x86/x86_64/traps.c
--- a/xen/arch/x86/x86_64/traps.c       Mon Oct 02 13:45:44 2006 +0100
+++ b/xen/arch/x86/x86_64/traps.c       Mon Oct 02 11:47:44 2006 -0400
@@ -206,7 +206,8 @@ unsigned long do_iret(void)
     if ( unlikely(copy_from_user(&iret_saved, (void *)regs->rsp,
                                  sizeof(iret_saved))) )
     {
-        DPRINTK("Fault while reading IRET context from guest stack\n");
+        DPRINTK(XEN_GUEST "Fault while reading IRET context from "
+                "guest stack\n");
         domain_crash_synchronous();
     }
 
@@ -215,7 +216,8 @@ unsigned long do_iret(void)
     {
         if ( unlikely(pagetable_is_null(v->arch.guest_table_user)) )
         {
-            DPRINTK("Guest switching to user mode with no user page tables\n");
+            DPRINTK(XEN_GUEST "Guest switching to user mode with no "
+                    "user page tables\n");
             domain_crash_synchronous();
         }
         toggle_guest_mode(v);
diff -r 96a77ef725b8 xen/common/event_channel.c
--- a/xen/common/event_channel.c        Mon Oct 02 13:45:44 2006 +0100
+++ b/xen/common/event_channel.c        Mon Oct 02 11:47:44 2006 -0400
@@ -40,7 +40,8 @@
 
 #define ERROR_EXIT(_errno)                                          \
     do {                                                            \
-        DPRINTK("EVTCHNOP failure: domain %d, error %d, line %d\n", \
+        DPRINTK(XEN_GUEST                                           \
+                "EVTCHNOP failure: domain %d, error %d, line %d\n", \
                 current->domain->domain_id, (_errno), __LINE__);    \
         rc = (_errno);                                              \
         goto out;                                                   \
diff -r 96a77ef725b8 xen/common/grant_table.c
--- a/xen/common/grant_table.c  Mon Oct 02 13:45:44 2006 +0100
+++ b/xen/common/grant_table.c  Mon Oct 02 11:47:44 2006 -0400
@@ -47,7 +47,7 @@ union grant_combo {
 
 #define PIN_FAIL(_lbl, _rc, _f, _a...)          \
     do {                                        \
-        DPRINTK( _f, ## _a );                   \
+        DPRINTK( XEN_GUEST _f, ## _a );         \
         rc = (_rc);                             \
         goto _lbl;                              \
     } while ( 0 )
@@ -109,7 +109,7 @@ __gnttab_map_grant_ref(
     if ( unlikely(op->ref >= NR_GRANT_ENTRIES) ||
          unlikely((op->flags & (GNTMAP_device_map|GNTMAP_host_map)) == 0) )
     {
-        DPRINTK("Bad ref (%d) or flags (%x).\n", op->ref, op->flags);
+        DPRINTK(XEN_GUEST "Bad ref (%d) or flags (%x).\n", op->ref, op->flags);
         op->status = GNTST_bad_gntref;
         return;
     }
@@ -124,7 +124,7 @@ __gnttab_map_grant_ref(
     {
         if ( rd != NULL )
             put_domain(rd);
-        DPRINTK("Could not find domain %d\n", op->dom);
+        DPRINTK(XEN_GUEST "Could not find domain %d\n", op->dom);
         op->status = GNTST_bad_domain;
         return;
     }
@@ -139,7 +139,7 @@ __gnttab_map_grant_ref(
         if ( (lgt->maptrack_limit << 1) > MAPTRACK_MAX_ENTRIES )
         {
             put_domain(rd);
-            DPRINTK("Maptrack table is at maximum size.\n");
+            DPRINTK(XEN_GUEST "Maptrack table is at maximum size.\n");
             op->status = GNTST_no_device_space;
             return;
         }
@@ -149,7 +149,7 @@ __gnttab_map_grant_ref(
         if ( new_mt == NULL )
         {
             put_domain(rd);
-            DPRINTK("No more map handles available.\n");
+            DPRINTK(XEN_GUEST "No more map handles available.\n");
             op->status = GNTST_no_device_space;
             return;
         }
@@ -166,7 +166,7 @@ __gnttab_map_grant_ref(
         lgt->maptrack_order   += 1;
         lgt->maptrack_limit  <<= 1;
 
-        DPRINTK("Doubled maptrack size\n");
+        DPRINTK(XEN_GUEST "Doubled maptrack size\n");
         handle = get_maptrack_handle(ld->grant_table);
     }
 
@@ -353,7 +353,7 @@ __gnttab_unmap_grant_ref(
     if ( unlikely(op->handle >= ld->grant_table->maptrack_limit) ||
          unlikely(!map->flags) )
     {
-        DPRINTK("Bad handle (%d).\n", op->handle);
+        DPRINTK(XEN_GUEST "Bad handle (%d).\n", op->handle);
         op->status = GNTST_bad_handle;
         return;
     }
@@ -366,7 +366,7 @@ __gnttab_unmap_grant_ref(
     {
         if ( rd != NULL )
             put_domain(rd);
-        DPRINTK("Could not find domain %d\n", dom);
+        DPRINTK(XEN_GUEST "Could not find domain %d\n", dom);
         op->status = GNTST_bad_domain;
         return;
     }
@@ -486,13 +486,14 @@ gnttab_setup_table(
 
     if ( unlikely(copy_from_guest(&op, uop, 1) != 0) )
     {
-        DPRINTK("Fault while reading gnttab_setup_table_t.\n");
+        DPRINTK(XEN_GUEST "Fault while reading gnttab_setup_table_t.\n");
         return -EFAULT;
     }
 
     if ( unlikely(op.nr_frames > NR_GRANT_FRAMES) )
     {
-        DPRINTK("Xen only supports up to %d grant-table frames per domain.\n",
+        DPRINTK(XEN_GUEST "Xen only supports up to %d grant-table frames"
+                " per domain.\n",
                 NR_GRANT_FRAMES);
         op.status = GNTST_general_error;
         goto out;
@@ -511,7 +512,7 @@ gnttab_setup_table(
 
     if ( unlikely((d = find_domain_by_id(dom)) == NULL) )
     {
-        DPRINTK("Bad domid %d.\n", dom);
+        DPRINTK(XEN_GUEST "Bad domid %d.\n", dom);
         op.status = GNTST_bad_domain;
         goto out;
     }
@@ -549,7 +550,7 @@ gnttab_prepare_for_transfer(
     if ( unlikely((rgt = rd->grant_table) == NULL) ||
          unlikely(ref >= NR_GRANT_ENTRIES) )
     {
-        DPRINTK("Dom %d has no g.t., or ref is bad (%d).\n",
+        DPRINTK(XEN_GUEST "Dom %d has no g.t., or ref is bad (%d).\n",
                 rd->domain_id, ref);
         return 0;
     }
@@ -565,7 +566,8 @@ gnttab_prepare_for_transfer(
         if ( unlikely(scombo.shorts.flags != GTF_accept_transfer) ||
              unlikely(scombo.shorts.domid != ld->domain_id) )
         {
-            DPRINTK("Bad flags (%x) or dom (%d). (NB. expected dom %d)\n",
+            DPRINTK(XEN_GUEST "Bad flags (%x) or dom (%d). "
+                    "(NB. expected dom %d)\n",
                     scombo.shorts.flags, scombo.shorts.domid,
                     ld->domain_id);
             goto fail;
@@ -581,7 +583,7 @@ gnttab_prepare_for_transfer(
 
         if ( retries++ == 4 )
         {
-            DPRINTK("Shared grant entry is unstable.\n");
+            DPRINTK(XEN_GUEST "Shared grant entry is unstable.\n");
             goto fail;
         }
 
@@ -613,7 +615,8 @@ gnttab_transfer(
         /* Read from caller address space. */
         if ( unlikely(__copy_from_guest_offset(&gop, uop, i, 1)) )
         {
-            DPRINTK("gnttab_transfer: error reading req %d/%d\n", i, count);
+            DPRINTK(XEN_GUEST "gnttab_transfer: error reading req %d/%d\n",
+                    i, count);
             return -EFAULT;
         }
 
@@ -622,7 +625,7 @@ gnttab_transfer(
         /* Check the passed page frame for basic validity. */
         if ( unlikely(!mfn_valid(mfn)) )
         { 
-            DPRINTK("gnttab_transfer: out-of-range %lx\n",
+            DPRINTK(XEN_GUEST "gnttab_transfer: out-of-range %lx\n",
                     (unsigned long)gop.mfn);
             gop.status = GNTST_bad_page;
             goto copyback;
@@ -631,7 +634,7 @@ gnttab_transfer(
         page = mfn_to_page(mfn);
         if ( unlikely(IS_XEN_HEAP_FRAME(page)) )
         { 
-            DPRINTK("gnttab_transfer: xen frame %lx\n",
+            DPRINTK(XEN_GUEST "gnttab_transfer: xen frame %lx\n",
                     (unsigned long)gop.mfn);
             gop.status = GNTST_bad_page;
             goto copyback;
@@ -646,7 +649,8 @@ gnttab_transfer(
         /* Find the target domain. */
         if ( unlikely((e = find_domain_by_id(gop.domid)) == NULL) )
         {
-            DPRINTK("gnttab_transfer: can't find domain %d\n", gop.domid);
+            DPRINTK(XEN_GUEST "gnttab_transfer: can't find domain %d\n",
+                    gop.domid);
             page->count_info &= ~(PGC_count_mask|PGC_allocated);
             free_domheap_page(page);
             gop.status = GNTST_bad_domain;
@@ -665,7 +669,8 @@ gnttab_transfer(
              unlikely(!gnttab_prepare_for_transfer(e, d, gop.ref)) )
         {
             if ( !test_bit(_DOMF_dying, &e->domain_flags) )
-                DPRINTK("gnttab_transfer: Transferee has no reservation "
+                DPRINTK(XEN_GUEST "gnttab_transfer: "
+                        "Transferee has no reservation "
                         "headroom (%d,%d) or provided a bad grant ref (%08x) "
                         "or is dying (%lx)\n",
                         e->tot_pages, e->max_pages, gop.ref, e->domain_flags);
@@ -701,7 +706,8 @@ gnttab_transfer(
     copyback:
         if ( unlikely(__copy_to_guest_offset(uop, i, &gop, 1)) )
         {
-            DPRINTK("gnttab_transfer: error writing resp %d/%d\n", i, count);
+            DPRINTK(XEN_GUEST "gnttab_transfer: error writing resp %d/%d\n",
+                    i, count);
             return -EFAULT;
         }
     }
@@ -1090,7 +1096,8 @@ gnttab_release_mappings(
 
         ref = map->ref;
 
-        DPRINTK("Grant release (%hu) ref:(%hu) flags:(%x) dom:(%hu)\n",
+        DPRINTK(XEN_GUEST "Grant release (%hu) ref:(%hu) "
+                "flags:(%x) dom:(%hu)\n",
                 handle, ref, map->flags, map->domid);
 
         rd = find_domain_by_id(map->domid);
diff -r 96a77ef725b8 xen/common/keyhandler.c
--- a/xen/common/keyhandler.c   Mon Oct 02 13:45:44 2006 +0100
+++ b/xen/common/keyhandler.c   Mon Oct 02 11:47:44 2006 -0400
@@ -247,6 +247,13 @@ extern void perfc_reset(unsigned char ke
 extern void perfc_reset(unsigned char key);
 #endif
 
+static void do_set_log(unsigned char key,  struct cpu_user_regs *regs)
+{
+    print_log_level = key - '0';
+    /* always show this :-) */
+    printk(XEN_EMERG "loglevel set to %d\n", print_log_level);
+}
+
 static void do_debug_key(unsigned char key, struct cpu_user_regs *regs)
 {
     (void)debugger_trap_fatal(0xf001, regs);
@@ -257,6 +264,7 @@ static void do_debug_key(unsigned char k
 
 void initialize_keytable(void)
 {
+    int i;
     open_softirq(KEYPRESS_SOFTIRQ, keypress_softirq);
 
     register_irq_keyhandler(
@@ -279,6 +287,13 @@ void initialize_keytable(void)
     register_keyhandler(
         'P', perfc_reset,    "reset performance counters");
 #endif
+
+    for ( i = 0 ; i <= LOG_MAX ; i++ )
+    {
+        char buf[STR_MAX];
+        sprintf(buf, "set log level to %d", i);
+        register_irq_keyhandler('0'+i, do_set_log, buf);
+    }
 
     register_irq_keyhandler('%', do_debug_key,   "Trap to xendbg");
 }
diff -r 96a77ef725b8 xen/common/memory.c
--- a/xen/common/memory.c       Mon Oct 02 13:45:44 2006 +0100
+++ b/xen/common/memory.c       Mon Oct 02 11:47:44 2006 -0400
@@ -61,7 +61,7 @@ increase_reservation(
         if ( unlikely((page = alloc_domheap_pages(
             d, extent_order, memflags)) == NULL) )
         {
-            DPRINTK("Could not allocate order=%d extent: "
+            DPRINTK(XEN_GUEST "Could not allocate order=%d extent: "
                     "id=%d memflags=%x (%ld of %d)\n",
                     extent_order, d->domain_id, memflags, i, nr_extents);
             return i;
@@ -114,7 +114,7 @@ populate_physmap(
         if ( unlikely((page = alloc_domheap_pages(
             d, extent_order, memflags)) == NULL) )
         {
-            DPRINTK("Could not allocate order=%d extent: "
+            DPRINTK(XEN_GUEST "Could not allocate order=%d extent: "
                     "id=%d memflags=%x (%ld of %d)\n",
                     extent_order, d->domain_id, memflags, i, nr_extents);
             goto out;
@@ -153,7 +153,7 @@ guest_remove_page(
     mfn = gmfn_to_mfn(d, gmfn);
     if ( unlikely(!mfn_valid(mfn)) )
     {
-        DPRINTK("Domain %u page number %lx invalid\n",
+        DPRINTK(XEN_GUEST "Domain %u page number %lx invalid\n",
                 d->domain_id, gmfn);
         return 0;
     }
@@ -161,7 +161,7 @@ guest_remove_page(
     page = mfn_to_page(mfn);
     if ( unlikely(!get_page(page, d)) )
     {
-        DPRINTK("Bad page free for domain %u\n", d->domain_id);
+        DPRINTK(XEN_GUEST "Bad page free for domain %u\n", d->domain_id);
         return 0;
     }
 
@@ -174,7 +174,7 @@ guest_remove_page(
     if ( unlikely(!page_is_removable(page)) )
     {
         /* We'll make this a guest-visible error in future, so take heed! */
-        DPRINTK("Dom%d freeing in-use page %lx (pseudophys %lx):"
+        DPRINTK(XEN_GUEST "Dom%d freeing in-use page %lx (pseudophys %lx):"
                 " count=%lx type=%lx\n",
                 d->domain_id, mfn, get_gpfn_from_mfn(mfn),
                 (unsigned long)page->count_info, page->u.inuse.type_info);
diff -r 96a77ef725b8 xen/common/multicall.c
--- a/xen/common/multicall.c    Mon Oct 02 13:45:44 2006 +0100
+++ b/xen/common/multicall.c    Mon Oct 02 11:47:44 2006 -0400
@@ -24,7 +24,7 @@ do_multicall(
 
     if ( unlikely(__test_and_set_bit(_MCSF_in_multicall, &mcs->flags)) )
     {
-        DPRINTK("Multicall reentry is disallowed.\n");
+        DPRINTK(XEN_GUEST "Multicall reentry is disallowed.\n");
         return -EINVAL;
     }
 
diff -r 96a77ef725b8 xen/common/page_alloc.c
--- a/xen/common/page_alloc.c   Mon Oct 02 13:45:44 2006 +0100
+++ b/xen/common/page_alloc.c   Mon Oct 02 11:47:44 2006 -0400
@@ -542,7 +542,8 @@ int assign_pages(
 
     if ( unlikely(test_bit(_DOMF_dying, &d->domain_flags)) )
     {
-        DPRINTK("Cannot assign page to domain%d -- dying.\n", d->domain_id);
+        DPRINTK(XEN_GUEST "Cannot assign page to domain%d -- dying.\n",
+                d->domain_id);
         goto fail;
     }
 
@@ -550,7 +551,7 @@ int assign_pages(
     {
         if ( unlikely((d->tot_pages + (1 << order)) > d->max_pages) )
         {
-            DPRINTK("Over-allocation for domain %u: %u > %u\n",
+            DPRINTK(XEN_GUEST "Over-allocation for domain %u: %u > %u\n",
                     d->domain_id, d->tot_pages + (1 << order), d->max_pages);
             goto fail;
         }
diff -r 96a77ef725b8 xen/common/schedule.c
--- a/xen/common/schedule.c     Mon Oct 02 13:45:44 2006 +0100
+++ b/xen/common/schedule.c     Mon Oct 02 11:47:44 2006 -0400
@@ -468,7 +468,7 @@ 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.
          */
-        DPRINTK("Warning: huge timeout set by domain %d (vcpu %d):"
+        DPRINTK(XEN_GUEST "Warning: huge timeout set by domain %d (vcpu %d):"
                 " %"PRIx64"\n",
                 v->domain->domain_id, v->vcpu_id, (uint64_t)timeout);
         set_timer(&v->timer, NOW() + MILLISECS(100));
diff -r 96a77ef725b8 xen/common/trace.c
--- a/xen/common/trace.c        Mon Oct 02 13:45:44 2006 +0100
+++ b/xen/common/trace.c        Mon Oct 02 11:47:44 2006 -0400
@@ -131,7 +131,7 @@ static int tb_set_size(int size)
      */
     if ( (opt_tbuf_size != 0) || (size <= 0) )
     {
-        DPRINTK("tb_set_size from %d to %d not implemented\n",
+        DPRINTK(XEN_GUEST "tb_set_size from %d to %d not implemented\n",
                 opt_tbuf_size, size);
         return -EINVAL;
     }
diff -r 96a77ef725b8 xen/drivers/char/console.c
--- a/xen/drivers/char/console.c        Mon Oct 02 13:45:44 2006 +0100
+++ b/xen/drivers/char/console.c        Mon Oct 02 11:47:44 2006 -0400
@@ -294,6 +294,8 @@ static inline void __putstr(const char *
     }
 }
 
+int print_log_level = PRINT_LOG_DEFAULT;
+
 void printf(const char *fmt, ...)
 {
     static char   buf[1024];
@@ -302,6 +304,7 @@ void printf(const char *fmt, ...)
     va_list       args;
     char         *p, *q;
     unsigned long flags;
+    int           level = PRINT_LOG_DEFAULT;
 
     spin_lock_irqsave(&console_lock, flags);
 
@@ -310,6 +313,19 @@ void printf(const char *fmt, ...)
     va_end(args);        
 
     p = buf;
+    if ( (p[0] == '<') && (p[1] >= '0')
+         && (p[1] <= ('0' + LOG_MAX))
+         && (p[2] == '>') )
+    {
+        level = p[1] - '0';
+        p += 3;
+    }
+
+    if ( level > print_log_level )
+    {
+        goto out;
+    }
+
     while ( (q = strchr(p, '\n')) != NULL )
     {
         *q = '\0';
@@ -329,6 +345,7 @@ void printf(const char *fmt, ...)
         start_of_line = 0;
     }
 
+ out:
     spin_unlock_irqrestore(&console_lock, flags);
 }
 
diff -r 96a77ef725b8 xen/include/asm-ia64/mm.h
--- a/xen/include/asm-ia64/mm.h Mon Oct 02 13:45:44 2006 +0100
+++ b/xen/include/asm-ia64/mm.h Mon Oct 02 11:47:44 2006 -0400
@@ -170,7 +170,7 @@ static inline int get_page(struct page_i
            unlikely((nx & PGC_count_mask) == 0) ||     /* Count overflow? */
            unlikely((x >> 32) != _domain)) {           /* Wrong owner? */
 
-           DPRINTK("Error pfn %lx: rd=%p, od=%p, caf=%016lx, taf=%"
+           DPRINTK(XEN_GUEST "Error pfn %lx: rd=%p, od=%p, caf=%016lx, taf=%"
                PRtype_info "\n", page_to_mfn(page), domain,
                unpickle_domptr(x >> 32), x, page->u.inuse.type_info);
            return 0;
diff -r 96a77ef725b8 xen/include/asm-x86/mm.h
--- a/xen/include/asm-x86/mm.h  Mon Oct 02 13:45:44 2006 +0100
+++ b/xen/include/asm-x86/mm.h  Mon Oct 02 11:47:44 2006 -0400
@@ -214,7 +214,8 @@ static inline int get_page(struct page_i
              unlikely(d != _domain) )                /* Wrong owner? */
         {
             if ( !_shadow_mode_refcounts(domain) )
-                DPRINTK("Error pfn %lx: rd=%p, od=%p, caf=%08x, taf=%" 
+                DPRINTK(XEN_GUEST
+                        "Error pfn %lx: rd=%p, od=%p, caf=%08x, taf=%"
                         PRtype_info "\n",
                         page_to_mfn(page), domain, unpickle_domptr(d),
                         x, page->u.inuse.type_info);
diff -r 96a77ef725b8 xen/include/xen/config.h
--- a/xen/include/xen/config.h  Mon Oct 02 13:45:44 2006 +0100
+++ b/xen/include/xen/config.h  Mon Oct 02 11:47:44 2006 -0400
@@ -13,25 +13,34 @@
 #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
 
 /* Linux syslog levels. */
-#define KERN_NOTICE  ""
-#define KERN_WARNING ""
-#define KERN_DEBUG   ""
-#define KERN_INFO    ""
-#define KERN_ERR     ""
-#define KERN_CRIT    ""
-#define KERN_EMERG   ""
-#define KERN_ALERT   ""
+#define XEN_EMERG   "<0>"
+#define XEN_ALERT   "<1>"
+#define XEN_CRIT    "<2>"
+#define XEN_ERR     "<3>"
+#define XEN_WARNING "<4>"
+#define XEN_GUEST   "<5>"
+#define XEN_INFO    "<6>"
+#define XEN_DEBUG   "<7>"
+
+#define KERN_EMERG   XEN_EMERG
+#define KERN_ALERT   XEN_ALERT
+#define KERN_CRIT    XEN_CRIT
+#define KERN_ERR     XEN_ERR
+#define KERN_WARNING XEN_WARNING
+#define KERN_NOTICE  XEN_GUEST
+#define KERN_INFO    XEN_INFO
+#define KERN_DEBUG   XEN_DEBUG
+
+#define LOG_MAX 7
+
+#define PRINT_LOG_DEFAULT 5
 
 /* Linux 'checker' project. */
 #define __iomem
 #define __user
 
-#ifdef VERBOSE
 #define DPRINTK(_f, _a...) printk("(file=%s, line=%d) " _f, \
                            __FILE__ , __LINE__ , ## _a )
-#else
-#define DPRINTK(_f, _a...) ((void)0)
-#endif
 
 #ifndef __ASSEMBLY__
 #include <xen/compiler.h>
diff -r 96a77ef725b8 xen/include/xen/lib.h
--- a/xen/include/xen/lib.h     Mon Oct 02 13:45:44 2006 +0100
+++ b/xen/include/xen/lib.h     Mon Oct 02 11:47:44 2006 -0400
@@ -57,6 +57,7 @@ extern void panic(const char *format, ..
 extern void panic(const char *format, ...)
     __attribute__ ((format (printf, 1, 2)));
 extern long vm_assist(struct domain *, unsigned int, unsigned int);
+extern int print_log_level;
 
 /* vsprintf.c */
 extern int sprintf(char * buf, const char * fmt, ...)
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>