Skip to contentSkip to conversation

powerpc/powernv: report error messages from opal

RFC PATCH In review Oliver O'Halloran 3 participants 6 messages Dec 21, 2016 – Jul 7, 2017 1 message not in the archive PowerPC

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

RFC PATCH 1/1 powerpc/powernv: report error messages from opal

Recent versions of skiboot will raise an OPAL event (read: interrupt) when firmware writes an error message to its internal console. In conjunction they provide an OPAL call that the kernel can use to extract these messages from the OPAL log to allow them to be written into the kernel's log buffer where someone will (hopefully) look at them.

For the companion skiboot patches see:

	https://lists.ozlabs.org/pipermail/skiboot/2016-December/005861.html
---
 arch/powerpc/include/asm/opal-api.h            |  5 +++-
 arch/powerpc/include/asm/opal.h                |  1 +
 arch/powerpc/platforms/powernv/opal-msglog.c   | 41 ++++++++++++++++++++++++++
 arch/powerpc/platforms/powernv/opal-wrappers.S |  1 +
 4 files changed, 47 insertions(+), 1 deletion(-)
arch/powerpc/include/asm/opal-api.h +4 -1
index 0e2e57bcab50..cb9c0e6afb33 100644
@@ -167,7 +167,8 @@
 #define OPAL_INT_EOI				124
 #define OPAL_INT_SET_MFRR			125
 #define OPAL_PCI_TCE_KILL			126
-#define OPAL_LAST				126
+#define OPAL_SCRAPE_LOG				128
+#define OPAL_LAST				128
 
 /* Device tree flags */
 
@@ -288,6 +289,7 @@ enum OpalPendingState {
 	OPAL_EVENT_PCI_ERROR	   = 0x200,
 	OPAL_EVENT_DUMP_AVAIL	   = 0x400,
 	OPAL_EVENT_MSG_PENDING	   = 0x800,
+	OPAL_EVENT_LOG_PENDING	   = 0x1000,
 };
 
 enum OpalThreadStatus {
@@ -406,6 +408,7 @@ enum opal_msg_type {
 	OPAL_MSG_DPO		= 5,
 	OPAL_MSG_PRD		= 6,
 	OPAL_MSG_OCC		= 7,
+	OPAL_MSG_LOG		= 8,
 	OPAL_MSG_TYPE_MAX,
 };
 
arch/powerpc/include/asm/opal.h +1 -0
index 5c7db0f1a708..2b3bd3219fb4 100644
@@ -232,6 +232,7 @@ int64_t opal_pci_tce_kill(uint64_t phb_id, uint32_t kill_type,
 int64_t opal_rm_pci_tce_kill(uint64_t phb_id, uint32_t kill_type,
 			     uint32_t pe_num, uint32_t tce_size,
 			     uint64_t dma_addr, uint32_t npages);
+int64_t opal_scrape_log(int64_t *offset, char *buf, int64_t len, int64_t *lvl);
 
 /* Internal functions */
 extern int early_init_dt_scan_opal(unsigned long node, const char *uname,
arch/powerpc/platforms/powernv/opal-msglog.c +41 -0

61 lines not on this page · raw message

arch/powerpc/platforms/powernv/opal-wrappers.S +1 -0
index 3aa40f1b20f5..c59d7da3fd1a 100644
@@ -312,3 +312,4 @@ OPAL_CALL(opal_int_set_mfrr,			OPAL_INT_SET_MFRR);
 OPAL_CALL_REAL(opal_rm_int_set_mfrr,		OPAL_INT_SET_MFRR);
 OPAL_CALL(opal_pci_tce_kill,			OPAL_PCI_TCE_KILL);
 OPAL_CALL_REAL(opal_rm_pci_tce_kill,		OPAL_PCI_TCE_KILL);
+OPAL_CALL(opal_scrape_log,			OPAL_SCRAPE_LOG);
Signature · 1 line
2.7.4
#2 lore raw
Quoted 23 lines · Oliver O'Halloran

Recent versions of skiboot will raise an OPAL event (read: interrupt) when firmware writes an error message to its internal console. In conjunction they provide an OPAL call that the kernel can use to extract these messages from the OPAL log to allow them to be written into the kernel's log buffer where someone will (hopefully) look at them.

For the companion skiboot patches see:

	https://lists.ozlabs.org/pipermail/skiboot/2016-December/005861.html
---
 arch/powerpc/include/asm/opal-api.h            |  5 +++-
 arch/powerpc/include/asm/opal.h                |  1 +
 arch/powerpc/platforms/powernv/opal-msglog.c   | 41 ++++++++++++++++++++++++++
 arch/powerpc/platforms/powernv/opal-wrappers.S |  1 +
 4 files changed, 47 insertions(+), 1 deletion(-)
arch/powerpc/include/asm/opal-api.h +0 -0
index 0e2e57bcab50..cb9c0e6afb33 100644

arch/powerpc/include/asm/opal-api.h line 170

Quoted 5 lines
arch/powerpc/include/asm/opal-api.h +1 -1
@@ -167,7 +167,8 @@
 #define OPAL_INT_EOI				124
 #define OPAL_INT_SET_MFRR			125
 #define OPAL_PCI_TCE_KILL			126
-#define OPAL_LAST				126
+#define OPAL_SCRAPE_LOG				128

(another thought, along with the skiboot thoughts), I don't like the SCRAPE_LOG name so much, as it's more of a "hey linux, here's some log messages from firmware, possibly before you were involved"... OPAL_FETCH_LOG ?

Signature · 2 lines
Stewart Smith
OPAL Architect, IBM.
#3 lore raw
Quoted 16 lines · Stewart Smith

arch/powerpc/include/asm/opal-api.h line 170

Quoted 10 lines · Oliver O'Halloran
arch/powerpc/include/asm/opal-api.h +1 -1
index 0e2e57bcab50..cb9c0e6afb33 100644
@@ -167,7 +167,8 @@
 #define OPAL_INT_EOI				124
 #define OPAL_INT_SET_MFRR			125
 #define OPAL_PCI_TCE_KILL			126
-#define OPAL_LAST				126
+#define OPAL_SCRAPE_LOG				128

(another thought, along with the skiboot thoughts), I don't like the SCRAPE_LOG name so much, as it's more of a "hey linux, here's some log messages from firmware, possibly before you were involved"... OPAL_FETCH_LOG ?

I'm not a huge fan of an interrupt followed by an opal call just to fetch a single line of log.

Can't we do something more like the existing msglog code, where we have a ring buffer and then the interrupt just becomes "hey Linux you should look at your ring buffer".

cheers

#4 lore raw
Quoted 18 lines · Michael Ellerman
Quoted 16 lines · Stewart Smith

arch/powerpc/include/asm/opal-api.h line 170

Quoted 10 lines · Oliver O'Halloran
arch/powerpc/include/asm/opal-api.h +1 -1
index 0e2e57bcab50..cb9c0e6afb33 100644
@@ -167,7 +167,8 @@
 #define OPAL_INT_EOI				124
 #define OPAL_INT_SET_MFRR			125
 #define OPAL_PCI_TCE_KILL			126
-#define OPAL_LAST				126
+#define OPAL_SCRAPE_LOG				128

(another thought, along with the skiboot thoughts), I don't like the SCRAPE_LOG name so much, as it's more of a "hey linux, here's some log messages from firmware, possibly before you were involved"... OPAL_FETCH_LOG ?

Quoted 6 lines

I'm not a huge fan of an interrupt followed by an opal call just to fetch a single line of log.

Can't we do something more like the existing msglog code, where we have a ring buffer and then the interrupt just becomes "hey Linux you should look at your ring buffer".

Yeah... that would probably be a bit better...

Although that would mean we can only ever tell the running kernel what's in the ring buffer. We couldn't work out a way to (after kexec) resend important bits of info such as "we garded things out, your OCC didn't start and we trained everything at really slow speeds"

Signature · 2 lines
Stewart Smith
OPAL Architect, IBM.
author
#5 lore raw
Quoted 26 lines · Stewart Smith
Quoted 18 lines · Michael Ellerman
Quoted 16 lines · Stewart Smith

arch/powerpc/include/asm/opal-api.h line 170

Quoted 10 lines · Oliver O'Halloran
arch/powerpc/include/asm/opal-api.h +1 -1
index 0e2e57bcab50..cb9c0e6afb33 100644
@@ -167,7 +167,8 @@
 #define OPAL_INT_EOI                               124
 #define OPAL_INT_SET_MFRR                  125
 #define OPAL_PCI_TCE_KILL                  126
-#define OPAL_LAST                          126
+#define OPAL_SCRAPE_LOG                            128

(another thought, along with the skiboot thoughts), I don't like the SCRAPE_LOG name so much, as it's more of a "hey linux, here's some log messages from firmware, possibly before you were involved"... OPAL_FETCH_LOG ?

Quoted 6 lines

I'm not a huge fan of an interrupt followed by an opal call just to fetch a single line of log.

Can't we do something more like the existing msglog code, where we have a ring buffer and then the interrupt just becomes "hey Linux you should look at your ring buffer".

Quoted 6 lines

Yeah... that would probably be a bit better...

Although that would mean we can only ever tell the running kernel what's in the ring buffer. We couldn't work out a way to (after kexec) resend important bits of info such as "we garded things out, your OCC didn't start and we trained everything at really slow speeds"

Isn't this is the use case for BMC based error logs? A ring buffer is fundamentally a structure for transient data. There's no real way to hack in permanence other than making sure that making sure it never fills.

author
#6 lore raw
In reply to Michael Ellerman
Quoted 18 lines · Michael Ellerman
Quoted 16 lines · Stewart Smith

arch/powerpc/include/asm/opal-api.h line 170

Quoted 10 lines · Oliver O'Halloran
arch/powerpc/include/asm/opal-api.h +1 -1
index 0e2e57bcab50..cb9c0e6afb33 100644
@@ -167,7 +167,8 @@
 #define OPAL_INT_EOI                                124
 #define OPAL_INT_SET_MFRR                   125
 #define OPAL_PCI_TCE_KILL                   126
-#define OPAL_LAST                           126
+#define OPAL_SCRAPE_LOG                             128

(another thought, along with the skiboot thoughts), I don't like the SCRAPE_LOG name so much, as it's more of a "hey linux, here's some log messages from firmware, possibly before you were involved"... OPAL_FETCH_LOG ?

Quoted 6 lines

I'm not a huge fan of an interrupt followed by an opal call just to fetch a single line of log.

Can't we do something more like the existing msglog code, where we have a ring buffer and then the interrupt just becomes "hey Linux you should look at your ring buffer".

eh... personally I don't see the overhead of the OPAL call as being important. OPAL errors are infrequent and there's no need to make fetching OPAL errors fast.

I think we have a bit of a recurring problem where we make random Skiboot implementation details into part of the OPAL ABI. There is *no* reason the kernel should care about the skiboot log format so I'd rather we just kept the details of parsing it inside of Skiboot. I'm open to suggestions of how to improve the interface, but I think we should keep it.

oliver