nvdimm/pmem: remove test_and_clear_pmem_poison()
Subsystems (4)
PATCH v2 1/1 nvdimm/pmem: remove test_and_clear_pmem_poison()
From: Kaitao Cheng <[email protected]>
The pmem driver provides test_and_clear_pmem_poison() only to handle the CONFIG_MEMORY_FAILURE dependency of TestClearPageHWPoison(). The wrapper has no other pmem-specific behavior.
Define the HWPoison test-and-change helpers to return false when CONFIG_MEMORY_FAILURE is disabled. This allows pmem to call TestClearPageHWPoison() directly in all configurations.
---
Changes in v2 (David Hildenbrand, Oscar Salvador):
- squash patch#1 into patch#2.
Link to v1:
https://lore.kernel.org/all/[email protected]/
--- drivers/nvdimm/pmem.c | 2 +- drivers/nvdimm/pmem.h | 12 ------------ include/linux/page-flags.h | 1 + 3 files changed, 2 insertions(+), 13 deletions(-)
drivers/nvdimm/pmem.c +1 -1
@@ -80,7 +80,7 @@ static void pmem_mkpage_present(struct pmem_device *pmem, phys_addr_t offset,* here since we're in the driver I/O path and * outstanding I/O requests pin the dev_pagemap. */ -if (test_and_clear_pmem_poison (page)) +if (TestClearPageHWPoison (page))clear_mce_nospec (pfn); } }
drivers/nvdimm/pmem.h +0 -12
@@ -1,7 +1,6 @@/* 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/memremap.h> #include <linux/types.h>
@@ -31,15 +30,4 @@ long __pmem_direct_access(struct pmem_device *pmem, pgoff_t pgoff, long nr_pages, enum dax_access_mode mode, void **kaddr, unsigned long *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__ */
include/linux/page-flags.h +1 -0
@@ -655,6 +655,7 @@ TESTSCFLAG(HWPoison, hwpoison, PF_ANY)#define __PG_HWPOISON (1UL << PG_hwpoison)#else PAGEFLAG_FALSE(HWPoison, hwpoison) +TESTSCFLAG_FALSE(HWPoison, hwpoison)#define __PG_HWPOISON 0#endif
Signature · 1 line
2.54.0 (Apple Git-157)
Quoted 6 lines · Kaitao Cheng
From: Kaitao Cheng <[email protected]>
The pmem driver provides
test_and_clear_pmem_poison()only to handle theCONFIG_MEMORY_FAILUREdependency ofTestClearPageHWPoison(). The wrapper has no other pmem-specific behavior.
Quoted 8 lines
Define the HWPoison test-and-change helpers to return false when
CONFIG_MEMORY_FAILUREis disabled. This allows pmem to callTestClearPageHWPoison()directly in all configurations.Signed-off-by Kaitao Cheng <[email protected]>Acked-by Muchun Song <[email protected]>Reviewed-by Oscar Salvador <[email protected]>
Quoted 65 lines
---
Changes in v2 (David Hildenbrand, Oscar Salvador):
- squash patch#1 into patch#2.Link to v1:
https://lore.kernel.org/all/[email protected]/--- drivers/nvdimm/pmem.c | 2 +- drivers/nvdimm/pmem.h | 12 ------------ include/linux/page-flags.h | 1 + 3 files changed, 2 insertions(+), 13 deletions(-)drivers/nvdimm/pmem.c +1
-1@@ -80,7 +80,7 @@ static void pmem_mkpage_present(struct pmem_device *pmem, phys_addr_t offset,* here since we're in the driver I/O path and * outstanding I/O requests pin the dev_pagemap. */ -if (test_and_clear_pmem_poison (page)) +if (TestClearPageHWPoison (page))clear_mce_nospec (pfn); } }drivers/nvdimm/pmem.h +0
-12@@ -1,7 +1,6 @@/* 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/memremap.h> #include <linux/types.h> @@ -31,15 +30,4 @@ long __pmem_direct_access(struct pmem_device *pmem, pgoff_t pgoff, long nr_pages, enum dax_access_mode mode, void **kaddr, unsigned long *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__ */ include/linux/page-flags.h +1
-0@@ -655,6 +655,7 @@ TESTSCFLAG(HWPoison, hwpoison, PF_ANY)#define __PG_HWPOISON (1UL << PG_hwpoison)#else PAGEFLAG_FALSE(HWPoison, hwpoison) +TESTSCFLAG_FALSE(HWPoison, hwpoison)#define __PG_HWPOISON 0#endif
Alison Schofield
maintainerQuoted 9 lines · Kaitao Cheng
From: Kaitao Cheng <[email protected]>
The pmem driver provides
test_and_clear_pmem_poison()only to handle theCONFIG_MEMORY_FAILUREdependency ofTestClearPageHWPoison(). The wrapper has no other pmem-specific behavior.Define the HWPoison test-and-change helpers to return false when
CONFIG_MEMORY_FAILUREis disabled. This allows pmem to callTestClearPageHWPoison()directly in all configurations.
I see this merged here:
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git/commit/?h=mm-stable&id=2492d9c0afc02cebe8318155829e7d03bea617b8
Still not sure how all that works, but I got an email saying merged, yet this list was not on the email thread.
Quoted 73 lines
Signed-off-by Kaitao Cheng <[email protected]>Acked-by Muchun Song <[email protected]>Reviewed-by Oscar Salvador <[email protected]>---
Changes in v2 (David Hildenbrand, Oscar Salvador):
- squash patch#1 into patch#2.Link to v1:
https://lore.kernel.org/all/[email protected]/--- drivers/nvdimm/pmem.c | 2 +- drivers/nvdimm/pmem.h | 12 ------------ include/linux/page-flags.h | 1 + 3 files changed, 2 insertions(+), 13 deletions(-)drivers/nvdimm/pmem.c +1
-1@@ -80,7 +80,7 @@ static void pmem_mkpage_present(struct pmem_device *pmem, phys_addr_t offset,* here since we're in the driver I/O path and * outstanding I/O requests pin the dev_pagemap. */ -if (test_and_clear_pmem_poison (page)) +if (TestClearPageHWPoison (page))clear_mce_nospec (pfn); } }drivers/nvdimm/pmem.h +0
-12@@ -1,7 +1,6 @@/* 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/memremap.h> #include <linux/types.h> @@ -31,15 +30,4 @@ long __pmem_direct_access(struct pmem_device *pmem, pgoff_t pgoff, long nr_pages, enum dax_access_mode mode, void **kaddr, unsigned long *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__ */ include/linux/page-flags.h +1
-0@@ -655,6 +655,7 @@ TESTSCFLAG(HWPoison, hwpoison, PF_ANY)#define __PG_HWPOISON (1UL << PG_hwpoison)#else PAGEFLAG_FALSE(HWPoison, hwpoison) +TESTSCFLAG_FALSE(HWPoison, hwpoison)#define __PG_HWPOISON 0#endif Signature · 1 line
2.54.0 (Apple Git-157)
Quoted 11 lines · Alison Schofield
Quoted 9 lines · Kaitao Cheng
From: Kaitao Cheng <[email protected]>
The pmem driver provides
test_and_clear_pmem_poison()only to handle theCONFIG_MEMORY_FAILUREdependency ofTestClearPageHWPoison(). The wrapper has no other pmem-specific behavior.Define the HWPoison test-and-change helpers to return false when
CONFIG_MEMORY_FAILUREis disabled. This allows pmem to callTestClearPageHWPoison()directly in all configurations.
Quoted 5 lines
I see this merged here:
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git/commit/?h=mm-stable&id=2492d9c0afc02cebe8318155829e7d03bea617b8Still not sure how all that works, but I got an email saying merged, yet this list was not on the email thread.
Andrew Morton probably thought the change was straightforward, so he made the adjustment himself and merged it. There’s nothing wrong with the code itself.
Quoted 73 lines
Quoted 73 lines
Signed-off-by Kaitao Cheng <[email protected]>Acked-by Muchun Song <[email protected]>Reviewed-by Oscar Salvador <[email protected]>---
Changes in v2 (David Hildenbrand, Oscar Salvador):
- squash patch#1 into patch#2.Link to v1:
https://lore.kernel.org/all/[email protected]/--- drivers/nvdimm/pmem.c | 2 +- drivers/nvdimm/pmem.h | 12 ------------ include/linux/page-flags.h | 1 + 3 files changed, 2 insertions(+), 13 deletions(-)drivers/nvdimm/pmem.c +1
-1@@ -80,7 +80,7 @@ static void pmem_mkpage_present(struct pmem_device *pmem, phys_addr_t offset,* here since we're in the driver I/O path and * outstanding I/O requests pin the dev_pagemap. */ -if (test_and_clear_pmem_poison (page)) +if (TestClearPageHWPoison (page))clear_mce_nospec (pfn); } }drivers/nvdimm/pmem.h +0
-12@@ -1,7 +1,6 @@/* 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/memremap.h> #include <linux/types.h> @@ -31,15 +30,4 @@ long __pmem_direct_access(struct pmem_device *pmem, pgoff_t pgoff, long nr_pages, enum dax_access_mode mode, void **kaddr, unsigned long *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__ */ include/linux/page-flags.h +1
-0@@ -655,6 +655,7 @@ TESTSCFLAG(HWPoison, hwpoison, PF_ANY)#define __PG_HWPOISON (1UL << PG_hwpoison)#else PAGEFLAG_FALSE(HWPoison, hwpoison) +TESTSCFLAG_FALSE(HWPoison, hwpoison)#define __PG_HWPOISON 0#endif Signature · 1 line
2.54.0 (Apple Git-157)
Signature · 2 lines
Thanks Kaitao Cheng