target/i386: log MCE guest and host addresses
Patch logs MCE AO, AR messages injected to guest or taken by QEMU itself. We print the QEMU address for guest MCEs, helps on hypervisors that have another source of MCE logging like mce log, and when they go missing. For example we found these QEMU logs: September 26th 2019, 17:36:02.309 Droplet-153258224: Guest MCE Memory Error at qemu addr 0x7f8ce14f5000 and guest 3d6f5000 addr of type BUS_MCEERR_AR injected qemu-system-x86_64 amsN ams3nodeNNNN September 27th 2019, 06:25:03.234 Droplet-153258224: Guest MCE Memory Error at qemu addr 0x7f8ce14f5000 and guest 3d6f5000 addr of type BUS_MCEERR_AR injected qemu-system-x86_64 amsN ams3nodeNNNN The first log had a corresponding mce log entry, the second didnt (logging thresholds) we can infer from second entry same PA and mce type. Signed-off-by: Mario Smarduch <msmarduch@digitalocean.com> Message-Id: <20191009164459.8209-3-msmarduch@digitalocean.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
e9d4246192
commit
73284563dc
@ -592,9 +592,9 @@ static void kvm_mce_inject(X86CPU *cpu, hwaddr paddr, int code)
|
|||||||
(MCM_ADDR_PHYS << 6) | 0xc, flags);
|
(MCM_ADDR_PHYS << 6) | 0xc, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void hardware_memory_error(void)
|
static void hardware_memory_error(void *host_addr)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Hardware memory error!\n");
|
error_report("QEMU got Hardware memory error at addr %p", host_addr);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -618,15 +618,34 @@ void kvm_arch_on_sigbus_vcpu(CPUState *c, int code, void *addr)
|
|||||||
kvm_physical_memory_addr_from_host(c->kvm_state, addr, &paddr)) {
|
kvm_physical_memory_addr_from_host(c->kvm_state, addr, &paddr)) {
|
||||||
kvm_hwpoison_page_add(ram_addr);
|
kvm_hwpoison_page_add(ram_addr);
|
||||||
kvm_mce_inject(cpu, paddr, code);
|
kvm_mce_inject(cpu, paddr, code);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Use different logging severity based on error type.
|
||||||
|
* If there is additional MCE reporting on the hypervisor, QEMU VA
|
||||||
|
* could be another source to identify the PA and MCE details.
|
||||||
|
*/
|
||||||
|
if (code == BUS_MCEERR_AR) {
|
||||||
|
error_report("Guest MCE Memory Error at QEMU addr %p and "
|
||||||
|
"GUEST addr 0x%" HWADDR_PRIx " of type %s injected",
|
||||||
|
addr, paddr, "BUS_MCEERR_AR");
|
||||||
|
} else {
|
||||||
|
warn_report("Guest MCE Memory Error at QEMU addr %p and "
|
||||||
|
"GUEST addr 0x%" HWADDR_PRIx " of type %s injected",
|
||||||
|
addr, paddr, "BUS_MCEERR_AO");
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(stderr, "Hardware memory error for memory used by "
|
if (code == BUS_MCEERR_AO) {
|
||||||
"QEMU itself instead of guest system!\n");
|
warn_report("Hardware memory error at addr %p of type %s "
|
||||||
|
"for memory used by QEMU itself instead of guest system!",
|
||||||
|
addr, "BUS_MCEERR_AO");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (code == BUS_MCEERR_AR) {
|
if (code == BUS_MCEERR_AR) {
|
||||||
hardware_memory_error();
|
hardware_memory_error(addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Hope we are lucky for AO MCE */
|
/* Hope we are lucky for AO MCE */
|
||||||
|
Loading…
Reference in New Issue
Block a user