... in a simplified and consistent way.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
In the case that an appropriate symbol name can't be found, %p[sS] will
fall back to '%p' and print the address in hex.
+
+ %pv Domain and vCPU ID from a 'struct vcpu *' (printed as
+ "d<domid>v<vcpuid>")
if ( ctxt->caps & ~guest_mcg_cap & ~MCG_CAP_COUNT & ~MCG_CTL_P )
{
dprintk(XENLOG_G_ERR, "%s restore: unsupported MCA capabilities"
- " %#" PRIx64 " for d%d:v%u (supported: %#Lx)\n",
+ " %#" PRIx64 " for %pv (supported: %#Lx)\n",
has_hvm_container_vcpu(v) ? "HVM" : "PV", ctxt->caps,
- v->domain->domain_id, v->vcpu_id,
- guest_mcg_cap & ~MCG_CAP_COUNT);
+ v, guest_mcg_cap & ~MCG_CAP_COUNT);
return -EPERM;
}
guest_has_trap_callback(d, v->vcpu_id, TRAP_machine_check)) &&
!test_and_set_bool(v->mce_pending) )
{
- mce_printk(MCE_VERBOSE, "MCE: inject vMCE to d%d:v%d\n",
- d->domain_id, v->vcpu_id);
+ mce_printk(MCE_VERBOSE, "MCE: inject vMCE to %pv\n", v);
vcpu_kick(v);
ret = 0;
}
else
{
- mce_printk(MCE_QUIET, "Failed to inject vMCE to d%d:v%d\n",
- d->domain_id, v->vcpu_id);
+ mce_printk(MCE_QUIET, "Failed to inject vMCE to %pv\n", v);
ret = -EBUSY;
break;
}
if ( !warned )
{
warned = 1;
- printk(XENLOG_WARNING "Segment register inaccessible for d%dv%d\n"
+ printk(XENLOG_WARNING "Segment register inaccessible for %pv\n"
"(If you see this outside of debugging activity,"
" please report to xen-devel@lists.xenproject.org)\n",
- v->domain->domain_id, v->vcpu_id);
+ v);
}
memset(reg, 0, sizeof(*reg));
return;
if ( !cpu_has(c, X86_FEATURE_DTES64) )
{
printk(XENLOG_G_WARNING "CPU doesn't support 64-bit DS Area"
- " - Debug Store disabled for d%d:v%d\n",
- v->domain->domain_id, v->vcpu_id);
+ " - Debug Store disabled for %pv\n",
+ v);
goto func_out;
}
vpmu_set(vpmu, VPMU_CPU_HAS_DS);
/* If BTS_UNAVAIL is set reset the DS feature. */
vpmu_reset(vpmu, VPMU_CPU_HAS_DS);
printk(XENLOG_G_WARNING "CPU has set BTS_UNAVAIL"
- " - Debug Store disabled for d%d:v%d\n",
- v->domain->domain_id, v->vcpu_id);
+ " - Debug Store disabled for %pv\n",
+ v);
}
else
{
mfn_t *oos;
struct domain *d = v->domain;
- SHADOW_PRINTK("D%dV%d gmfn %lx\n",
- v->domain->domain_id, v->vcpu_id, mfn_x(gmfn));
+ SHADOW_PRINTK("%pv gmfn %lx\n", v, mfn_x(gmfn));
for_each_vcpu(d, v)
{
static void reserved_bit_page_fault(
unsigned long addr, struct cpu_user_regs *regs)
{
- printk("d%d:v%d: reserved bit in page table (ec=%04X)\n",
- current->domain->domain_id, current->vcpu_id, regs->error_code);
+ printk("%pv: reserved bit in page table (ec=%04X)\n",
+ current, regs->error_code);
show_page_walk(addr);
show_execution_state(regs);
}
tb->flags |= TBF_INTERRUPT;
if ( unlikely(null_trap_bounce(v, tb)) )
{
- printk("d%d:v%d: unhandled page fault (ec=%04X)\n",
- v->domain->domain_id, v->vcpu_id, error_code);
+ printk("%pv: unhandled page fault (ec=%04X)\n", v, error_code);
show_page_walk(addr);
}
vcpu_info_t dummy_vcpu_info;
-int current_domain_id(void)
-{
- return current->domain->domain_id;
-}
-
static void __domain_finalise_shutdown(struct domain *d)
{
struct vcpu *v;
if ( !is_idle_vcpu(current) )
{
- printk("*** Dumping CPU%u guest state (d%d:v%d): ***\n",
- smp_processor_id(), current->domain->domain_id,
- current->vcpu_id);
+ printk("*** Dumping CPU%u guest state (%pv): ***\n",
+ smp_processor_id(), current);
show_execution_state(guest_cpu_user_regs());
printk("\n");
}
struct list_head *iter;
int pos = 0;
- d2printk("rqi d%dv%d\n",
- svc->vcpu->domain->domain_id,
- svc->vcpu->vcpu_id);
+ d2printk("rqi %pv\n", svc->vcpu);
BUG_ON(&svc->rqd->runq != runq);
/* Idle vcpus not allowed on the runqueue anymore */
if ( svc->credit > iter_svc->credit )
{
- d2printk(" p%d d%dv%d\n",
- pos,
- iter_svc->vcpu->domain->domain_id,
- iter_svc->vcpu->vcpu_id);
+ d2printk(" p%d %pv\n", pos, iter_svc->vcpu);
break;
}
pos++;
cpumask_t mask;
struct csched_vcpu * cur;
- d2printk("rqt d%dv%d cd%dv%d\n",
- new->vcpu->domain->domain_id,
- new->vcpu->vcpu_id,
- current->domain->domain_id,
- current->vcpu_id);
+ d2printk("rqt %pv curr %pv\n", new->vcpu, current);
BUG_ON(new->vcpu->processor != cpu);
BUG_ON(new->rqd != rqd);
t2c_update(rqd, delta, svc);
svc->start_time = now;
- d2printk("b d%dv%d c%d\n",
- svc->vcpu->domain->domain_id,
- svc->vcpu->vcpu_id,
- svc->credit);
+ d2printk("b %pv c%d\n", svc->vcpu, svc->credit);
} else {
d2printk("%s: Time went backwards? now %"PRI_stime" start %"PRI_stime"\n",
__func__, now, svc->start_time);
csched_vcpu_insert(const struct scheduler *ops, struct vcpu *vc)
{
struct csched_vcpu *svc = vc->sched_priv;
- struct domain * const dom = vc->domain;
struct csched_dom * const sdom = svc->sdom;
- printk("%s: Inserting d%dv%d\n",
- __func__, dom->domain_id, vc->vcpu_id);
+ printk("%s: Inserting %pv\n", __func__, vc);
/* NB: On boot, idle vcpus are inserted before alloc_pdata() has
* been called for that cpu.
/* Schedule lock should be held at this point. */
- d2printk("w d%dv%d\n", vc->domain->domain_id, vc->vcpu_id);
+ d2printk("w %pv\n", vc);
BUG_ON( is_idle_vcpu(vc) );
{
if ( test_and_clear_bit(__CSFLAG_runq_migrate_request, &svc->flags) )
{
- d2printk("d%dv%d -\n", svc->vcpu->domain->domain_id, svc->vcpu->vcpu_id);
+ d2printk("%pv -\n", svc->vcpu);
clear_bit(__CSFLAG_runq_migrate_request, &svc->flags);
}
/* Leave it where it is for now. When we actually pay attention
}
else
{
- d2printk("d%dv%d +\n", svc->vcpu->domain->domain_id, svc->vcpu->vcpu_id);
+ d2printk("%pv +\n", svc->vcpu);
new_cpu = cpumask_cycle(vc->processor, &svc->migrate_rqd->active);
goto out_up;
}
{
if ( test_bit(__CSFLAG_scheduled, &svc->flags) )
{
- d2printk("d%dv%d %d-%d a\n", svc->vcpu->domain->domain_id, svc->vcpu->vcpu_id,
- svc->rqd->id, trqd->id);
+ d2printk("%pv %d-%d a\n", svc->vcpu, svc->rqd->id, trqd->id);
/* It's running; mark it to migrate. */
svc->migrate_rqd = trqd;
set_bit(_VPF_migrating, &svc->vcpu->pause_flags);
{
int on_runq=0;
/* It's not running; just move it */
- d2printk("d%dv%d %d-%d i\n", svc->vcpu->domain->domain_id, svc->vcpu->vcpu_id,
- svc->rqd->id, trqd->id);
+ d2printk("%pv %d-%d i\n", svc->vcpu, svc->rqd->id, trqd->id);
if ( __vcpu_on_runq(svc) )
{
__runq_remove(svc);
SCHED_STAT_CRANK(schedule);
CSCHED_VCPU_CHECK(current);
- d2printk("sc p%d c d%dv%d now %"PRI_stime"\n",
- cpu,
- scurr->vcpu->domain->domain_id,
- scurr->vcpu->vcpu_id,
- now);
+ d2printk("sc p%d c %pv now %"PRI_stime"\n", cpu, scurr->vcpu, now);
BUG_ON(!cpumask_test_cpu(cpu, &CSCHED_PRIV(ops)->initialized));
}
}
}
- printk("%s: pcpu %d rq %d, but scurr d%dv%d assigned to "
+ printk("%s: pcpu %d rq %d, but scurr %pv assigned to "
"pcpu %d rq %d!\n",
__func__,
cpu, this_rqi,
- scurr->vcpu->domain->domain_id, scurr->vcpu->vcpu_id,
- scurr->vcpu->processor, other_rqi);
+ scurr->vcpu, scurr->vcpu->processor, other_rqi);
}
BUG_ON(!is_idle_vcpu(scurr->vcpu) && scurr->rqd != rqd);
__runq_remove(snext);
if ( snext->vcpu->is_running )
{
- printk("p%d: snext d%dv%d running on p%d! scurr d%dv%d\n",
- cpu,
- snext->vcpu->domain->domain_id, snext->vcpu->vcpu_id,
- snext->vcpu->processor,
- scurr->vcpu->domain->domain_id,
- scurr->vcpu->vcpu_id);
+ printk("p%d: snext %pv running on p%d! scurr %pv\n",
+ cpu, snext->vcpu, snext->vcpu->processor, scurr->vcpu);
BUG();
}
set_bit(__CSFLAG_scheduled, &snext->flags);
if ( v->affinity_broken )
{
- printk(XENLOG_DEBUG "Restoring affinity for d%dv%d\n",
- d->domain_id, v->vcpu_id);
+ printk(XENLOG_DEBUG "Restoring affinity for %pv\n", v);
cpumask_copy(v->cpu_affinity, v->cpu_affinity_saved);
v->affinity_broken = 0;
}
if ( cpumask_empty(&online_affinity) &&
cpumask_test_cpu(cpu, v->cpu_affinity) )
{
- printk(XENLOG_DEBUG "Breaking affinity for d%dv%d\n",
- d->domain_id, v->vcpu_id);
+ printk(XENLOG_DEBUG "Breaking affinity for %pv\n", v);
if (system_state == SYS_STATE_suspend)
{
#include <xen/ctype.h>
#include <xen/symbols.h>
#include <xen/lib.h>
+#include <xen/sched.h>
#include <asm/div64.h>
#include <asm/page.h>
return str;
}
+
+ case 'v': /* d<domain-id>v<vcpu-id> from a struct vcpu */
+ {
+ const struct vcpu *v = arg;
+
+ ++*fmt_ptr;
+ if ( str <= end )
+ *str = 'd';
+ str = number(str + 1, end, v->domain->domain_id, 10, -1, -1, 0);
+ if ( str <= end )
+ *str = 'v';
+ return number(str + 1, end, v->vcpu_id, 10, -1, -1, 0);
+ }
}
if ( field_width == -1 )
#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 )
+ printk(XENLOG_GUEST _l "%s:%d:%pv " _f, __FILE__, \
+ __LINE__, current, ## _a )
#endif /* !__ASSEMBLY__ */