Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1208361

[PATCH v2 3/3] mm/hwpoison: don't try to unpoison containment-failed pages

From Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Newsgroups linux.kernel
Subject [PATCH v2 3/3] mm/hwpoison: don't try to unpoison containment-failed pages
Date 2015-08-17 06:40 +0200
Message-ID <pYknf-55o-9@gated-at.bofh.it> (permalink)
References <pXj9V-618-27@gated-at.bofh.it> <pYknf-55o-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


memory_failure() can be called at any page at any time, which means that we
can't eliminate the possibility of containment failure. In such case the best
option is to leak the page intentionally (and never touch it later.)

We have an unpoison function for testing, and it cannot handle such
containment-failed pages, which results in kernel panic (visible with various
calltraces.) So this patch suggests that we limit the unpoisonable pages to
properly contained pages and ignore any other ones.

Testers are recommended to keep in mind that there're un-unpoisonable pages
when writing test programs.

Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
---
 mm/memory-failure.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git mmotm-2015-08-13-15-29.orig/mm/memory-failure.c mmotm-2015-08-13-15-29/mm/memory-failure.c
index 7986db56e240..613389e9e5a8 100644
--- mmotm-2015-08-13-15-29.orig/mm/memory-failure.c
+++ mmotm-2015-08-13-15-29/mm/memory-failure.c
@@ -1433,6 +1433,22 @@ int unpoison_memory(unsigned long pfn)
 		return 0;
 	}
 
+	if (page_count(page) > 1) {
+		pr_info("MCE: Someone grabs the hwpoison page %#lx\n", pfn);
+		return 0;
+	}
+
+	if (page_mapped(page)) {
+		pr_info("MCE: Someone maps the hwpoison page %#lx\n", pfn);
+		return 0;
+	}
+
+	if (page_mapping(page)) {
+		pr_info("MCE: the hwpoison page has non-NULL mapping %#lx\n",
+			pfn);
+		return 0;
+	}
+
 	/*
 	 * unpoison_memory() can encounter thp only when the thp is being
 	 * worked by memory_failure() and the page lock is not held yet.
-- 
2.4.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] mm/hwpoison: fix race between soft_offline_page and unpoison_memory Wanpeng Li <wanpeng.li@hotmail.com> - 2015-08-13 09:40 +0200
  Re: [PATCH] mm/hwpoison: fix race between soft_offline_page and  unpoison_memory Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> - 2015-08-13 11:00 +0200
    Re: [PATCH] mm/hwpoison: fix race between soft_offline_page and  unpoison_memory Wanpeng Li <wanpeng.li@hotmail.com> - 2015-08-13 11:20 +0200
      Re: [PATCH] mm/hwpoison: fix race between soft_offline_page and  unpoison_memory Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> - 2015-08-13 12:10 +0200
        Re: [PATCH] mm/hwpoison: fix race between soft_offline_page and  unpoison_memory Wanpeng Li <wanpeng.li@hotmail.com> - 2015-08-13 12:30 +0200
          Re: [PATCH] mm/hwpoison: fix race between soft_offline_page and  unpoison_memory Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> - 2015-08-14 06:30 +0200
            Re: [PATCH] mm/hwpoison: fix race between soft_offline_page and  unpoison_memory Wanpeng Li <wanpeng.li@hotmail.com> - 2015-08-14 07:10 +0200
              Re: [PATCH] mm/hwpoison: fix race between soft_offline_page and  unpoison_memory Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> - 2015-08-14 09:30 +0200
                Re: [PATCH] mm/hwpoison: fix race between soft_offline_page and  unpoison_memory Wanpeng Li <wanpeng.li@hotmail.com> - 2015-08-14 10:00 +0200
                Re: [PATCH] mm/hwpoison: fix race between soft_offline_page and  unpoison_memory Wanpeng Li <wanpeng.li@hotmail.com> - 2015-08-14 10:00 +0200
                Re: [PATCH] mm/hwpoison: fix race between soft_offline_page and  unpoison_memory Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> - 2015-08-14 10:40 +0200
                Re: [PATCH] mm/hwpoison: fix race between soft_offline_page and  unpoison_memory Wanpeng Li <wanpeng.li@hotmail.com> - 2015-08-14 11:10 +0200
                Re: [PATCH] mm/hwpoison: fix race between soft_offline_page and  unpoison_memory Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> - 2015-08-17 06:40 +0200
                [PATCH v2 2/3] mm/hwpoison: fix race between soft_offline_page and  unpoison_memory Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> - 2015-08-17 06:40 +0200
                [PATCH v2 3/3] mm/hwpoison: don't try to unpoison  containment-failed pages Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> - 2015-08-17 06:40 +0200
                [PATCH v2 1/3] mm/hwpoison: introduce num_poisoned_pages wrappers Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> - 2015-08-17 06:40 +0200
                Re: [PATCH] mm/hwpoison: fix race between soft_offline_page and  unpoison_memory Wanpeng Li <wanpeng.li@hotmail.com> - 2015-08-17 07:30 +0200
                Re: [PATCH] mm/hwpoison: fix race between soft_offline_page and  unpoison_memory Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> - 2015-08-14 10:20 +0200

csiph-web