Commit 495367c0 authored by Chen Yucong's avatar Chen Yucong Committed by Linus Torvalds

mm/memory-failure.c: replace "MCE" with "Memory failure"

HWPoison was specific to some particular x86 platforms.  And it is often
seen as high level machine check handler.  And therefore, 'MCE' is used
for the format prefix of printk().  However, 'PowerNV' has also used
HWPoison for handling memory errors[1], so 'MCE' is no longer suitable
to memory_failure.c.

Additionally, 'MCE' and 'Memory failure' have different context.  The
former belongs to exception context and the latter belongs to process
context.  Furthermore, HWPoison can also be used for off-lining those
sub-health pages that do not trigger any machine check exception.

This patch aims to replace 'MCE' with a more appropriate prefix.

[1] commit 75eb3d9b ("powerpc/powernv: Get FSP memory errors
and plumb into memory poison infrastructure.")
Signed-off-by: default avatarChen Yucong <slaoub@gmail.com>
Acked-by: default avatarNaoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 340a43be
...@@ -184,8 +184,8 @@ static int kill_proc(struct task_struct *t, unsigned long addr, int trapno, ...@@ -184,8 +184,8 @@ static int kill_proc(struct task_struct *t, unsigned long addr, int trapno,
struct siginfo si; struct siginfo si;
int ret; int ret;
pr_err("MCE %#lx: Killing %s:%d due to hardware memory corruption\n", pr_err("Memory failure: %#lx: Killing %s:%d due to hardware memory corruption\n",
pfn, t->comm, t->pid); pfn, t->comm, t->pid);
si.si_signo = SIGBUS; si.si_signo = SIGBUS;
si.si_errno = 0; si.si_errno = 0;
si.si_addr = (void *)addr; si.si_addr = (void *)addr;
...@@ -208,7 +208,7 @@ static int kill_proc(struct task_struct *t, unsigned long addr, int trapno, ...@@ -208,7 +208,7 @@ static int kill_proc(struct task_struct *t, unsigned long addr, int trapno,
ret = send_sig_info(SIGBUS, &si, t); /* synchronous? */ ret = send_sig_info(SIGBUS, &si, t); /* synchronous? */
} }
if (ret < 0) if (ret < 0)
pr_info("MCE: Error sending signal to %s:%d: %d\n", pr_info("Memory failure: Error sending signal to %s:%d: %d\n",
t->comm, t->pid, ret); t->comm, t->pid, ret);
return ret; return ret;
} }
...@@ -289,7 +289,7 @@ static void add_to_kill(struct task_struct *tsk, struct page *p, ...@@ -289,7 +289,7 @@ static void add_to_kill(struct task_struct *tsk, struct page *p,
} else { } else {
tk = kmalloc(sizeof(struct to_kill), GFP_ATOMIC); tk = kmalloc(sizeof(struct to_kill), GFP_ATOMIC);
if (!tk) { if (!tk) {
pr_err("MCE: Out of memory while machine check handling\n"); pr_err("Memory failure: Out of memory while machine check handling\n");
return; return;
} }
} }
...@@ -303,7 +303,7 @@ static void add_to_kill(struct task_struct *tsk, struct page *p, ...@@ -303,7 +303,7 @@ static void add_to_kill(struct task_struct *tsk, struct page *p,
* a SIGKILL because the error is not contained anymore. * a SIGKILL because the error is not contained anymore.
*/ */
if (tk->addr == -EFAULT) { if (tk->addr == -EFAULT) {
pr_info("MCE: Unable to find user space address %lx in %s\n", pr_info("Memory failure: Unable to find user space address %lx in %s\n",
page_to_pfn(p), tsk->comm); page_to_pfn(p), tsk->comm);
tk->addr_valid = 0; tk->addr_valid = 0;
} }
...@@ -334,7 +334,7 @@ static void kill_procs(struct list_head *to_kill, int forcekill, int trapno, ...@@ -334,7 +334,7 @@ static void kill_procs(struct list_head *to_kill, int forcekill, int trapno,
* signal and then access the memory. Just kill it. * signal and then access the memory. Just kill it.
*/ */
if (fail || tk->addr_valid == 0) { if (fail || tk->addr_valid == 0) {
pr_err("MCE %#lx: forcibly killing %s:%d because of failure to unmap corrupted page\n", pr_err("Memory failure: %#lx: forcibly killing %s:%d because of failure to unmap corrupted page\n",
pfn, tk->tsk->comm, tk->tsk->pid); pfn, tk->tsk->comm, tk->tsk->pid);
force_sig(SIGKILL, tk->tsk); force_sig(SIGKILL, tk->tsk);
} }
...@@ -347,7 +347,7 @@ static void kill_procs(struct list_head *to_kill, int forcekill, int trapno, ...@@ -347,7 +347,7 @@ static void kill_procs(struct list_head *to_kill, int forcekill, int trapno,
*/ */
else if (kill_proc(tk->tsk, tk->addr, trapno, else if (kill_proc(tk->tsk, tk->addr, trapno,
pfn, page, flags) < 0) pfn, page, flags) < 0)
pr_err("MCE %#lx: Cannot send advisory machine check signal to %s:%d\n", pr_err("Memory failure: %#lx: Cannot send advisory machine check signal to %s:%d\n",
pfn, tk->tsk->comm, tk->tsk->pid); pfn, tk->tsk->comm, tk->tsk->pid);
} }
put_task_struct(tk->tsk); put_task_struct(tk->tsk);
...@@ -559,7 +559,7 @@ static int me_kernel(struct page *p, unsigned long pfn) ...@@ -559,7 +559,7 @@ static int me_kernel(struct page *p, unsigned long pfn)
*/ */
static int me_unknown(struct page *p, unsigned long pfn) static int me_unknown(struct page *p, unsigned long pfn)
{ {
pr_err("MCE %#lx: Unknown page state\n", pfn); pr_err("Memory failure: %#lx: Unknown page state\n", pfn);
return MF_FAILED; return MF_FAILED;
} }
...@@ -604,11 +604,12 @@ static int me_pagecache_clean(struct page *p, unsigned long pfn) ...@@ -604,11 +604,12 @@ static int me_pagecache_clean(struct page *p, unsigned long pfn)
if (mapping->a_ops->error_remove_page) { if (mapping->a_ops->error_remove_page) {
err = mapping->a_ops->error_remove_page(mapping, p); err = mapping->a_ops->error_remove_page(mapping, p);
if (err != 0) { if (err != 0) {
pr_info("MCE %#lx: Failed to punch page: %d\n", pr_info("Memory failure: %#lx: Failed to punch page: %d\n",
pfn, err); pfn, err);
} else if (page_has_private(p) && } else if (page_has_private(p) &&
!try_to_release_page(p, GFP_NOIO)) { !try_to_release_page(p, GFP_NOIO)) {
pr_info("MCE %#lx: failed to release buffers\n", pfn); pr_info("Memory failure: %#lx: failed to release buffers\n",
pfn);
} else { } else {
ret = MF_RECOVERED; ret = MF_RECOVERED;
} }
...@@ -620,7 +621,8 @@ static int me_pagecache_clean(struct page *p, unsigned long pfn) ...@@ -620,7 +621,8 @@ static int me_pagecache_clean(struct page *p, unsigned long pfn)
if (invalidate_inode_page(p)) if (invalidate_inode_page(p))
ret = MF_RECOVERED; ret = MF_RECOVERED;
else else
pr_info("MCE %#lx: Failed to invalidate\n", pfn); pr_info("Memory failure: %#lx: Failed to invalidate\n",
pfn);
} }
return ret; return ret;
} }
...@@ -833,7 +835,7 @@ static void action_result(unsigned long pfn, enum mf_action_page_type type, ...@@ -833,7 +835,7 @@ static void action_result(unsigned long pfn, enum mf_action_page_type type,
{ {
trace_memory_failure_event(pfn, type, result); trace_memory_failure_event(pfn, type, result);
pr_err("MCE %#lx: recovery action for %s: %s\n", pr_err("Memory failure: %#lx: recovery action for %s: %s\n",
pfn, action_page_types[type], action_name[result]); pfn, action_page_types[type], action_name[result]);
} }
...@@ -849,7 +851,7 @@ static int page_action(struct page_state *ps, struct page *p, ...@@ -849,7 +851,7 @@ static int page_action(struct page_state *ps, struct page *p,
if (ps->action == me_swapcache_dirty && result == MF_DELAYED) if (ps->action == me_swapcache_dirty && result == MF_DELAYED)
count--; count--;
if (count != 0) { if (count != 0) {
pr_err("MCE %#lx: %s still referenced by %d users\n", pr_err("Memory failure: %#lx: %s still referenced by %d users\n",
pfn, action_page_types[ps->type], count); pfn, action_page_types[ps->type], count);
result = MF_FAILED; result = MF_FAILED;
} }
...@@ -882,7 +884,7 @@ int get_hwpoison_page(struct page *page) ...@@ -882,7 +884,7 @@ int get_hwpoison_page(struct page *page)
* tries to touch the "partially handled" page. * tries to touch the "partially handled" page.
*/ */
if (!PageAnon(head)) { if (!PageAnon(head)) {
pr_err("MCE: %#lx: non anonymous thp\n", pr_err("Memory failure: %#lx: non anonymous thp\n",
page_to_pfn(page)); page_to_pfn(page));
return 0; return 0;
} }
...@@ -892,7 +894,8 @@ int get_hwpoison_page(struct page *page) ...@@ -892,7 +894,8 @@ int get_hwpoison_page(struct page *page)
if (head == compound_head(page)) if (head == compound_head(page))
return 1; return 1;
pr_info("MCE: %#lx cannot catch tail\n", page_to_pfn(page)); pr_info("Memory failure: %#lx cannot catch tail\n",
page_to_pfn(page));
put_page(head); put_page(head);
} }
...@@ -931,12 +934,13 @@ static int hwpoison_user_mappings(struct page *p, unsigned long pfn, ...@@ -931,12 +934,13 @@ static int hwpoison_user_mappings(struct page *p, unsigned long pfn,
return SWAP_SUCCESS; return SWAP_SUCCESS;
if (PageKsm(p)) { if (PageKsm(p)) {
pr_err("MCE %#lx: can't handle KSM pages.\n", pfn); pr_err("Memory failure: %#lx: can't handle KSM pages.\n", pfn);
return SWAP_FAIL; return SWAP_FAIL;
} }
if (PageSwapCache(p)) { if (PageSwapCache(p)) {
pr_err("MCE %#lx: keeping poisoned page in swap cache\n", pfn); pr_err("Memory failure: %#lx: keeping poisoned page in swap cache\n",
pfn);
ttu |= TTU_IGNORE_HWPOISON; ttu |= TTU_IGNORE_HWPOISON;
} }
...@@ -954,7 +958,7 @@ static int hwpoison_user_mappings(struct page *p, unsigned long pfn, ...@@ -954,7 +958,7 @@ static int hwpoison_user_mappings(struct page *p, unsigned long pfn,
} else { } else {
kill = 0; kill = 0;
ttu |= TTU_IGNORE_HWPOISON; ttu |= TTU_IGNORE_HWPOISON;
pr_info("MCE %#lx: corrupted page was clean: dropped without side effects\n", pr_info("Memory failure: %#lx: corrupted page was clean: dropped without side effects\n",
pfn); pfn);
} }
} }
...@@ -972,7 +976,7 @@ static int hwpoison_user_mappings(struct page *p, unsigned long pfn, ...@@ -972,7 +976,7 @@ static int hwpoison_user_mappings(struct page *p, unsigned long pfn,
ret = try_to_unmap(hpage, ttu); ret = try_to_unmap(hpage, ttu);
if (ret != SWAP_SUCCESS) if (ret != SWAP_SUCCESS)
pr_err("MCE %#lx: failed to unmap page (mapcount=%d)\n", pr_err("Memory failure: %#lx: failed to unmap page (mapcount=%d)\n",
pfn, page_mapcount(hpage)); pfn, page_mapcount(hpage));
/* /*
...@@ -1040,14 +1044,16 @@ int memory_failure(unsigned long pfn, int trapno, int flags) ...@@ -1040,14 +1044,16 @@ int memory_failure(unsigned long pfn, int trapno, int flags)
panic("Memory failure from trap %d on page %lx", trapno, pfn); panic("Memory failure from trap %d on page %lx", trapno, pfn);
if (!pfn_valid(pfn)) { if (!pfn_valid(pfn)) {
pr_err("MCE %#lx: memory outside kernel control\n", pfn); pr_err("Memory failure: %#lx: memory outside kernel control\n",
pfn);
return -ENXIO; return -ENXIO;
} }
p = pfn_to_page(pfn); p = pfn_to_page(pfn);
orig_head = hpage = compound_head(p); orig_head = hpage = compound_head(p);
if (TestSetPageHWPoison(p)) { if (TestSetPageHWPoison(p)) {
pr_err("MCE %#lx: already hardware poisoned\n", pfn); pr_err("Memory failure: %#lx: already hardware poisoned\n",
pfn);
return 0; return 0;
} }
...@@ -1112,9 +1118,11 @@ int memory_failure(unsigned long pfn, int trapno, int flags) ...@@ -1112,9 +1118,11 @@ int memory_failure(unsigned long pfn, int trapno, int flags)
if (!PageAnon(hpage) || unlikely(split_huge_page(hpage))) { if (!PageAnon(hpage) || unlikely(split_huge_page(hpage))) {
unlock_page(hpage); unlock_page(hpage);
if (!PageAnon(hpage)) if (!PageAnon(hpage))
pr_err("MCE: %#lx: non anonymous thp\n", pfn); pr_err("Memory failure: %#lx: non anonymous thp\n",
pfn);
else else
pr_err("MCE: %#lx: thp split failed\n", pfn); pr_err("Memory failure: %#lx: thp split failed\n",
pfn);
if (TestClearPageHWPoison(p)) if (TestClearPageHWPoison(p))
num_poisoned_pages_sub(nr_pages); num_poisoned_pages_sub(nr_pages);
put_hwpoison_page(p); put_hwpoison_page(p);
...@@ -1178,7 +1186,7 @@ int memory_failure(unsigned long pfn, int trapno, int flags) ...@@ -1178,7 +1186,7 @@ int memory_failure(unsigned long pfn, int trapno, int flags)
* unpoison always clear PG_hwpoison inside page lock * unpoison always clear PG_hwpoison inside page lock
*/ */
if (!PageHWPoison(p)) { if (!PageHWPoison(p)) {
pr_err("MCE %#lx: just unpoisoned\n", pfn); pr_err("Memory failure: %#lx: just unpoisoned\n", pfn);
num_poisoned_pages_sub(nr_pages); num_poisoned_pages_sub(nr_pages);
unlock_page(hpage); unlock_page(hpage);
put_hwpoison_page(hpage); put_hwpoison_page(hpage);
...@@ -1395,25 +1403,25 @@ int unpoison_memory(unsigned long pfn) ...@@ -1395,25 +1403,25 @@ int unpoison_memory(unsigned long pfn)
page = compound_head(p); page = compound_head(p);
if (!PageHWPoison(p)) { if (!PageHWPoison(p)) {
unpoison_pr_info("MCE: Page was already unpoisoned %#lx\n", unpoison_pr_info("Unpoison: Page was already unpoisoned %#lx\n",
pfn, &unpoison_rs); pfn, &unpoison_rs);
return 0; return 0;
} }
if (page_count(page) > 1) { if (page_count(page) > 1) {
unpoison_pr_info("MCE: Someone grabs the hwpoison page %#lx\n", unpoison_pr_info("Unpoison: Someone grabs the hwpoison page %#lx\n",
pfn, &unpoison_rs); pfn, &unpoison_rs);
return 0; return 0;
} }
if (page_mapped(page)) { if (page_mapped(page)) {
unpoison_pr_info("MCE: Someone maps the hwpoison page %#lx\n", unpoison_pr_info("Unpoison: Someone maps the hwpoison page %#lx\n",
pfn, &unpoison_rs); pfn, &unpoison_rs);
return 0; return 0;
} }
if (page_mapping(page)) { if (page_mapping(page)) {
unpoison_pr_info("MCE: the hwpoison page has non-NULL mapping %#lx\n", unpoison_pr_info("Unpoison: the hwpoison page has non-NULL mapping %#lx\n",
pfn, &unpoison_rs); pfn, &unpoison_rs);
return 0; return 0;
} }
...@@ -1424,7 +1432,7 @@ int unpoison_memory(unsigned long pfn) ...@@ -1424,7 +1432,7 @@ int unpoison_memory(unsigned long pfn)
* In such case, we yield to memory_failure() and make unpoison fail. * In such case, we yield to memory_failure() and make unpoison fail.
*/ */
if (!PageHuge(page) && PageTransHuge(page)) { if (!PageHuge(page) && PageTransHuge(page)) {
unpoison_pr_info("MCE: Memory failure is now running on %#lx\n", unpoison_pr_info("Unpoison: Memory failure is now running on %#lx\n",
pfn, &unpoison_rs); pfn, &unpoison_rs);
return 0; return 0;
} }
...@@ -1439,13 +1447,13 @@ int unpoison_memory(unsigned long pfn) ...@@ -1439,13 +1447,13 @@ int unpoison_memory(unsigned long pfn)
* to the end. * to the end.
*/ */
if (PageHuge(page)) { if (PageHuge(page)) {
unpoison_pr_info("MCE: Memory failure is now running on free hugepage %#lx\n", unpoison_pr_info("Unpoison: Memory failure is now running on free hugepage %#lx\n",
pfn, &unpoison_rs); pfn, &unpoison_rs);
return 0; return 0;
} }
if (TestClearPageHWPoison(p)) if (TestClearPageHWPoison(p))
num_poisoned_pages_dec(); num_poisoned_pages_dec();
unpoison_pr_info("MCE: Software-unpoisoned free page %#lx\n", unpoison_pr_info("Unpoison: Software-unpoisoned free page %#lx\n",
pfn, &unpoison_rs); pfn, &unpoison_rs);
return 0; return 0;
} }
...@@ -1458,7 +1466,7 @@ int unpoison_memory(unsigned long pfn) ...@@ -1458,7 +1466,7 @@ int unpoison_memory(unsigned long pfn)
* the free buddy page pool. * the free buddy page pool.
*/ */
if (TestClearPageHWPoison(page)) { if (TestClearPageHWPoison(page)) {
unpoison_pr_info("MCE: Software-unpoisoned page %#lx\n", unpoison_pr_info("Unpoison: Software-unpoisoned page %#lx\n",
pfn, &unpoison_rs); pfn, &unpoison_rs);
num_poisoned_pages_sub(nr_pages); num_poisoned_pages_sub(nr_pages);
freeit = 1; freeit = 1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment