qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ppc/spapr: Set the effective address provided flag in mc error log.
@ 2020-03-17 12:29 Mahesh Salgaonkar
  2020-03-17 15:51 ` no-reply
  0 siblings, 1 reply; 4+ messages in thread
From: Mahesh Salgaonkar @ 2020-03-17 12:29 UTC (permalink / raw)
  To: Qemu-ppc
  Cc: Alexey Kardashevskiy, Greg Kurz, Nicholas Piggin, Qemu-devel,
	Ganesh Goudar, David Gibson

Per PAPR, it is expected to set effective address provided flag in
sub_err_type member of mc extended error log (i.e
rtas_event_log_v6_mc.sub_err_type). This somehow got missed in original
fwnmi-mce patch series. Hence guest fails to extract effective address from
mce rtas log. This patch fixes that.

Without this patch guest MCE logs fails print DAR value:

[   11.933608] Disabling lock debugging due to kernel taint
[   11.933773] MCE: CPU0: machine check (Severe) Host TLB Multihit [Recovered]
[   11.933979] MCE: CPU0: NIP: [c000000000090b34] radix__flush_tlb_range_psize+0x194/0xf00
[   11.934223] MCE: CPU0: Initiator CPU
[   11.934341] MCE: CPU0: Unknown

After the change:

[   22.454149] Disabling lock debugging due to kernel taint
[   22.454316] MCE: CPU0: machine check (Severe) Host TLB Multihit DAR: deadbeefdeadbeef [Recovered]
[   22.454605] MCE: CPU0: NIP: [c0000000003e5804] kmem_cache_alloc+0x84/0x330
[   22.454820] MCE: CPU0: Initiator CPU
[   22.454944] MCE: CPU0: Unknown


Signed-off-by: Mahesh Salgaonkar <mahesh@linux.ibm.com>
---
 hw/ppc/spapr_events.c |   26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/hw/ppc/spapr_events.c b/hw/ppc/spapr_events.c
index 8b32b7eea5..98a32a2e2e 100644
--- a/hw/ppc/spapr_events.c
+++ b/hw/ppc/spapr_events.c
@@ -243,6 +243,14 @@ struct rtas_event_log_v6_mc {
 #define RTAS_LOG_V6_MC_TLB_PARITY                        1
 #define RTAS_LOG_V6_MC_TLB_MULTIHIT                      2
 #define RTAS_LOG_V6_MC_TLB_INDETERMINATE                 3
+/*
+ * Per PAPR,
+ * For UE error type, set bit 1 of sub_err_type to indicate effective addr is
+ * provided. For other error types (SLB/ERAT/TLB), set bit 0 to indicate
+ * same.
+ */
+#define RTAS_LOG_V6_MC_UE_EA_ADDR_PROVIDED               0x40
+#define RTAS_LOG_V6_MC_EA_ADDR_PROVIDED                  0x80
     uint8_t reserved_1[6];
     uint64_t effective_address;
     uint64_t logical_address;
@@ -726,6 +734,22 @@ void spapr_hotplug_req_remove_by_count_indexed(SpaprDrcType drc_type,
                             RTAS_LOG_V6_HP_ACTION_REMOVE, drc_type, &drc_id);
 }
 
+static void spapr_mc_set_ea_provided_flag(struct mc_extended_log *ext_elog)
+{
+	switch (ext_elog->mc.error_type) {
+	case RTAS_LOG_V6_MC_TYPE_UE:
+		ext_elog->mc.sub_err_type |= RTAS_LOG_V6_MC_UE_EA_ADDR_PROVIDED;
+		break;
+	case RTAS_LOG_V6_MC_TYPE_SLB:
+	case RTAS_LOG_V6_MC_TYPE_ERAT:
+	case RTAS_LOG_V6_MC_TYPE_TLB:
+		ext_elog->mc.sub_err_type |= RTAS_LOG_V6_MC_EA_ADDR_PROVIDED;
+		break;
+	default:
+		break;
+	}
+}
+
 static uint32_t spapr_mce_get_elog_type(PowerPCCPU *cpu, bool recovered,
                                         struct mc_extended_log *ext_elog)
 {
@@ -751,6 +775,7 @@ static uint32_t spapr_mce_get_elog_type(PowerPCCPU *cpu, bool recovered,
             ext_elog->mc.sub_err_type = mc_derror_table[i].error_subtype;
             if (mc_derror_table[i].dar_valid) {
                 ext_elog->mc.effective_address = cpu_to_be64(env->spr[SPR_DAR]);
+                spapr_mc_set_ea_provided_flag(ext_elog);
             }
 
             summary |= mc_derror_table[i].initiator
@@ -769,6 +794,7 @@ static uint32_t spapr_mce_get_elog_type(PowerPCCPU *cpu, bool recovered,
             ext_elog->mc.sub_err_type = mc_ierror_table[i].error_subtype;
             if (mc_ierror_table[i].nip_valid) {
                 ext_elog->mc.effective_address = cpu_to_be64(env->nip);
+                spapr_mc_set_ea_provided_flag(ext_elog);
             }
 
             summary |= mc_ierror_table[i].initiator



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] ppc/spapr: Set the effective address provided flag in mc error log.
  2020-03-17 12:29 [PATCH] ppc/spapr: Set the effective address provided flag in mc error log Mahesh Salgaonkar
@ 2020-03-17 15:51 ` no-reply
  2020-03-17 16:11   ` Greg Kurz
  0 siblings, 1 reply; 4+ messages in thread
From: no-reply @ 2020-03-17 15:51 UTC (permalink / raw)
  To: mahesh; +Cc: aik, groug, npiggin, qemu-devel, ganeshgr, qemu-ppc, david

Patchew URL: https://patchew.org/QEMU/158444819283.31599.12155058652686614304.stgit@jupiter/



Hi,

This series seems to have some coding style problems. See output below for
more information:

Subject: [PATCH] ppc/spapr: Set the effective address provided flag in mc error log.
Message-id: 158444819283.31599.12155058652686614304.stgit@jupiter
Type: series

=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===

Switched to a new branch 'test'
62d8ada ppc/spapr: Set the effective address provided flag in mc error log.

=== OUTPUT BEGIN ===
ERROR: code indent should never use tabs
#57: FILE: hw/ppc/spapr_events.c:739:
+^Iswitch (ext_elog->mc.error_type) {$

ERROR: code indent should never use tabs
#58: FILE: hw/ppc/spapr_events.c:740:
+^Icase RTAS_LOG_V6_MC_TYPE_UE:$

ERROR: code indent should never use tabs
#59: FILE: hw/ppc/spapr_events.c:741:
+^I^Iext_elog->mc.sub_err_type |= RTAS_LOG_V6_MC_UE_EA_ADDR_PROVIDED;$

ERROR: code indent should never use tabs
#60: FILE: hw/ppc/spapr_events.c:742:
+^I^Ibreak;$

ERROR: code indent should never use tabs
#61: FILE: hw/ppc/spapr_events.c:743:
+^Icase RTAS_LOG_V6_MC_TYPE_SLB:$

ERROR: code indent should never use tabs
#62: FILE: hw/ppc/spapr_events.c:744:
+^Icase RTAS_LOG_V6_MC_TYPE_ERAT:$

ERROR: code indent should never use tabs
#63: FILE: hw/ppc/spapr_events.c:745:
+^Icase RTAS_LOG_V6_MC_TYPE_TLB:$

ERROR: code indent should never use tabs
#64: FILE: hw/ppc/spapr_events.c:746:
+^I^Iext_elog->mc.sub_err_type |= RTAS_LOG_V6_MC_EA_ADDR_PROVIDED;$

ERROR: code indent should never use tabs
#65: FILE: hw/ppc/spapr_events.c:747:
+^I^Ibreak;$

ERROR: code indent should never use tabs
#66: FILE: hw/ppc/spapr_events.c:748:
+^Idefault:$

ERROR: code indent should never use tabs
#67: FILE: hw/ppc/spapr_events.c:749:
+^I^Ibreak;$

ERROR: code indent should never use tabs
#68: FILE: hw/ppc/spapr_events.c:750:
+^I}$

total: 12 errors, 0 warnings, 50 lines checked

Commit 62d8adac0688 (ppc/spapr: Set the effective address provided flag in mc error log.) has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
=== OUTPUT END ===

Test command exited with code: 1


The full log is available at
http://patchew.org/logs/158444819283.31599.12155058652686614304.stgit@jupiter/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ppc/spapr: Set the effective address provided flag in mc error log.
  2020-03-17 15:51 ` no-reply
@ 2020-03-17 16:11   ` Greg Kurz
  2020-03-18  4:06     ` Mahesh J Salgaonkar
  0 siblings, 1 reply; 4+ messages in thread
From: Greg Kurz @ 2020-03-17 16:11 UTC (permalink / raw)
  To: mahesh; +Cc: aik, qemu-devel, npiggin, ganeshgr, qemu-ppc, david

On Tue, 17 Mar 2020 08:51:50 -0700 (PDT)
no-reply@patchew.org wrote:

> Patchew URL: https://patchew.org/QEMU/158444819283.31599.12155058652686614304.stgit@jupiter/
> 
> 
> 
> Hi,
> 
> This series seems to have some coding style problems. See output below for
> more information:
> 
> Subject: [PATCH] ppc/spapr: Set the effective address provided flag in mc error log.
> Message-id: 158444819283.31599.12155058652686614304.stgit@jupiter
> Type: series
> 
> === TEST SCRIPT BEGIN ===
> #!/bin/bash
> git rev-parse base > /dev/null || exit 0
> git config --local diff.renamelimit 0
> git config --local diff.renames True
> git config --local diff.algorithm histogram
> ./scripts/checkpatch.pl --mailback base..
> === TEST SCRIPT END ===
> 
> Switched to a new branch 'test'
> 62d8ada ppc/spapr: Set the effective address provided flag in mc error log.
> 
> === OUTPUT BEGIN ===
> ERROR: code indent should never use tabs
> #57: FILE: hw/ppc/spapr_events.c:739:
> +^Iswitch (ext_elog->mc.error_type) {$
> 

Yeah no tabs allowed in the QEMU code (see CODING_STYLE.rst).

If your editor is emacs, you can consider setting these:

  (setq indent-tabs-mode nil)
  (setq c-basic-offset 4))

> ERROR: code indent should never use tabs
> #58: FILE: hw/ppc/spapr_events.c:740:
> +^Icase RTAS_LOG_V6_MC_TYPE_UE:$
> 
> ERROR: code indent should never use tabs
> #59: FILE: hw/ppc/spapr_events.c:741:
> +^I^Iext_elog->mc.sub_err_type |= RTAS_LOG_V6_MC_UE_EA_ADDR_PROVIDED;$
> 
> ERROR: code indent should never use tabs
> #60: FILE: hw/ppc/spapr_events.c:742:
> +^I^Ibreak;$
> 
> ERROR: code indent should never use tabs
> #61: FILE: hw/ppc/spapr_events.c:743:
> +^Icase RTAS_LOG_V6_MC_TYPE_SLB:$
> 
> ERROR: code indent should never use tabs
> #62: FILE: hw/ppc/spapr_events.c:744:
> +^Icase RTAS_LOG_V6_MC_TYPE_ERAT:$
> 
> ERROR: code indent should never use tabs
> #63: FILE: hw/ppc/spapr_events.c:745:
> +^Icase RTAS_LOG_V6_MC_TYPE_TLB:$
> 
> ERROR: code indent should never use tabs
> #64: FILE: hw/ppc/spapr_events.c:746:
> +^I^Iext_elog->mc.sub_err_type |= RTAS_LOG_V6_MC_EA_ADDR_PROVIDED;$
> 
> ERROR: code indent should never use tabs
> #65: FILE: hw/ppc/spapr_events.c:747:
> +^I^Ibreak;$
> 
> ERROR: code indent should never use tabs
> #66: FILE: hw/ppc/spapr_events.c:748:
> +^Idefault:$
> 
> ERROR: code indent should never use tabs
> #67: FILE: hw/ppc/spapr_events.c:749:
> +^I^Ibreak;$
> 
> ERROR: code indent should never use tabs
> #68: FILE: hw/ppc/spapr_events.c:750:
> +^I}$
> 
> total: 12 errors, 0 warnings, 50 lines checked
> 
> Commit 62d8adac0688 (ppc/spapr: Set the effective address provided flag in mc error log.) has style problems, please review.  If any of these errors
> are false positives report them to the maintainer, see
> CHECKPATCH in MAINTAINERS.
> === OUTPUT END ===
> 
> Test command exited with code: 1
> 
> 
> The full log is available at
> http://patchew.org/logs/158444819283.31599.12155058652686614304.stgit@jupiter/testing.checkpatch/?type=message.
> ---
> Email generated automatically by Patchew [https://patchew.org/].
> Please send your feedback to patchew-devel@redhat.com


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ppc/spapr: Set the effective address provided flag in mc error log.
  2020-03-17 16:11   ` Greg Kurz
@ 2020-03-18  4:06     ` Mahesh J Salgaonkar
  0 siblings, 0 replies; 4+ messages in thread
From: Mahesh J Salgaonkar @ 2020-03-18  4:06 UTC (permalink / raw)
  To: Greg Kurz; +Cc: aik, qemu-devel, npiggin, ganeshgr, qemu-ppc, david

On 2020-03-17 17:11:22 Tue, Greg Kurz wrote:
> On Tue, 17 Mar 2020 08:51:50 -0700 (PDT)
> no-reply@patchew.org wrote:
> 
> > Patchew URL: https://patchew.org/QEMU/158444819283.31599.12155058652686614304.stgit@jupiter/
> > 
> > 
> > 
> > Hi,
> > 
> > This series seems to have some coding style problems. See output below for
> > more information:
> > 
> > Subject: [PATCH] ppc/spapr: Set the effective address provided flag in mc error log.
> > Message-id: 158444819283.31599.12155058652686614304.stgit@jupiter
> > Type: series
> > 
> > === TEST SCRIPT BEGIN ===
> > #!/bin/bash
> > git rev-parse base > /dev/null || exit 0
> > git config --local diff.renamelimit 0
> > git config --local diff.renames True
> > git config --local diff.algorithm histogram
> > ./scripts/checkpatch.pl --mailback base..
> > === TEST SCRIPT END ===
> > 
> > Switched to a new branch 'test'
> > 62d8ada ppc/spapr: Set the effective address provided flag in mc error log.
> > 
> > === OUTPUT BEGIN ===
> > ERROR: code indent should never use tabs
> > #57: FILE: hw/ppc/spapr_events.c:739:
> > +^Iswitch (ext_elog->mc.error_type) {$
> > 
> 
> Yeah no tabs allowed in the QEMU code (see CODING_STYLE.rst).
> 
> If your editor is emacs, you can consider setting these:
> 
>   (setq indent-tabs-mode nil)
>   (setq c-basic-offset 4))

My bad. Will fix it and respin v2.

Thanks,
-Mahesh.



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-03-18  4:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-03-17 12:29 [PATCH] ppc/spapr: Set the effective address provided flag in mc error log Mahesh Salgaonkar
2020-03-17 15:51 ` no-reply
2020-03-17 16:11   ` Greg Kurz
2020-03-18  4:06     ` Mahesh J Salgaonkar

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).