summaryrefslogtreecommitdiffstats
path: root/drivers/nvdimm/pmem.h
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2018-07-13 21:50:37 -0700
committerDave Jiang <dave.jiang@intel.com>2018-08-20 09:22:45 -0700
commitc953cc987ab87d180e1d5de2f1c217abe33aac77 (patch)
tree29e82381bba655d2141bf39c261312b56d128442 /drivers/nvdimm/pmem.h
parent284ce4011ba60d6c487b668eea729b6294930806 (diff)
downloadtalos-op-linux-c953cc987ab87d180e1d5de2f1c217abe33aac77.tar.gz
talos-op-linux-c953cc987ab87d180e1d5de2f1c217abe33aac77.zip
libnvdimm, pmem: Restore page attributes when clearing errors
Use clear_mce_nospec() to restore WB mode for the kernel linear mapping of a pmem page that was marked 'HWPoison'. A page with 'HWPoison' set has also been marked UC in PAT (page attribute table) via set_mce_nospec() to prevent speculative retrievals of poison. The 'HWPoison' flag is only cleared when overwriting an entire page. Signed-off-by: Dan Williams <dan.j.williams@intel.com> Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Diffstat (limited to 'drivers/nvdimm/pmem.h')
-rw-r--r--drivers/nvdimm/pmem.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/nvdimm/pmem.h b/drivers/nvdimm/pmem.h
index a64ebc78b5df..59cfe13ea8a8 100644
--- a/drivers/nvdimm/pmem.h
+++ b/drivers/nvdimm/pmem.h
@@ -1,6 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef __NVDIMM_PMEM_H__
#define __NVDIMM_PMEM_H__
+#include <linux/page-flags.h>
#include <linux/badblocks.h>
#include <linux/types.h>
#include <linux/pfn_t.h>
@@ -27,4 +28,16 @@ struct pmem_device {
long __pmem_direct_access(struct pmem_device *pmem, pgoff_t pgoff,
long nr_pages, void **kaddr, pfn_t *pfn);
+
+#ifdef CONFIG_MEMORY_FAILURE
+static inline bool test_and_clear_pmem_poison(struct page *page)
+{
+ return TestClearPageHWPoison(page);
+}
+#else
+static inline bool test_and_clear_pmem_poison(struct page *page)
+{
+ return false;
+}
+#endif
#endif /* __NVDIMM_PMEM_H__ */
OpenPOWER on IntegriCloud