aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2017-07-09 19:14:01 -0400
committerEric W. Biederman <ebiederm@xmission.com>2018-01-23 13:17:42 -0500
commit83b57531c58f4173d1c0d0b2c0bc88c853c32ea5 (patch)
tree42397d1c3d0f5f6c2c29ea4ae2ff74250ba454a2
parentf71dd7dc2dc989dc712b246a74d243e4b2c5f8a7 (diff)
mm/memory_failure: Remove unused trapno from memory_failure
Today 4 architectures set ARCH_SUPPORTS_MEMORY_FAILURE (arm64, parisc, powerpc, and x86), while 4 other architectures set __ARCH_SI_TRAPNO (alpha, metag, sparc, and tile). These two sets of architectures do not interesect so remove the trapno paramater to remove confusion. Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
-rw-r--r--arch/parisc/kernel/pdt.c2
-rw-r--r--arch/powerpc/platforms/powernv/opal-memory-errors.c2
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce.c6
-rw-r--r--drivers/acpi/apei/ghes.c2
-rw-r--r--drivers/base/memory.c2
-rw-r--r--drivers/ras/cec.c2
-rw-r--r--include/linux/mm.h4
-rw-r--r--mm/hwpoison-inject.c2
-rw-r--r--mm/madvise.c2
-rw-r--r--mm/memory-failure.c33
10 files changed, 25 insertions, 32 deletions
diff --git a/arch/parisc/kernel/pdt.c b/arch/parisc/kernel/pdt.c
index e07eb34c8750..36434d4da381 100644
--- a/arch/parisc/kernel/pdt.c
+++ b/arch/parisc/kernel/pdt.c
@@ -325,7 +325,7 @@ static int pdt_mainloop(void *unused)
325#ifdef CONFIG_MEMORY_FAILURE 325#ifdef CONFIG_MEMORY_FAILURE
326 if ((pde & PDT_ADDR_PERM_ERR) || 326 if ((pde & PDT_ADDR_PERM_ERR) ||
327 ((pde & PDT_ADDR_SINGLE_ERR) == 0)) 327 ((pde & PDT_ADDR_SINGLE_ERR) == 0))
328 memory_failure(pde >> PAGE_SHIFT, 0, 0); 328 memory_failure(pde >> PAGE_SHIFT, 0);
329 else 329 else
330 soft_offline_page( 330 soft_offline_page(
331 pfn_to_page(pde >> PAGE_SHIFT), 0); 331 pfn_to_page(pde >> PAGE_SHIFT), 0);
diff --git a/arch/powerpc/platforms/powernv/opal-memory-errors.c b/arch/powerpc/platforms/powernv/opal-memory-errors.c
index d9916ea62305..8ddc1accf199 100644
--- a/arch/powerpc/platforms/powernv/opal-memory-errors.c
+++ b/arch/powerpc/platforms/powernv/opal-memory-errors.c
@@ -60,7 +60,7 @@ static void handle_memory_error_event(struct OpalMemoryErrorData *merr_evt)
60 } 60 }
61 61
62 for (; paddr_start < paddr_end; paddr_start += PAGE_SIZE) { 62 for (; paddr_start < paddr_end; paddr_start += PAGE_SIZE) {
63 memory_failure(paddr_start >> PAGE_SHIFT, 0, 0); 63 memory_failure(paddr_start >> PAGE_SHIFT, 0);
64 } 64 }
65} 65}
66 66
diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
index b1d616d08eee..3b7319e25168 100644
--- a/arch/x86/kernel/cpu/mcheck/mce.c
+++ b/arch/x86/kernel/cpu/mcheck/mce.c
@@ -582,7 +582,7 @@ static int srao_decode_notifier(struct notifier_block *nb, unsigned long val,
582 582
583 if (mce_usable_address(mce) && (mce->severity == MCE_AO_SEVERITY)) { 583 if (mce_usable_address(mce) && (mce->severity == MCE_AO_SEVERITY)) {
584 pfn = mce->addr >> PAGE_SHIFT; 584 pfn = mce->addr >> PAGE_SHIFT;
585 memory_failure(pfn, MCE_VECTOR, 0); 585 memory_failure(pfn, 0);
586 } 586 }
587 587
588 return NOTIFY_OK; 588 return NOTIFY_OK;
@@ -1046,7 +1046,7 @@ static int do_memory_failure(struct mce *m)
1046 pr_err("Uncorrected hardware memory error in user-access at %llx", m->addr); 1046 pr_err("Uncorrected hardware memory error in user-access at %llx", m->addr);
1047 if (!(m->mcgstatus & MCG_STATUS_RIPV)) 1047 if (!(m->mcgstatus & MCG_STATUS_RIPV))
1048 flags |= MF_MUST_KILL; 1048 flags |= MF_MUST_KILL;
1049 ret = memory_failure(m->addr >> PAGE_SHIFT, MCE_VECTOR, flags); 1049 ret = memory_failure(m->addr >> PAGE_SHIFT, flags);
1050 if (ret) 1050 if (ret)
1051 pr_err("Memory error not recovered"); 1051 pr_err("Memory error not recovered");
1052 return ret; 1052 return ret;
@@ -1325,7 +1325,7 @@ out_ist:
1325EXPORT_SYMBOL_GPL(do_machine_check); 1325EXPORT_SYMBOL_GPL(do_machine_check);
1326 1326
1327#ifndef CONFIG_MEMORY_FAILURE 1327#ifndef CONFIG_MEMORY_FAILURE
1328int memory_failure(unsigned long pfn, int vector, int flags) 1328int memory_failure(unsigned long pfn, int flags)
1329{ 1329{
1330 /* mce_severity() should not hand us an ACTION_REQUIRED error */ 1330 /* mce_severity() should not hand us an ACTION_REQUIRED error */
1331 BUG_ON(flags & MF_ACTION_REQUIRED); 1331 BUG_ON(flags & MF_ACTION_REQUIRED);
diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c
index 6402f7fad3bb..bb5f9c643e0e 100644
--- a/drivers/acpi/apei/ghes.c
+++ b/drivers/acpi/apei/ghes.c
@@ -410,7 +410,7 @@ static void ghes_handle_memory_failure(struct acpi_hest_generic_data *gdata, int
410 flags = 0; 410 flags = 0;
411 411
412 if (flags != -1) 412 if (flags != -1)
413 memory_failure_queue(pfn, 0, flags); 413 memory_failure_queue(pfn, flags);
414#endif 414#endif
415} 415}
416 416
diff --git a/drivers/base/memory.c b/drivers/base/memory.c
index 1d60b58a8c19..fe4b24f05f6a 100644
--- a/drivers/base/memory.c
+++ b/drivers/base/memory.c
@@ -569,7 +569,7 @@ store_hard_offline_page(struct device *dev,
569 if (kstrtoull(buf, 0, &pfn) < 0) 569 if (kstrtoull(buf, 0, &pfn) < 0)
570 return -EINVAL; 570 return -EINVAL;
571 pfn >>= PAGE_SHIFT; 571 pfn >>= PAGE_SHIFT;
572 ret = memory_failure(pfn, 0, 0); 572 ret = memory_failure(pfn, 0);
573 return ret ? ret : count; 573 return ret ? ret : count;
574} 574}
575 575
diff --git a/drivers/ras/cec.c b/drivers/ras/cec.c
index ca44e6977cf2..2d9ec378a8bc 100644
--- a/drivers/ras/cec.c
+++ b/drivers/ras/cec.c
@@ -327,7 +327,7 @@ int cec_add_elem(u64 pfn)
327 } else { 327 } else {
328 /* We have reached max count for this page, soft-offline it. */ 328 /* We have reached max count for this page, soft-offline it. */
329 pr_err("Soft-offlining pfn: 0x%llx\n", pfn); 329 pr_err("Soft-offlining pfn: 0x%llx\n", pfn);
330 memory_failure_queue(pfn, 0, MF_SOFT_OFFLINE); 330 memory_failure_queue(pfn, MF_SOFT_OFFLINE);
331 ca->pfns_poisoned++; 331 ca->pfns_poisoned++;
332 } 332 }
333 333
diff --git a/include/linux/mm.h b/include/linux/mm.h
index ea818ff739cd..7fc92384977e 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -2570,8 +2570,8 @@ enum mf_flags {
2570 MF_MUST_KILL = 1 << 2, 2570 MF_MUST_KILL = 1 << 2,
2571 MF_SOFT_OFFLINE = 1 << 3, 2571 MF_SOFT_OFFLINE = 1 << 3,
2572}; 2572};
2573extern int memory_failure(unsigned long pfn, int trapno, int flags); 2573extern int memory_failure(unsigned long pfn, int flags);
2574extern void memory_failure_queue(unsigned long pfn, int trapno, int flags); 2574extern void memory_failure_queue(unsigned long pfn, int flags);
2575extern int unpoison_memory(unsigned long pfn); 2575extern int unpoison_memory(unsigned long pfn);
2576extern int get_hwpoison_page(struct page *page); 2576extern int get_hwpoison_page(struct page *page);
2577#define put_hwpoison_page(page) put_page(page) 2577#define put_hwpoison_page(page) put_page(page)
diff --git a/mm/hwpoison-inject.c b/mm/hwpoison-inject.c
index 356df057a2a8..b6ac70616c32 100644
--- a/mm/hwpoison-inject.c
+++ b/mm/hwpoison-inject.c
@@ -52,7 +52,7 @@ static int hwpoison_inject(void *data, u64 val)
52 52
53inject: 53inject:
54 pr_info("Injecting memory failure at pfn %#lx\n", pfn); 54 pr_info("Injecting memory failure at pfn %#lx\n", pfn);
55 return memory_failure(pfn, 18, MF_COUNT_INCREASED); 55 return memory_failure(pfn, MF_COUNT_INCREASED);
56put_out: 56put_out:
57 put_hwpoison_page(p); 57 put_hwpoison_page(p);
58 return 0; 58 return 0;
diff --git a/mm/madvise.c b/mm/madvise.c
index 751e97aa2210..4d3c922ea1a1 100644
--- a/mm/madvise.c
+++ b/mm/madvise.c
@@ -661,7 +661,7 @@ static int madvise_inject_error(int behavior,
661 pr_info("Injecting memory failure for pfn %#lx at process virtual address %#lx\n", 661 pr_info("Injecting memory failure for pfn %#lx at process virtual address %#lx\n",
662 page_to_pfn(page), start); 662 page_to_pfn(page), start);
663 663
664 ret = memory_failure(page_to_pfn(page), 0, MF_COUNT_INCREASED); 664 ret = memory_failure(page_to_pfn(page), MF_COUNT_INCREASED);
665 if (ret) 665 if (ret)
666 return ret; 666 return ret;
667 } 667 }
diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index 4acdf393a801..c5f5f31bd979 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -178,7 +178,7 @@ EXPORT_SYMBOL_GPL(hwpoison_filter);
178 * ``action optional'' if they are not immediately affected by the error 178 * ``action optional'' if they are not immediately affected by the error
179 * ``action required'' if error happened in current execution context 179 * ``action required'' if error happened in current execution context
180 */ 180 */
181static int kill_proc(struct task_struct *t, unsigned long addr, int trapno, 181static int kill_proc(struct task_struct *t, unsigned long addr,
182 unsigned long pfn, struct page *page, int flags) 182 unsigned long pfn, struct page *page, int flags)
183{ 183{
184 struct siginfo si; 184 struct siginfo si;
@@ -189,9 +189,6 @@ static int kill_proc(struct task_struct *t, unsigned long addr, int trapno,
189 si.si_signo = SIGBUS; 189 si.si_signo = SIGBUS;
190 si.si_errno = 0; 190 si.si_errno = 0;
191 si.si_addr = (void *)addr; 191 si.si_addr = (void *)addr;
192#ifdef __ARCH_SI_TRAPNO
193 si.si_trapno = trapno;
194#endif
195 si.si_addr_lsb = compound_order(compound_head(page)) + PAGE_SHIFT; 192 si.si_addr_lsb = compound_order(compound_head(page)) + PAGE_SHIFT;
196 193
197 if ((flags & MF_ACTION_REQUIRED) && t->mm == current->mm) { 194 if ((flags & MF_ACTION_REQUIRED) && t->mm == current->mm) {
@@ -323,7 +320,7 @@ static void add_to_kill(struct task_struct *tsk, struct page *p,
323 * Also when FAIL is set do a force kill because something went 320 * Also when FAIL is set do a force kill because something went
324 * wrong earlier. 321 * wrong earlier.
325 */ 322 */
326static void kill_procs(struct list_head *to_kill, int forcekill, int trapno, 323static void kill_procs(struct list_head *to_kill, int forcekill,
327 bool fail, struct page *page, unsigned long pfn, 324 bool fail, struct page *page, unsigned long pfn,
328 int flags) 325 int flags)
329{ 326{
@@ -348,7 +345,7 @@ static void kill_procs(struct list_head *to_kill, int forcekill, int trapno,
348 * check for that, but we need to tell the 345 * check for that, but we need to tell the
349 * process anyways. 346 * process anyways.
350 */ 347 */
351 else if (kill_proc(tk->tsk, tk->addr, trapno, 348 else if (kill_proc(tk->tsk, tk->addr,
352 pfn, page, flags) < 0) 349 pfn, page, flags) < 0)
353 pr_err("Memory failure: %#lx: Cannot send advisory machine check signal to %s:%d\n", 350 pr_err("Memory failure: %#lx: Cannot send advisory machine check signal to %s:%d\n",
354 pfn, tk->tsk->comm, tk->tsk->pid); 351 pfn, tk->tsk->comm, tk->tsk->pid);
@@ -927,7 +924,7 @@ EXPORT_SYMBOL_GPL(get_hwpoison_page);
927 * the pages and send SIGBUS to the processes if the data was dirty. 924 * the pages and send SIGBUS to the processes if the data was dirty.
928 */ 925 */
929static bool hwpoison_user_mappings(struct page *p, unsigned long pfn, 926static bool hwpoison_user_mappings(struct page *p, unsigned long pfn,
930 int trapno, int flags, struct page **hpagep) 927 int flags, struct page **hpagep)
931{ 928{
932 enum ttu_flags ttu = TTU_IGNORE_MLOCK | TTU_IGNORE_ACCESS; 929 enum ttu_flags ttu = TTU_IGNORE_MLOCK | TTU_IGNORE_ACCESS;
933 struct address_space *mapping; 930 struct address_space *mapping;
@@ -1017,7 +1014,7 @@ static bool hwpoison_user_mappings(struct page *p, unsigned long pfn,
1017 * any accesses to the poisoned memory. 1014 * any accesses to the poisoned memory.
1018 */ 1015 */
1019 forcekill = PageDirty(hpage) || (flags & MF_MUST_KILL); 1016 forcekill = PageDirty(hpage) || (flags & MF_MUST_KILL);
1020 kill_procs(&tokill, forcekill, trapno, !unmap_success, p, pfn, flags); 1017 kill_procs(&tokill, forcekill, !unmap_success, p, pfn, flags);
1021 1018
1022 return unmap_success; 1019 return unmap_success;
1023} 1020}
@@ -1045,7 +1042,7 @@ static int identify_page_state(unsigned long pfn, struct page *p,
1045 return page_action(ps, p, pfn); 1042 return page_action(ps, p, pfn);
1046} 1043}
1047 1044
1048static int memory_failure_hugetlb(unsigned long pfn, int trapno, int flags) 1045static int memory_failure_hugetlb(unsigned long pfn, int flags)
1049{ 1046{
1050 struct page *p = pfn_to_page(pfn); 1047 struct page *p = pfn_to_page(pfn);
1051 struct page *head = compound_head(p); 1048 struct page *head = compound_head(p);
@@ -1090,7 +1087,7 @@ static int memory_failure_hugetlb(unsigned long pfn, int trapno, int flags)
1090 return 0; 1087 return 0;
1091 } 1088 }
1092 1089
1093 if (!hwpoison_user_mappings(p, pfn, trapno, flags, &head)) { 1090 if (!hwpoison_user_mappings(p, pfn, flags, &head)) {
1094 action_result(pfn, MF_MSG_UNMAP_FAILED, MF_IGNORED); 1091 action_result(pfn, MF_MSG_UNMAP_FAILED, MF_IGNORED);
1095 res = -EBUSY; 1092 res = -EBUSY;
1096 goto out; 1093 goto out;
@@ -1105,7 +1102,6 @@ out:
1105/** 1102/**
1106 * memory_failure - Handle memory failure of a page. 1103 * memory_failure - Handle memory failure of a page.
1107 * @pfn: Page Number of the corrupted page 1104 * @pfn: Page Number of the corrupted page
1108 * @trapno: Trap number reported in the signal to user space.
1109 * @flags: fine tune action taken 1105 * @flags: fine tune action taken
1110 * 1106 *
1111 * This function is called by the low level machine check code 1107 * This function is called by the low level machine check code
@@ -1120,7 +1116,7 @@ out:
1120 * Must run in process context (e.g. a work queue) with interrupts 1116 * Must run in process context (e.g. a work queue) with interrupts
1121 * enabled and no spinlocks hold. 1117 * enabled and no spinlocks hold.
1122 */ 1118 */
1123int memory_failure(unsigned long pfn, int trapno, int flags) 1119int memory_failure(unsigned long pfn, int flags)
1124{ 1120{
1125 struct page *p; 1121 struct page *p;
1126 struct page *hpage; 1122 struct page *hpage;
@@ -1129,7 +1125,7 @@ int memory_failure(unsigned long pfn, int trapno, int flags)
1129 unsigned long page_flags; 1125 unsigned long page_flags;
1130 1126
1131 if (!sysctl_memory_failure_recovery) 1127 if (!sysctl_memory_failure_recovery)
1132 panic("Memory failure from trap %d on page %lx", trapno, pfn); 1128 panic("Memory failure on page %lx", pfn);
1133 1129
1134 if (!pfn_valid(pfn)) { 1130 if (!pfn_valid(pfn)) {
1135 pr_err("Memory failure: %#lx: memory outside kernel control\n", 1131 pr_err("Memory failure: %#lx: memory outside kernel control\n",
@@ -1139,7 +1135,7 @@ int memory_failure(unsigned long pfn, int trapno, int flags)
1139 1135
1140 p = pfn_to_page(pfn); 1136 p = pfn_to_page(pfn);
1141 if (PageHuge(p)) 1137 if (PageHuge(p))
1142 return memory_failure_hugetlb(pfn, trapno, flags); 1138 return memory_failure_hugetlb(pfn, flags);
1143 if (TestSetPageHWPoison(p)) { 1139 if (TestSetPageHWPoison(p)) {
1144 pr_err("Memory failure: %#lx: already hardware poisoned\n", 1140 pr_err("Memory failure: %#lx: already hardware poisoned\n",
1145 pfn); 1141 pfn);
@@ -1268,7 +1264,7 @@ int memory_failure(unsigned long pfn, int trapno, int flags)
1268 * When the raw error page is thp tail page, hpage points to the raw 1264 * When the raw error page is thp tail page, hpage points to the raw
1269 * page after thp split. 1265 * page after thp split.
1270 */ 1266 */
1271 if (!hwpoison_user_mappings(p, pfn, trapno, flags, &hpage)) { 1267 if (!hwpoison_user_mappings(p, pfn, flags, &hpage)) {
1272 action_result(pfn, MF_MSG_UNMAP_FAILED, MF_IGNORED); 1268 action_result(pfn, MF_MSG_UNMAP_FAILED, MF_IGNORED);
1273 res = -EBUSY; 1269 res = -EBUSY;
1274 goto out; 1270 goto out;
@@ -1296,7 +1292,6 @@ EXPORT_SYMBOL_GPL(memory_failure);
1296 1292
1297struct memory_failure_entry { 1293struct memory_failure_entry {
1298 unsigned long pfn; 1294 unsigned long pfn;
1299 int trapno;
1300 int flags; 1295 int flags;
1301}; 1296};
1302 1297
@@ -1312,7 +1307,6 @@ static DEFINE_PER_CPU(struct memory_failure_cpu, memory_failure_cpu);
1312/** 1307/**
1313 * memory_failure_queue - Schedule handling memory failure of a page. 1308 * memory_failure_queue - Schedule handling memory failure of a page.
1314 * @pfn: Page Number of the corrupted page 1309 * @pfn: Page Number of the corrupted page
1315 * @trapno: Trap number reported in the signal to user space.
1316 * @flags: Flags for memory failure handling 1310 * @flags: Flags for memory failure handling
1317 * 1311 *
1318 * This function is called by the low level hardware error handler 1312 * This function is called by the low level hardware error handler
@@ -1326,13 +1320,12 @@ static DEFINE_PER_CPU(struct memory_failure_cpu, memory_failure_cpu);
1326 * 1320 *
1327 * Can run in IRQ context. 1321 * Can run in IRQ context.
1328 */ 1322 */
1329void memory_failure_queue(unsigned long pfn, int trapno, int flags) 1323void memory_failure_queue(unsigned long pfn, int flags)
1330{ 1324{
1331 struct memory_failure_cpu *mf_cpu; 1325 struct memory_failure_cpu *mf_cpu;
1332 unsigned long proc_flags; 1326 unsigned long proc_flags;
1333 struct memory_failure_entry entry = { 1327 struct memory_failure_entry entry = {
1334 .pfn = pfn, 1328 .pfn = pfn,
1335 .trapno = trapno,
1336 .flags = flags, 1329 .flags = flags,
1337 }; 1330 };
1338 1331
@@ -1365,7 +1358,7 @@ static void memory_failure_work_func(struct work_struct *work)
1365 if (entry.flags & MF_SOFT_OFFLINE) 1358 if (entry.flags & MF_SOFT_OFFLINE)
1366 soft_offline_page(pfn_to_page(entry.pfn), entry.flags); 1359 soft_offline_page(pfn_to_page(entry.pfn), entry.flags);
1367 else 1360 else
1368 memory_failure(entry.pfn, entry.trapno, entry.flags); 1361 memory_failure(entry.pfn, entry.flags);
1369 } 1362 }
1370} 1363}
1371 1364