[XEN] Some cleanups to the log-level stuff. Largely this
authorkaf24@localhost.localdomain <kaf24@localhost.localdomain>
Fri, 27 Oct 2006 22:47:30 +0000 (23:47 +0100)
committerkaf24@localhost.localdomain <kaf24@localhost.localdomain>
Fri, 27 Oct 2006 22:47:30 +0000 (23:47 +0100)
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@xensource.com>
42 files changed:
xen/arch/ia64/vmx/vlsapic.c
xen/arch/ia64/vmx/vmx_hypercall.c
xen/arch/ia64/vmx/vmx_init.c
xen/arch/ia64/xen/dom0_ops.c
xen/arch/ia64/xen/domain.c
xen/arch/ia64/xen/irq.c
xen/arch/ia64/xen/mm.c
xen/arch/ia64/xen/tlb_track.c
xen/arch/ia64/xen/vcpu.c
xen/arch/powerpc/mm.c
xen/arch/powerpc/shadow.c
xen/arch/x86/domain.c
xen/arch/x86/extable.c
xen/arch/x86/hvm/hvm.c
xen/arch/x86/hvm/i8259.c
xen/arch/x86/hvm/instrlen.c
xen/arch/x86/hvm/platform.c
xen/arch/x86/hvm/svm/svm.c
xen/arch/x86/hvm/vioapic.c
xen/arch/x86/hvm/vmx/vmcs.c
xen/arch/x86/hvm/vmx/vmx.c
xen/arch/x86/io_apic.c
xen/arch/x86/irq.c
xen/arch/x86/mm.c
xen/arch/x86/mm/shadow/common.c
xen/arch/x86/platform_hypercall.c
xen/arch/x86/traps.c
xen/arch/x86/x86_32/seg_fixup.c
xen/arch/x86/x86_64/traps.c
xen/arch/x86/x86_emulate.c
xen/common/domain.c
xen/common/event_channel.c
xen/common/grant_table.c
xen/common/memory.c
xen/common/multicall.c
xen/common/page_alloc.c
xen/common/schedule.c
xen/common/trace.c
xen/drivers/char/console.c
xen/include/asm-ia64/mm.h
xen/include/asm-x86/mm.h
xen/include/xen/config.h

index 14b23b46fb34644ef4deaf713e997e3581f1c4ec..0c94a161f87ede809974f6a5742c3b66caad91a3 100644 (file)
@@ -95,7 +95,7 @@ static int vmx_vcpu_unpend_interrupt(VCPU *vcpu, uint8_t vector)
     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, uint8_t vector)
     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);
index bf8f688f93363e0d8e24da104a9958cb1078b633..2252ad6401802d242bfb88f8ac771dd6610872c9 100644 (file)
@@ -79,7 +79,7 @@ do_hvm_op(unsigned long op, XEN_GUEST_HANDLE(void) arg)
     }
 
     default:
-        DPRINTK(XENLOG_G_INFO "Bad HVM op %ld.\n", op);
+        gdprintk(XENLOG_INFO, "Bad HVM op %ld.\n", op);
         rc = -ENOSYS;
     }
     return rc;
index 49e7d789db799b09ada36efcf998a090e7f2ec50..407203d4be806661c9c1c2f0b634fb643dc2dc59 100644 (file)
@@ -277,7 +277,7 @@ static void vmx_create_event_channels(struct vcpu *v)
                        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);
                }
        }
index 18baad94a99bce7878f423a8e66a84d9df43bc1b..7bf0500cb8e3637c9f9a407500490a9e7cca4b53 100644 (file)
@@ -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()
index 0a5e9bbf5d21a686cf694546d6ac9465087c0d17..cadd3793b716c7af2c3aa97b1d8fc9342dc05e26 100644 (file)
@@ -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, xen_domctl_shadow_op_t *sc)
        //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;
        }   
index 32579dcd8349a0c856eb85d054c7d21c276e4cd9..6211e9b418b107e81060e2cddb9a9eb300ed1735 100644 (file)
@@ -377,7 +377,7 @@ int pirq_guest_bind(struct vcpu *v, int irq, int will_share)
     {
         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 irq, int will_share)
         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 irq, int will_share)
     }
     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 irq, int will_share)
 
     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;
index 84ee232f7e129ed7c1fc6f563aa0e876985e80b3..40d91f22a3176b2fe37b7693133b70661f9aee59 100644 (file)
@@ -229,7 +229,7 @@ try_to_clear_PGC_allocate(struct domain* d, struct page_info* page)
         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 address, u64 itir__, u64* logps,
        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, unsigned long size)
 
         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 domain* d, unsigned long mpaddr,
     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 domain* d, unsigned long mpaddr,
             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, unsigned long mpaddr, unsigned long mfn)
                 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, unsigned long gpfn, unsigned long mfn,
             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 gpaddr,
 
     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 gpaddr,
     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 gpaddr,
     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 gpaddr,
 
     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 gpaddr,
         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_info *page, unsigned int memflags)
     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_info *page, unsigned int memflags)
 
         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_info *page, unsigned int memflags)
         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_info *page, unsigned int memflags)
             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_info *page, unsigned int memflags)
                         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, unsigned long mpaddr,
     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;
     }
index d403abd4951c02298d12e4aacf1cb777806410d4..07816a4acb0cc06692f127f6a8659de64364b6f1 100644 (file)
@@ -44,13 +44,14 @@ tlb_track_allocate_entries(struct tlb_track* tlb_track)
 
     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;
     }
index 19133d005e588e070b796850a7f5f54a70a48432..bc5784fff099013fe85a86f73e5da858136ddf88 100644 (file)
@@ -1544,8 +1544,9 @@ vcpu_get_domain_bundle(VCPU * vcpu, REGS * regs, u64 gip,
                // 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 * regs, u64 gip,
                        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;
index 44d859fe338f6beba6c8d2d8a8d21129636a67ba..f00b6f8ea97a38a0e188f13485cb5495d87f0325 100644 (file)
@@ -268,7 +268,7 @@ int allocate_rma(struct domain *d, unsigned int order)
 
     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;
     }
index e5eca17e0743d4a6b90f26b9bf33ea7c52bc6d16..3d33433c0fd8f9ef745bfc752e89a425a5a993f3 100644 (file)
@@ -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:
index efb36c67d60bd7d453dde707f976dfbd933d8ed2..c1b60a3c004796298097d7789688ab21897cb343 100644 (file)
@@ -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);
         }
index 642e7f59129915641438cffe175428822f2e4878..c578c835f4b3bf28abda9595fbc948ba97900c0f 100644 (file)
@@ -74,7 +74,7 @@ search_pre_exception_table(struct cpu_user_regs *regs)
     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);
index a3110f9940048e35d069fb6b9e224037bacea532..0c6a7b6e645a63b9142b22e42d391b6e7edefc2d 100644 (file)
@@ -194,7 +194,7 @@ void hvm_create_event_channels(struct vcpu *v)
             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_regs *pregs)
 
     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 cmd, XEN_GUEST_HANDLE(void) arg)
     }
 
     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_regs *pregs)
     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 trampoline_vector)
 
     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 trampoline_vector)
 
     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 trampoline_vector)
 
     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_GUEST_HANDLE(void) arg)
 
     default:
     {
-        DPRINTK(XENLOG_G_INFO "Bad HVM op %ld.\n", op);
+        gdprintk(XENLOG_INFO, "Bad HVM op %ld.\n", op);
         rc = -ENOSYS;
         break;
     }
index 64689e4a8d2c83ffb406cfbdce916d3b12a604ad..7cf96f4b57620209d8e0415d06cf587f416b5ed4 100644 (file)
@@ -140,10 +140,8 @@ void pic_set_xen_irq(void *opaque, int irq, int level)
 
     /* 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 {
index f7b3bb8b06e4f93336d1ffc82c8fdeb2cbe54559..a1c6c64af1fe787b0796769435d831dae7297567 100644 (file)
@@ -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;
index 7f2c32641d1d1ec1324ebe3f7d071bdf1ccfe50a..21b757be46cd421c55789a8b21b29f107e7c5679 100644 (file)
@@ -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 ) {
index 7c06473ea12e7c0e08377fb2acbb5fdc9d68165c..6054df0a489c1c2796b98cd29a1d65fc0009f27e 100644 (file)
@@ -805,7 +805,7 @@ static void svm_final_setup_guest(struct vcpu *v)
 
     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);
     }
index cb71c59ee286a62c674955b1022937494f2dc5fc..d7b2321e626bbfc141b5fb4142093ce81ba4a0e7 100644 (file)
@@ -556,10 +556,8 @@ void hvm_vioapic_set_xen_irq(struct domain *d, int irq, int level)
        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;
index c5e54bb3aa7f8aebb2b2e69098d3f0ea28b90380..86bf19ad8c7e38f80c88b741f03d1171011fd943 100644 (file)
@@ -145,7 +145,7 @@ static struct vmcs_struct *vmx_alloc_vmcs(void)
 
     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;
     }
 
index 9d95f120e325a135c439a0488f37dc56e433bb61..1a9eb7333b11145d57e658fad93c72d422b2aa74 100644 (file)
@@ -71,7 +71,7 @@ static int vmx_initialize_guest_resources(struct vcpu *v)
 
     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_resources(struct vcpu *v)
 
         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_resources(struct vcpu *v)
 
         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_resources(struct vcpu *v)
 
         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_regs *regs)
         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_regs *regs)
         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);
     }
index d329c68151f650c2b15d1280bf5cfdd393f5b4e3..d56351e7aa3ce944e05b107bab608eeaa02442d0 100644 (file)
@@ -1980,7 +1980,7 @@ int ioapic_guest_read(unsigned long physbase, unsigned int reg, u32 *pval)
 }
 
 #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,        \
index 65f9e2c5e853758528aa61407ad7a12986d5dc85..1821a56e24252a619220dda2f55cbf19d9cbfa34 100644 (file)
@@ -432,7 +432,7 @@ int pirq_guest_bind(struct vcpu *v, int irq, int will_share)
     {
         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 irq, int will_share)
         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 irq, int will_share)
     }
     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 irq, int will_share)
 
     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;
index f96a73339c674993201b92b0432969bda9893261..3e3b17663b65f9c6e8979b7c4dd64edaf781a158 100644 (file)
 #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, 
index d99877b49c185be57970c1a2eb1342a042d57198..d9b45eb7a49d1a91b04c14e438d07b183ccd6c93 100644 (file)
@@ -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;
     }
 
index 141829ee7f9e3e77568a77593b37bf52a412dacc..7d2ee6f49620e5e16d906c7f224d7db7e217e0d5 100644 (file)
@@ -125,7 +125,7 @@ long do_platform_op(XEN_GUEST_HANDLE(xen_platform_op_t) u_xenpf_op)
         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));
index ff6b05236861fc95f3ede0b65367397264abf31e..b8efa919e105fbba890f495586b727b356b5e61a 100644 (file)
@@ -407,7 +407,7 @@ static inline int do_trap(int trapnr, char *str,
 
     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));
+    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, " 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 cpu_user_regs *regs)
         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 cpu_user_regs *regs)
         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 cpu_user_regs *regs)
 
             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 cpu_user_regs *regs)
                 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(struct cpu_user_regs *regs)
 
     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;
index 597264025d4a02d5b42c5088a88452cd241b4206..9a1db40b87b55231b61884729371f61921c2f0e9 100644 (file)
@@ -181,7 +181,7 @@ int fixup_seg(u16 seg, unsigned long offset)
         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 offset)
         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 offset)
     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 offset)
                _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 offset)
         }
     }
 
-    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 *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 *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 *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 *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 *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 *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 *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 *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 *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 *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 *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 *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 *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],
index ab1e20599b0bcd1a1594d57256a85bc633932855..0f1a822eb7a0f9503256e73c6f524ebedd5c3961 100644 (file)
@@ -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();
         }
index 4ce246b275363515278963d2e48242825f7f9112..f189ac75f31a066ff5fb3a7105bf71ac7a8d4d9c 100644 (file)
 #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;
 }
 
index f96becc578e696f65ad000d7a824d6af3c252c78..2d25a7053b38345ba0e059dfb02a82f145d27344 100644 (file)
@@ -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 domid)
     return d;
 }
 
-
 void free_domain(struct domain *d)
 {
     struct vcpu *v;
@@ -69,7 +73,6 @@ void free_domain(struct domain *d)
     xfree(d);
 }
 
-
 struct vcpu *alloc_vcpu(
     struct domain *d, unsigned int vcpu_id, unsigned int cpu_id)
 {
index d929fbcf419950ca43687aa03f4e3fbde028ff04..b0d23eb8e0b0c658dfbd9965b8c958467399cb8c 100644 (file)
@@ -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);                                              \
index c31bf5f4b96e435ed659aebcdbb04d5a9d0d828d..ff7a54d80f6bdc64fe174d2af36cea323100ca68 100644 (file)
@@ -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);
 
index 6f80cd2ff86d9ef02a1c9e66dc74eba356456b3c..a0e65e08e17de09032737cd6444bbeed75cbc5b8 100644 (file)
@@ -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);
index 0b54889cf6ea035a1ec51eb4fff9e63b8034659b..499e6bd62cbf5d093339e6bd6c5b0c280351fc98 100644 (file)
@@ -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;
     }
 
index 8db7ea9b6878066af10f577fa437dff7a83f26f1..bfb055f5e0cc211cdd71c672db6d43591d766c6a 100644 (file)
@@ -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;
         }
index aa36ac849de2d71d5b17af32817b4e0e948897b4..e85f0846e7052051c5e3f03311bb65a00e4d4a31 100644 (file)
@@ -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));
index 3c367dd54eb3231f73b31af3305e9367f4bf04d0..a5cec8e69a2b440973337b36ce1f54079ddc2266 100644 (file)
@@ -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;
     }
index f391da7a80ae6c183aa4e86d47c4aced6d1c95a8..19651de00d9c58bcacd334d740b44e013eba244e 100644 (file)
@@ -58,6 +58,30 @@ 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;
 int xenlog_guest_upper_thresh = XENLOG_GUEST_UPPER_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;
index 48f6934566d639510f6c392f30aa1ca533b69d2c..4a7fa504929272aa75543d14f86236e5779af16a 100644 (file)
@@ -175,7 +175,7 @@ static inline int get_page(struct page_info *page,
            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;
index 8931a3d5ef9dc78dcc8ce69ccf8ef9ebf809386e..328d635b489d655cbfd6026b9e111194cbf789ea 100644 (file)
@@ -213,7 +213,7 @@ static inline int get_page(struct page_info *page,
              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),
index 97c9d824f698b9f394bc553ced0bf5d9ebacab0f..0cb6dadf5c7fb4757bcda8232e699c090b94320a 100644 (file)
@@ -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
 
 #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
 #define __iomem
 #define __user
 
-#define DPRINTK(_f, _a...) printk("(file=%s, line=%d) " _f, \
-                           __FILE__ , __LINE__ , ## _a )
-
 #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__)