Skip to contentSkip to conversation

mm, memory-failure: clarify error message

PATCH Superseded Jane Chu 4 participants 6 messages May 17, 2019 – May 21, 2019

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Jane Chu

author
#0 lore raw

PATCH 1/1 mm, memory-failure: clarify error message

Some user who install SIGBUS handler that does longjmp out therefore keeping the process alive is confused by the error message
"[188988.765862] Memory failure: 0x1840200: Killing
cellsrv:33395 due to hardware memory corruption"
Slightly modify the error message to improve clarity.

---
 mm/memory-failure.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
mm/memory-failure.c +4 -3
index fc8b517..14de5e2 100644
@@ -216,10 +216,9 @@ static int kill_proc(struct to_kill *tk, unsigned long pfn, int flags)
 	short addr_lsb = tk->size_shift;
 	int ret;
 
-	pr_err("Memory failure: %#lx: Killing %s:%d due to hardware memory corruption\n",
-		pfn, t->comm, t->pid);
-
 	if ((flags & MF_ACTION_REQUIRED) && t->mm == current->mm) {
+		pr_err("Memory failure: %#lx: Killing %s:%d due to hardware memory "
+			"corruption\n", pfn, t->comm, t->pid);
 		ret = force_sig_mceerr(BUS_MCEERR_AR, (void __user *)tk->addr,
 				       addr_lsb, current);
 	} else {
@@ -229,6 +228,8 @@ static int kill_proc(struct to_kill *tk, unsigned long pfn, int flags)
 		 * This could cause a loop when the user sets SIGBUS
 		 * to SIG_IGN, but hopefully no one will do that?
 		 */
+		pr_err("Memory failure: %#lx: Sending SIGBUS to %s:%d due to hardware "
+			"memory corruption\n", pfn, t->comm, t->pid);
 		ret = send_sig_mceerr(BUS_MCEERR_AO, (void __user *)tk->addr,
 				      addr_lsb, t);  /* synchronous? */
 	}
Signature · 6 lines
1.8.3.1

_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm
#1 lore raw
Quoted 1 line · Jane Chu

Some user who install SIGBUS handler that does longjmp out

What the longjmp about ? Are you referring to the mechanism of catching the signal which was registered ?

Quoted 4 lines

therefore keeping the process alive is confused by the error message
"[188988.765862] Memory failure: 0x1840200: Killing
cellsrv:33395 due to hardware memory corruption"

Its a valid point because those are two distinct actions.

Quoted 25 lines

Slightly modify the error message to improve clarity.

---
 mm/memory-failure.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
mm/memory-failure.c +2 -3
index fc8b517..14de5e2 100644
@@ -216,10 +216,9 @@ static int kill_proc(struct to_kill *tk, unsigned long pfn, int flags)
 	short addr_lsb = tk->size_shift;
 	int ret;
 
-	pr_err("Memory failure: %#lx: Killing %s:%d due to hardware memory corruption\n",
-		pfn, t->comm, t->pid);
-
 	if ((flags & MF_ACTION_REQUIRED) && t->mm == current->mm) {
+		pr_err("Memory failure: %#lx: Killing %s:%d due to hardware memory "
+			"corruption\n", pfn, t->comm, t->pid);
 		ret = force_sig_mceerr(BUS_MCEERR_AR, (void __user *)tk->addr,
 				       addr_lsb, current);
 	} else {

mm/memory-failure.c static int kill_proc(struct to_kill *tk, unsigned long pfn, int flags) · line 234

Quoted 7 lines
mm/memory-failure.c +2 -0
@@ -229,6 +228,8 @@ static int kill_proc(struct to_kill *tk, unsigned long pfn, int flags)
 		 * This could cause a loop when the user sets SIGBUS
 		 * to SIG_IGN, but hopefully no one will do that?
 		 */
+		pr_err("Memory failure: %#lx: Sending SIGBUS to %s:%d due to hardware "
+			"memory corruption\n", pfn, t->comm, t->pid);
 		ret = send_sig_mceerr(BUS_MCEERR_AO, (void __user *)tk->addr,
 				      addr_lsb, t);  /* synchronous? */

As both the pr_err() messages are very similar, could not we just switch between "Killing" and "Sending SIGBUS to" based on a variable e.g action_[kill|sigbus] evaluated previously with ((flags & MF_ACTION_REQUIRED) && t->mm == current->mm).
_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm

maintainer
#5 lore raw
In reply to Jane Chu
Quoted 17 lines · Jane Chu

Some user who install SIGBUS handler that does longjmp out therefore keeping the process alive is confused by the error message
"[188988.765862] Memory failure: 0x1840200: Killing
cellsrv:33395 due to hardware memory corruption"
Slightly modify the error message to improve clarity.

---
 mm/memory-failure.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
mm/memory-failure.c +0 -0
index fc8b517..14de5e2 100644

mm/memory-failure.c static int kill_proc(struct to_kill *tk, unsigned long pfn, int flags) · line 221

Quoted 9 lines
mm/memory-failure.c +2 -3
@@ -216,10 +216,9 @@ static int kill_proc(struct to_kill *tk, unsigned long pfn, int flags)
 	short addr_lsb = tk->size_shift;
 	int ret;
 
-	pr_err("Memory failure: %#lx: Killing %s:%d due to hardware memory corruption\n",
-		pfn, t->comm, t->pid);
-
 	if ((flags & MF_ACTION_REQUIRED) && t->mm == current->mm) {
+		pr_err("Memory failure: %#lx: Killing %s:%d due to hardware memory "
+			"corruption\n", pfn, t->comm, t->pid);

Minor nit, but the string shouldn't be split over multiple lines to preserve grep-ability. In such a case it is usually considered OK to exceed 80 characters for the line if needed.

mm/memory-failure.c static int kill_proc(struct to_kill *tk, unsigned long pfn, int flags) · line 235

Quoted 12 lines
mm/memory-failure.c +2 -0
 		ret = force_sig_mceerr(BUS_MCEERR_AR, (void __user *)tk->addr,
 				       addr_lsb, current);
 	} else {
@@ -229,6 +228,8 @@ static int kill_proc(struct to_kill *tk, unsigned long pfn, int flags)
 		 * This could cause a loop when the user sets SIGBUS
 		 * to SIG_IGN, but hopefully no one will do that?
 		 */
+		pr_err("Memory failure: %#lx: Sending SIGBUS to %s:%d due to hardware "
+			"memory corruption\n", pfn, t->comm, t->pid);
 		ret = send_sig_mceerr(BUS_MCEERR_AO, (void __user *)tk->addr,
 				      addr_lsb, t);  /* synchronous? */
 	}

_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm

#2 lore raw
In reply to Anshuman Khandual
Quoted 7 lines · Anshuman Khandual
Quoted 1 line · Jane Chu

Some user who install SIGBUS handler that does longjmp out

What the longjmp about ? Are you referring to the mechanism of catching the signal which was registered ?

AFAIK, longjmp() might be useful for signal-based retrying, so highly optimized applications like Oracle DB might want to utilize it to handle memory errors in application level, I guess.

Quoted 36 lines
Quoted 5 lines

therefore keeping the process alive is confused by the error message
"[188988.765862] Memory failure: 0x1840200: Killing
cellsrv:33395 due to hardware memory corruption"

Its a valid point because those are two distinct actions.

Quoted 28 lines

Slightly modify the error message to improve clarity.

---
 mm/memory-failure.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
mm/memory-failure.c +2 -3
index fc8b517..14de5e2 100644
@@ -216,10 +216,9 @@ static int kill_proc(struct to_kill *tk, unsigned long pfn, int flags)
 	short addr_lsb = tk->size_shift;
 	int ret;
 
-	pr_err("Memory failure: %#lx: Killing %s:%d due to hardware memory corruption\n",
-		pfn, t->comm, t->pid);
-
 	if ((flags & MF_ACTION_REQUIRED) && t->mm == current->mm) {
+		pr_err("Memory failure: %#lx: Killing %s:%d due to hardware memory "
+			"corruption\n", pfn, t->comm, t->pid);
 		ret = force_sig_mceerr(BUS_MCEERR_AR, (void __user *)tk->addr,
 				       addr_lsb, current);
 	} else {
@@ -229,6 +228,8 @@ static int kill_proc(struct to_kill *tk, unsigned long pfn, int flags)
 		 * This could cause a loop when the user sets SIGBUS
 		 * to SIG_IGN, but hopefully no one will do that?
 		 */
Quoted 8 lines

mm/memory-failure.c static int kill_proc(struct to_kill *tk, unsigned long pfn, int flags) · line 234

Quoted 4 lines
mm/memory-failure.c +2 -0
+		pr_err("Memory failure: %#lx: Sending SIGBUS to %s:%d due to hardware "
+			"memory corruption\n", pfn, t->comm, t->pid);
 		ret = send_sig_mceerr(BUS_MCEERR_AO, (void __user *)tk->addr,
 				      addr_lsb, t);  /* synchronous? */

As both the pr_err() messages are very similar, could not we just switch between "Killing" and "Sending SIGBUS to" based on a variable e.g action_[kill|sigbus] evaluated previously with ((flags & MF_ACTION_REQUIRED) && t->mm == current->mm).

That might need additional if sentence, which I'm not sure worth doing. I think that the simplest fix for the reported problem (a confusing message) is like below:

- pr_err("Memory failure: %#lx: Killing %s:%d due to hardware memory corruption\n",
+ pr_err("Memory failure: %#lx: Sending SIGBUS to %s:%d due to hardware memory corruption\n",
pfn, t->comm, t->pid);

Or, if we have a good reason to separate the message for MF_ACTION_REQUIRED and MF_ACTION_OPTIONAL, that might be OK.

Thanks,
Naoya Horiguchi

author
#3 lore raw

Thanks Vishal and Naoya!

-jane

Quoted 64 lines · Naoya Horiguchi
Quoted 5 lines · Anshuman Khandual
Quoted 1 line · Jane Chu

Some user who install SIGBUS handler that does longjmp out

What the longjmp about ? Are you referring to the mechanism of catching the signal which was registered ?

AFAIK, longjmp() might be useful for signal-based retrying, so highly optimized applications like Oracle DB might want to utilize it to handle memory errors in application level, I guess.

Quoted 33 lines
Quoted 4 lines

therefore keeping the process alive is confused by the error message
"[188988.765862] Memory failure: 0x1840200: Killing
cellsrv:33395 due to hardware memory corruption"

Its a valid point because those are two distinct actions.

Quoted 27 lines

Slightly modify the error message to improve clarity.

---
  mm/memory-failure.c | 7 ++++---
  1 file changed, 4 insertions(+), 3 deletions(-)
mm/memory-failure.c +2 -3
index fc8b517..14de5e2 100644
@@ -216,10 +216,9 @@ static int kill_proc(struct to_kill *tk, unsigned long pfn, int flags)
  	short addr_lsb = tk->size_shift;
  	int ret;
 
-	pr_err("Memory failure: %#lx: Killing %s:%d due to hardware memory corruption\n",
-		pfn, t->comm, t->pid);
-
  	if ((flags & MF_ACTION_REQUIRED) && t->mm == current->mm) {
+		pr_err("Memory failure: %#lx: Killing %s:%d due to hardware memory "
+			"corruption\n", pfn, t->comm, t->pid);
  		ret = force_sig_mceerr(BUS_MCEERR_AR, (void __user *)tk->addr,
  				       addr_lsb, current);
  	} else {
@@ -229,6 +228,8 @@ static int kill_proc(struct to_kill *tk, unsigned long pfn, int flags)
  		 * This could cause a loop when the user sets SIGBUS
  		 * to SIG_IGN, but hopefully no one will do that?
Quoted 8 lines

mm/memory-failure.c static int kill_proc(struct to_kill *tk, unsigned long pfn, int flags) · line 234

Quoted 5 lines
mm/memory-failure.c +2 -0
  		 */
+		pr_err("Memory failure: %#lx: Sending SIGBUS to %s:%d due to hardware "
+			"memory corruption\n", pfn, t->comm, t->pid);
  		ret = send_sig_mceerr(BUS_MCEERR_AO, (void __user *)tk->addr,
  				      addr_lsb, t);  /* synchronous? */

As both the pr_err() messages are very similar, could not we just switch between "Killing" and "Sending SIGBUS to" based on a variable e.g action_[kill|sigbus] evaluated previously with ((flags & MF_ACTION_REQUIRED) && t->mm == current->mm).

That might need additional if sentence, which I'm not sure worth doing. I think that the simplest fix for the reported problem (a confusing message) is like below:

- pr_err("Memory failure: %#lx: Killing %s:%d due to hardware memory corruption\n",
+ pr_err("Memory failure: %#lx: Sending SIGBUS to %s:%d due to hardware memory corruption\n",
pfn, t->comm, t->pid);

Or, if we have a good reason to separate the message for MF_ACTION_REQUIRED and MF_ACTION_OPTIONAL, that might be OK.

Thanks,
Naoya Horiguchi

author
#4 lore raw
In reply to Anshuman Khandual
Quoted 4 lines · Anshuman Khandual
Quoted 1 line · Jane Chu

Some user who install SIGBUS handler that does longjmp out

What the longjmp about ? Are you referring to the mechanism of catching the signal which was registered ?

Yes.

thanks,
-jane