Commit c86f106b authored by Anton Nefedov's avatar Anton Nefedov Committed by Paolo Bonzini
Browse files

report guest crash information in GUEST_PANICKED event



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: default avatarAnton Nefedov <anton.nefedov@virtuozzo.com>
Signed-off-by: default avatarDenis V. Lunev <den@openvz.org>
Message-Id: <1487053524-18674-3-git-send-email-den@openvz.org>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent d187e08d
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -42,7 +42,7 @@ static void handle_event(int event)
    }

    if (event & PVPANIC_PANICKED) {
        qemu_system_guest_panicked();
        qemu_system_guest_panicked(NULL);
        return;
    }
}
+2 −1
Original line number Diff line number Diff line
@@ -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);
}
+10 −0
Original line number Diff line number Diff line
@@ -158,6 +158,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);
@@ -471,6 +472,15 @@ int cpu_write_elf32_note(WriteCoreDumpFunction f, CPUState *cpu,
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:
+1 −1
Original line number Diff line number Diff line
@@ -66,7 +66,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);
+1 −1
Original line number Diff line number Diff line
@@ -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;
Loading