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

[Xen-changelog] [xen-unstable] [XEN] Some cleanups to the log-level stuff. Largely this



# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxxx
# Node ID 36679b74e24a8a0f8757da1d9fdabd3374779d15
# Parent  d60b709724f48397b95da3d56299213cae391789
[XEN] Some cleanups to the log-level stuff. Largely this
is a rename and slight interface change to DPRINTK (now
replaced by dprintk() and gdprintk()). Also shuffle some
log-level definitions around and tweak the semantics of
the upper threshold.
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 xen/arch/ia64/vmx/vlsapic.c       |    6 +--
 xen/arch/ia64/vmx/vmx_hypercall.c |    2 -
 xen/arch/ia64/vmx/vmx_init.c      |    2 -
 xen/arch/ia64/xen/dom0_ops.c      |    2 -
 xen/arch/ia64/xen/domain.c        |    4 +-
 xen/arch/ia64/xen/irq.c           |    8 ++--
 xen/arch/ia64/xen/mm.c            |   61 ++++++++++++++++---------------
 xen/arch/ia64/xen/tlb_track.c     |    5 +-
 xen/arch/ia64/xen/vcpu.c          |    7 ++-
 xen/arch/powerpc/mm.c             |    2 -
 xen/arch/powerpc/shadow.c         |    4 +-
 xen/arch/x86/domain.c             |    2 -
 xen/arch/x86/extable.c            |    2 -
 xen/arch/x86/hvm/hvm.c            |   22 +++++------
 xen/arch/x86/hvm/i8259.c          |    6 +--
 xen/arch/x86/hvm/instrlen.c       |    4 +-
 xen/arch/x86/hvm/platform.c       |    6 ++-
 xen/arch/x86/hvm/svm/svm.c        |    2 -
 xen/arch/x86/hvm/vioapic.c        |    6 +--
 xen/arch/x86/hvm/vmx/vmcs.c       |    2 -
 xen/arch/x86/hvm/vmx/vmx.c        |   12 +++---
 xen/arch/x86/io_apic.c            |    2 -
 xen/arch/x86/irq.c                |    8 ++--
 xen/arch/x86/mm.c                 |   17 +-------
 xen/arch/x86/mm/shadow/common.c   |    2 -
 xen/arch/x86/platform_hypercall.c |    2 -
 xen/arch/x86/traps.c              |   29 +++++++--------
 xen/arch/x86/x86_32/seg_fixup.c   |   40 ++++++++++----------
 xen/arch/x86/x86_64/traps.c       |    4 +-
 xen/arch/x86/x86_emulate.c        |   12 +++---
 xen/common/domain.c               |    7 ++-
 xen/common/event_channel.c        |    2 -
 xen/common/grant_table.c          |   42 ++++++++++-----------
 xen/common/memory.c               |   10 ++---
 xen/common/multicall.c            |    2 -
 xen/common/page_alloc.c           |    4 +-
 xen/common/schedule.c             |    2 -
 xen/common/trace.c                |    2 -
 xen/drivers/char/console.c        |   26 +++++++++++++
 xen/include/asm-ia64/mm.h         |    2 -
 xen/include/asm-x86/mm.h          |    2 -
 xen/include/xen/config.h          |   73 +++++---------------------------------
 42 files changed, 212 insertions(+), 245 deletions(-)

diff -r d60b709724f4 -r 36679b74e24a xen/arch/ia64/vmx/vlsapic.c
--- a/xen/arch/ia64/vmx/vlsapic.c       Fri Oct 27 19:15:48 2006 +0100
+++ b/xen/arch/ia64/vmx/vlsapic.c       Fri Oct 27 23:47:30 2006 +0100
@@ -95,7 +95,7 @@ static int vmx_vcpu_unpend_interrupt(VCP
     int ret;
 
     if (vector & ~0xff) {
-        DPRINTK("vmx_vcpu_pend_interrupt: bad vector\n");
+        dprintk(XENLOG_WARNING, "vmx_vcpu_pend_interrupt: bad vector\n");
         return -1;
     }
 
@@ -410,7 +410,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(XENLOG_INFO "VLSAPIC inservice base=%p\n", &VLSAPIC_INSVC(vcpu,0) 
);
+    dprintk(XENLOG_INFO, "VLSAPIC inservice base=%p\n", &VLSAPIC_INSVC(vcpu,0) 
);
 }
 
 /*
@@ -539,7 +539,7 @@ int vmx_vcpu_pend_interrupt(VCPU *vcpu, 
     int ret;
 
     if (vector & ~0xff) {
-        DPRINTK(XENLOG_G_INFO "vmx_vcpu_pend_interrupt: bad vector\n");
+        gdprintk(XENLOG_INFO, "vmx_vcpu_pend_interrupt: bad vector\n");
         return -1;
     }
     local_irq_save(spsr);
diff -r d60b709724f4 -r 36679b74e24a xen/arch/ia64/vmx/vmx_hypercall.c
--- a/xen/arch/ia64/vmx/vmx_hypercall.c Fri Oct 27 19:15:48 2006 +0100
+++ b/xen/arch/ia64/vmx/vmx_hypercall.c Fri Oct 27 23:47:30 2006 +0100
@@ -79,7 +79,7 @@ do_hvm_op(unsigned long op, XEN_GUEST_HA
     }
 
     default:
-        DPRINTK(XENLOG_G_INFO "Bad HVM op %ld.\n", op);
+        gdprintk(XENLOG_INFO, "Bad HVM op %ld.\n", op);
         rc = -ENOSYS;
     }
     return rc;
diff -r d60b709724f4 -r 36679b74e24a xen/arch/ia64/vmx/vmx_init.c
--- a/xen/arch/ia64/vmx/vmx_init.c      Fri Oct 27 19:15:48 2006 +0100
+++ b/xen/arch/ia64/vmx/vmx_init.c      Fri Oct 27 23:47:30 2006 +0100
@@ -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(XENLOG_G_INFO "Allocated port %d for hvm.\n",
+                       gdprintk(XENLOG_INFO, "Allocated port %d for hvm.\n",
                                o->arch.arch_vmx.xen_port);
                }
        }
diff -r d60b709724f4 -r 36679b74e24a xen/arch/ia64/xen/dom0_ops.c
--- a/xen/arch/ia64/xen/dom0_ops.c      Fri Oct 27 19:15:48 2006 +0100
+++ b/xen/arch/ia64/xen/dom0_ops.c      Fri Oct 27 23:47:30 2006 +0100
@@ -320,7 +320,7 @@ do_dom0vp_op(unsigned long cmd,
     case IA64_DOM0VP_phystomach:
         ret = ____lookup_domain_mpa(d, arg0 << PAGE_SHIFT);
         if (ret == INVALID_MFN) {
-            DPRINTK(XENLOG_INFO "%s: INVALID_MFN ret: 0x%lx\n",
+            dprintk(XENLOG_INFO, "%s: INVALID_MFN ret: 0x%lx\n",
                      __func__, ret);
         } else {
             ret = (ret & _PFN_MASK) >> PAGE_SHIFT;//XXX pte_pfn()
diff -r d60b709724f4 -r 36679b74e24a xen/arch/ia64/xen/domain.c
--- a/xen/arch/ia64/xen/domain.c        Fri Oct 27 19:15:48 2006 +0100
+++ b/xen/arch/ia64/xen/domain.c        Fri Oct 27 23:47:30 2006 +0100
@@ -412,7 +412,7 @@ int arch_domain_create(struct domain *d)
 
 #ifdef CONFIG_XEN_IA64_PERVCPU_VHPT
        d->arch.has_pervcpu_vhpt = opt_pervcpu_vhpt;
-       DPRINTK("%s:%d domain %d pervcpu_vhpt %d\n",
+       dprintk(XENLOG_WARNING, "%s:%d domain %d pervcpu_vhpt %d\n",
                __func__, __LINE__, d->domain_id, d->arch.has_pervcpu_vhpt);
 #endif
        if (tlb_track_create(d) < 0)
@@ -682,7 +682,7 @@ int shadow_mode_control(struct domain *d
        //struct vcpu *v;
 
        if (unlikely(d == current->domain)) {
-               DPRINTK(XENLOG_G_INFO
+               gdprintk(XENLOG_INFO,
                         "Don't try to do a shadow op on yourself!\n");
                return -EINVAL;
        }   
diff -r d60b709724f4 -r 36679b74e24a xen/arch/ia64/xen/irq.c
--- a/xen/arch/ia64/xen/irq.c   Fri Oct 27 19:15:48 2006 +0100
+++ b/xen/arch/ia64/xen/irq.c   Fri Oct 27 23:47:30 2006 +0100
@@ -377,7 +377,7 @@ int pirq_guest_bind(struct vcpu *v, int 
     {
         if ( desc->action != NULL )
         {
-            DPRINTK(XENLOG_G_INFO
+            gdprintk(XENLOG_INFO,
                     "Cannot bind IRQ %d to guest. In use by '%s'.\n",
                     irq, desc->action->name);
             rc = -EBUSY;
@@ -387,7 +387,7 @@ int pirq_guest_bind(struct vcpu *v, int 
         action = xmalloc(irq_guest_action_t);
         if ( (desc->action = (struct irqaction *)action) == NULL )
         {
-            DPRINTK(XENLOG_G_INFO
+            gdprintk(XENLOG_INFO,
                     "Cannot bind IRQ %d to guest. Out of memory.\n",
                     irq);
             rc = -ENOMEM;
@@ -413,7 +413,7 @@ int pirq_guest_bind(struct vcpu *v, int 
     }
     else if ( !will_share || !action->shareable )
     {
-        DPRINTK(XENLOG_G_INFO
+        gdprintk(XENLOG_INFO,
                 "Cannot bind IRQ %d to guest. Will not share with others.\n",
                 irq);
         rc = -EBUSY;
@@ -422,7 +422,7 @@ int pirq_guest_bind(struct vcpu *v, int 
 
     if ( action->nr_guests == IRQ_MAX_GUESTS )
     {
-        DPRINTK(XENLOG_G_INFO
+        gdprintk(XENLOG_INFO,
                 "Cannot bind IRQ %d to guest. Already at max share.\n",
                 irq);
         rc = -EBUSY;
diff -r d60b709724f4 -r 36679b74e24a xen/arch/ia64/xen/mm.c
--- a/xen/arch/ia64/xen/mm.c    Fri Oct 27 19:15:48 2006 +0100
+++ b/xen/arch/ia64/xen/mm.c    Fri Oct 27 23:47:30 2006 +0100
@@ -229,7 +229,7 @@ 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(XENLOG_G_INFO "gnttab_transfer: "
+                gdprintk(XENLOG_INFO, "gnttab_transfer: "
                         "Bad page %p: ed=%p(%u) 0x%x, "
                         "sd=%p 0x%x,"
                         " caf=%016lx, taf=%" PRtype_info "\n",
@@ -445,7 +445,8 @@ u64 translate_domain_pte(u64 pteval, u64
        arflags2 = pteval2 & _PAGE_AR_MASK;
        if (arflags != _PAGE_AR_R && arflags2 == _PAGE_AR_R) {
 #if 0
-               DPRINTK("%s:%d "
+               dprintk(XENLOG_WARNING,
+                "%s:%d "
                        "pteval 0x%lx arflag 0x%lx address 0x%lx itir 0x%lx "
                        "pteval2 0x%lx arflags2 0x%lx mpaddr 0x%lx\n",
                        __func__, __LINE__,
@@ -979,7 +980,7 @@ efi_mmio(unsigned long physaddr, unsigne
 
         if (start <= physaddr && physaddr < end) {
             if ((physaddr + size) > end) {
-                DPRINTK(XENLOG_G_INFO "%s: physaddr 0x%lx size = 0x%lx\n",
+                gdprintk(XENLOG_INFO, "%s: physaddr 0x%lx size = 0x%lx\n",
                         __func__, physaddr, size);
                 return 0;
             }
@@ -1014,12 +1015,12 @@ assign_domain_mmio_page(struct domain *d
                         unsigned long mpaddr, unsigned long size)
 {
     if (size == 0) {
-        DPRINTK(XENLOG_G_INFO "%s: domain %p mpaddr 0x%lx size = 0x%lx\n",
+        gdprintk(XENLOG_INFO, "%s: domain %p mpaddr 0x%lx size = 0x%lx\n",
                 __func__, d, mpaddr, size);
     }
     if (!efi_mmio(mpaddr, size)) {
 #ifndef NDEBUG
-        DPRINTK(XENLOG_G_INFO "%s: domain %p mpaddr 0x%lx size = 0x%lx\n",
+        gdprintk(XENLOG_INFO, "%s: domain %p mpaddr 0x%lx size = 0x%lx\n",
                 __func__, d, mpaddr, size);
 #endif
         return -EINVAL;
@@ -1109,7 +1110,7 @@ assign_domain_page_cmpxchg_rel(struct do
     old_mfn = page_to_mfn(old_page);
     old_pte = pfn_pte(old_mfn, __pgprot(old_prot));
     if (!pte_present(old_pte)) {
-        DPRINTK(XENLOG_G_INFO
+        gdprintk(XENLOG_INFO,
                 "%s: old_pte 0x%lx old_prot 0x%lx old_mfn 0x%lx\n",
                 __func__, pte_val(old_pte), old_prot, old_mfn);
         return -EINVAL;
@@ -1126,7 +1127,7 @@ assign_domain_page_cmpxchg_rel(struct do
             goto again;
         }
 
-        DPRINTK(XENLOG_G_INFO
+        gdprintk(XENLOG_INFO,
                 "%s: old_pte 0x%lx old_prot 0x%lx old_mfn 0x%lx "
                 "ret_pte 0x%lx ret_mfn 0x%lx\n",
                 __func__,
@@ -1187,7 +1188,7 @@ zap_domain_page_one(struct domain *d, un
                 goto again;
             }
 
-            DPRINTK(XENLOG_G_INFO "%s: old_pte 0x%lx old_arflags 0x%lx mfn 
0x%lx "
+            gdprintk(XENLOG_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,
@@ -1255,7 +1256,7 @@ dom0vp_add_physmap(struct domain* d, uns
             rd = dom_io;
             break;
         default:
-            DPRINTK(XENLOG_G_INFO "d 0x%p domid %d "
+            gdprintk(XENLOG_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;
@@ -1328,7 +1329,7 @@ dom0vp_expose_p2m(struct domain* d,
         (conv_start_gpfn % granule_pfn) != 0 ||
         (assign_start_gpfn % granule_pfn) != 0 ||
         (expose_num_pfn % granule_pfn) != 0) {
-        DPRINTK(XENLOG_G_INFO
+        gdprintk(XENLOG_INFO,
                 "%s conv_start_gpfn 0x%016lx assign_start_gpfn 0x%016lx "
                 "expose_size 0x%016lx granulte_pfn 0x%016lx\n", __func__, 
                 conv_start_gpfn, assign_start_gpfn, expose_size, granule_pfn);
@@ -1336,7 +1337,7 @@ dom0vp_expose_p2m(struct domain* d,
     }
 
     if (granule_pfn != PTRS_PER_PTE) {
-        DPRINTK(XENLOG_G_INFO
+        gdprintk(XENLOG_INFO,
                 "%s granule_pfn 0x%016lx PTRS_PER_PTE 0x%016lx\n",
                 __func__, granule_pfn, PTRS_PER_PTE);
         return -ENOSYS;
@@ -1355,7 +1356,7 @@ dom0vp_expose_p2m(struct domain* d,
         assign_pte = lookup_alloc_domain_pte(d, (assign_start_gpfn <<
                                              PAGE_SHIFT) + i * sizeof(pte_t));
         if (assign_pte == NULL) {
-            DPRINTK(XENLOG_G_INFO "%s failed to allocate pte page\n", 
__func__);
+            gdprintk(XENLOG_INFO, "%s failed to allocate pte page\n", 
__func__);
             return -ENOMEM;
         }
 
@@ -1376,7 +1377,7 @@ dom0vp_expose_p2m(struct domain* d,
 
         if (expose_p2m_page(d, (assign_start_gpfn << PAGE_SHIFT) +
                             i * sizeof(pte_t), virt_to_page(conv_pte)) < 0) {
-            DPRINTK(XENLOG_G_INFO "%s failed to assign page\n", __func__);
+            gdprintk(XENLOG_INFO, "%s failed to assign page\n", __func__);
             return -EAGAIN;
         }
 
@@ -1395,7 +1396,7 @@ dom0vp_expose_p2m(struct domain* d,
         }
         if (expose_p2m_page(d, (assign_start_gpfn + i) << PAGE_SHIFT,
                             p2m_pte_zero_page) < 0) {
-            DPRINTK(XENLOG_G_INFO "%s failed to assign zero-pte page\n", 
__func__);
+            gdprintk(XENLOG_INFO, "%s failed to assign zero-pte page\n", 
__func__);
             return -EAGAIN;
         }
     }
@@ -1418,7 +1419,7 @@ create_grant_host_mapping(unsigned long 
 
     if (flags & (GNTMAP_device_map |
                  GNTMAP_application_map | GNTMAP_contains_pte)) {
-        DPRINTK(XENLOG_G_INFO "%s: flags 0x%x\n", __func__, flags);
+        gdprintk(XENLOG_INFO, "%s: flags 0x%x\n", __func__, flags);
         return GNTST_general_error;
     }
 
@@ -1452,13 +1453,13 @@ destroy_grant_host_mapping(unsigned long
     struct page_info* page;
 
     if (flags & (GNTMAP_application_map | GNTMAP_contains_pte)) {
-        DPRINTK(XENLOG_G_INFO "%s: flags 0x%x\n", __func__, flags);
+        gdprintk(XENLOG_INFO, "%s: flags 0x%x\n", __func__, flags);
         return GNTST_general_error;
     }
 
     pte = lookup_noalloc_domain_pte(d, gpaddr);
     if (pte == NULL) {
-        DPRINTK(XENLOG_G_INFO "%s: gpaddr 0x%lx mfn 0x%lx\n",
+        gdprintk(XENLOG_INFO, "%s: gpaddr 0x%lx mfn 0x%lx\n",
                 __func__, gpaddr, mfn);
         return GNTST_general_error;
     }
@@ -1467,7 +1468,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(XENLOG_G_INFO "%s: gpaddr 0x%lx mfn 0x%lx cur_pte 0x%lx\n",
+        gdprintk(XENLOG_INFO, "%s: gpaddr 0x%lx mfn 0x%lx cur_pte 0x%lx\n",
                 __func__, gpaddr, mfn, pte_val(cur_pte));
         return GNTST_general_error;
     }
@@ -1475,7 +1476,7 @@ 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(XENLOG_G_INFO "%s: gpaddr 0x%lx mfn 0x%lx"
+        gdprintk(XENLOG_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;
@@ -1484,7 +1485,7 @@ destroy_grant_host_mapping(unsigned long
         if (pte_pfn(old_pte) == mfn) {
             goto again;
         }
-        DPRINTK(XENLOG_G_INFO "%s gpaddr 0x%lx mfn 0x%lx cur_pte "
+        gdprintk(XENLOG_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;
@@ -1517,7 +1518,7 @@ steal_page(struct domain *d, struct page
     u64 x, nx, y;
 
     if (page_get_owner(page) != d) {
-        DPRINTK(XENLOG_G_INFO "%s d 0x%p owner 0x%p\n",
+        gdprintk(XENLOG_INFO, "%s d 0x%p owner 0x%p\n",
                 __func__, d, page_get_owner(page));
         return -1;
     }
@@ -1530,7 +1531,7 @@ steal_page(struct domain *d, struct page
 
         new = alloc_domheap_page(d);
         if (new == NULL) {
-            DPRINTK(XENLOG_G_INFO "alloc_domheap_page() failed\n");
+            gdprintk(XENLOG_INFO, "alloc_domheap_page() failed\n");
             return -1;
         }
         // zero out pages for security reasons
@@ -1554,7 +1555,7 @@ 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(XENLOG_G_INFO "assign_domain_page_cmpxchg_rel failed %d\n",
+            gdprintk(XENLOG_INFO, "assign_domain_page_cmpxchg_rel failed %d\n",
                     ret);
             set_gpfn_from_mfn(new_mfn, INVALID_M2P_ENTRY);
             free_domheap_page(new);
@@ -1592,7 +1593,7 @@ steal_page(struct domain *d, struct page
             unlikely(_nd != _d)) {
             struct domain* nd = unpickle_domptr(_nd);
             if (nd == NULL) {
-                DPRINTK(XENLOG_G_INFO "gnttab_transfer: "
+                gdprintk(XENLOG_INFO, "gnttab_transfer: "
                         "Bad page %p: ed=%p(%u) 0x%x, "
                         "sd=%p 0x%x,"
                         " caf=%016lx, taf=%" PRtype_info
@@ -1604,7 +1605,7 @@ steal_page(struct domain *d, struct page
                         page->u.inuse.type_info,
                         memflags);
             } else {
-                DPRINTK(XENLOG_G_WARNING "gnttab_transfer: "
+                gdprintk(XENLOG_WARNING, "gnttab_transfer: "
                         "Bad page %p: ed=%p(%u) 0x%x, "
                         "sd=%p(%u) 0x%x,"
                         " caf=%016lx, taf=%" PRtype_info
@@ -1682,24 +1683,24 @@ domain_page_flush(struct domain* d, unsi
     switch (tlb_track_search_and_remove(d->arch.tlb_track,
                                         ptep, old_pte, &entry)) {
     case TLB_TRACK_NOT_TRACKED:
-        // DPRINTK("%s TLB_TRACK_NOT_TRACKED\n", __func__);
+        // dprintk(XENLOG_WARNING, "%s TLB_TRACK_NOT_TRACKED\n", __func__);
         domain_flush_vtlb_all();
         break;
     case TLB_TRACK_NOT_FOUND:
         /* do nothing */
-        // DPRINTK("%s TLB_TRACK_NOT_FOUND\n", __func__);
+        // dprintk(XENLOG_WARNING, "%s TLB_TRACK_NOT_FOUND\n", __func__);
         break;
     case TLB_TRACK_FOUND:
-        // DPRINTK("%s TLB_TRACK_FOUND\n", __func__);
+        // dprintk(XENLOG_WARNING, "%s TLB_TRACK_FOUND\n", __func__);
         domain_flush_vtlb_track_entry(d, entry);
         tlb_track_free_entry(d->arch.tlb_track, entry);
         break;
     case TLB_TRACK_MANY:
-        DPRINTK(XENLOG_G_INFO "%s TLB_TRACK_MANY\n", __func__);
+        gdprintk(XENLOG_INFO, "%s TLB_TRACK_MANY\n", __func__);
         domain_flush_vtlb_all();
         break;
     case TLB_TRACK_AGAIN:
-        DPRINTK(XENLOG_G_ERR "%s TLB_TRACK_AGAIN\n", __func__);
+        gdprintk(XENLOG_ERR, "%s TLB_TRACK_AGAIN\n", __func__);
         BUG();
         break;
     }
diff -r d60b709724f4 -r 36679b74e24a xen/arch/ia64/xen/tlb_track.c
--- a/xen/arch/ia64/xen/tlb_track.c     Fri Oct 27 19:15:48 2006 +0100
+++ b/xen/arch/ia64/xen/tlb_track.c     Fri Oct 27 23:47:30 2006 +0100
@@ -44,13 +44,14 @@ tlb_track_allocate_entries(struct tlb_tr
 
     BUG_ON(tlb_track->num_free > 0);
     if (tlb_track->num_entries >= tlb_track->limit) {
-        DPRINTK("%s: num_entries %d limit %d\n",
+        dprintk(XENLOG_WARNING, "%s: num_entries %d limit %d\n",
                 __func__, tlb_track->num_entries, tlb_track->limit);
         return -ENOMEM;
     }
     entry_page = alloc_domheap_page(NULL);
     if (entry_page == NULL) {
-        DPRINTK("%s: domheap page failed. num_entries %d limit %d\n",
+        dprintk(XENLOG_WARNING,
+                "%s: domheap page failed. num_entries %d limit %d\n",
                 __func__, tlb_track->num_entries, tlb_track->limit);
         return -ENOMEM;
     }
diff -r d60b709724f4 -r 36679b74e24a xen/arch/ia64/xen/vcpu.c
--- a/xen/arch/ia64/xen/vcpu.c  Fri Oct 27 19:15:48 2006 +0100
+++ b/xen/arch/ia64/xen/vcpu.c  Fri Oct 27 23:47:30 2006 +0100
@@ -1544,8 +1544,9 @@ vcpu_get_domain_bundle(VCPU * vcpu, REGS
                // Last itc.i value is cached to PSCBX(vcpu, itlb).
                tr = PSCBX(vcpu, itlb);
                if (vcpu_match_tr_entry(&tr, gip, rid)) {
-                       //DPRINTK("%s gip 0x%lx gpip 0x%lx\n", __func__,
-                       //      gip, gpip);
+                       //dprintk(XENLOG_WARNING,
+                       //        "%s gip 0x%lx gpip 0x%lx\n", __func__,
+                       //        gip, gpip);
                        goto found;
                }
                trp = vcpu_tr_lookup(vcpu, gip, rid, 1);
@@ -1571,7 +1572,7 @@ vcpu_get_domain_bundle(VCPU * vcpu, REGS
                        set_metaphysical_rr0();
                }
                if (bundle->i64[0] == 0 && bundle->i64[1] == 0) {
-                       DPRINTK(XENLOG_INFO "%s gip 0x%lx\n", __func__, gip);
+                       dprintk(XENLOG_INFO, "%s gip 0x%lx\n", __func__, gip);
                        return 0;
                }
                return 1;
diff -r d60b709724f4 -r 36679b74e24a xen/arch/powerpc/mm.c
--- a/xen/arch/powerpc/mm.c     Fri Oct 27 19:15:48 2006 +0100
+++ b/xen/arch/powerpc/mm.c     Fri Oct 27 23:47:30 2006 +0100
@@ -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(XENLOG_G_INFO "Could not allocate order=%d RMA for domain 
%u\n",
+        gdprintk(XENLOG_INFO, "Could not allocate order=%d RMA for domain 
%u\n",
                 order, d->domain_id);
         return -ENOMEM;
     }
diff -r d60b709724f4 -r 36679b74e24a xen/arch/powerpc/shadow.c
--- a/xen/arch/powerpc/shadow.c Fri Oct 27 19:15:48 2006 +0100
+++ b/xen/arch/powerpc/shadow.c Fri Oct 27 23:47:30 2006 +0100
@@ -120,14 +120,14 @@ int shadow_domctl(struct domain *d,
 {
     if ( unlikely(d == current->domain) )
     {
-        DPRINTK(XENLOG_G_INFO "Don't try to do a shadow op on yourself!\n");
+        gdprintk(XENLOG_INFO, "Don't try to do a shadow op on yourself!\n");
         return -EINVAL;
     }
 
     switch ( sc->op )
     {
     case XEN_DOMCTL_SHADOW_OP_OFF:
-         DPRINTK(XENLOG_G_INFO "Shadow is mandatory!\n");
+         gdprintk(XENLOG_INFO, "Shadow is mandatory!\n");
          return -EINVAL;
 
     case XEN_DOMCTL_SHADOW_OP_GET_ALLOCATION:
diff -r d60b709724f4 -r 36679b74e24a xen/arch/x86/domain.c
--- a/xen/arch/x86/domain.c     Fri Oct 27 19:15:48 2006 +0100
+++ b/xen/arch/x86/domain.c     Fri Oct 27 23:47:30 2006 +0100
@@ -564,7 +564,7 @@ static void load_segments(struct vcpu *n
              put_user(regs->r11,           rsp-10) |
              put_user(regs->rcx,           rsp-11) )
         {
-            DPRINTK(XENLOG_G_ERR "Error while creating failsafe "
+            gdprintk(XENLOG_ERR, "Error while creating failsafe "
                     "callback frame.\n");
             domain_crash(n->domain);
         }
diff -r d60b709724f4 -r 36679b74e24a xen/arch/x86/extable.c
--- a/xen/arch/x86/extable.c    Fri Oct 27 19:15:48 2006 +0100
+++ b/xen/arch/x86/extable.c    Fri Oct 27 23:47:30 2006 +0100
@@ -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(XENLOG_INFO "Pre-exception: %p -> %p\n", _p(addr), _p(fixup));
+    dprintk(XENLOG_INFO, "Pre-exception: %p -> %p\n", _p(addr), _p(fixup));
 #ifdef PERF_COUNTERS
     if ( fixup )
         perfc_incrc(exception_fixed);
diff -r d60b709724f4 -r 36679b74e24a xen/arch/x86/hvm/hvm.c
--- a/xen/arch/x86/hvm/hvm.c    Fri Oct 27 19:15:48 2006 +0100
+++ b/xen/arch/x86/hvm/hvm.c    Fri Oct 27 23:47:30 2006 +0100
@@ -194,7 +194,7 @@ 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(XENLOG_INFO "Allocated port %d for hvm.\n",
+            dprintk(XENLOG_INFO, "Allocated port %d for hvm.\n",
                     o->arch.hvm_vcpu.xen_port);
         }
     }
@@ -356,7 +356,7 @@ static void hvm_vcpu_down(void)
     struct domain *d = v->domain;
     int online_count = 0;
 
-    DPRINTK(XENLOG_G_INFO "DOM%d/VCPU%d: going offline.\n",
+    gdprintk(XENLOG_INFO, "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. */
@@ -373,7 +373,7 @@ static void hvm_vcpu_down(void)
     /* ... Shut down the domain if not. */
     if ( online_count == 0 )
     {
-        DPRINTK(XENLOG_G_INFO "DOM%d: all CPUs offline -- powering off.\n",
+        gdprintk(XENLOG_INFO, "DOM%d: all CPUs offline -- powering off.\n",
                 d->domain_id);
         domain_shutdown(d, SHUTDOWN_poweroff);
     }
@@ -514,7 +514,7 @@ void hvm_do_hypercall(struct cpu_user_re
 
     if ( (pregs->eax >= NR_hypercalls) || !hvm_hypercall_table[pregs->eax] )
     {
-        DPRINTK(XENLOG_G_INFO "HVM vcpu %d:%d did a bad hypercall %d.\n",
+        gdprintk(XENLOG_INFO, "HVM vcpu %d:%d did a bad hypercall %d.\n",
                 current->domain->domain_id, current->vcpu_id,
                 pregs->eax);
         pregs->eax = -ENOSYS;
@@ -560,7 +560,7 @@ static long do_memory_op_compat32(int cm
     }
 
     default:
-        DPRINTK(XENLOG_G_INFO "memory_op %d.\n", cmd);
+        gdprintk(XENLOG_INFO, "memory_op %d.\n", cmd);
         rc = -ENOSYS;
         break;
     }
@@ -593,7 +593,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(XENLOG_G_INFO "HVM vcpu %d:%d did a bad hypercall %ld.\n",
+        gdprintk(XENLOG_INFO, "HVM vcpu %d:%d did a bad hypercall %ld.\n",
                 current->domain->domain_id, current->vcpu_id,
                 pregs->rax);
         pregs->rax = -ENOSYS;
@@ -644,7 +644,7 @@ int hvm_bringup_ap(int vcpuid, int tramp
 
     if ( bsp->vcpu_id != 0 )
     {
-        DPRINTK(XENLOG_G_ERR "Not calling hvm_bringup_ap from BSP context.\n");
+        gdprintk(XENLOG_ERR, "Not calling hvm_bringup_ap from BSP context.\n");
         domain_crash_synchronous();
     }
 
@@ -653,7 +653,7 @@ int hvm_bringup_ap(int vcpuid, int tramp
 
     if ( (ctxt = xmalloc(struct vcpu_guest_context)) == NULL )
     {
-        DPRINTK(XENLOG_G_INFO
+        gdprintk(XENLOG_INFO,
                 "Failed to allocate memory in hvm_bringup_ap.\n");
         return -ENOMEM;
     }
@@ -668,14 +668,14 @@ int hvm_bringup_ap(int vcpuid, int tramp
 
     if ( rc != 0 )
     {
-        DPRINTK(XENLOG_G_INFO
+        gdprintk(XENLOG_INFO,
                "AP %d bringup failed in boot_vcpu %x.\n", vcpuid, rc);
         goto out;
     }
 
     if ( test_and_clear_bit(_VCPUF_down, &d->vcpu[vcpuid]->vcpu_flags) )
         vcpu_wake(d->vcpu[vcpuid]);
-    DPRINTK(XENLOG_G_INFO "AP %d bringup suceeded.\n", vcpuid);
+    gdprintk(XENLOG_INFO, "AP %d bringup suceeded.\n", vcpuid);
 
  out:
     xfree(ctxt);
@@ -734,7 +734,7 @@ long do_hvm_op(unsigned long op, XEN_GUE
 
     default:
     {
-        DPRINTK(XENLOG_G_INFO "Bad HVM op %ld.\n", op);
+        gdprintk(XENLOG_INFO, "Bad HVM op %ld.\n", op);
         rc = -ENOSYS;
         break;
     }
diff -r d60b709724f4 -r 36679b74e24a xen/arch/x86/hvm/i8259.c
--- a/xen/arch/x86/hvm/i8259.c  Fri Oct 27 19:15:48 2006 +0100
+++ b/xen/arch/x86/hvm/i8259.c  Fri Oct 27 23:47:30 2006 +0100
@@ -140,10 +140,8 @@ void pic_set_xen_irq(void *opaque, int i
 
     /* Set it on the 8259s */
     ps = &s->pics[irq >> 3];
-    if (!(ps->elcr & (1 << (irq & 7)))) {
-       DPRINTK("edge-triggered override IRQ?\n");
-       domain_crash(current->domain);
-    }
+    if (!(ps->elcr & (1 << (irq & 7))))
+       gdprintk(XENLOG_WARNING, "edge-triggered override IRQ?\n");
     if (level) {
        ps->irr_xen |= 1 << (irq & 7);
     } else {
diff -r d60b709724f4 -r 36679b74e24a xen/arch/x86/hvm/instrlen.c
--- a/xen/arch/x86/hvm/instrlen.c       Fri Oct 27 19:15:48 2006 +0100
+++ b/xen/arch/x86/hvm/instrlen.c       Fri Oct 27 23:47:30 2006 +0100
@@ -317,7 +317,7 @@ done_prefixes:
 
         if ( modrm_mod == 3 )
         {
-            DPRINTK(XENLOG_G_WARNING "Cannot parse ModRM.mod == 3.\n");
+            gdprintk(XENLOG_WARNING, "Cannot parse ModRM.mod == 3.\n");
             goto cannot_emulate;
         }
 
@@ -444,7 +444,7 @@ done:
     return length;
 
 cannot_emulate:
-    DPRINTK(XENLOG_G_WARNING
+    gdprintk(XENLOG_WARNING,
             "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 d60b709724f4 -r 36679b74e24a xen/arch/x86/hvm/platform.c
--- a/xen/arch/x86/hvm/platform.c       Fri Oct 27 19:15:48 2006 +0100
+++ b/xen/arch/x86/hvm/platform.c       Fri Oct 27 23:47:30 2006 +0100
@@ -956,7 +956,8 @@ void handle_mmio(unsigned long gpa)
         }
 
         if ( addr & (size - 1) )
-            DPRINTK("Unaligned ioport access: %lx, %d\n", addr, size);
+            gdprintk(XENLOG_WARNING,
+                     "Unaligned ioport access: %lx, %d\n", addr, size);
 
         /*
          * In case of a movs spanning multiple pages, we break the accesses
@@ -971,7 +972,8 @@ void handle_mmio(unsigned long gpa)
         if ( (addr & PAGE_MASK) != ((addr + size - 1) & PAGE_MASK) ) {
             unsigned long value = 0;
 
-            DPRINTK("Single io request in a movs crossing page boundary.\n");
+            gdprintk(XENLOG_WARNING,
+                     "Single io request in a movs crossing page boundary.\n");
             mmio_op->flags |= OVERLAP;
 
             if ( dir == IOREQ_WRITE ) {
diff -r d60b709724f4 -r 36679b74e24a xen/arch/x86/hvm/svm/svm.c
--- a/xen/arch/x86/hvm/svm/svm.c        Fri Oct 27 19:15:48 2006 +0100
+++ b/xen/arch/x86/hvm/svm/svm.c        Fri Oct 27 23:47:30 2006 +0100
@@ -805,7 +805,7 @@ static void svm_final_setup_guest(struct
 
     if ( !shadow_mode_external(d) )
     {
-        DPRINTK(XENLOG_G_ERR "Can't init HVM for dom %u vcpu %u: "
+        gdprintk(XENLOG_ERR, "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 d60b709724f4 -r 36679b74e24a xen/arch/x86/hvm/vioapic.c
--- a/xen/arch/x86/hvm/vioapic.c        Fri Oct 27 19:15:48 2006 +0100
+++ b/xen/arch/x86/hvm/vioapic.c        Fri Oct 27 23:47:30 2006 +0100
@@ -556,10 +556,8 @@ void hvm_vioapic_set_xen_irq(struct doma
        s->redirtbl[irq].RedirForm.mask)
         return;
 
-    if (s->redirtbl[irq].RedirForm.trigmod != IOAPIC_LEVEL_TRIGGER) {
-       DPRINTK("Forcing edge triggered APIC irq %d?\n", irq);
-       domain_crash(d);
-    }
+    if (s->redirtbl[irq].RedirForm.trigmod != IOAPIC_LEVEL_TRIGGER)
+       gdprintk(XENLOG_WARNING, "Forcing edge triggered APIC irq %d?\n", irq);
 
     if (level)
        s->irr_xen |= 1 << irq;
diff -r d60b709724f4 -r 36679b74e24a xen/arch/x86/hvm/vmx/vmcs.c
--- a/xen/arch/x86/hvm/vmx/vmcs.c       Fri Oct 27 19:15:48 2006 +0100
+++ b/xen/arch/x86/hvm/vmx/vmcs.c       Fri Oct 27 23:47:30 2006 +0100
@@ -145,7 +145,7 @@ static struct vmcs_struct *vmx_alloc_vmc
 
     if ( (vmcs = alloc_xenheap_page()) == NULL )
     {
-        DPRINTK(XENLOG_G_WARNING "Failed to allocate VMCS.\n");
+        gdprintk(XENLOG_WARNING, "Failed to allocate VMCS.\n");
         return NULL;
     }
 
diff -r d60b709724f4 -r 36679b74e24a xen/arch/x86/hvm/vmx/vmx.c
--- a/xen/arch/x86/hvm/vmx/vmx.c        Fri Oct 27 19:15:48 2006 +0100
+++ b/xen/arch/x86/hvm/vmx/vmx.c        Fri Oct 27 23:47:30 2006 +0100
@@ -71,7 +71,7 @@ static int vmx_initialize_guest_resource
 
     if ( !shadow_mode_external(d) )
     {
-        DPRINTK(XENLOG_ERR "Can't init HVM for dom %u vcpu %u: "
+        dprintk(XENLOG_ERR, "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(XENLOG_WARNING
+            dprintk(XENLOG_WARNING,
                     "Failed to create VMCS for vcpu %d: err=%d.\n",
                     vc->vcpu_id, rc);
             return 0;
@@ -93,7 +93,7 @@ static int vmx_initialize_guest_resource
 
         if ( (io_bitmap_a = alloc_xenheap_pages(IO_BITMAP_ORDER)) == NULL )
         {
-            DPRINTK(XENLOG_WARNING
+            dprintk(XENLOG_WARNING,
                    "Failed to allocate io bitmap b for vcpu %d.\n",
                     vc->vcpu_id);
             return 0;
@@ -101,7 +101,7 @@ static int vmx_initialize_guest_resource
 
         if ( (io_bitmap_b = alloc_xenheap_pages(IO_BITMAP_ORDER)) == NULL )
         {
-            DPRINTK(XENLOG_WARNING
+            dprintk(XENLOG_WARNING,
                     "Failed to allocate io bitmap b for vcpu %d.\n",
                     vc->vcpu_id);
             return 0;
@@ -940,7 +940,7 @@ static void vmx_do_cpuid(struct cpu_user
         unsigned long mfn = get_mfn_from_gpfn(value >> PAGE_SHIFT);
         char *p;
 
-        DPRINTK(XENLOG_G_INFO "Input address is 0x%"PRIx64".\n", value);
+        gdprintk(XENLOG_INFO, "Input address is 0x%"PRIx64".\n", value);
 
         /* 8-byte aligned valid pseudophys address from vmxassist, please. */
         if ( (value & 7) || (mfn == INVALID_MFN) ||
@@ -951,7 +951,7 @@ static void vmx_do_cpuid(struct cpu_user
         value = *((uint64_t *)(p + (value & (PAGE_SIZE - 1))));
         unmap_domain_page(p);
 
-        DPRINTK(XENLOG_G_INFO "Output value is 0x%"PRIx64".\n", value);
+        gdprintk(XENLOG_INFO, "Output value is 0x%"PRIx64".\n", value);
         ecx = (u32)(value >>  0);
         edx = (u32)(value >> 32);
     }
diff -r d60b709724f4 -r 36679b74e24a xen/arch/x86/io_apic.c
--- a/xen/arch/x86/io_apic.c    Fri Oct 27 19:15:48 2006 +0100
+++ b/xen/arch/x86/io_apic.c    Fri Oct 27 23:47:30 2006 +0100
@@ -1980,7 +1980,7 @@ int ioapic_guest_read(unsigned long phys
 }
 
 #define WARN_BOGUS_WRITE(f, a...)                                       \
-    DPRINTK(XENLOG_INFO "\n%s: "                                        \
+    dprintk(XENLOG_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,        \
diff -r d60b709724f4 -r 36679b74e24a xen/arch/x86/irq.c
--- a/xen/arch/x86/irq.c        Fri Oct 27 19:15:48 2006 +0100
+++ b/xen/arch/x86/irq.c        Fri Oct 27 23:47:30 2006 +0100
@@ -432,7 +432,7 @@ int pirq_guest_bind(struct vcpu *v, int 
     {
         if ( desc->action != NULL )
         {
-            DPRINTK(XENLOG_G_INFO
+            gdprintk(XENLOG_INFO,
                     "Cannot bind IRQ %d to guest. In use by '%s'.\n",
                     irq, desc->action->name);
             rc = -EBUSY;
@@ -442,7 +442,7 @@ int pirq_guest_bind(struct vcpu *v, int 
         action = xmalloc(irq_guest_action_t);
         if ( (desc->action = (struct irqaction *)action) == NULL )
         {
-            DPRINTK(XENLOG_G_INFO
+            gdprintk(XENLOG_INFO,
                     "Cannot bind IRQ %d to guest. Out of memory.\n",
                     irq);
             rc = -ENOMEM;
@@ -467,7 +467,7 @@ int pirq_guest_bind(struct vcpu *v, int 
     }
     else if ( !will_share || !action->shareable )
     {
-        DPRINTK(XENLOG_G_INFO "Cannot bind IRQ %d to guest. "
+        gdprintk(XENLOG_INFO, "Cannot bind IRQ %d to guest. "
                "Will not share with others.\n",
                 irq);
         rc = -EBUSY;
@@ -488,7 +488,7 @@ int pirq_guest_bind(struct vcpu *v, int 
 
     if ( action->nr_guests == IRQ_MAX_GUESTS )
     {
-        DPRINTK(XENLOG_G_INFO "Cannot bind IRQ %d to guest. "
+        gdprintk(XENLOG_INFO, "Cannot bind IRQ %d to guest. "
                "Already at max share.\n", irq);
         rc = -EBUSY;
         goto out;
diff -r d60b709724f4 -r 36679b74e24a xen/arch/x86/mm.c
--- a/xen/arch/x86/mm.c Fri Oct 27 19:15:48 2006 +0100
+++ b/xen/arch/x86/mm.c Fri Oct 27 23:47:30 2006 +0100
@@ -108,16 +108,7 @@
 #include <asm/e820.h>
 #include <public/memory.h>
 
-#ifdef VERBOSE
-#define MEM_LOG(_f, _a...)                                          \
-    do {                                                            \
-        if ( printk_ratelimit() )                                   \
-            printk("DOM%u: (file=mm.c, line=%d) " _f "\n",          \
-                   current->domain->domain_id , __LINE__ , ## _a ); \
-    } while (0)
-#else
-#define MEM_LOG(_f, _a...) ((void)0)
-#endif
+#define MEM_LOG(_f, _a...) gdprintk(XENLOG_WARNING , _f , ## _a)
 
 /*
  * PTE updates can be done with ordinary writes except:
@@ -2261,8 +2252,7 @@ int do_mmu_update(
             {
                 if ( shadow_mode_refcounts(d) )
                 {
-                    DPRINTK(XENLOG_INFO
-                            "mmu update on shadow-refcounted domain!");
+                    MEM_LOG("mmu update on shadow-refcounted domain!");
                     break;
                 }
 
@@ -2626,8 +2616,7 @@ int steal_page(
         x = y;
         if (unlikely((x & (PGC_count_mask|PGC_allocated)) !=
                      (1 | PGC_allocated)) || unlikely(_nd != _d)) { 
-            DPRINTK(XENLOG_G_WARNING
-                    "gnttab_transfer: Bad page %p: ed=%p(%u), sd=%p,"
+            MEM_LOG("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 d60b709724f4 -r 36679b74e24a xen/arch/x86/mm/shadow/common.c
--- a/xen/arch/x86/mm/shadow/common.c   Fri Oct 27 19:15:48 2006 +0100
+++ b/xen/arch/x86/mm/shadow/common.c   Fri Oct 27 23:47:30 2006 +0100
@@ -3072,7 +3072,7 @@ int shadow_domctl(struct domain *d,
 
     if ( unlikely(d == current->domain) )
     {
-        DPRINTK(XENLOG_G_INFO "Don't try to do a shadow op on yourself!\n");
+        gdprintk(XENLOG_INFO, "Don't try to do a shadow op on yourself!\n");
         return -EINVAL;
     }
 
diff -r d60b709724f4 -r 36679b74e24a xen/arch/x86/platform_hypercall.c
--- a/xen/arch/x86/platform_hypercall.c Fri Oct 27 19:15:48 2006 +0100
+++ b/xen/arch/x86/platform_hypercall.c Fri Oct 27 23:47:30 2006 +0100
@@ -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(XENLOG_INFO "Domain 0 says that IO-APIC REGSEL is %s\n",
+            dprintk(XENLOG_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 d60b709724f4 -r 36679b74e24a xen/arch/x86/traps.c
--- a/xen/arch/x86/traps.c      Fri Oct 27 19:15:48 2006 +0100
+++ b/xen/arch/x86/traps.c      Fri Oct 27 23:47:30 2006 +0100
@@ -407,7 +407,7 @@ static inline int do_trap(int trapnr, ch
 
     if ( likely((fixup = search_exception_table(regs->eip)) != 0) )
     {
-        DPRINTK(XENLOG_ERR "Trap %d: %p -> %p\n",
+        dprintk(XENLOG_ERR, "Trap %d: %p -> %p\n",
                 trapnr, _p(regs->eip), _p(fixup));
         regs->eip = fixup;
         return 0;
@@ -476,7 +476,7 @@ int wrmsr_hypervisor_regs(
 
         if ( idx > 0 )
         {
-            DPRINTK(XENLOG_G_WARNING
+            gdprintk(XENLOG_WARNING,
                     "Dom%d: Out of range index %u to MSR %08x\n",
                     d->domain_id, idx, 0x40000000);
             return 0;
@@ -487,7 +487,7 @@ int wrmsr_hypervisor_regs(
         if ( !mfn_valid(mfn) ||
              !get_page_and_type(mfn_to_page(mfn), d, PGT_writable_page) )
         {
-            DPRINTK(XENLOG_G_WARNING
+            gdprintk(XENLOG_WARNING,
                     "Dom%d: Bad GMFN %lx (MFN %lx) to MSR %08x\n",
                     d->domain_id, gmfn, mfn, 0x40000000);
             return 0;
@@ -835,18 +835,18 @@ static int __spurious_page_fault(
         return 0;
 
  spurious:
-    DPRINTK(XENLOG_WARNING "Spurious fault in domain %u:%u "
+    dprintk(XENLOG_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(XENLOG_WARNING " l4e = %"PRIpte"\n", l4e_get_intpte(l4e));
+    dprintk(XENLOG_WARNING, " l4e = %"PRIpte"\n", l4e_get_intpte(l4e));
 #endif
 #if CONFIG_PAGING_LEVELS >= 3
-    DPRINTK(XENLOG_WARNING " l3e = %"PRIpte"\n", l3e_get_intpte(l3e));
-#endif
-    DPRINTK(XENLOG_WARNING " l2e = %"PRIpte"\n", l2e_get_intpte(l2e));
-    DPRINTK(XENLOG_WARNING " l1e = %"PRIpte"\n", l1e_get_intpte(l1e));
+    dprintk(XENLOG_WARNING, " l3e = %"PRIpte"\n", l3e_get_intpte(l3e));
+#endif
+    dprintk(XENLOG_WARNING, " l2e = %"PRIpte"\n", l2e_get_intpte(l2e));
+    dprintk(XENLOG_WARNING, " l1e = %"PRIpte"\n", l1e_get_intpte(l1e));
 #ifndef NDEBUG
     show_registers(regs);
 #endif
@@ -1317,7 +1317,7 @@ static int emulate_privileged_op(struct 
         case 0: /* Write CR0 */
             if ( (*reg ^ read_cr0()) & ~X86_CR0_TS )
             {
-                DPRINTK(XENLOG_G_WARNING
+                gdprintk(XENLOG_WARNING,
                         "Attempt to change unmodifiable CR0 flags.\n");
                 goto fail;
             }
@@ -1338,7 +1338,7 @@ static int emulate_privileged_op(struct 
         case 4:
             if ( *reg != (read_cr4() & ~(X86_CR4_PGE|X86_CR4_PSE)) )
             {
-                DPRINTK(XENLOG_G_WARNING "Attempt to change CR4 flags.\n");
+                gdprintk(XENLOG_WARNING, "Attempt to change CR4 flags.\n");
                 goto fail;
             }
             break;
@@ -1386,7 +1386,7 @@ static int emulate_privileged_op(struct 
 
             if ( (rdmsr_safe(regs->ecx, l, h) != 0) ||
                  (regs->eax != l) || (regs->edx != h) )
-                DPRINTK(XENLOG_G_WARNING "Domain attempted WRMSR %p from "
+                gdprintk(XENLOG_WARNING, "Domain attempted WRMSR %p from "
                         "%08x:%08x to %08lx:%08lx.\n",
                         _p(regs->ecx), h, l, (long)regs->edx, (long)regs->eax);
             break;
@@ -1422,7 +1422,8 @@ static int emulate_privileged_op(struct 
                 break;
             }
             /* Everyone can read the MSR space. */
-            /*DPRINTK("Domain attempted RDMSR %p.\n", _p(regs->ecx));*/
+            /* gdprintk(XENLOG_WARNING,"Domain attempted RDMSR %p.\n",
+                        _p(regs->ecx));*/
             if ( rdmsr_safe(regs->ecx, regs->eax, regs->edx) )
                 goto fail;
             break;
@@ -1515,7 +1516,7 @@ asmlinkage int do_general_protection(str
 
     if ( likely((fixup = search_exception_table(regs->eip)) != 0) )
     {
-        DPRINTK(XENLOG_WARNING "GPF (%04x): %p -> %p\n",
+        dprintk(XENLOG_WARNING, "GPF (%04x): %p -> %p\n",
                 regs->error_code, _p(regs->eip), _p(fixup));
         regs->eip = fixup;
         return 0;
diff -r d60b709724f4 -r 36679b74e24a xen/arch/x86/x86_32/seg_fixup.c
--- a/xen/arch/x86/x86_32/seg_fixup.c   Fri Oct 27 19:15:48 2006 +0100
+++ b/xen/arch/x86/x86_32/seg_fixup.c   Fri Oct 27 23:47:30 2006 +0100
@@ -181,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(XENLOG_DEBUG "Segment %04x out of LDT range (%ld)\n",
+            dprintk(XENLOG_DEBUG, "Segment %04x out of LDT range (%ld)\n",
                     seg, d->arch.guest_context.ldt_ents);
             goto fail;
         }
@@ -191,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(XENLOG_DEBUG "Segment %04x out of GDT range (%ld)\n",
+            dprintk(XENLOG_DEBUG, "Segment %04x out of GDT range (%ld)\n",
                     seg, d->arch.guest_context.gdt_ents);
             goto fail;
         }
@@ -201,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(XENLOG_DEBUG "Fault while reading segment %04x\n", seg);
+        dprintk(XENLOG_DEBUG, "Fault while reading segment %04x\n", seg);
         goto fail; /* Barking up the wrong tree. Decode needs a page fault.*/
     }
 
@@ -210,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(XENLOG_DEBUG "Bad segment %08lx:%08lx\n", a, b);
+        dprintk(XENLOG_DEBUG, "Bad segment %08lx:%08lx\n", a, b);
         goto fail;
     }
 
@@ -240,7 +240,7 @@ int fixup_seg(u16 seg, unsigned long off
         }
     }
 
-    DPRINTK(XENLOG_DEBUG "None of the above! "
+    dprintk(XENLOG_DEBUG, "None of the above! "
             "(%08lx:%08lx, %08lx, %08lx, %08lx)\n",
             a, b, base, limit, base+limit);
 
@@ -279,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(XENLOG_DEBUG "Taken fault at bad CS %04x\n", regs->cs);
+        dprintk(XENLOG_DEBUG, "Taken fault at bad CS %04x\n", regs->cs);
         goto fail;
     }
 
     if ( !linearise_address((u16)regs->cs, regs->eip, (unsigned long *)&eip) )
     {
-        DPRINTK(XENLOG_DEBUG "Cannot linearise %04x:%08x\n",
+        dprintk(XENLOG_DEBUG, "Cannot linearise %04x:%08x\n",
                 regs->cs, regs->eip);
         goto fail;
     }
@@ -295,7 +295,7 @@ int gpf_emulate_4gb(struct cpu_user_regs
     {
         if ( get_user(b, pb) )
         {
-            DPRINTK(XENLOG_DEBUG
+            dprintk(XENLOG_DEBUG,
                     "Fault while accessing byte %d of instruction\n",
                     pb-eip);
             goto page_fault;
@@ -303,7 +303,7 @@ int gpf_emulate_4gb(struct cpu_user_regs
 
         if ( (pb - eip) >= 15 )
         {
-            DPRINTK(XENLOG_DEBUG "Too many instruction prefixes for a "
+            dprintk(XENLOG_DEBUG, "Too many instruction prefixes for a "
                     "legal instruction\n");
             goto fail;
         }
@@ -316,7 +316,7 @@ int gpf_emulate_4gb(struct cpu_user_regs
         case 0x26: /* ES override */
         case 0x64: /* FS override */
         case 0x36: /* SS override */
-            DPRINTK(XENLOG_DEBUG "Unhandled prefix %02x\n", b);
+            dprintk(XENLOG_DEBUG, "Unhandled prefix %02x\n", b);
             goto fail;
         case 0x66: /* Operand-size override */
         case 0xf0: /* LOCK */
@@ -334,7 +334,7 @@ int gpf_emulate_4gb(struct cpu_user_regs
 
     if ( !gs_override )
     {
-        DPRINTK(XENLOG_DEBUG "Only instructions with GS override\n");
+        dprintk(XENLOG_DEBUG, "Only instructions with GS override\n");
         goto fail;
     }
 
@@ -342,7 +342,7 @@ int gpf_emulate_4gb(struct cpu_user_regs
     pb++;
     if ( decode == 0 )
     {
-        DPRINTK(XENLOG_DEBUG "Unsupported opcode %02x\n", b);
+        dprintk(XENLOG_DEBUG, "Unsupported opcode %02x\n", b);
         goto fail;
     }
     
@@ -354,7 +354,7 @@ int gpf_emulate_4gb(struct cpu_user_regs
 
         if ( get_user(offset, (u32 *)pb) )
         {
-            DPRINTK(XENLOG_DEBUG "Fault while extracting <disp32>.\n");
+            dprintk(XENLOG_DEBUG, "Fault while extracting <disp32>.\n");
             goto page_fault;
         }
         pb += 4;
@@ -368,7 +368,7 @@ int gpf_emulate_4gb(struct cpu_user_regs
 
     if ( get_user(modrm, pb) )
     {
-        DPRINTK(XENLOG_DEBUG "Fault while extracting modrm byte\n");
+        dprintk(XENLOG_DEBUG, "Fault while extracting modrm byte\n");
         goto page_fault;
     }
 
@@ -380,7 +380,7 @@ int gpf_emulate_4gb(struct cpu_user_regs
 
     if ( rm == 4 )
     {
-        DPRINTK(XENLOG_DEBUG "FIXME: Add decoding for the SIB byte.\n");
+        dprintk(XENLOG_DEBUG, "FIXME: Add decoding for the SIB byte.\n");
         goto fixme;
     }
 
@@ -398,7 +398,7 @@ int gpf_emulate_4gb(struct cpu_user_regs
             memreg = NULL;
             if ( get_user(disp32, (u32 *)pb) )
             {
-                DPRINTK(XENLOG_DEBUG "Fault while extracting <disp8>.\n");
+                dprintk(XENLOG_DEBUG, "Fault while extracting <disp8>.\n");
                 goto page_fault;
             }
             pb += 4;
@@ -408,7 +408,7 @@ int gpf_emulate_4gb(struct cpu_user_regs
     case 1:
         if ( get_user(disp8, pb) )
         {
-            DPRINTK(XENLOG_DEBUG "Fault while extracting <disp8>.\n");
+            dprintk(XENLOG_DEBUG, "Fault while extracting <disp8>.\n");
             goto page_fault;
         }
         pb++;
@@ -418,14 +418,14 @@ int gpf_emulate_4gb(struct cpu_user_regs
     case 2:
         if ( get_user(disp32, (u32 *)pb) )
         {
-            DPRINTK(XENLOG_DEBUG "Fault while extracting <disp8>.\n");
+            dprintk(XENLOG_DEBUG, "Fault while extracting <disp8>.\n");
             goto page_fault;
         }
         pb += 4;
         break;
 
     case 3:
-        DPRINTK(XENLOG_DEBUG "Not a memory operand!\n");
+        dprintk(XENLOG_DEBUG, "Not a memory operand!\n");
         goto fail;
     }
 
@@ -456,7 +456,7 @@ int gpf_emulate_4gb(struct cpu_user_regs
     return EXCRET_fault_fixed;
 
  fixme:
-    DPRINTK(XENLOG_DEBUG "Undecodable instruction "
+    dprintk(XENLOG_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],
diff -r d60b709724f4 -r 36679b74e24a xen/arch/x86/x86_64/traps.c
--- a/xen/arch/x86/x86_64/traps.c       Fri Oct 27 19:15:48 2006 +0100
+++ b/xen/arch/x86/x86_64/traps.c       Fri Oct 27 23:47:30 2006 +0100
@@ -206,7 +206,7 @@ unsigned long do_iret(void)
     if ( unlikely(copy_from_user(&iret_saved, (void *)regs->rsp,
                                  sizeof(iret_saved))) )
     {
-        DPRINTK(XENLOG_G_ERR "Fault while reading IRET context from "
+        gdprintk(XENLOG_ERR, "Fault while reading IRET context from "
                 "guest stack\n");
         domain_crash_synchronous();
     }
@@ -216,7 +216,7 @@ unsigned long do_iret(void)
     {
         if ( unlikely(pagetable_is_null(v->arch.guest_table_user)) )
         {
-            DPRINTK(XENLOG_G_ERR "Guest switching to user mode with no "
+            gdprintk(XENLOG_ERR, "Guest switching to user mode with no "
                     "user page tables\n");
             domain_crash_synchronous();
         }
diff -r d60b709724f4 -r 36679b74e24a xen/arch/x86/x86_emulate.c
--- a/xen/arch/x86/x86_emulate.c        Fri Oct 27 19:15:48 2006 +0100
+++ b/xen/arch/x86/x86_emulate.c        Fri Oct 27 23:47:30 2006 +0100
@@ -10,14 +10,14 @@
 #include <stdio.h>
 #include <stdint.h>
 #include <public/xen.h>
-#define DPRINTF(_f, _a...) printf( _f , ## _a )
+#define dprintf(_f, _a...) printf( _f , ## _a )
 #else
 #include <xen/config.h>
 #include <xen/types.h>
 #include <xen/lib.h>
 #include <xen/mm.h>
 #include <asm/regs.h>
-#define DPRINTF DPRINTK
+#define dprintf(_f, _a...) gdprintk(XENLOG_WARNING, _f , ## _a )
 #endif
 #include <asm-x86/x86_emulate.h>
 
@@ -560,7 +560,7 @@ x86_emulate_memop(
 
         if ( modrm_mod == 3 )
         {
-            DPRINTF("Cannot parse ModRM.mod == 3.\n");
+            dprintf("Cannot parse ModRM.mod == 3.\n");
             goto cannot_emulate;
         }
 
@@ -970,7 +970,7 @@ x86_emulate_memop(
             _regs.edi, (_regs.eflags & EFLG_DF) ? -dst.bytes : dst.bytes);
         break;
     case 0xa6 ... 0xa7: /* cmps */
-        DPRINTF("Urk! I don't handle CMPS.\n");
+        dprintf("Urk! I don't handle CMPS.\n");
         goto cannot_emulate;
     case 0xaa ... 0xab: /* stos */
         dst.type  = OP_MEM;
@@ -990,7 +990,7 @@ x86_emulate_memop(
             _regs.esi, (_regs.eflags & EFLG_DF) ? -dst.bytes : dst.bytes);
         break;
     case 0xae ... 0xaf: /* scas */
-        DPRINTF("Urk! I don't handle SCAS.\n");
+        dprintf("Urk! I don't handle SCAS.\n");
         goto cannot_emulate;
     }
     goto writeback;
@@ -1149,7 +1149,7 @@ x86_emulate_memop(
     goto writeback;
 
  cannot_emulate:
-    DPRINTF("Cannot emulate %02x\n", b);
+    dprintf("Cannot emulate %02x\n", b);
     return -1;
 }
 
diff -r d60b709724f4 -r 36679b74e24a xen/common/domain.c
--- a/xen/common/domain.c       Fri Oct 27 19:15:48 2006 +0100
+++ b/xen/common/domain.c       Fri Oct 27 23:47:30 2006 +0100
@@ -35,6 +35,11 @@ struct domain *dom0;
 
 struct vcpu *idle_vcpu[NR_CPUS] __read_mostly;
 
+int current_domain_id(void)
+{
+    return current->domain->domain_id;
+}
+
 struct domain *alloc_domain(domid_t domid)
 {
     struct domain *d;
@@ -54,7 +59,6 @@ struct domain *alloc_domain(domid_t domi
     return d;
 }
 
-
 void free_domain(struct domain *d)
 {
     struct vcpu *v;
@@ -68,7 +72,6 @@ void free_domain(struct domain *d)
 
     xfree(d);
 }
-
 
 struct vcpu *alloc_vcpu(
     struct domain *d, unsigned int vcpu_id, unsigned int cpu_id)
diff -r d60b709724f4 -r 36679b74e24a xen/common/event_channel.c
--- a/xen/common/event_channel.c        Fri Oct 27 19:15:48 2006 +0100
+++ b/xen/common/event_channel.c        Fri Oct 27 23:47:30 2006 +0100
@@ -40,7 +40,7 @@
 
 #define ERROR_EXIT(_errno)                                          \
     do {                                                            \
-        DPRINTK(XENLOG_G_WARNING                                    \
+        gdprintk(XENLOG_WARNING,                                    \
                 "EVTCHNOP failure: domain %d, error %d, line %d\n", \
                 current->domain->domain_id, (_errno), __LINE__);    \
         rc = (_errno);                                              \
diff -r d60b709724f4 -r 36679b74e24a xen/common/grant_table.c
--- a/xen/common/grant_table.c  Fri Oct 27 19:15:48 2006 +0100
+++ b/xen/common/grant_table.c  Fri Oct 27 23:47:30 2006 +0100
@@ -47,7 +47,7 @@ union grant_combo {
 
 #define PIN_FAIL(_lbl, _rc, _f, _a...)          \
     do {                                        \
-        DPRINTK( XENLOG_G_WARNING _f, ## _a );  \
+        gdprintk(XENLOG_WARNING, _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(XENLOG_G_INFO "Bad ref (%d) or flags (%x).\n",
+        gdprintk(XENLOG_INFO, "Bad ref (%d) or flags (%x).\n",
                 op->ref, op->flags);
         op->status = GNTST_bad_gntref;
         return;
@@ -125,7 +125,7 @@ __gnttab_map_grant_ref(
     {
         if ( rd != NULL )
             put_domain(rd);
-        DPRINTK(XENLOG_G_INFO "Could not find domain %d\n", op->dom);
+        gdprintk(XENLOG_INFO, "Could not find domain %d\n", op->dom);
         op->status = GNTST_bad_domain;
         return;
     }
@@ -140,7 +140,7 @@ __gnttab_map_grant_ref(
         if ( (lgt->maptrack_limit << 1) > MAPTRACK_MAX_ENTRIES )
         {
             put_domain(rd);
-            DPRINTK(XENLOG_G_INFO "Maptrack table is at maximum size.\n");
+            gdprintk(XENLOG_INFO, "Maptrack table is at maximum size.\n");
             op->status = GNTST_no_device_space;
             return;
         }
@@ -150,7 +150,7 @@ __gnttab_map_grant_ref(
         if ( new_mt == NULL )
         {
             put_domain(rd);
-            DPRINTK(XENLOG_G_INFO "No more map handles available.\n");
+            gdprintk(XENLOG_INFO, "No more map handles available.\n");
             op->status = GNTST_no_device_space;
             return;
         }
@@ -167,7 +167,7 @@ __gnttab_map_grant_ref(
         lgt->maptrack_order   += 1;
         lgt->maptrack_limit  <<= 1;
 
-        DPRINTK(XENLOG_G_INFO "Doubled maptrack size\n");
+        gdprintk(XENLOG_INFO, "Doubled maptrack size\n");
         handle = get_maptrack_handle(ld->grant_table);
     }
 
@@ -354,7 +354,7 @@ __gnttab_unmap_grant_ref(
     if ( unlikely(op->handle >= ld->grant_table->maptrack_limit) ||
          unlikely(!map->flags) )
     {
-        DPRINTK(XENLOG_G_INFO "Bad handle (%d).\n", op->handle);
+        gdprintk(XENLOG_INFO, "Bad handle (%d).\n", op->handle);
         op->status = GNTST_bad_handle;
         return;
     }
@@ -367,7 +367,7 @@ __gnttab_unmap_grant_ref(
     {
         if ( rd != NULL )
             put_domain(rd);
-        DPRINTK(XENLOG_G_INFO "Could not find domain %d\n", dom);
+        gdprintk(XENLOG_INFO, "Could not find domain %d\n", dom);
         op->status = GNTST_bad_domain;
         return;
     }
@@ -487,13 +487,13 @@ gnttab_setup_table(
 
     if ( unlikely(copy_from_guest(&op, uop, 1) != 0) )
     {
-        DPRINTK(XENLOG_G_INFO "Fault while reading gnttab_setup_table_t.\n");
+        gdprintk(XENLOG_INFO, "Fault while reading gnttab_setup_table_t.\n");
         return -EFAULT;
     }
 
     if ( unlikely(op.nr_frames > NR_GRANT_FRAMES) )
     {
-        DPRINTK(XENLOG_G_INFO "Xen only supports up to %d grant-table frames"
+        gdprintk(XENLOG_INFO, "Xen only supports up to %d grant-table frames"
                 " per domain.\n",
                 NR_GRANT_FRAMES);
         op.status = GNTST_general_error;
@@ -513,7 +513,7 @@ gnttab_setup_table(
 
     if ( unlikely((d = find_domain_by_id(dom)) == NULL) )
     {
-        DPRINTK(XENLOG_G_INFO "Bad domid %d.\n", dom);
+        gdprintk(XENLOG_INFO, "Bad domid %d.\n", dom);
         op.status = GNTST_bad_domain;
         goto out;
     }
@@ -551,7 +551,7 @@ gnttab_prepare_for_transfer(
     if ( unlikely((rgt = rd->grant_table) == NULL) ||
          unlikely(ref >= NR_GRANT_ENTRIES) )
     {
-        DPRINTK(XENLOG_G_INFO "Dom %d has no g.t., or ref is bad (%d).\n",
+        gdprintk(XENLOG_INFO, "Dom %d has no g.t., or ref is bad (%d).\n",
                 rd->domain_id, ref);
         return 0;
     }
@@ -567,7 +567,7 @@ gnttab_prepare_for_transfer(
         if ( unlikely(scombo.shorts.flags != GTF_accept_transfer) ||
              unlikely(scombo.shorts.domid != ld->domain_id) )
         {
-            DPRINTK(XENLOG_G_INFO "Bad flags (%x) or dom (%d). "
+            gdprintk(XENLOG_INFO, "Bad flags (%x) or dom (%d). "
                     "(NB. expected dom %d)\n",
                     scombo.shorts.flags, scombo.shorts.domid,
                     ld->domain_id);
@@ -584,7 +584,7 @@ gnttab_prepare_for_transfer(
 
         if ( retries++ == 4 )
         {
-            DPRINTK(XENLOG_G_WARNING "Shared grant entry is unstable.\n");
+            gdprintk(XENLOG_WARNING, "Shared grant entry is unstable.\n");
             goto fail;
         }
 
@@ -616,7 +616,7 @@ gnttab_transfer(
         /* Read from caller address space. */
         if ( unlikely(__copy_from_guest_offset(&gop, uop, i, 1)) )
         {
-            DPRINTK(XENLOG_G_INFO "gnttab_transfer: error reading req %d/%d\n",
+            gdprintk(XENLOG_INFO, "gnttab_transfer: error reading req %d/%d\n",
                     i, count);
             return -EFAULT;
         }
@@ -626,7 +626,7 @@ gnttab_transfer(
         /* Check the passed page frame for basic validity. */
         if ( unlikely(!mfn_valid(mfn)) )
         { 
-            DPRINTK(XENLOG_G_INFO "gnttab_transfer: out-of-range %lx\n",
+            gdprintk(XENLOG_INFO, "gnttab_transfer: out-of-range %lx\n",
                     (unsigned long)gop.mfn);
             gop.status = GNTST_bad_page;
             goto copyback;
@@ -635,7 +635,7 @@ gnttab_transfer(
         page = mfn_to_page(mfn);
         if ( unlikely(IS_XEN_HEAP_FRAME(page)) )
         { 
-            DPRINTK(XENLOG_G_INFO "gnttab_transfer: xen frame %lx\n",
+            gdprintk(XENLOG_INFO, "gnttab_transfer: xen frame %lx\n",
                     (unsigned long)gop.mfn);
             gop.status = GNTST_bad_page;
             goto copyback;
@@ -650,7 +650,7 @@ gnttab_transfer(
         /* Find the target domain. */
         if ( unlikely((e = find_domain_by_id(gop.domid)) == NULL) )
         {
-            DPRINTK(XENLOG_G_INFO "gnttab_transfer: can't find domain %d\n",
+            gdprintk(XENLOG_INFO, "gnttab_transfer: can't find domain %d\n",
                     gop.domid);
             page->count_info &= ~(PGC_count_mask|PGC_allocated);
             free_domheap_page(page);
@@ -670,7 +670,7 @@ gnttab_transfer(
              unlikely(!gnttab_prepare_for_transfer(e, d, gop.ref)) )
         {
             if ( !test_bit(_DOMF_dying, &e->domain_flags) )
-                DPRINTK(XENLOG_G_INFO "gnttab_transfer: "
+                gdprintk(XENLOG_INFO, "gnttab_transfer: "
                         "Transferee has no reservation "
                         "headroom (%d,%d) or provided a bad grant ref (%08x) "
                         "or is dying (%lx)\n",
@@ -707,7 +707,7 @@ gnttab_transfer(
     copyback:
         if ( unlikely(__copy_to_guest_offset(uop, i, &gop, 1)) )
         {
-            DPRINTK(XENLOG_G_INFO "gnttab_transfer: error writing resp 
%d/%d\n",
+            gdprintk(XENLOG_INFO, "gnttab_transfer: error writing resp 
%d/%d\n",
                     i, count);
             return -EFAULT;
         }
@@ -1097,7 +1097,7 @@ gnttab_release_mappings(
 
         ref = map->ref;
 
-        DPRINTK(XENLOG_G_INFO "Grant release (%hu) ref:(%hu) "
+        gdprintk(XENLOG_INFO, "Grant release (%hu) ref:(%hu) "
                 "flags:(%x) dom:(%hu)\n",
                 handle, ref, map->flags, map->domid);
 
diff -r d60b709724f4 -r 36679b74e24a xen/common/memory.c
--- a/xen/common/memory.c       Fri Oct 27 19:15:48 2006 +0100
+++ b/xen/common/memory.c       Fri Oct 27 23:47:30 2006 +0100
@@ -63,7 +63,7 @@ increase_reservation(
         if ( unlikely((page = __alloc_domheap_pages( d, cpu, 
             extent_order, memflags )) == NULL) ) 
         {
-            DPRINTK(XENLOG_G_INFO "Could not allocate order=%d extent: "
+            gdprintk(XENLOG_INFO, "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;
@@ -118,7 +118,7 @@ populate_physmap(
         if ( unlikely((page = __alloc_domheap_pages( d, cpu, 
             extent_order, memflags )) == NULL) ) 
         {
-            DPRINTK(XENLOG_G_INFO "Could not allocate order=%d extent: "
+            gdprintk(XENLOG_INFO, "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;
@@ -157,7 +157,7 @@ guest_remove_page(
     mfn = gmfn_to_mfn(d, gmfn);
     if ( unlikely(!mfn_valid(mfn)) )
     {
-        DPRINTK(XENLOG_G_INFO "Domain %u page number %lx invalid\n",
+        gdprintk(XENLOG_INFO, "Domain %u page number %lx invalid\n",
                 d->domain_id, gmfn);
         return 0;
     }
@@ -165,7 +165,7 @@ guest_remove_page(
     page = mfn_to_page(mfn);
     if ( unlikely(!get_page(page, d)) )
     {
-        DPRINTK(XENLOG_G_INFO "Bad page free for domain %u\n", d->domain_id);
+        gdprintk(XENLOG_INFO, "Bad page free for domain %u\n", d->domain_id);
         return 0;
     }
 
@@ -178,7 +178,7 @@ guest_remove_page(
     if ( unlikely(!page_is_removable(page)) )
     {
         /* We'll make this a guest-visible error in future, so take heed! */
-        DPRINTK(XENLOG_G_INFO "Dom%d freeing in-use page %lx (pseudophys %lx):"
+        gdprintk(XENLOG_INFO, "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 d60b709724f4 -r 36679b74e24a xen/common/multicall.c
--- a/xen/common/multicall.c    Fri Oct 27 19:15:48 2006 +0100
+++ b/xen/common/multicall.c    Fri Oct 27 23:47:30 2006 +0100
@@ -24,7 +24,7 @@ do_multicall(
 
     if ( unlikely(__test_and_set_bit(_MCSF_in_multicall, &mcs->flags)) )
     {
-        DPRINTK(XENLOG_G_INFO "Multicall reentry is disallowed.\n");
+        gdprintk(XENLOG_INFO, "Multicall reentry is disallowed.\n");
         return -EINVAL;
     }
 
diff -r d60b709724f4 -r 36679b74e24a xen/common/page_alloc.c
--- a/xen/common/page_alloc.c   Fri Oct 27 19:15:48 2006 +0100
+++ b/xen/common/page_alloc.c   Fri Oct 27 23:47:30 2006 +0100
@@ -599,7 +599,7 @@ int assign_pages(
 
     if ( unlikely(test_bit(_DOMF_dying, &d->domain_flags)) )
     {
-        DPRINTK(XENLOG_G_INFO "Cannot assign page to domain%d -- dying.\n",
+        gdprintk(XENLOG_INFO, "Cannot assign page to domain%d -- dying.\n",
                 d->domain_id);
         goto fail;
     }
@@ -608,7 +608,7 @@ int assign_pages(
     {
         if ( unlikely((d->tot_pages + (1 << order)) > d->max_pages) )
         {
-            DPRINTK(XENLOG_G_INFO "Over-allocation for domain %u: %u > %u\n",
+            gdprintk(XENLOG_INFO, "Over-allocation for domain %u: %u > %u\n",
                     d->domain_id, d->tot_pages + (1 << order), d->max_pages);
             goto fail;
         }
diff -r d60b709724f4 -r 36679b74e24a xen/common/schedule.c
--- a/xen/common/schedule.c     Fri Oct 27 19:15:48 2006 +0100
+++ b/xen/common/schedule.c     Fri Oct 27 23:47:30 2006 +0100
@@ -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(XENLOG_G_INFO "Warning: huge timeout set by domain %d (vcpu 
%d):"
+        gdprintk(XENLOG_INFO, "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 d60b709724f4 -r 36679b74e24a xen/common/trace.c
--- a/xen/common/trace.c        Fri Oct 27 19:15:48 2006 +0100
+++ b/xen/common/trace.c        Fri Oct 27 23:47:30 2006 +0100
@@ -131,7 +131,7 @@ static int tb_set_size(int size)
      */
     if ( (opt_tbuf_size != 0) || (size <= 0) )
     {
-        DPRINTK(XENLOG_G_INFO "tb_set_size from %d to %d not implemented\n",
+        gdprintk(XENLOG_INFO, "tb_set_size from %d to %d not implemented\n",
                 opt_tbuf_size, size);
         return -EINVAL;
     }
diff -r d60b709724f4 -r 36679b74e24a xen/drivers/char/console.c
--- a/xen/drivers/char/console.c        Fri Oct 27 19:15:48 2006 +0100
+++ b/xen/drivers/char/console.c        Fri Oct 27 23:47:30 2006 +0100
@@ -57,6 +57,30 @@ static int sercon_handle = -1;
 static int sercon_handle = -1;
 
 static DEFINE_SPINLOCK(console_lock);
+
+/*
+ * To control the amount of printing, thresholds are added.
+ * These thresholds correspond to the XENLOG logging levels.
+ * There's an upper and lower threshold for non-guest messages and for
+ * guest-provoked messages.  This works as follows, for a given log level L:
+ *
+ * L < lower_threshold                     : always logged
+ * lower_threshold <= L < upper_threshold  : rate-limited logging
+ * upper_threshold <= L                    : never logged
+ *
+ * Note, in the above algorithm, to disable rate limiting simply make
+ * the lower threshold equal to the upper.
+ */
+#define XENLOG_UPPER_THRESHOLD       2 /* Do not print INFO and DEBUG  */
+#define XENLOG_LOWER_THRESHOLD       2 /* Always print ERR and WARNING */
+#define XENLOG_GUEST_UPPER_THRESHOLD 2 /* Do not print INFO and DEBUG  */
+#define XENLOG_GUEST_LOWER_THRESHOLD 0 /* Rate-limit ERR and WARNING   */
+/*
+ * The XENLOG_DEFAULT is the default given to printks that
+ * do not have any print level associated with them.
+ */
+#define XENLOG_DEFAULT       1 /* XENLOG_WARNING */
+#define XENLOG_GUEST_DEFAULT 1 /* XENLOG_WARNING */
 
 int xenlog_upper_thresh = XENLOG_UPPER_THRESHOLD;
 int xenlog_lower_thresh = XENLOG_LOWER_THRESHOLD;
@@ -346,7 +370,7 @@ void printk(const char *fmt, ...)
 
     if ( !print_regardless )
     {
-        if ( level > upper_thresh )
+        if ( level >= upper_thresh )
             goto out;
         if ( (level >= lower_thresh) && (!printk_ratelimit()) )
             goto out;
diff -r d60b709724f4 -r 36679b74e24a xen/include/asm-ia64/mm.h
--- a/xen/include/asm-ia64/mm.h Fri Oct 27 19:15:48 2006 +0100
+++ b/xen/include/asm-ia64/mm.h Fri Oct 27 23:47:30 2006 +0100
@@ -175,7 +175,7 @@ static inline int get_page(struct page_i
            unlikely((nx & PGC_count_mask) == 0) ||     /* Count overflow? */
            unlikely((x >> 32) != _domain)) {           /* Wrong owner? */
 
-           DPRINTK(XENLOG_G_INFO "Error pfn %lx: rd=%p, od=%p, caf=%016lx, 
taf=%"
+           gdprintk(XENLOG_INFO, "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 d60b709724f4 -r 36679b74e24a xen/include/asm-x86/mm.h
--- a/xen/include/asm-x86/mm.h  Fri Oct 27 19:15:48 2006 +0100
+++ b/xen/include/asm-x86/mm.h  Fri Oct 27 23:47:30 2006 +0100
@@ -213,7 +213,7 @@ static inline int get_page(struct page_i
              unlikely(d != _domain) )                /* Wrong owner? */
         {
             if ( !_shadow_mode_refcounts(domain) )
-                DPRINTK(XENLOG_G_INFO
+                gdprintk(XENLOG_INFO,
                         "Error pfn %lx: rd=%p, od=%p, caf=%08x, taf=%"
                         PRtype_info "\n",
                         page_to_mfn(page), domain, unpickle_domptr(d),
diff -r d60b709724f4 -r 36679b74e24a xen/include/xen/config.h
--- a/xen/include/xen/config.h  Fri Oct 27 19:15:48 2006 +0100
+++ b/xen/include/xen/config.h  Fri Oct 27 23:47:30 2006 +0100
@@ -29,7 +29,7 @@
  * it to allow for DoS by causing the HV to print out a lot of
  * info, so where ever the guest has control of what is printed
  * we use the XENLOG_GUEST to distinguish that the output is
- * controled by the Guest.
+ * controlled by the guest.
  *
  * To make it easier on the typing, the above log levels all
  * have a corresponding _G_ equivalent that appends the
@@ -51,65 +51,8 @@
 #define XENLOG_MAX 3
 
 /*
- * To control the amount of printing, thresholds are added.
- * These thresholds correspond to the above log levels.
- * There's an upper and lower threshold for non-guests
- * and Guest.  This works as follows:
- *
- * If printk log level > upper threshold
- *   don't print anything
- *
- * If printk log level >= lower threshold
- *   rate limit the print (keep the amount down)
- *
- * Otherwise, just print.
- *
- * Note, in the above algorithm, to never rate limit
- * simply make the lower threshold greater than the upper.
- * This way the output will never be rate limited.
- *
- * For example:
- *   lower = 2; upper = 1;
- *  This will always print ERR and WARNING messages
- *  but will not print anything else.  Nothing is
- *  rate limited.
- */
-/*
- * Defaults:
- *   For the HV, always print ERR and WARNING
- *   but nothing for INFO and DEBUG.
- *
- *   For Guests, always rate limit ERR and WARNING
- *   but never print for INFO and DEBUG.
- */
-#ifndef XENLOG_UPPER_THRESHOLD
-#define XENLOG_UPPER_THRESHOLD 1
-#endif
-#ifndef XENLOG_LOWER_THRESHOLD
-#define XENLOG_LOWER_THRESHOLD 2
-#endif
-#ifndef XENLOG_GUEST_UPPER_THRESHOLD
-#define XENLOG_GUEST_UPPER_THRESHOLD 1
-#endif
-#ifndef XENLOG_GUEST_LOWER_THRESHOLD
-#define XENLOG_GUEST_LOWER_THRESHOLD 0
-#endif
-
-/*
- * The XENLOG_DEFAULT is the default given to printks that
- * do not have any print level associated to it.
- */
-#ifndef XENLOG_DEFAULT
-#define XENLOG_DEFAULT 1 /* Warning */
-#endif
-#ifndef XENLOG_GUEST_DEFAULT
-#define XENLOG_GUEST_DEFAULT 1 /* Warning */
-#endif
-
-/*
  * Some code is copied directly from Linux.
  * Match some of the Linux log levels to Xen.
- *  (Should these be Guest logs?? - SDR)
  */
 #define KERN_ERR       XENLOG_ERR
 #define KERN_CRIT      XENLOG_ERR
@@ -123,12 +66,18 @@
 #define __iomem
 #define __user
 
-#define DPRINTK(_f, _a...) printk("(file=%s, line=%d) " _f, \
-                           __FILE__ , __LINE__ , ## _a )
+#ifndef __ASSEMBLY__
 
-#ifndef __ASSEMBLY__
+int current_domain_id(void);
+#define dprintk(_l, _f, _a...)                              \
+    printk(_l "%s:%d: " _f, __FILE__ , __LINE__ , ## _a )
+#define gdprintk(_l, _f, _a...)                             \
+    printk(XENLOG_GUEST _l "%s:%d:d%d " _f, __FILE__,       \
+           __LINE__, current_domain_id() , ## _a )
+
 #include <xen/compiler.h>
-#endif
+
+#endif /* !__ASSEMBLY__ */
 
 #define __STR(...) #__VA_ARGS__
 #define STR(...) __STR(__VA_ARGS__)

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.