[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v4 4/6] x86/HVM: also dump stacks from show_execution_state()


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Wed, 29 Sep 2021 15:14:46 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=eW/2cF3lu6QYOHTIXUs9q6QXeBV+Luo/7Lua57wsjCU=; b=LE7xNH0JaXtIoBkxN4JgLUV3+TfN1ISvfg2NbNU5E2EfMho/eapi/8XljV0II4pY9mZuYP3AnwOJCr8UlmrGT0WnDeg2pRJ82xRbvp7VE7hDGU3jtKqvcUhZRhjMHvxWjV4bFX+6jYojxXfgDLJsMISVVRxrMOdnYL+V/S80gGc4jpcD8Aj5l07NRe4/O7tR81OOaZHPj8vcGyNVPoX/d3x+mta+yON4UomsXNVlK8ppR3OoRnZZftst74PA3Ag9laWtuPPf8UsrN26tbx8LNYh3YGmelsUSKCIrO9N3pu/d6Sr0evgRYTgx8/T8ldoe0tfjuy/rbcbpoFgxbeKiDw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hO+bq2XZYZuU4NVXmDz0OiVOj56/iXgRQE3QFAH9IUJ4BDp2oQdTVaSlvUFnryPn6XwHnxWLwY3RwSDIO/dLUzHnYqBqLvdpngf3SyL6J+nnxMokpJtupMEq3gwZD4M/YMbQ7QaTDXTUfBsKgpLfHWpkkH+Yz2q41fZyhXtEbvC8tlAs6mooBg2+uQ4rTOkilYAbqDnjzptx+5sU3tSxD20Fk0KqpML6jZn1Tq1Fxa5KeCj91XCr7POeNL54/m+c4OQS3R11hlTARF7ayz9W5ffJwTfL9Q/Wny7JYhNvt9so0yXL8gE9OV8oZnwytV7/G24zR1Th5+KHnSmD/1wQPg==
  • Authentication-results: citrix.com; dkim=none (message not signed) header.d=none;citrix.com; dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Wed, 29 Sep 2021 13:14:55 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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@xxxxxxxx>
---
v4: New.

--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -303,10 +303,6 @@ static void show_guest_stack(struct vcpu
     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);
@@ -611,14 +607,11 @@ static void show_trace(const struct cpu_
     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));
@@ -687,8 +680,30 @@ void show_execution_state(const struct c
     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);
 }
--- a/xen/include/asm-x86/processor.h
+++ b/xen/include/asm-x86/processor.h
@@ -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);




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.