* [Qemu-devel] [PATCH v3 0/3] kvm: report available guest crash parameters @ 2017-02-14 6:25 Denis V. Lunev 2017-02-14 6:25 ` [Qemu-devel] [PATCH v4 1/3] i386/cpu: add crash-information QOM property Denis V. Lunev ` (3 more replies) 0 siblings, 4 replies; 10+ messages in thread From: Denis V. Lunev @ 2017-02-14 6:25 UTC (permalink / raw) To: qemu-devel Cc: Denis V. Lunev, Anton Nefedov, Paolo Bonzini, Marcelo Tosatti, Richard Henderson, Eduardo Habkost, Eric Blake, Markus Armbruster Windows reports BSOD parameters through Hyper-V crash MSRs. This information is very useful for initial crash analysis and thus it would be nice to see it in the QEMU log file. There is suitable log mask for the purpose. Linux guest does not provide this information, but still it would be nice to log that we have crashed. Changes from v3: - existing kvm_cpu_synchronize_state() used to fetch HV crash MSRs (hence, no separate storage for these MSRs in struct X86CPU anymore) - qapi_free_GuestPanicInformation() used to release memory Changes from v2: - fixed PPC compilation Changes since v1: - patches resplit - created property to query crash parameters - crash parameters added to panic event Signed-off-by: Anton Nefedov <anton.nefedov@virtuozzo.com> Signed-off-by: Denis V. Lunev <den@openvz.org> CC: Paolo Bonzini <pbonzini@redhat.com> CC: Marcelo Tosatti <mtosatti@redhat.com> CC: Richard Henderson <rth@twiddle.net> CC: Eduardo Habkost <ehabkost@redhat.com> CC: Eric Blake <eblake@redhat.com> CC: Markus Armbruster <armbru@redhat.com> Anton Nefedov (3): i386/cpu: add crash-information QOM property report guest crash information in GUEST_PANICKED event vl: log available guest crash information hw/misc/pvpanic.c | 2 +- hw/ppc/spapr_rtas.c | 3 ++- include/qom/cpu.h | 10 +++++++++ include/sysemu/kvm.h | 2 ++ include/sysemu/sysemu.h | 2 +- kvm-all.c | 3 ++- qapi-schema.json | 24 +++++++++++++++++++++ qapi/event.json | 6 ++++-- qom/cpu.c | 11 ++++++++++ stubs/Makefile.objs | 1 + stubs/kvm-crash.c | 8 +++++++ target/i386/cpu.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++++ target/i386/cpu.h | 3 +++ target/i386/kvm.c | 41 ++++++++++++++++++++++++++++++++++++ target/s390x/kvm.c | 4 ++-- vl.c | 23 ++++++++++++++++++--- 16 files changed, 187 insertions(+), 11 deletions(-) create mode 100644 stubs/kvm-crash.c -- 2.7.4 ^ permalink raw reply [flat|nested] 10+ messages in thread
* [Qemu-devel] [PATCH v4 1/3] i386/cpu: add crash-information QOM property 2017-02-14 6:25 [Qemu-devel] [PATCH v3 0/3] kvm: report available guest crash parameters Denis V. Lunev @ 2017-02-14 6:25 ` Denis V. Lunev 2017-02-15 19:41 ` Eric Blake 2017-02-20 18:32 ` Daniel P. Berrange 2017-02-14 6:25 ` [Qemu-devel] [PATCH v4 2/3] report guest crash information in GUEST_PANICKED event Denis V. Lunev ` (2 subsequent siblings) 3 siblings, 2 replies; 10+ messages in thread From: Denis V. Lunev @ 2017-02-14 6:25 UTC (permalink / raw) To: qemu-devel; +Cc: Anton Nefedov, Denis V . Lunev From: Anton Nefedov <anton.nefedov@virtuozzo.com> Windows reports BSOD parameters through Hyper-V crash MSRs. This information is very useful for initial crash analysis and thus it would be nice to have a way to fetch it. Signed-off-by: Anton Nefedov <anton.nefedov@virtuozzo.com> Signed-off-by: Denis V. Lunev <den@openvz.org> --- kvm-all.c | 1 + qapi-schema.json | 24 ++++++++++++++++++++++++ target/i386/cpu.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 75 insertions(+) diff --git a/kvm-all.c b/kvm-all.c index a27c880..64f46c8 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -2000,6 +2000,7 @@ int kvm_cpu_exec(CPUState *cpu) ret = EXCP_INTERRUPT; break; case KVM_SYSTEM_EVENT_CRASH: + kvm_cpu_synchronize_state(cpu); qemu_mutex_lock_iothread(); qemu_system_guest_panicked(); qemu_mutex_unlock_iothread(); diff --git a/qapi-schema.json b/qapi-schema.json index cbdffdd..9cb6ac5 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -5846,6 +5846,30 @@ 'data': [ 'pause', 'poweroff' ] } ## +# @GuestPanicInformation: +# +# Information about a guest panic +# +# Since: 2.9 +## +{'union': 'GuestPanicInformation', + 'data': { 'hyper-v': 'GuestPanicInformationHyperV' } } + +## +# @GuestPanicInformationHyperV: +# +# Hyper-V specific guest panic information (HV crash MSRs) +# +# Since: 2.9 +## +{'struct': 'GuestPanicInformationHyperV', + 'data': { 'arg1': 'uint64', + 'arg2': 'uint64', + 'arg3': 'uint64', + 'arg4': 'uint64', + 'arg5': 'uint64' } } + +## # @rtc-reset-reinjection: # # This command will reset the RTC interrupt reinjection backlog. diff --git a/target/i386/cpu.c b/target/i386/cpu.c index eb49980..71aa91f 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -3495,6 +3495,53 @@ static void x86_cpu_register_feature_bit_props(X86CPU *cpu, x86_cpu_register_bit_prop(cpu, name, &cpu->env.features[w], bitnr); } +static GuestPanicInformation *x86_cpu_get_crash_info(CPUState *cs) +{ + X86CPU *cpu = X86_CPU(cs); + CPUX86State *env = &cpu->env; + GuestPanicInformation *panic_info = NULL; + + if (env->features[FEAT_HYPERV_EDX] & HV_X64_GUEST_CRASH_MSR_AVAILABLE) { + GuestPanicInformationHyperV *panic_info_hv = + g_malloc0(sizeof(GuestPanicInformationHyperV)); + panic_info = g_malloc0(sizeof(GuestPanicInformation)); + + panic_info->type = GUEST_PANIC_INFORMATION_KIND_HYPER_V; + panic_info->u.hyper_v.data = panic_info_hv; + + assert(HV_X64_MSR_CRASH_PARAMS >= 5); + panic_info_hv->arg1 = env->msr_hv_crash_params[0]; + panic_info_hv->arg2 = env->msr_hv_crash_params[1]; + panic_info_hv->arg3 = env->msr_hv_crash_params[2]; + panic_info_hv->arg4 = env->msr_hv_crash_params[3]; + panic_info_hv->arg5 = env->msr_hv_crash_params[4]; + } + + return panic_info; +} +static void x86_cpu_get_crash_info_qom(Object *obj, Visitor *v, + const char *name, void *opaque, + Error **errp) +{ + CPUState *cs = CPU(obj); + GuestPanicInformation *panic_info; + + if (!cs->crash_occurred) { + error_setg(errp, "No crash occured"); + return; + } + + panic_info = x86_cpu_get_crash_info(cs); + if (panic_info == NULL) { + error_setg(errp, "No crash information"); + return; + } + + visit_type_GuestPanicInformation(v, "crash-information", &panic_info, + errp); + qapi_free_GuestPanicInformation(panic_info); +} + static void x86_cpu_initfn(Object *obj) { CPUState *cs = CPU(obj); @@ -3530,6 +3577,9 @@ static void x86_cpu_initfn(Object *obj) x86_cpu_get_feature_words, NULL, NULL, (void *)cpu->filtered_features, NULL); + object_property_add(obj, "crash-information", "GuestPanicInformation", + x86_cpu_get_crash_info_qom, NULL, NULL, NULL, NULL); + cpu->hyperv_spinlock_attempts = HYPERV_SPINLOCK_NEVER_RETRY; for (w = 0; w < FEATURE_WORDS; w++) { -- 2.7.4 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [Qemu-devel] [PATCH v4 1/3] i386/cpu: add crash-information QOM property 2017-02-14 6:25 ` [Qemu-devel] [PATCH v4 1/3] i386/cpu: add crash-information QOM property Denis V. Lunev @ 2017-02-15 19:41 ` Eric Blake 2017-02-20 0:53 ` Markus Armbruster 2017-02-20 18:32 ` Daniel P. Berrange 1 sibling, 1 reply; 10+ messages in thread From: Eric Blake @ 2017-02-15 19:41 UTC (permalink / raw) To: Denis V. Lunev, qemu-devel; +Cc: Anton Nefedov, Markus Armbruster [-- Attachment #1: Type: text/plain, Size: 1400 bytes --] On 02/14/2017 12:25 AM, Denis V. Lunev wrote: > From: Anton Nefedov <anton.nefedov@virtuozzo.com> > > Windows reports BSOD parameters through Hyper-V crash MSRs. This > information is very useful for initial crash analysis and thus > it would be nice to have a way to fetch it. > > Signed-off-by: Anton Nefedov <anton.nefedov@virtuozzo.com> > Signed-off-by: Denis V. Lunev <den@openvz.org> > --- > +++ b/qapi-schema.json > @@ -5846,6 +5846,30 @@ > 'data': [ 'pause', 'poweroff' ] } > > ## > +# @GuestPanicInformation: > +# > +# Information about a guest panic > +# > +# Since: 2.9 > +## > +{'union': 'GuestPanicInformation', > + 'data': { 'hyper-v': 'GuestPanicInformationHyperV' } } > + Markus has been trying to eliminate the addition of new "simple unions" - while they are syntactically shorter in the .json file, they are bulkier over the wire with extra {} nesting, and more verbose in the C code, when compared to using a flat union instead. I won't necessarily hold up this patch as-is, but if we are going to avoid new simple unions, we have to change this before 2.9 bakes in the {} nesting (we can convert a simple union to a flat union without breaking QMP back-compat, but it's messier than if we avoid the nesting to begin with). -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org [-- Attachment #2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 604 bytes --] ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Qemu-devel] [PATCH v4 1/3] i386/cpu: add crash-information QOM property 2017-02-15 19:41 ` Eric Blake @ 2017-02-20 0:53 ` Markus Armbruster 0 siblings, 0 replies; 10+ messages in thread From: Markus Armbruster @ 2017-02-20 0:53 UTC (permalink / raw) To: Eric Blake; +Cc: Denis V. Lunev, qemu-devel, Anton Nefedov Eric Blake <eblake@redhat.com> writes: > On 02/14/2017 12:25 AM, Denis V. Lunev wrote: >> From: Anton Nefedov <anton.nefedov@virtuozzo.com> >> >> Windows reports BSOD parameters through Hyper-V crash MSRs. This >> information is very useful for initial crash analysis and thus >> it would be nice to have a way to fetch it. >> >> Signed-off-by: Anton Nefedov <anton.nefedov@virtuozzo.com> >> Signed-off-by: Denis V. Lunev <den@openvz.org> >> --- > >> +++ b/qapi-schema.json >> @@ -5846,6 +5846,30 @@ >> 'data': [ 'pause', 'poweroff' ] } >> >> ## >> +# @GuestPanicInformation: >> +# >> +# Information about a guest panic >> +# >> +# Since: 2.9 >> +## >> +{'union': 'GuestPanicInformation', >> + 'data': { 'hyper-v': 'GuestPanicInformationHyperV' } } >> + > > Markus has been trying to eliminate the addition of new "simple unions" > - while they are syntactically shorter in the .json file, they are > bulkier over the wire with extra {} nesting, and more verbose in the C > code, when compared to using a flat union instead. I won't necessarily > hold up this patch as-is, but if we are going to avoid new simple > unions, we have to change this before 2.9 bakes in the {} nesting (we > can convert a simple union to a flat union without breaking QMP > back-compat, but it's messier than if we avoid the nesting to begin with). We should not add new simple unions. Please have a look at my "[PATCH 0/2] Flatten simple unions where we still can". Message-Id: <1486569864-17005-1-git-send-email-armbru@redhat.com> https://lists.gnu.org/archive/html/qemu-devel/2017-02/msg01689.html ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Qemu-devel] [PATCH v4 1/3] i386/cpu: add crash-information QOM property 2017-02-14 6:25 ` [Qemu-devel] [PATCH v4 1/3] i386/cpu: add crash-information QOM property Denis V. Lunev 2017-02-15 19:41 ` Eric Blake @ 2017-02-20 18:32 ` Daniel P. Berrange 1 sibling, 0 replies; 10+ messages in thread From: Daniel P. Berrange @ 2017-02-20 18:32 UTC (permalink / raw) To: Denis V. Lunev; +Cc: qemu-devel, Anton Nefedov On Tue, Feb 14, 2017 at 09:25:22AM +0300, Denis V. Lunev wrote: > From: Anton Nefedov <anton.nefedov@virtuozzo.com> > > Windows reports BSOD parameters through Hyper-V crash MSRs. This > information is very useful for initial crash analysis and thus > it would be nice to have a way to fetch it. > > Signed-off-by: Anton Nefedov <anton.nefedov@virtuozzo.com> > Signed-off-by: Denis V. Lunev <den@openvz.org> > --- > kvm-all.c | 1 + > qapi-schema.json | 24 ++++++++++++++++++++++++ > target/i386/cpu.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ > 3 files changed, 75 insertions(+) > > diff --git a/kvm-all.c b/kvm-all.c > index a27c880..64f46c8 100644 > --- a/kvm-all.c > +++ b/kvm-all.c > @@ -2000,6 +2000,7 @@ int kvm_cpu_exec(CPUState *cpu) > ret = EXCP_INTERRUPT; > break; > case KVM_SYSTEM_EVENT_CRASH: > + kvm_cpu_synchronize_state(cpu); > qemu_mutex_lock_iothread(); > qemu_system_guest_panicked(); > qemu_mutex_unlock_iothread(); > diff --git a/qapi-schema.json b/qapi-schema.json > index cbdffdd..9cb6ac5 100644 > --- a/qapi-schema.json > +++ b/qapi-schema.json > @@ -5846,6 +5846,30 @@ > 'data': [ 'pause', 'poweroff' ] } > > ## > +# @GuestPanicInformation: > +# > +# Information about a guest panic > +# > +# Since: 2.9 > +## > +{'union': 'GuestPanicInformation', > + 'data': { 'hyper-v': 'GuestPanicInformationHyperV' } } > + > +## > +# @GuestPanicInformationHyperV: > +# > +# Hyper-V specific guest panic information (HV crash MSRs) > +# > +# Since: 2.9 > +## > +{'struct': 'GuestPanicInformationHyperV', > + 'data': { 'arg1': 'uint64', > + 'arg2': 'uint64', > + 'arg3': 'uint64', > + 'arg4': 'uint64', > + 'arg5': 'uint64' } } Is there any benefit in naming these fields ? In the Linux kernel they are filled with ip, ax, bx, cx, dx register values. I'm unclear if that's defined standard semantics by Microsoft, and thus consistent for all OS using this interface, or just what Linux happens to store there ? If they're standard, then IMHO it could be nicer to name the QAPI fields ip, ax, bx, cx, dx. Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://entangle-photo.org -o- http://search.cpan.org/~danberr/ :| ^ permalink raw reply [flat|nested] 10+ messages in thread
* [Qemu-devel] [PATCH v4 2/3] report guest crash information in GUEST_PANICKED event 2017-02-14 6:25 [Qemu-devel] [PATCH v3 0/3] kvm: report available guest crash parameters Denis V. Lunev 2017-02-14 6:25 ` [Qemu-devel] [PATCH v4 1/3] i386/cpu: add crash-information QOM property Denis V. Lunev @ 2017-02-14 6:25 ` Denis V. Lunev 2017-02-15 19:43 ` Eric Blake 2017-02-14 6:25 ` [Qemu-devel] [PATCH v4 3/3] vl: log available guest crash information Denis V. Lunev 2017-02-15 16:47 ` [Qemu-devel] [PATCH v3 0/3] kvm: report available guest crash parameters Paolo Bonzini 3 siblings, 1 reply; 10+ messages in thread From: Denis V. Lunev @ 2017-02-14 6:25 UTC (permalink / raw) To: qemu-devel; +Cc: Anton Nefedov, Denis V . Lunev From: Anton Nefedov <anton.nefedov@virtuozzo.com> it's not very convenient to use the crash-information property interface, so provide a CPU class callback to get the guest crash information, and pass that information in the event Signed-off-by: Anton Nefedov <anton.nefedov@virtuozzo.com> Signed-off-by: Denis V. Lunev <den@openvz.org> --- hw/misc/pvpanic.c | 2 +- hw/ppc/spapr_rtas.c | 3 ++- include/qom/cpu.h | 10 ++++++++++ include/sysemu/sysemu.h | 2 +- kvm-all.c | 2 +- qapi/event.json | 6 ++++-- qom/cpu.c | 11 +++++++++++ target/i386/cpu.c | 1 + target/s390x/kvm.c | 4 ++-- vl.c | 11 ++++++++--- 10 files changed, 41 insertions(+), 11 deletions(-) diff --git a/hw/misc/pvpanic.c b/hw/misc/pvpanic.c index 0ac1e6a..57da7f2 100644 --- a/hw/misc/pvpanic.c +++ b/hw/misc/pvpanic.c @@ -42,7 +42,7 @@ static void handle_event(int event) } if (event & PVPANIC_PANICKED) { - qemu_system_guest_panicked(); + qemu_system_guest_panicked(NULL); return; } } diff --git a/hw/ppc/spapr_rtas.c b/hw/ppc/spapr_rtas.c index bb19944..619f32c 100644 --- a/hw/ppc/spapr_rtas.c +++ b/hw/ppc/spapr_rtas.c @@ -334,7 +334,8 @@ static void rtas_ibm_os_term(PowerPCCPU *cpu, { target_ulong ret = 0; - qapi_event_send_guest_panicked(GUEST_PANIC_ACTION_PAUSE, &error_abort); + qapi_event_send_guest_panicked(GUEST_PANIC_ACTION_PAUSE, false, NULL, + &error_abort); rtas_st(rets, 0, ret); } diff --git a/include/qom/cpu.h b/include/qom/cpu.h index ca4d0fb..f95a6c3 100644 --- a/include/qom/cpu.h +++ b/include/qom/cpu.h @@ -156,6 +156,7 @@ typedef struct CPUClass { uint8_t *buf, int len, bool is_write); void (*dump_state)(CPUState *cpu, FILE *f, fprintf_function cpu_fprintf, int flags); + GuestPanicInformation* (*get_crash_info)(CPUState *cpu); void (*dump_statistics)(CPUState *cpu, FILE *f, fprintf_function cpu_fprintf, int flags); int64_t (*get_arch_id)(CPUState *cpu); @@ -469,6 +470,15 @@ int cpu_write_elf32_qemunote(WriteCoreDumpFunction f, CPUState *cpu, void *opaque); /** + * cpu_get_crash_info: + * @cpu: The CPU to get crash information for + * + * Gets the previously saved crash information. + * Caller is responsible for freeing the data. + */ +GuestPanicInformation *cpu_get_crash_info(CPUState *cpu); + +/** * CPUDumpFlags: * @CPU_DUMP_CODE: * @CPU_DUMP_FPU: dump FPU register state, not just integer diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h index 4d50694..2c39bed 100644 --- a/include/sysemu/sysemu.h +++ b/include/sysemu/sysemu.h @@ -64,7 +64,7 @@ int qemu_shutdown_requested_get(void); int qemu_reset_requested_get(void); void qemu_system_killed(int signal, pid_t pid); void qemu_system_reset(bool report); -void qemu_system_guest_panicked(void); +void qemu_system_guest_panicked(GuestPanicInformation *info); size_t qemu_target_page_bits(void); void qemu_add_exit_notifier(Notifier *notify); diff --git a/kvm-all.c b/kvm-all.c index 64f46c8..0c94637 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -2002,7 +2002,7 @@ int kvm_cpu_exec(CPUState *cpu) case KVM_SYSTEM_EVENT_CRASH: kvm_cpu_synchronize_state(cpu); qemu_mutex_lock_iothread(); - qemu_system_guest_panicked(); + qemu_system_guest_panicked(cpu_get_crash_info(cpu)); qemu_mutex_unlock_iothread(); ret = 0; break; diff --git a/qapi/event.json b/qapi/event.json index 7bf539b..970ff02 100644 --- a/qapi/event.json +++ b/qapi/event.json @@ -488,7 +488,9 @@ # # @action: action that has been taken, currently always "pause" # -# Since: 1.5 +# @info: optional information about a panic +# +# Since: 1.5 (@info since 2.9) # # Example: # @@ -497,7 +499,7 @@ # ## { 'event': 'GUEST_PANICKED', - 'data': { 'action': 'GuestPanicAction' } } + 'data': { 'action': 'GuestPanicAction', '*info': 'GuestPanicInformation' } } ## # @QUORUM_FAILURE: diff --git a/qom/cpu.c b/qom/cpu.c index d57faf3..5158f31 100644 --- a/qom/cpu.c +++ b/qom/cpu.c @@ -218,6 +218,17 @@ static bool cpu_common_exec_interrupt(CPUState *cpu, int int_req) return false; } +GuestPanicInformation *cpu_get_crash_info(CPUState *cpu) +{ + CPUClass *cc = CPU_GET_CLASS(cpu); + GuestPanicInformation *res = NULL; + + if (cc->get_crash_info) { + res = cc->get_crash_info(cpu); + } + return res; +} + void cpu_dump_state(CPUState *cpu, FILE *f, fprintf_function cpu_fprintf, int flags) { diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 71aa91f..fd7add2 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -3734,6 +3734,7 @@ static void x86_cpu_common_class_init(ObjectClass *oc, void *data) cc->do_interrupt = x86_cpu_do_interrupt; cc->cpu_exec_interrupt = x86_cpu_exec_interrupt; cc->dump_state = x86_cpu_dump_state; + cc->get_crash_info = x86_cpu_get_crash_info; cc->set_pc = x86_cpu_set_pc; cc->synchronize_from_tb = x86_cpu_synchronize_from_tb; cc->gdb_read_register = x86_cpu_gdb_read_register; diff --git a/target/s390x/kvm.c b/target/s390x/kvm.c index 6ed3876..2536780 100644 --- a/target/s390x/kvm.c +++ b/target/s390x/kvm.c @@ -1864,7 +1864,7 @@ static void unmanageable_intercept(S390CPU *cpu, const char *str, int pswoffset) str, cs->cpu_index, ldq_phys(cs->as, cpu->env.psa + pswoffset), ldq_phys(cs->as, cpu->env.psa + pswoffset + 8)); s390_cpu_halt(cpu); - qemu_system_guest_panicked(); + qemu_system_guest_panicked(NULL); } static int handle_intercept(S390CPU *cpu) @@ -1897,7 +1897,7 @@ static int handle_intercept(S390CPU *cpu) if (is_special_wait_psw(cs)) { qemu_system_shutdown_request(); } else { - qemu_system_guest_panicked(); + qemu_system_guest_panicked(NULL); } } r = EXCP_HALTED; diff --git a/vl.c b/vl.c index b4eaf03..d68254b 100644 --- a/vl.c +++ b/vl.c @@ -1707,18 +1707,23 @@ void qemu_system_reset(bool report) cpu_synchronize_all_post_reset(); } -void qemu_system_guest_panicked(void) +void qemu_system_guest_panicked(GuestPanicInformation *info) { if (current_cpu) { current_cpu->crash_occurred = true; } - qapi_event_send_guest_panicked(GUEST_PANIC_ACTION_PAUSE, &error_abort); + qapi_event_send_guest_panicked(GUEST_PANIC_ACTION_PAUSE, + !!info, info, &error_abort); vm_stop(RUN_STATE_GUEST_PANICKED); if (!no_shutdown) { qapi_event_send_guest_panicked(GUEST_PANIC_ACTION_POWEROFF, - &error_abort); + !!info, info, &error_abort); qemu_system_shutdown_request(); } + + if (info) { + qapi_free_GuestPanicInformation(info); + } } void qemu_system_reset_request(void) -- 2.7.4 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [Qemu-devel] [PATCH v4 2/3] report guest crash information in GUEST_PANICKED event 2017-02-14 6:25 ` [Qemu-devel] [PATCH v4 2/3] report guest crash information in GUEST_PANICKED event Denis V. Lunev @ 2017-02-15 19:43 ` Eric Blake 0 siblings, 0 replies; 10+ messages in thread From: Eric Blake @ 2017-02-15 19:43 UTC (permalink / raw) To: Denis V. Lunev, qemu-devel; +Cc: Anton Nefedov [-- Attachment #1: Type: text/plain, Size: 1033 bytes --] On 02/14/2017 12:25 AM, Denis V. Lunev wrote: > From: Anton Nefedov <anton.nefedov@virtuozzo.com> > > it's not very convenient to use the crash-information property interface, > so provide a CPU class callback to get the guest crash information, and pass > that information in the event > > Signed-off-by: Anton Nefedov <anton.nefedov@virtuozzo.com> > Signed-off-by: Denis V. Lunev <den@openvz.org> > --- > +++ b/qapi/event.json > @@ -488,7 +488,9 @@ > # > # @action: action that has been taken, currently always "pause" > # > -# Since: 1.5 > +# @info: optional information about a panic > +# > +# Since: 1.5 (@info since 2.9) This is more usually written: # @info: #optional information about a panic (since 2.9) # # Since: 1.5 > + > + if (info) { > + qapi_free_GuestPanicInformation(info); qapi_free_*() is safe to call on a NULL pointer, so this is a useless 'if'. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org [-- Attachment #2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 604 bytes --] ^ permalink raw reply [flat|nested] 10+ messages in thread
* [Qemu-devel] [PATCH v4 3/3] vl: log available guest crash information 2017-02-14 6:25 [Qemu-devel] [PATCH v3 0/3] kvm: report available guest crash parameters Denis V. Lunev 2017-02-14 6:25 ` [Qemu-devel] [PATCH v4 1/3] i386/cpu: add crash-information QOM property Denis V. Lunev 2017-02-14 6:25 ` [Qemu-devel] [PATCH v4 2/3] report guest crash information in GUEST_PANICKED event Denis V. Lunev @ 2017-02-14 6:25 ` Denis V. Lunev 2017-02-15 16:47 ` [Qemu-devel] [PATCH v3 0/3] kvm: report available guest crash parameters Paolo Bonzini 3 siblings, 0 replies; 10+ messages in thread From: Denis V. Lunev @ 2017-02-14 6:25 UTC (permalink / raw) To: qemu-devel; +Cc: Anton Nefedov, Denis V . Lunev From: Anton Nefedov <anton.nefedov@virtuozzo.com> There is a suitable log mask for the purpose. Signed-off-by: Anton Nefedov <anton.nefedov@virtuozzo.com> Signed-off-by: Denis V. Lunev <den@openvz.org> --- vl.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/vl.c b/vl.c index d68254b..903c46d 100644 --- a/vl.c +++ b/vl.c @@ -1709,6 +1709,8 @@ void qemu_system_reset(bool report) void qemu_system_guest_panicked(GuestPanicInformation *info) { + qemu_log_mask(LOG_GUEST_ERROR, "Guest crashed\n"); + if (current_cpu) { current_cpu->crash_occurred = true; } @@ -1722,6 +1724,15 @@ void qemu_system_guest_panicked(GuestPanicInformation *info) } if (info) { + if (info->type == GUEST_PANIC_INFORMATION_KIND_HYPER_V) { + qemu_log_mask(LOG_GUEST_ERROR, "HV crash parameters: (%#"PRIx64 + " %#"PRIx64" %#"PRIx64" %#"PRIx64" %#"PRIx64")\n", + info->u.hyper_v.data->arg1, + info->u.hyper_v.data->arg2, + info->u.hyper_v.data->arg3, + info->u.hyper_v.data->arg4, + info->u.hyper_v.data->arg5); + } qapi_free_GuestPanicInformation(info); } } -- 2.7.4 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [Qemu-devel] [PATCH v3 0/3] kvm: report available guest crash parameters 2017-02-14 6:25 [Qemu-devel] [PATCH v3 0/3] kvm: report available guest crash parameters Denis V. Lunev ` (2 preceding siblings ...) 2017-02-14 6:25 ` [Qemu-devel] [PATCH v4 3/3] vl: log available guest crash information Denis V. Lunev @ 2017-02-15 16:47 ` Paolo Bonzini 3 siblings, 0 replies; 10+ messages in thread From: Paolo Bonzini @ 2017-02-15 16:47 UTC (permalink / raw) To: Denis V. Lunev, qemu-devel Cc: Anton Nefedov, Eduardo Habkost, Marcelo Tosatti, Markus Armbruster, Richard Henderson On 14/02/2017 07:25, Denis V. Lunev wrote: > Windows reports BSOD parameters through Hyper-V crash MSRs. This > information is very useful for initial crash analysis and thus > it would be nice to see it in the QEMU log file. There is suitable > log mask for the purpose. > > Linux guest does not provide this information, but still it would > be nice to log that we have crashed. > > Changes from v3: > - existing kvm_cpu_synchronize_state() used to fetch HV crash MSRs > (hence, no separate storage for these MSRs in struct X86CPU anymore) Nice. :) > - qapi_free_GuestPanicInformation() used to release memory > > Changes from v2: > - fixed PPC compilation > > Changes since v1: > - patches resplit > - created property to query crash parameters > - crash parameters added to panic event > > Signed-off-by: Anton Nefedov <anton.nefedov@virtuozzo.com> > Signed-off-by: Denis V. Lunev <den@openvz.org> > CC: Paolo Bonzini <pbonzini@redhat.com> > CC: Marcelo Tosatti <mtosatti@redhat.com> > CC: Richard Henderson <rth@twiddle.net> > CC: Eduardo Habkost <ehabkost@redhat.com> > CC: Eric Blake <eblake@redhat.com> > CC: Markus Armbruster <armbru@redhat.com> > > Anton Nefedov (3): > i386/cpu: add crash-information QOM property > report guest crash information in GUEST_PANICKED event > vl: log available guest crash information > > hw/misc/pvpanic.c | 2 +- > hw/ppc/spapr_rtas.c | 3 ++- > include/qom/cpu.h | 10 +++++++++ > include/sysemu/kvm.h | 2 ++ > include/sysemu/sysemu.h | 2 +- > kvm-all.c | 3 ++- > qapi-schema.json | 24 +++++++++++++++++++++ > qapi/event.json | 6 ++++-- > qom/cpu.c | 11 ++++++++++ > stubs/Makefile.objs | 1 + > stubs/kvm-crash.c | 8 +++++++ > target/i386/cpu.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++++ > target/i386/cpu.h | 3 +++ > target/i386/kvm.c | 41 ++++++++++++++++++++++++++++++++++++ > target/s390x/kvm.c | 4 ++-- > vl.c | 23 ++++++++++++++++++--- > 16 files changed, 187 insertions(+), 11 deletions(-) > create mode 100644 stubs/kvm-crash.c > Queued for 2.9, thanks! Paolo ^ permalink raw reply [flat|nested] 10+ messages in thread
* [Qemu-devel] [PATCH v3 0/3] kvm: report available guest crash parameters @ 2017-02-13 7:08 Denis V. Lunev 0 siblings, 0 replies; 10+ messages in thread From: Denis V. Lunev @ 2017-02-13 7:08 UTC (permalink / raw) To: qemu-devel Cc: Denis V. Lunev, Anton Nefedov, Paolo Bonzini, Marcelo Tosatti, Richard Henderson, Eduardo Habkost, Eric Blake, Markus Armbruster Windows reports BSOD parameters through Hyper-V crash MSRs. This information is very useful for initial crash analysis and thus it would be nice to see it in the QEMU log file. There is suitable log mask for the purpose. Linux guest does not provide this information, but still it would be nice to log that we have crashed. Changes from v2: - fixed PPC compilation Changes since v1: - patches resplit - created property to query crash parameters - crash parameters added to panic event Signed-off-by: Anton Nefedov <anton.nefedov@virtuozzo.com> Signed-off-by: Denis V. Lunev <den@openvz.org> CC: Paolo Bonzini <pbonzini@redhat.com> CC: Marcelo Tosatti <mtosatti@redhat.com> CC: Richard Henderson <rth@twiddle.net> CC: Eduardo Habkost <ehabkost@redhat.com> CC: Eric Blake <eblake@redhat.com> CC: Markus Armbruster <armbru@redhat.com> Anton Nefedov (3): i386/cpu: add crash-information QOM property report guest crash information in GUEST_PANICKED event vl: log available guest crash information hw/misc/pvpanic.c | 2 +- hw/ppc/spapr_rtas.c | 3 ++- include/qom/cpu.h | 10 +++++++++ include/sysemu/kvm.h | 2 ++ include/sysemu/sysemu.h | 2 +- kvm-all.c | 3 ++- qapi-schema.json | 24 +++++++++++++++++++++ qapi/event.json | 6 ++++-- qom/cpu.c | 11 ++++++++++ stubs/Makefile.objs | 1 + stubs/kvm-crash.c | 8 +++++++ target/i386/cpu.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++++ target/i386/cpu.h | 3 +++ target/i386/kvm.c | 41 ++++++++++++++++++++++++++++++++++++ target/s390x/kvm.c | 4 ++-- vl.c | 23 ++++++++++++++++++--- 16 files changed, 187 insertions(+), 11 deletions(-) create mode 100644 stubs/kvm-crash.c -- 2.7.4 ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2017-02-20 18:32 UTC | newest] Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2017-02-14 6:25 [Qemu-devel] [PATCH v3 0/3] kvm: report available guest crash parameters Denis V. Lunev 2017-02-14 6:25 ` [Qemu-devel] [PATCH v4 1/3] i386/cpu: add crash-information QOM property Denis V. Lunev 2017-02-15 19:41 ` Eric Blake 2017-02-20 0:53 ` Markus Armbruster 2017-02-20 18:32 ` Daniel P. Berrange 2017-02-14 6:25 ` [Qemu-devel] [PATCH v4 2/3] report guest crash information in GUEST_PANICKED event Denis V. Lunev 2017-02-15 19:43 ` Eric Blake 2017-02-14 6:25 ` [Qemu-devel] [PATCH v4 3/3] vl: log available guest crash information Denis V. Lunev 2017-02-15 16:47 ` [Qemu-devel] [PATCH v3 0/3] kvm: report available guest crash parameters Paolo Bonzini -- strict thread matches above, loose matches on Subject: below -- 2017-02-13 7:08 Denis V. Lunev
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.