* [PATCH] x86, add hypervisor name to dump_stack()
@ 2012-10-10 14:27 Prarit Bhargava
2012-10-24 9:49 ` Ingo Molnar
0 siblings, 1 reply; 4+ messages in thread
From: Prarit Bhargava @ 2012-10-10 14:27 UTC (permalink / raw)
To: linux-kernel
Cc: Prarit Bhargava, Avi Kivity, Gleb Natapov, Alex Williamson,
Marcelo Tostatti, Ingo Molnar, kvm, x86
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 a single extra line on virtual
machines that indicates the hypervisor type.
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
---
arch/x86/kernel/dumpstack.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/arch/x86/kernel/dumpstack.c b/arch/x86/kernel/dumpstack.c
index ae42418b..75a635e 100644
--- a/arch/x86/kernel/dumpstack.c
+++ b/arch/x86/kernel/dumpstack.c
@@ -17,6 +17,7 @@
#include <linux/sysfs.h>
#include <asm/stacktrace.h>
+#include <asm/hypervisor.h>
int panic_on_unrecovered_nmi;
@@ -193,6 +194,8 @@ void dump_stack(void)
init_utsname()->release,
(int)strcspn(init_utsname()->version, " "),
init_utsname()->version);
+ if (x86_hyper && x86_hyper->name)
+ printk("Hypervisor: %s\n", x86_hyper->name);
show_trace(NULL, NULL, &stack, bp);
}
EXPORT_SYMBOL(dump_stack);
--
1.7.9.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] x86, add hypervisor name to dump_stack()
2012-10-10 14:27 [PATCH] x86, add hypervisor name to dump_stack() Prarit Bhargava
@ 2012-10-24 9:49 ` Ingo Molnar
2012-10-24 12:15 ` Prarit Bhargava
0 siblings, 1 reply; 4+ messages in thread
From: Ingo Molnar @ 2012-10-24 9:49 UTC (permalink / raw)
To: Prarit Bhargava
Cc: linux-kernel, Avi Kivity, Gleb Natapov, Alex Williamson,
Marcelo Tostatti, Ingo Molnar, kvm, x86
* Prarit Bhargava <prarit@redhat.com> 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 a single extra line on virtual
> machines that indicates the hypervisor type.
>
> 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
> ---
> arch/x86/kernel/dumpstack.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/arch/x86/kernel/dumpstack.c b/arch/x86/kernel/dumpstack.c
> index ae42418b..75a635e 100644
> --- a/arch/x86/kernel/dumpstack.c
> +++ b/arch/x86/kernel/dumpstack.c
> @@ -17,6 +17,7 @@
> #include <linux/sysfs.h>
>
> #include <asm/stacktrace.h>
> +#include <asm/hypervisor.h>
>
>
> int panic_on_unrecovered_nmi;
> @@ -193,6 +194,8 @@ void dump_stack(void)
> init_utsname()->release,
> (int)strcspn(init_utsname()->version, " "),
> init_utsname()->version);
> + if (x86_hyper && x86_hyper->name)
> + printk("Hypervisor: %s\n", x86_hyper->name);
> show_trace(NULL, NULL, &stack, bp);
Looks useful, but please don't waste a full new line on it but
embedd it in the already existing status line that prints
details like release and version.
Thanks,
Ingo
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] x86, add hypervisor name to dump_stack()
2012-10-24 9:49 ` Ingo Molnar
@ 2012-10-24 12:15 ` Prarit Bhargava
2012-10-24 12:58 ` Ingo Molnar
0 siblings, 1 reply; 4+ messages in thread
From: Prarit Bhargava @ 2012-10-24 12:15 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Avi Kivity, Gleb Natapov, Alex Williamson,
Marcelo Tostatti, Ingo Molnar, kvm, x86
On 10/24/2012 05:49 AM, Ingo Molnar wrote:
>
> * Prarit Bhargava <prarit@redhat.com> 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 a single extra line on virtual
>> machines that indicates the hypervisor type.
>>
>> 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
>> ---
>> arch/x86/kernel/dumpstack.c | 3 +++
>> 1 file changed, 3 insertions(+)
>>
>> diff --git a/arch/x86/kernel/dumpstack.c b/arch/x86/kernel/dumpstack.c
>> index ae42418b..75a635e 100644
>> --- a/arch/x86/kernel/dumpstack.c
>> +++ b/arch/x86/kernel/dumpstack.c
>> @@ -17,6 +17,7 @@
>> #include <linux/sysfs.h>
>>
>> #include <asm/stacktrace.h>
>> +#include <asm/hypervisor.h>
>>
>>
>> int panic_on_unrecovered_nmi;
>> @@ -193,6 +194,8 @@ void dump_stack(void)
>> init_utsname()->release,
>> (int)strcspn(init_utsname()->version, " "),
>> init_utsname()->version);
>> + if (x86_hyper && x86_hyper->name)
>> + printk("Hypervisor: %s\n", x86_hyper->name);
>> show_trace(NULL, NULL, &stack, bp);
>
> Looks useful, but please don't waste a full new line on it but
> embedd it in the already existing status line that prints
> details like release and version.
Ingo, I thought about doing that but since x86_hyper can be NULL (... maybe it
should initialized to "Bare-metal" or "No Hypervisor"?) I didn't want to break
up the printk line. I'll look into doing it a different way...
P.
>
> Thanks,
>
> Ingo
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] x86, add hypervisor name to dump_stack()
2012-10-24 12:15 ` Prarit Bhargava
@ 2012-10-24 12:58 ` Ingo Molnar
0 siblings, 0 replies; 4+ messages in thread
From: Ingo Molnar @ 2012-10-24 12:58 UTC (permalink / raw)
To: Prarit Bhargava
Cc: linux-kernel, Avi Kivity, Gleb Natapov, Alex Williamson,
Marcelo Tostatti, Ingo Molnar, kvm, x86
* Prarit Bhargava <prarit@redhat.com> wrote:
> > Looks useful, but please don't waste a full new line on it
> > but embedd it in the already existing status line that
> > prints details like release and version.
>
> Ingo, I thought about doing that but since x86_hyper can be
> NULL (... maybe it should initialized to "Bare-metal" or "No
> Hypervisor"?) I didn't want to break up the printk line. I'll
> look into doing it a different way...
You don't have to break it up - just initialize a name string
to:
const char *machine_name = "x86";
const char *kernel_type = "native";
if (x86_hyperv) {
machine_name = x86_hyperv->name;
kernel_type = "guest";
}
And print it as:
"[%s %s kernel]", machine_name, kernel_type
That way we'll get nice:
... [x86 native kernel]
... [KVM guest kernel]
... [Xen guest kernel]
etc.
Printouts. Please use the naming I outlined above, that's how we
refer to these kernels within arch/x86/.
(The above code is pseudocode, untested.)
Thanks,
Ingo
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-10-24 12:58 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-10 14:27 [PATCH] x86, add hypervisor name to dump_stack() Prarit Bhargava
2012-10-24 9:49 ` Ingo Molnar
2012-10-24 12:15 ` Prarit Bhargava
2012-10-24 12:58 ` Ingo Molnar
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).