kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Prarit Bhargava <prarit@redhat.com>
To: Prarit Bhargava <prarit@redhat.com>
Cc: linux-kernel@vger.kernel.org, Avi Kivity <avi@redhat.com>,
	Gleb Natapov <gleb@redhat.com>,
	Alex Williamson <alex.williamson@redhat.com>,
	Marcelo Tostatti <mtosatti@redhat.com>,
	Ingo Molnar <mingo@redhat.com>,
	kvm@vger.kernel.org, x86@kernel.org
Subject: Re: [PATCH] x86, add hypervisor name to dump_stack() [v3]
Date: Tue, 30 Oct 2012 15:16:56 -0400	[thread overview]
Message-ID: <509027A8.3010509@redhat.com> (raw)
In-Reply-To: <1351624497-26389-1-git-send-email-prarit@redhat.com>



On 10/30/2012 03:14 PM, Prarit Bhargava wrote:
> Debugging crash, panics, stack trace WARN_ONs, etc., from both virtual and
> bare-metal boots can get difficult very quickly.  While there are ways to
> decipher the output and determine if the output is from a virtual guest,
> the in-kernel hypervisors now have a single registration point
> and set x86_hyper.  We can use this to output additional debug
> information during a panic/oops/stack trace.
> 
> Signed-off-by: Prarit Bhargava <prarit@redhat.com>
> Cc: Avi Kivity <avi@redhat.com>
> Cc: Gleb Natapov <gleb@redhat.com>
> Cc: Alex Williamson <alex.williamson@redhat.com>
> Cc: Marcelo Tostatti <mtosatti@redhat.com>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: kvm@vger.kernel.org
> Cc: x86@kernel.org
> 
> [v2]: Modifications suggested by Ingo and added changes for similar output
>       from process.c
> 
> [v3]: Unify common code and move output to end of line
> ---
>  arch/x86/kernel/dumpstack.c |    6 +-----
>  arch/x86/kernel/process.c   |   12 +++++++++++-
>  2 files changed, 12 insertions(+), 6 deletions(-)
> 
> diff --git a/arch/x86/kernel/dumpstack.c b/arch/x86/kernel/dumpstack.c
> index ae42418b..96d40ed 100644
> --- a/arch/x86/kernel/dumpstack.c
> +++ b/arch/x86/kernel/dumpstack.c
> @@ -188,11 +188,7 @@ void dump_stack(void)
>  	unsigned long stack;
>  
>  	bp = stack_frame(current, NULL);
> -	printk("Pid: %d, comm: %.20s %s %s %.*s\n",
> -		current->pid, current->comm, print_tainted(),
> -		init_utsname()->release,
> -		(int)strcspn(init_utsname()->version, " "),
> -		init_utsname()->version);
> +	show_regs_common();
>  	show_trace(NULL, NULL, &stack, bp);
>  }
>  EXPORT_SYMBOL(dump_stack);
> diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
> index b644e1c..14bd064 100644
> --- a/arch/x86/kernel/process.c
> +++ b/arch/x86/kernel/process.c
> @@ -28,6 +28,7 @@
>  #include <asm/fpu-internal.h>
>  #include <asm/debugreg.h>
>  #include <asm/nmi.h>
> +#include <asm/hypervisor.h>
>  
>  /*
>   * per-CPU TSS segments. Threads are completely 'soft' on Linux,
> @@ -124,6 +125,13 @@ void exit_thread(void)
>  void show_regs_common(void)
>  {
>  	const char *vendor, *product, *board;
> +	const char *machine_name = "x86";
> +	const char *kernel_type = "native";
> +
> +	if (x86_hyper) {
> +		machine_name = x86_hyper->name;
> +		kernel_type = "guest";
> +	}
>  
>  	vendor = dmi_get_system_info(DMI_SYS_VENDOR);
>  	if (!vendor)
> @@ -135,7 +143,9 @@ void show_regs_common(void)
>  	/* Board Name is optional */
>  	board = dmi_get_system_info(DMI_BOARD_NAME);
>  
> -	printk(KERN_DEFAULT "Pid: %d, comm: %.20s %s %s %.*s %s %s%s%s\n",
> +	printk(KERN_DEFAULT
> +	       "[%s %s kernel] Pid: %d, comm: %.20s %s %s %.*s %s %s%s%s\n",
> +	       machine_name, kernel_type,

Ugh ... self-nak.  I sent the wrong version of this patch.  Sorry Ingo :(

P.

>  	       current->pid, current->comm, print_tainted(),
>  	       init_utsname()->release,
>  	       (int)strcspn(init_utsname()->version, " "),

      reply	other threads:[~2012-10-30 19:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-30 19:14 [PATCH] x86, add hypervisor name to dump_stack() [v3] Prarit Bhargava
2012-10-30 19:16 ` Prarit Bhargava [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=509027A8.3010509@redhat.com \
    --to=prarit@redhat.com \
    --cc=alex.williamson@redhat.com \
    --cc=avi@redhat.com \
    --cc=gleb@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=mtosatti@redhat.com \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).