diff mbox series

[07/13] mm/memory-failure: remove unneeded hwpoison_filter() variant

Message ID 20240524091310.1430048-8-linmiaohe@huawei.com (mailing list archive)
State New
Headers show
Series Some cleanups for memory-failure | expand

Commit Message

Miaohe Lin May 24, 2024, 9:13 a.m. UTC
When CONFIG_HWPOISON_INJECT is not enabled, there is no user of the
hwpoison_filter(). Remove it.

Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
---
 mm/memory-failure.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

Comments

kernel test robot May 24, 2024, 3:38 p.m. UTC | #1
Hi Miaohe,

kernel test robot noticed the following build errors:

[auto build test ERROR on akpm-mm/mm-everything]
[also build test ERROR on linus/master next-20240523]
[cannot apply to v6.9]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Miaohe-Lin/mm-memory-failure-simplify-put_ref_page/20240524-171903
base:   https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
patch link:    https://lore.kernel.org/r/20240524091310.1430048-8-linmiaohe%40huawei.com
patch subject: [PATCH 07/13] mm/memory-failure: remove unneeded hwpoison_filter() variant
config: i386-buildonly-randconfig-003-20240524 (https://download.01.org/0day-ci/archive/20240524/202405242320.8nUwcaQN-lkp@intel.com/config)
compiler: gcc-9 (Ubuntu 9.5.0-4ubuntu2) 9.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240524/202405242320.8nUwcaQN-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202405242320.8nUwcaQN-lkp@intel.com/

All errors (new ones prefixed by >>):

   ld: mm/memory-failure.o: in function `memory_failure':
>> memory-failure.c:(.text+0x2635): undefined reference to `hwpoison_filter'
>> ld: memory-failure.c:(.text+0x283d): undefined reference to `hwpoison_filter'
   ld: mm/memory-failure.o: in function `soft_offline_page':
   memory-failure.c:(.text+0x2e12): undefined reference to `hwpoison_filter'
kernel test robot May 24, 2024, 3:59 p.m. UTC | #2
Hi Miaohe,

kernel test robot noticed the following build errors:

[auto build test ERROR on akpm-mm/mm-everything]
[also build test ERROR on linus/master next-20240523]
[cannot apply to v6.9]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Miaohe-Lin/mm-memory-failure-simplify-put_ref_page/20240524-171903
base:   https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
patch link:    https://lore.kernel.org/r/20240524091310.1430048-8-linmiaohe%40huawei.com
patch subject: [PATCH 07/13] mm/memory-failure: remove unneeded hwpoison_filter() variant
config: i386-randconfig-005-20240524 (https://download.01.org/0day-ci/archive/20240524/202405242336.o1NEOrln-lkp@intel.com/config)
compiler: gcc-11 (Ubuntu 11.4.0-4ubuntu1) 11.4.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240524/202405242336.o1NEOrln-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202405242336.o1NEOrln-lkp@intel.com/

All errors (new ones prefixed by >>):

   ld: mm/memory-failure.o: in function `try_memory_failure_hugetlb':
>> mm/memory-failure.c:2098:(.text+0x28a8): undefined reference to `hwpoison_filter'
   ld: mm/memory-failure.o: in function `memory_failure':
   mm/memory-failure.c:2321:(.text+0x2a98): undefined reference to `hwpoison_filter'
   ld: mm/memory-failure.o: in function `soft_offline_page':
   mm/memory-failure.c:2841:(.text+0x3217): undefined reference to `hwpoison_filter'


vim +2098 mm/memory-failure.c

405ce051236cc6 Naoya Horiguchi         2022-04-21  2057  
405ce051236cc6 Naoya Horiguchi         2022-04-21  2058  /*
405ce051236cc6 Naoya Horiguchi         2022-04-21  2059   * Taking refcount of hugetlb pages needs extra care about race conditions
405ce051236cc6 Naoya Horiguchi         2022-04-21  2060   * with basic operations like hugepage allocation/free/demotion.
405ce051236cc6 Naoya Horiguchi         2022-04-21  2061   * So some of prechecks for hwpoison (pinning, and testing/setting
405ce051236cc6 Naoya Horiguchi         2022-04-21  2062   * PageHWPoison) should be done in single hugetlb_lock range.
405ce051236cc6 Naoya Horiguchi         2022-04-21  2063   */
405ce051236cc6 Naoya Horiguchi         2022-04-21  2064  static int try_memory_failure_hugetlb(unsigned long pfn, int flags, int *hugetlb)
0348d2ebec9b00 Naoya Horiguchi         2017-07-10  2065  {
761ad8d7c7b548 Naoya Horiguchi         2017-07-10  2066  	int res;
405ce051236cc6 Naoya Horiguchi         2022-04-21  2067  	struct page *p = pfn_to_page(pfn);
bc1cfde1946752 Sidhartha Kumar         2023-01-12  2068  	struct folio *folio;
761ad8d7c7b548 Naoya Horiguchi         2017-07-10  2069  	unsigned long page_flags;
e591ef7d96d6ea Naoya Horiguchi         2022-10-24  2070  	bool migratable_cleared = false;
761ad8d7c7b548 Naoya Horiguchi         2017-07-10  2071  
405ce051236cc6 Naoya Horiguchi         2022-04-21  2072  	*hugetlb = 1;
405ce051236cc6 Naoya Horiguchi         2022-04-21  2073  retry:
e591ef7d96d6ea Naoya Horiguchi         2022-10-24  2074  	res = get_huge_page_for_hwpoison(pfn, flags, &migratable_cleared);
405ce051236cc6 Naoya Horiguchi         2022-04-21  2075  	if (res == 2) { /* fallback to normal page handling */
405ce051236cc6 Naoya Horiguchi         2022-04-21  2076  		*hugetlb = 0;
405ce051236cc6 Naoya Horiguchi         2022-04-21  2077  		return 0;
405ce051236cc6 Naoya Horiguchi         2022-04-21  2078  	} else if (res == -EHWPOISON) {
96f96763de26d6 Kefeng Wang             2022-07-26  2079  		pr_err("%#lx: already hardware poisoned\n", pfn);
405ce051236cc6 Naoya Horiguchi         2022-04-21  2080  		if (flags & MF_ACTION_REQUIRED) {
bc1cfde1946752 Sidhartha Kumar         2023-01-12  2081  			folio = page_folio(p);
bc1cfde1946752 Sidhartha Kumar         2023-01-12  2082  			res = kill_accessing_process(current, folio_pfn(folio), flags);
38fe2f81155c0e Jane Chu                2024-05-21  2083  			action_result(pfn, MF_MSG_ALREADY_POISONED, MF_FAILED);
38fe2f81155c0e Jane Chu                2024-05-21  2084  			return res;
405ce051236cc6 Naoya Horiguchi         2022-04-21  2085  		}
405ce051236cc6 Naoya Horiguchi         2022-04-21  2086  		return res;
405ce051236cc6 Naoya Horiguchi         2022-04-21  2087  	} else if (res == -EBUSY) {
38f6d29397ccb9 Naoya Horiguchi         2022-07-14  2088  		if (!(flags & MF_NO_RETRY)) {
38f6d29397ccb9 Naoya Horiguchi         2022-07-14  2089  			flags |= MF_NO_RETRY;
405ce051236cc6 Naoya Horiguchi         2022-04-21  2090  			goto retry;
405ce051236cc6 Naoya Horiguchi         2022-04-21  2091  		}
38fe2f81155c0e Jane Chu                2024-05-21  2092  		return action_result(pfn, MF_MSG_GET_HWPOISON, MF_IGNORED);
761ad8d7c7b548 Naoya Horiguchi         2017-07-10  2093  	}
761ad8d7c7b548 Naoya Horiguchi         2017-07-10  2094  
bc1cfde1946752 Sidhartha Kumar         2023-01-12  2095  	folio = page_folio(p);
bc1cfde1946752 Sidhartha Kumar         2023-01-12  2096  	folio_lock(folio);
405ce051236cc6 Naoya Horiguchi         2022-04-21  2097  
e37e7b0b3bd52e Naoya Horiguchi         2021-12-24 @2098  	if (hwpoison_filter(p)) {
2ff6cecee669bf Sidhartha Kumar         2023-01-12  2099  		folio_clear_hugetlb_hwpoison(folio);
e591ef7d96d6ea Naoya Horiguchi         2022-10-24  2100  		if (migratable_cleared)
bc1cfde1946752 Sidhartha Kumar         2023-01-12  2101  			folio_set_hugetlb_migratable(folio);
bc1cfde1946752 Sidhartha Kumar         2023-01-12  2102  		folio_unlock(folio);
f36a5543a74883 Miaohe Lin              2022-08-18  2103  		if (res == 1)
bc1cfde1946752 Sidhartha Kumar         2023-01-12  2104  			folio_put(folio);
f36a5543a74883 Miaohe Lin              2022-08-18  2105  		return -EOPNOTSUPP;
761ad8d7c7b548 Naoya Horiguchi         2017-07-10  2106  	}
405ce051236cc6 Naoya Horiguchi         2022-04-21  2107  
405ce051236cc6 Naoya Horiguchi         2022-04-21  2108  	/*
405ce051236cc6 Naoya Horiguchi         2022-04-21  2109  	 * Handling free hugepage.  The possible race with hugepage allocation
405ce051236cc6 Naoya Horiguchi         2022-04-21  2110  	 * or demotion can be prevented by PageHWPoison flag.
405ce051236cc6 Naoya Horiguchi         2022-04-21  2111  	 */
405ce051236cc6 Naoya Horiguchi         2022-04-21  2112  	if (res == 0) {
bc1cfde1946752 Sidhartha Kumar         2023-01-12  2113  		folio_unlock(folio);
f40962a5b0bca2 Miaohe Lin              2024-05-23  2114  		if (__page_handle_poison(p) > 0) {
a8b2c2ce89d4e0 Oscar Salvador          2020-12-14  2115  			page_ref_inc(p);
a8b2c2ce89d4e0 Oscar Salvador          2020-12-14  2116  			res = MF_RECOVERED;
ceaf8fbea79a85 Naoya Horiguchi         2022-07-14  2117  		} else {
ceaf8fbea79a85 Naoya Horiguchi         2022-07-14  2118  			res = MF_FAILED;
a8b2c2ce89d4e0 Oscar Salvador          2020-12-14  2119  		}
b66d00dfebe79e Kefeng Wang             2022-10-21  2120  		return action_result(pfn, MF_MSG_FREE_HUGE, res);
761ad8d7c7b548 Naoya Horiguchi         2017-07-10  2121  	}
761ad8d7c7b548 Naoya Horiguchi         2017-07-10  2122  
bc1cfde1946752 Sidhartha Kumar         2023-01-12  2123  	page_flags = folio->flags;
761ad8d7c7b548 Naoya Horiguchi         2017-07-10  2124  
03468a0f52893b Matthew Wilcox (Oracle  2024-04-12  2125) 	if (!hwpoison_user_mappings(folio, p, pfn, flags)) {
bc1cfde1946752 Sidhartha Kumar         2023-01-12  2126  		folio_unlock(folio);
38fe2f81155c0e Jane Chu                2024-05-21  2127  		return action_result(pfn, MF_MSG_UNMAP_FAILED, MF_FAILED);
761ad8d7c7b548 Naoya Horiguchi         2017-07-10  2128  	}
761ad8d7c7b548 Naoya Horiguchi         2017-07-10  2129  
ea6d0630100b28 Naoya Horiguchi         2021-06-24  2130  	return identify_page_state(pfn, p, page_flags);
761ad8d7c7b548 Naoya Horiguchi         2017-07-10  2131  }
00cc790e003693 Shiyang Ruan            2022-06-03  2132
Miaohe Lin May 25, 2024, 1:52 a.m. UTC | #3
On 2024/5/24 23:59, kernel test robot wrote:
> Hi Miaohe,
> 
> kernel test robot noticed the following build errors:
> 
> [auto build test ERROR on akpm-mm/mm-everything]
> [also build test ERROR on linus/master next-20240523]
> [cannot apply to v6.9]
> [If your patch is applied to the wrong git tree, kindly drop us a note.
> And when submitting patch, we suggest to use '--base' as documented in
> https://git-scm.com/docs/git-format-patch#_base_tree_information]
> 
> url:    https://github.com/intel-lab-lkp/linux/commits/Miaohe-Lin/mm-memory-failure-simplify-put_ref_page/20240524-171903
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
> patch link:    https://lore.kernel.org/r/20240524091310.1430048-8-linmiaohe%40huawei.com
> patch subject: [PATCH 07/13] mm/memory-failure: remove unneeded hwpoison_filter() variant
> config: i386-randconfig-005-20240524 (https://download.01.org/0day-ci/archive/20240524/202405242336.o1NEOrln-lkp@intel.com/config)
> compiler: gcc-11 (Ubuntu 11.4.0-4ubuntu1) 11.4.0
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240524/202405242336.o1NEOrln-lkp@intel.com/reproduce)
> 
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@intel.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202405242336.o1NEOrln-lkp@intel.com/
> 
> All errors (new ones prefixed by >>):
> 
>    ld: mm/memory-failure.o: in function `try_memory_failure_hugetlb':
>>> mm/memory-failure.c:2098:(.text+0x28a8): undefined reference to `hwpoison_filter'
>    ld: mm/memory-failure.o: in function `memory_failure':
>    mm/memory-failure.c:2321:(.text+0x2a98): undefined reference to `hwpoison_filter'
>    ld: mm/memory-failure.o: in function `soft_offline_page':
>    mm/memory-failure.c:2841:(.text+0x3217): undefined reference to `hwpoison_filter'

Thanks for building and reporting. I will fix this in next version.
Thanks.
.
diff mbox series

Patch

diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index be9bda281d91..2c3ecbfc2134 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -294,14 +294,8 @@  int hwpoison_filter(struct page *p)
 
 	return 0;
 }
-#else
-int hwpoison_filter(struct page *p)
-{
-	return 0;
-}
-#endif
-
 EXPORT_SYMBOL_GPL(hwpoison_filter);
+#endif
 
 /*
  * Kill all processes that have a poisoned page mapped and then isolate