Changeset View
Standalone View
sys/dev/xen/debug/debug.c
Show First 20 Lines • Show All 72 Lines • ▼ Show 20 Lines | |||||
{ | { | ||||
#if defined(STACK) && defined(DDB) | #if defined(STACK) && defined(DDB) | ||||
struct stack st; | struct stack st; | ||||
stack_save(&st); | stack_save(&st); | ||||
mtx_lock_spin(&lock); | mtx_lock_spin(&lock); | ||||
sbuf_clear(buf); | sbuf_clear(buf); | ||||
xc_printf("Printing stack trace vCPU%d\n", PCPU_GET(vcpu_id)); | xc_printf("Printing stack trace vCPU%u\n", XEN_VCPUID()); | ||||
stack_sbuf_print_ddb(buf, &st); | stack_sbuf_print_ddb(buf, &st); | ||||
royger: I think I'm confused, why do you need to fetch the cpuid to get the vcpu id? The previous code… | |||||
Not Done Inline ActionsThis is where the implementation for the Arm counterpart could help to understand the approach :). I don't know why on x86 you need a specific field vcpu_id. On Arm the vCPU ID will be equivalent to the physical CPU ID. The field pc_vcpu_id doesn't seem to exist on Arm today and it looks like on x86 it is only used by Xen code. So to me it sounds a bit wasteful to introduce the field on Arm. julien_xen.org: This is where the implementation for the Arm counterpart could help to understand the approach… | |||||
Not Done Inline Actions
On x86 the vCPU ID should be fetched from the Xen cpuid leaves. While currently there's a relation between the ACPI CPU ID and the vCPU ID, it's not written down anywhere, and a proper implementation should fetch the vCPU ID from cpuid and expect it to be a random value.
Fine. TBH I don't think adding an unsigned int to each CPU data area is going to make that much of a difference (it would be conditional to enabling XENHVM). I don't seem to be able to find how the vCPU ID is fetched on Arm from the public headers, but as long as it's clear that's fine. I'm however slightly worried that we will now have a mix of cpu_to_vcpu_id and PCPU_GET(vcpu_id), which makes the code confusing IMO, that's another reason why I would prefer Arm to just add a vcpu_id field. royger: > This is where the implementation for the Arm counterpart could help to understand the… | |||||
sbuf_finish(buf); | sbuf_finish(buf); | ||||
mtx_unlock_spin(&lock); | mtx_unlock_spin(&lock); | ||||
#endif | #endif | ||||
return (FILTER_HANDLED); | return (FILTER_HANDLED); | ||||
} | } | ||||
static void | static void | ||||
▲ Show 20 Lines • Show All 64 Lines • Show Last 20 Lines |
I think I'm confused, why do you need to fetch the cpuid to get the vcpu id? The previous code already gives you the vcpu id directly using PCPU_GET(vcpu_id).