Index: sys/dev/xen/debug/debug.c =================================================================== --- sys/dev/xen/debug/debug.c +++ sys/dev/xen/debug/debug.c @@ -81,7 +81,8 @@ mtx_lock_spin(&lock); sbuf_clear(buf); - xc_printf("Printing stack trace vCPU%d\n", PCPU_GET(vcpu_id)); + xc_printf("Printing stack trace vCPU%d\n", + cpu_to_vcpu_id(PCPU_GET(cpuid))); stack_sbuf_print_ddb(buf, &st); sbuf_finish(buf); mtx_unlock_spin(&lock); Index: sys/x86/include/xen/xen-os.h =================================================================== --- sys/x86/include/xen/xen-os.h +++ sys/x86/include/xen/xen-os.h @@ -36,12 +36,21 @@ /* Everything below this point is not included by assembler (.S) files. */ #ifndef __ASSEMBLY__ +#include + /* If non-zero, the hypervisor has been configured to use a direct vector */ extern int xen_vector_callback_enabled; /* tunable for disabling PV disks */ extern int xen_disable_pv_disks; +static inline u_int +cpu_to_vcpu_id(u_int cpuid) +{ + + return (pcpu_find(cpuid)->pc_vcpu_id); +} + static inline bool xen_support_evtchn_rebind(void) {