x86/HVM: also dump stacks from show_execution_state()

Wire up show_hvm_stack() also on this path. Move the show_guest_stack()
invocation out of show_stack(), rendering dead the is-HVM check there.

While separating guest and host paths, also move the show_code()
invocation - the function bails immediately when guest_mode() returns
"true".

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
This commit is contained in:
Jan Beulich committed 2021-12-03 11:15:57 +01:00
1 parent c037dfb909
commit adb715db69
2 files changed
+25 -11

No files matched your search

+25 -10
View File
@@ -306,10 +306,6 @@ static void show_guest_stack(struct vcpu *v, const struct cpu_user_regs *regs)
unsigned long mask = STACK_SIZE;
void *stack_page = NULL;
/* Avoid HVM as we don't know what the stack looks like. */
if ( is_hvm_vcpu(v) )
return;
if ( is_pv_32bit_vcpu(v) )
{
compat_show_guest_stack(v, regs, debug_stack_lines);
@@ -618,14 +614,11 @@ static void show_trace(const struct cpu_user_regs *regs)
printk("\n");
}
void show_stack(const struct cpu_user_regs *regs)
static void show_stack(const struct cpu_user_regs *regs)
{
unsigned long *stack = ESP_BEFORE_EXCEPTION(regs), *stack_bottom, addr;
int i;
if ( guest_mode(regs) )
return show_guest_stack(current, regs);
printk("Xen stack trace from "__OP"sp=%p:\n ", stack);
stack_bottom = _p(get_stack_dump_bottom(regs->rsp));
@@ -694,8 +687,30 @@ void show_execution_state(const struct cpu_user_regs *regs)
unsigned long flags = console_lock_recursive_irqsave();
show_registers(regs);
show_code(regs);
show_stack(regs);
if ( guest_mode(regs) )
{
struct vcpu *curr = current;
if ( is_hvm_vcpu(curr) )
{
/*
* Stop interleaving prevention: The necessary P2M lookups
* involve locking, which has to occur with IRQs enabled.
*/
console_unlock_recursive_irqrestore(flags);
show_hvm_stack(curr, regs);
return;
}
show_guest_stack(curr, regs);
}
else
{
show_code(regs);
show_stack(regs);
}
console_unlock_recursive_irqrestore(flags);
}
-1
View File
@@ -493,7 +493,6 @@ static always_inline void rep_nop(void)
#define cpu_relax() rep_nop()
void show_code(const struct cpu_user_regs *regs);
void show_stack(const struct cpu_user_regs *regs);
void show_stack_overflow(unsigned int cpu, const struct cpu_user_regs *regs);
void show_registers(const struct cpu_user_regs *regs);
void show_execution_state(const struct cpu_user_regs *regs);
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.