Skip to contentSkip to conversation

powerpc/pseries: Parse control memory access error

PATCH Superseded Ganesh Goudar 3 participants 14 messages Aug 5, 2021 – Aug 27, 2021

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/3 powerpc/pseries: Parse control memory access error

Add support to parse and log control memory access error for pseries.

---
v2: No changes in this patch.

---
 arch/powerpc/platforms/pseries/ras.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
arch/powerpc/platforms/pseries/ras.c +21 -0
index 167f2e1b8d39..608c35cad0c3 100644
@@ -80,6 +80,7 @@ struct pseries_mc_errorlog {
 #define MC_ERROR_TYPE_TLB		0x04
 #define MC_ERROR_TYPE_D_CACHE		0x05
 #define MC_ERROR_TYPE_I_CACHE		0x07
+#define MC_ERROR_TYPE_CTRL_MEM_ACCESS	0x08
 
 /* RTAS pseries MCE error sub types */
 #define MC_ERROR_UE_INDETERMINATE		0
@@ -103,6 +104,9 @@ struct pseries_mc_errorlog {
 #define MC_ERROR_TLB_MULTIHIT		2
 #define MC_ERROR_TLB_INDETERMINATE	3
 
+#define MC_ERROR_CTRL_MEM_ACCESS_PTABLE_WALK	0
+#define MC_ERROR_CTRL_MEM_ACCESS_OP_ACCESS	1
+
 static inline u8 rtas_mc_error_sub_type(const struct pseries_mc_errorlog *mlog)
 {
 	switch (mlog->error_type) {
@@ -112,6 +116,8 @@ static inline u8 rtas_mc_error_sub_type(const struct pseries_mc_errorlog *mlog)
 	case	MC_ERROR_TYPE_ERAT:
 	case	MC_ERROR_TYPE_TLB:
 		return (mlog->sub_err_type & 0x03);
+	case	MC_ERROR_TYPE_CTRL_MEM_ACCESS:
+		return (mlog->sub_err_type & 0x70) >> 4;
 	default:
 		return 0;
 	}
@@ -699,6 +705,21 @@ static int mce_handle_err_virtmode(struct pt_regs *regs,
 	case MC_ERROR_TYPE_I_CACHE:
 		mce_err.error_type = MCE_ERROR_TYPE_ICACHE;
 		break;
+	case MC_ERROR_TYPE_CTRL_MEM_ACCESS:
+		mce_err.error_type = MCE_ERROR_TYPE_RA;
+		if (mce_log->sub_err_type & 0x80)
+			eaddr = be64_to_cpu(mce_log->effective_address);
+		switch (err_sub_type) {
+		case MC_ERROR_CTRL_MEM_ACCESS_PTABLE_WALK:
+			mce_err.u.ra_error_type =
+				MCE_RA_ERROR_PAGE_TABLE_WALK_LOAD_STORE_FOREIGN;
+			break;
+		case MC_ERROR_CTRL_MEM_ACCESS_OP_ACCESS:
+			mce_err.u.ra_error_type =
+				MCE_RA_ERROR_LOAD_STORE_FOREIGN;
+			break;
+		}
+		break;
 	case MC_ERROR_TYPE_UNKNOWN:
 	default:
 		mce_err.error_type = MCE_ERROR_TYPE_UNKNOWN;
Signature · 1 line
2.31.1
#1 lore raw

PATCH v2 2/3 selftests/powerpc: Add test for real address error handling

Add test for real address or control memory address access error handling, using NX-GZIP engine.

The error is injected by accessing the control memory address using illegal instruction, on successful handling the process attempting to access control memory address using illegal instruction receives SIGBUS.

---
v2: Fix build error.

---
 tools/testing/selftests/powerpc/Makefile      |  3 +-
 tools/testing/selftests/powerpc/mce/Makefile  |  6 +++
 .../selftests/powerpc/mce/inject-ra-err.c     | 42 +++++++++++++++++++
 .../selftests/powerpc/mce/inject-ra-err.sh    | 18 ++++++++
 tools/testing/selftests/powerpc/mce/vas-api.h |  1 +
 5 files changed, 69 insertions(+), 1 deletion(-)
 create mode 100644 tools/testing/selftests/powerpc/mce/Makefile
 create mode 100644 tools/testing/selftests/powerpc/mce/inject-ra-err.c
 create mode 100755 tools/testing/selftests/powerpc/mce/inject-ra-err.sh
 create mode 120000 tools/testing/selftests/powerpc/mce/vas-api.h
tools/testing/selftests/powerpc/Makefile +2 -1
index 0830e63818c1..4830372d7416 100644
@@ -31,7 +31,8 @@ SUB_DIRS = alignment		\
 	   vphn         \
 	   math		\
 	   ptrace	\
-	   security
+	   security	\
+	   mce
 
 endif
 
tools/testing/selftests/powerpc/mce/Makefile new file +6 -0
new file mode 100644
index 000000000000..0f537ce86370
@@ -0,0 +1,6 @@
+#SPDX-License-Identifier: GPL-2.0-or-later
+
+TEST_PROGS := inject-ra-err.sh
+TEST_GEN_FILES := inject-ra-err
+
+include ../../lib.mk
tools/testing/selftests/powerpc/mce/inject-ra-err.c new file +42 -0

42 lines not on this page · raw message

tools/testing/selftests/powerpc/mce/inject-ra-err.sh new file +18 -0
new file mode 100755
index 000000000000..3633cdc651a1
@@ -0,0 +1,18 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+if [[ ! -w /dev/crypto/nx-gzip ]]; then
+	echo "WARN: Can't access /dev/crypto/nx-gzip, skipping"
+	exit 0
+fi
+
+timeout 5 ./inject-ra-err
+
+# 128 + 7 (SIGBUS) = 135, 128 is a exit code with special meaning.
+if [ $? -ne 135 ]; then
+	echo "FAILED: Real address or Control memory access error not handled"
+	exit $?
+fi
+
+echo "OK: Real address or Control memory access error is handled"
+exit 0
tools/testing/selftests/powerpc/mce/vas-api.h new file +1 -0
new file mode 120000
index 000000000000..1455c1bcd351
@@ -0,0 +1 @@
+../../../../../arch/powerpc/include/uapi/asm/vas-api.h
\ No newline at end of file
Signature · 1 line
2.31.1
#2 lore raw

Re: [PATCH v2 2/3] selftests/powerpc: Add test for real address error handling

Quoted 7 lines · Ganesh Goudar

Add test for real address or control memory address access error handling, using NX-GZIP engine.

The error is injected by accessing the control memory address using illegal instruction, on successful handling the process attempting to access control memory address using illegal instruction receives SIGBUS.

...

Quoted 14 lines
tools/testing/selftests/powerpc/mce/inject-ra-err.sh new file +8 -0
new file mode 100755
index 000000000000..3633cdc651a1
@@ -0,0 +1,18 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+if [[ ! -w /dev/crypto/nx-gzip ]]; then
+	echo "WARN: Can't access /dev/crypto/nx-gzip, skipping"
+	exit 0
+fi
+

tools/testing/selftests/powerpc/mce/inject-ra-err.sh line 18

Quoted 10 lines
tools/testing/selftests/powerpc/mce/inject-ra-err.sh new file +10 -0
+timeout 5 ./inject-ra-err
+
+# 128 + 7 (SIGBUS) = 135, 128 is a exit code with special meaning.
+if [ $? -ne 135 ]; then
+	echo "FAILED: Real address or Control memory access error not handled"
+	exit $?
+fi
+
+echo "OK: Real address or Control memory access error is handled"
+exit 0

I don't think we really need the shell script, we should be able to do all that in the C code.

Can you try this?

cheers

tools/testing/selftests/powerpc/mce/Makefile new file +7 -0
new file mode 100644
index 000000000000..2424513982d9
@@ -0,0 +1,7 @@
+#SPDX-License-Identifier: GPL-2.0-or-later
+
+TEST_GEN_PROGS := inject-ra-err
+
+include ../../lib.mk
+
+$(TEST_GEN_PROGS): ../harness.c
tools/testing/selftests/powerpc/mce/inject-ra-err.c new file +64 -0

64 lines not on this page · raw message

author
#3 lore raw

Re: [PATCH v2 2/3] selftests/powerpc: Add test for real address error handling

Quoted 37 lines · Michael Ellerman
Quoted 7 lines · Ganesh Goudar

Add test for real address or control memory address access error handling, using NX-GZIP engine.

The error is injected by accessing the control memory address using illegal instruction, on successful handling the process attempting to access control memory address using illegal instruction receives SIGBUS.

...

Quoted 14 lines
tools/testing/selftests/powerpc/mce/inject-ra-err.sh new file +8 -0
new file mode 100755
index 000000000000..3633cdc651a1
@@ -0,0 +1,18 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+if [[ ! -w /dev/crypto/nx-gzip ]]; then
+	echo "WARN: Can't access /dev/crypto/nx-gzip, skipping"
+	exit 0
+fi
+

tools/testing/selftests/powerpc/mce/inject-ra-err.sh line 18

Quoted 10 lines
tools/testing/selftests/powerpc/mce/inject-ra-err.sh new file +10 -0
+timeout 5 ./inject-ra-err
+
+# 128 + 7 (SIGBUS) = 135, 128 is a exit code with special meaning.
+if [ $? -ne 135 ]; then
+	echo "FAILED: Real address or Control memory access error not handled"
+	exit $?
+fi
+
+echo "OK: Real address or Control memory access error is handled"
+exit 0

I don't think we really need the shell script, we should be able to do all that in the C code.

Quoted 1 line

Can you try this?

it works!, We need to set timeout, with 120 sec timeout we may flood the dmesg. Thanks.

Quoted 86 lines

cheers

tools/testing/selftests/powerpc/mce/Makefile new file +7 -0
new file mode 100644
index 000000000000..2424513982d9
@@ -0,0 +1,7 @@
+#SPDX-License-Identifier: GPL-2.0-or-later
+
+TEST_GEN_PROGS := inject-ra-err
+
+include ../../lib.mk
+
+$(TEST_GEN_PROGS): ../harness.c
tools/testing/selftests/powerpc/mce/inject-ra-err.c new file +64 -0
new file mode 100644
index 000000000000..ba0f9c28f786
@@ -0,0 +1,64 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include <errno.h>
+#include <fcntl.h>
+#include <signal.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/ioctl.h>
+#include <sys/mman.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+#include "vas-api.h"
+#include "utils.h"
+
+static bool faulted;
+
+static void sigbus_handler(int n, siginfo_t *info, void *ctxt_v)
+{
+	ucontext_t *ctxt = (ucontext_t *)ctxt_v;
+	struct pt_regs *regs = ctxt->uc_mcontext.regs;
+
+	faulted = true;
+	regs->nip += 4;
+}
+
+static int test_ra_error(void)
+{
+	struct vas_tx_win_open_attr attr;
+	int fd, *paste_addr;
+	char *devname = "/dev/crypto/nx-gzip";
+	struct sigaction act = {
+		.sa_sigaction = sigbus_handler,
+		.sa_flags = SA_SIGINFO,
+	};
+
+	memset(&attr, 0, sizeof(attr));
+	attr.version = 1;
+	attr.vas_id = 0;
+
+	SKIP_IF(!access(devname, F_OK));
+
+	fd = open(devname, O_RDWR);
+	FAIL_IF(fd < 0);
+	FAIL_IF(ioctl(fd, VAS_TX_WIN_OPEN, &attr) < 0);
+	FAIL_IF(sigaction(SIGBUS, &act, NULL) != 0);
+
+	paste_addr = mmap(NULL, 4096, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0ULL);
+
+	/* The following assignment triggers exception */
+	mb();
+	*paste_addr = 1;
+	mb();
+
+	FAIL_IF(!faulted);
+
+	return 0;
+}
+
+int main(void)
+{
+	return test_harness(test_ra_error, "inject-ra-err");
+}
#4 lore raw

Re: [PATCH v2 2/3] selftests/powerpc: Add test for real address error handling

Quoted 39 lines · Ganesh
Quoted 37 lines · Michael Ellerman
Quoted 7 lines · Ganesh Goudar

Add test for real address or control memory address access error handling, using NX-GZIP engine.

The error is injected by accessing the control memory address using illegal instruction, on successful handling the process attempting to access control memory address using illegal instruction receives SIGBUS.

...

Quoted 14 lines
tools/testing/selftests/powerpc/mce/inject-ra-err.sh new file +8 -0
new file mode 100755
index 000000000000..3633cdc651a1
@@ -0,0 +1,18 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+if [[ ! -w /dev/crypto/nx-gzip ]]; then
+	echo "WARN: Can't access /dev/crypto/nx-gzip, skipping"
+	exit 0
+fi
+

tools/testing/selftests/powerpc/mce/inject-ra-err.sh line 18

Quoted 10 lines
tools/testing/selftests/powerpc/mce/inject-ra-err.sh new file +10 -0
+timeout 5 ./inject-ra-err
+
+# 128 + 7 (SIGBUS) = 135, 128 is a exit code with special meaning.
+if [ $? -ne 135 ]; then
+	echo "FAILED: Real address or Control memory access error not handled"
+	exit $?
+fi
+
+echo "OK: Real address or Control memory access error is handled"
+exit 0

I don't think we really need the shell script, we should be able to do all that in the C code.

Quoted 3 lines
Quoted 1 line

Can you try this?

it works!, We need to set timeout, with 120 sec timeout we may flood the dmesg.

Hmm. Does it keep faulting? The regs->nip += 4 is meant to avoid that.

cheers

author
#5 lore raw

Re: [PATCH v2 2/3] selftests/powerpc: Add test for real address error handling

Quoted 40 lines · Michael Ellerman
Quoted 39 lines · Ganesh
Quoted 37 lines · Michael Ellerman
Quoted 7 lines · Ganesh Goudar

Add test for real address or control memory address access error handling, using NX-GZIP engine.

The error is injected by accessing the control memory address using illegal instruction, on successful handling the process attempting to access control memory address using illegal instruction receives SIGBUS.

...

Quoted 14 lines
tools/testing/selftests/powerpc/mce/inject-ra-err.sh new file +8 -0
new file mode 100755
index 000000000000..3633cdc651a1
@@ -0,0 +1,18 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+if [[ ! -w /dev/crypto/nx-gzip ]]; then
+	echo "WARN: Can't access /dev/crypto/nx-gzip, skipping"
+	exit 0
+fi
+

tools/testing/selftests/powerpc/mce/inject-ra-err.sh line 18

Quoted 10 lines
tools/testing/selftests/powerpc/mce/inject-ra-err.sh new file +10 -0
+timeout 5 ./inject-ra-err
+
+# 128 + 7 (SIGBUS) = 135, 128 is a exit code with special meaning.
+if [ $? -ne 135 ]; then
+	echo "FAILED: Real address or Control memory access error not handled"
+	exit $?
+fi
+
+echo "OK: Real address or Control memory access error is handled"
+exit 0

I don't think we really need the shell script, we should be able to do all that in the C code.

Quoted 3 lines
Quoted 2 lines
Quoted 1 line

Can you try this?

it works!, We need to set timeout, with 120 sec timeout we may flood the dmesg.

Hmm. Does it keep faulting? The regs->nip += 4 is meant to avoid that.

Yes, it keeps faulting, if we fail to handle and not send SIGBUS to the process.

Quoted 2 lines

cheers

#6 lore raw

PATCH v2 3/3 powerpc/mce: Modify the real address error logging messages

In reply to Ganesh Goudar

To avoid ambiguity, modify the strings in real address error logging messages to "foreign/control memory" from "foreign", Since the error discriptions in P9 user manual and P10 user manual are different for same type of errors.

P9 User Manual for MCE:
DSISR:59 Host real address to foreign space during translation. DSISR:60 Host real address to foreign space on a load or store
access.

P10 User Manual for MCE:
DSISR:59 D-side tablewalk used a host real address in the
control memory address range.
DSISR:60 D-side operand access to control memory address space.

---
v2: No changes in this patch.

---
 arch/powerpc/kernel/mce.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
arch/powerpc/kernel/mce.c +4 -4
index 47a683cd00d2..f3ef480bb739 100644
@@ -388,14 +388,14 @@ void machine_check_print_event_info(struct machine_check_event *evt,
 	static const char *mc_ra_types[] = {
 		"Indeterminate",
 		"Instruction fetch (bad)",
-		"Instruction fetch (foreign)",
+		"Instruction fetch (foreign/control memory)",
 		"Page table walk ifetch (bad)",
-		"Page table walk ifetch (foreign)",
+		"Page table walk ifetch (foreign/control memory)",
 		"Load (bad)",
 		"Store (bad)",
 		"Page table walk Load/Store (bad)",
-		"Page table walk Load/Store (foreign)",
-		"Load/Store (foreign)",
+		"Page table walk Load/Store (foreign/control memory)",
+		"Load/Store (foreign/control memory)",
 	};
 	static const char *mc_link_types[] = {
 		"Indeterminate",
Signature · 1 line
2.31.1
author
#7 lore raw
In reply to Ganesh Goudar

Hi mpe, Any comments on this patchset?

Quoted 63 lines · Ganesh Goudar

Add support to parse and log control memory access error for pseries.

---
v2: No changes in this patch.

---
  arch/powerpc/platforms/pseries/ras.c | 21 +++++++++++++++++++++
  1 file changed, 21 insertions(+)
arch/powerpc/platforms/pseries/ras.c +21 -0
index 167f2e1b8d39..608c35cad0c3 100644
@@ -80,6 +80,7 @@ struct pseries_mc_errorlog {
  #define MC_ERROR_TYPE_TLB		0x04
  #define MC_ERROR_TYPE_D_CACHE		0x05
  #define MC_ERROR_TYPE_I_CACHE		0x07
+#define MC_ERROR_TYPE_CTRL_MEM_ACCESS	0x08
 
  /* RTAS pseries MCE error sub types */
  #define MC_ERROR_UE_INDETERMINATE		0
@@ -103,6 +104,9 @@ struct pseries_mc_errorlog {
  #define MC_ERROR_TLB_MULTIHIT		2
  #define MC_ERROR_TLB_INDETERMINATE	3
 
+#define MC_ERROR_CTRL_MEM_ACCESS_PTABLE_WALK	0
+#define MC_ERROR_CTRL_MEM_ACCESS_OP_ACCESS	1
+
  static inline u8 rtas_mc_error_sub_type(const struct pseries_mc_errorlog *mlog)
  {
  	switch (mlog->error_type) {
@@ -112,6 +116,8 @@ static inline u8 rtas_mc_error_sub_type(const struct pseries_mc_errorlog *mlog)
  	case	MC_ERROR_TYPE_ERAT:
  	case	MC_ERROR_TYPE_TLB:
  		return (mlog->sub_err_type & 0x03);
+	case	MC_ERROR_TYPE_CTRL_MEM_ACCESS:
+		return (mlog->sub_err_type & 0x70) >> 4;
  	default:
  		return 0;
  	}
@@ -699,6 +705,21 @@ static int mce_handle_err_virtmode(struct pt_regs *regs,
  	case MC_ERROR_TYPE_I_CACHE:
  		mce_err.error_type = MCE_ERROR_TYPE_ICACHE;
  		break;
+	case MC_ERROR_TYPE_CTRL_MEM_ACCESS:
+		mce_err.error_type = MCE_ERROR_TYPE_RA;
+		if (mce_log->sub_err_type & 0x80)
+			eaddr = be64_to_cpu(mce_log->effective_address);
+		switch (err_sub_type) {
+		case MC_ERROR_CTRL_MEM_ACCESS_PTABLE_WALK:
+			mce_err.u.ra_error_type =
+				MCE_RA_ERROR_PAGE_TABLE_WALK_LOAD_STORE_FOREIGN;
+			break;
+		case MC_ERROR_CTRL_MEM_ACCESS_OP_ACCESS:
+			mce_err.u.ra_error_type =
+				MCE_RA_ERROR_LOAD_STORE_FOREIGN;
+			break;
+		}
+		break;
  	case MC_ERROR_TYPE_UNKNOWN:
  	default:
  		mce_err.error_type = MCE_ERROR_TYPE_UNKNOWN;
#8 lore raw
In reply to Ganesh Goudar

Hi Ganesh,

Some comments below ...

Quoted 19 lines · Ganesh Goudar

Add support to parse and log control memory access error for pseries.

---
v2: No changes in this patch.

---
 arch/powerpc/platforms/pseries/ras.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
arch/powerpc/platforms/pseries/ras.c +1 -0
index 167f2e1b8d39..608c35cad0c3 100644
@@ -80,6 +80,7 @@ struct pseries_mc_errorlog {
 #define MC_ERROR_TYPE_TLB		0x04
 #define MC_ERROR_TYPE_D_CACHE		0x05
 #define MC_ERROR_TYPE_I_CACHE		0x07
+#define MC_ERROR_TYPE_CTRL_MEM_ACCESS	0x08

...

arch/powerpc/platforms/pseries/ras.c struct pseries_mc_errorlog { · line 108

Quoted 3 lines
arch/powerpc/platforms/pseries/ras.c +2 -0
+#define MC_ERROR_CTRL_MEM_ACCESS_PTABLE_WALK	0
+#define MC_ERROR_CTRL_MEM_ACCESS_OP_ACCESS	1

Where do the above values come from?

arch/powerpc/platforms/pseries/ras.c static inline u8 rtas_mc_error_sub_type(const struct pseries_mc_errorlog *mlog) · line 120

Quoted 10 lines
arch/powerpc/platforms/pseries/ras.c +3 -0
+
 static inline u8 rtas_mc_error_sub_type(const struct pseries_mc_errorlog *mlog)
 {
 	switch (mlog->error_type) {
@@ -112,6 +116,8 @@ static inline u8 rtas_mc_error_sub_type(const struct pseries_mc_errorlog *mlog)
 	case	MC_ERROR_TYPE_ERAT:
 	case	MC_ERROR_TYPE_TLB:
 		return (mlog->sub_err_type & 0x03);
+	case	MC_ERROR_TYPE_CTRL_MEM_ACCESS:
+		return (mlog->sub_err_type & 0x70) >> 4;

Can you add to the comment above sub_err_type explaining what these bits are.

arch/powerpc/platforms/pseries/ras.c static int mce_handle_err_virtmode(struct pt_regs *regs, · line 710

Quoted 10 lines
arch/powerpc/platforms/pseries/ras.c +3 -0
 	default:
 		return 0;
 	}
@@ -699,6 +705,21 @@ static int mce_handle_err_virtmode(struct pt_regs *regs,
 	case MC_ERROR_TYPE_I_CACHE:
 		mce_err.error_type = MCE_ERROR_TYPE_ICACHE;
 		break;
+	case MC_ERROR_TYPE_CTRL_MEM_ACCESS:
+		mce_err.error_type = MCE_ERROR_TYPE_RA;
+		if (mce_log->sub_err_type & 0x80)

This appears many times in the file.

Can we add eg. MC_EFFECTIVE_ADDR_PROVIDED?

arch/powerpc/platforms/pseries/ras.c static int mce_handle_err_virtmode(struct pt_regs *regs, · line 715

Quoted 5 lines
arch/powerpc/platforms/pseries/ras.c +5 -0
+			eaddr = be64_to_cpu(mce_log->effective_address);
+		switch (err_sub_type) {
+		case MC_ERROR_CTRL_MEM_ACCESS_PTABLE_WALK:
+			mce_err.u.ra_error_type =
+				MCE_RA_ERROR_PAGE_TABLE_WALK_LOAD_STORE_FOREIGN;

That name is ridiculously long, but I guess that's not your fault :) We can fix it up in a later patch.

arch/powerpc/platforms/pseries/ras.c static int mce_handle_err_virtmode(struct pt_regs *regs, · line 722

Quoted 7 lines
arch/powerpc/platforms/pseries/ras.c +7 -0
+			break;
+		case MC_ERROR_CTRL_MEM_ACCESS_OP_ACCESS:
+			mce_err.u.ra_error_type =
+				MCE_RA_ERROR_LOAD_STORE_FOREIGN;
+			break;
+		}
+		break;

cheers

#9 lore raw
Quoted 6 lines · Michael Ellerman

arch/powerpc/platforms/pseries/ras.c static int mce_handle_err_virtmode(struct pt_regs *regs, · line 715

Quoted 3 lines
arch/powerpc/platforms/pseries/ras.c +3 -0
+		case MC_ERROR_CTRL_MEM_ACCESS_PTABLE_WALK:
+			mce_err.u.ra_error_type =
+				MCE_RA_ERROR_PAGE_TABLE_WALK_LOAD_STORE_FOREIGN;

That name is ridiculously long, but I guess that's not your fault :) We can fix it up in a later patch.

It also has surprisingly little information content for the 47 chars length it has :-) What does this even mean?!

Segher

author
#10 lore raw
Quoted 8 lines · Segher Boessenkool
Quoted 5 lines · Michael Ellerman

arch/powerpc/platforms/pseries/ras.c static int mce_handle_err_virtmode(struct pt_regs *regs, · line 715

Quoted 3 lines
arch/powerpc/platforms/pseries/ras.c +3 -0
+		case MC_ERROR_CTRL_MEM_ACCESS_PTABLE_WALK:
+			mce_err.u.ra_error_type =
+				MCE_RA_ERROR_PAGE_TABLE_WALK_LOAD_STORE_FOREIGN;

That name is ridiculously long, but I guess that's not your fault :) We can fix it up in a later patch.

It also has surprisingly little information content for the 47 chars length it has :-) What does this even mean?!

It means control memory access error/real address error is detected during page table walk.

Quoted 2 lines

Segher

#11 lore raw
Quoted 8 lines · Ganesh
Quoted 6 lines · Segher Boessenkool
Quoted 5 lines · Michael Ellerman

arch/powerpc/platforms/pseries/ras.c static int mce_handle_err_virtmode(struct pt_regs *regs, · line 715

Quoted 3 lines
arch/powerpc/platforms/pseries/ras.c +3 -0
+		case MC_ERROR_CTRL_MEM_ACCESS_PTABLE_WALK:
+			mce_err.u.ra_error_type =
+			 MCE_RA_ERROR_PAGE_TABLE_WALK_LOAD_STORE_FOREIGN;

That name is ridiculously long, but I guess that's not your fault :) We can fix it up in a later patch.

Quoted 6 lines
Quoted 2 lines

It also has surprisingly little information content for the 47 chars length it has :-) What does this even mean?!

It means control memory access error/real address error is detected during page
table walk.

This isn't obvious from the name. The name contains some words your explanation does not, as well: LOAD, STORE, FOREIGN. Most importantly, the name is just a jumble of words, with no apparent connection between them.

I didn't ask for an explanation, sorry if you misunderstood. I was just exploring the many ways this name is baffling :-)

Segher

author
#12 lore raw
In reply to Michael Ellerman
Quoted 26 lines · Michael Ellerman

Hi Ganesh,

Some comments below ...

Quoted 19 lines · Ganesh Goudar

Add support to parse and log control memory access error for pseries.

---
v2: No changes in this patch.

---
  arch/powerpc/platforms/pseries/ras.c | 21 +++++++++++++++++++++
  1 file changed, 21 insertions(+)
arch/powerpc/platforms/pseries/ras.c +1 -0
index 167f2e1b8d39..608c35cad0c3 100644
@@ -80,6 +80,7 @@ struct pseries_mc_errorlog {
  #define MC_ERROR_TYPE_TLB		0x04
  #define MC_ERROR_TYPE_D_CACHE		0x05
  #define MC_ERROR_TYPE_I_CACHE		0x07
+#define MC_ERROR_TYPE_CTRL_MEM_ACCESS	0x08

...

Quoted 1 line
Quoted 4 lines

arch/powerpc/platforms/pseries/ras.c struct pseries_mc_errorlog { · line 108

Quoted 2 lines
arch/powerpc/platforms/pseries/ras.c +2 -0
+#define MC_ERROR_CTRL_MEM_ACCESS_PTABLE_WALK	0
+#define MC_ERROR_CTRL_MEM_ACCESS_OP_ACCESS	1

Where do the above values come from?

It is from latest PAPR that added support for control memory error.

Quoted 11 lines

arch/powerpc/platforms/pseries/ras.c static inline u8 rtas_mc_error_sub_type(const struct pseries_mc_errorlog *mlog) · line 120

Quoted 10 lines
arch/powerpc/platforms/pseries/ras.c +3 -0
+
  static inline u8 rtas_mc_error_sub_type(const struct pseries_mc_errorlog *mlog)
  {
  	switch (mlog->error_type) {
@@ -112,6 +116,8 @@ static inline u8 rtas_mc_error_sub_type(const struct pseries_mc_errorlog *mlog)
  	case	MC_ERROR_TYPE_ERAT:
  	case	MC_ERROR_TYPE_TLB:
  		return (mlog->sub_err_type & 0x03);
+	case	MC_ERROR_TYPE_CTRL_MEM_ACCESS:
+		return (mlog->sub_err_type & 0x70) >> 4;

Can you add to the comment above sub_err_type explaining what these bits are.

Sure, for other errors it is explained in pseries_mc_errorlog definition, ill add it there.

Quoted 12 lines

arch/powerpc/platforms/pseries/ras.c static int mce_handle_err_virtmode(struct pt_regs *regs, · line 710

Quoted 10 lines
arch/powerpc/platforms/pseries/ras.c +3 -0
  	default:
  		return 0;
  	}
@@ -699,6 +705,21 @@ static int mce_handle_err_virtmode(struct pt_regs *regs,
  	case MC_ERROR_TYPE_I_CACHE:
  		mce_err.error_type = MCE_ERROR_TYPE_ICACHE;
  		break;
+	case MC_ERROR_TYPE_CTRL_MEM_ACCESS:
+		mce_err.error_type = MCE_ERROR_TYPE_RA;
+		if (mce_log->sub_err_type & 0x80)

This appears many times in the file.

Quoted 1 line

Can we add eg. MC_EFFECTIVE_ADDR_PROVIDED?

ok, thanks.

Quoted 16 lines

arch/powerpc/platforms/pseries/ras.c static int mce_handle_err_virtmode(struct pt_regs *regs, · line 715

Quoted 5 lines
arch/powerpc/platforms/pseries/ras.c +5 -0
+			eaddr = be64_to_cpu(mce_log->effective_address);
+		switch (err_sub_type) {
+		case MC_ERROR_CTRL_MEM_ACCESS_PTABLE_WALK:
+			mce_err.u.ra_error_type =
+				MCE_RA_ERROR_PAGE_TABLE_WALK_LOAD_STORE_FOREIGN;

That name is ridiculously long, but I guess that's not your fault :) We can fix it up in a later patch.

arch/powerpc/platforms/pseries/ras.c static int mce_handle_err_virtmode(struct pt_regs *regs, · line 722

Quoted 7 lines
arch/powerpc/platforms/pseries/ras.c +7 -0
+			break;
+		case MC_ERROR_CTRL_MEM_ACCESS_OP_ACCESS:
+			mce_err.u.ra_error_type =
+				MCE_RA_ERROR_LOAD_STORE_FOREIGN;
+			break;
+		}
+		break;

cheers

#13 lore raw
Quoted 23 lines · Ganesh
Quoted 22 lines · Michael Ellerman
Quoted 19 lines · Ganesh Goudar

Add support to parse and log control memory access error for pseries.

---
v2: No changes in this patch.

---
  arch/powerpc/platforms/pseries/ras.c | 21 +++++++++++++++++++++
  1 file changed, 21 insertions(+)
arch/powerpc/platforms/pseries/ras.c +1 -0
index 167f2e1b8d39..608c35cad0c3 100644
@@ -80,6 +80,7 @@ struct pseries_mc_errorlog {
  #define MC_ERROR_TYPE_TLB		0x04
  #define MC_ERROR_TYPE_D_CACHE		0x05
  #define MC_ERROR_TYPE_I_CACHE		0x07
+#define MC_ERROR_TYPE_CTRL_MEM_ACCESS	0x08

...

Quoted 1 line
Quoted 6 lines
Quoted 4 lines

arch/powerpc/platforms/pseries/ras.c struct pseries_mc_errorlog { · line 108

Quoted 2 lines
arch/powerpc/platforms/pseries/ras.c +2 -0
+#define MC_ERROR_CTRL_MEM_ACCESS_PTABLE_WALK	0
+#define MC_ERROR_CTRL_MEM_ACCESS_OP_ACCESS	1

Where do the above values come from?

It is from latest PAPR that added support for control memory error.

Please cite the version of the document and the section number in the change log.

cheers