powerpc/64s: Better printing of machine check info for guest MCEs
authorPaul Mackerras <paulus@ozlabs.org>
Thu, 21 Feb 2019 02:40:20 +0000 (13:40 +1100)
committerMichael Ellerman <mpe@ellerman.id.au>
Thu, 21 Feb 2019 12:16:45 +0000 (23:16 +1100)
This adds an "in_guest" parameter to machine_check_print_event_info()
so that we can avoid trying to translate guest NIP values into
symbolic form using the host kernel's symbol table.

Reviewed-by: Aravinda Prasad <aravinda@linux.vnet.ibm.com>
Reviewed-by: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/include/asm/mce.h
arch/powerpc/kernel/mce.c
arch/powerpc/kvm/book3s_hv.c
arch/powerpc/platforms/powernv/opal.c

index a8b8903e184408b4623d842d9dc9f457639cccd3..17996bc9382b447e76dd212caad62fd4d97705eb 100644 (file)
@@ -209,7 +209,7 @@ extern int get_mce_event(struct machine_check_event *mce, bool release);
 extern void release_mce_event(void);
 extern void machine_check_queue_event(void);
 extern void machine_check_print_event_info(struct machine_check_event *evt,
-                                          bool user_mode);
+                                          bool user_mode, bool in_guest);
 #ifdef CONFIG_PPC_BOOK3S_64
 void flush_and_reload_slb(void);
 #endif /* CONFIG_PPC_BOOK3S_64 */
index bd933a75f0bcbe6dda0ede7abefe69038ada36e4..d501b48f287ece90a39f86be1370c222d74f1a8e 100644 (file)
@@ -301,13 +301,13 @@ static void machine_check_process_queued_event(struct irq_work *work)
        while (__this_cpu_read(mce_queue_count) > 0) {
                index = __this_cpu_read(mce_queue_count) - 1;
                evt = this_cpu_ptr(&mce_event_queue[index]);
-               machine_check_print_event_info(evt, false);
+               machine_check_print_event_info(evt, false, false);
                __this_cpu_dec(mce_queue_count);
        }
 }
 
 void machine_check_print_event_info(struct machine_check_event *evt,
-                                   bool user_mode)
+                                   bool user_mode, bool in_guest)
 {
        const char *level, *sevstr, *subtype;
        static const char *mc_ue_types[] = {
@@ -387,7 +387,9 @@ void machine_check_print_event_info(struct machine_check_event *evt,
               evt->disposition == MCE_DISPOSITION_RECOVERED ?
               "Recovered" : "Not recovered");
 
-       if (user_mode) {
+       if (in_guest) {
+               printk("%s  Guest NIP: %016llx\n", level, evt->srr0);
+       } else if (user_mode) {
                printk("%s  NIP: [%016llx] PID: %d Comm: %s\n", level,
                        evt->srr0, current->pid, current->comm);
        } else {
index 53b202415395f79ceb6705620240678efe510252..a3d5318f5d1e9a9e2654525cfa65059a232982b8 100644 (file)
@@ -1216,7 +1216,7 @@ static int kvmppc_handle_exit_hv(struct kvm_run *run, struct kvm_vcpu *vcpu,
                break;
        case BOOK3S_INTERRUPT_MACHINE_CHECK:
                /* Print the MCE event to host console. */
-               machine_check_print_event_info(&vcpu->arch.mce_evt, false);
+               machine_check_print_event_info(&vcpu->arch.mce_evt, false, true);
 
                /*
                 * If the guest can do FWNMI, exit to userspace so it can
@@ -1406,7 +1406,7 @@ static int kvmppc_handle_nested_exit(struct kvm_run *run, struct kvm_vcpu *vcpu)
                /* Pass the machine check to the L1 guest */
                r = RESUME_HOST;
                /* Print the MCE event to host console. */
-               machine_check_print_event_info(&vcpu->arch.mce_evt, false);
+               machine_check_print_event_info(&vcpu->arch.mce_evt, false, true);
                break;
        /*
         * We get these next two if the guest accesses a page which it thinks
index 79586f127521349784ccba896ee6635bdd8d0bbb..05c85be0370f95b147db897665dc6c633e0e8eb5 100644 (file)
@@ -587,7 +587,7 @@ int opal_machine_check(struct pt_regs *regs)
                       evt.version);
                return 0;
        }
-       machine_check_print_event_info(&evt, user_mode(regs));
+       machine_check_print_event_info(&evt, user_mode(regs), false);
 
        if (opal_recover_mce(regs, &evt))
                return 1;