All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: oe-kbuild-all@lists.linux.dev
Subject: [willy-pagecache:hugetlb-20260728 6/22] mm/memory-failure.c:2751:18: error: use of undeclared identifier 'hugetlb_lock'; did you mean 'hugetlb_walk'?
Date: Wed, 29 Jul 2026 16:12:22 +0800	[thread overview]
Message-ID: <202607291537.yk07Dfte-lkp@intel.com> (raw)

tree:   git://git.infradead.org/users/willy/pagecache hugetlb-20260728
head:   9d175837a52482ede820b73b06d16914dfe184b9
commit: 4e9ba443c27579c311e9cc43d1ed6d4c01abcccf [6/22] hugetlb: Use the has_hwpoisoned flag
config: x86_64-kexec (https://download.01.org/0day-ci/archive/20260729/202607291537.yk07Dfte-lkp@intel.com/config)
compiler: clang version 22.1.3 (https://github.com/llvm/llvm-project e9846648fd6183ee6d8cbdb4502213fcf902a211)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260729/202607291537.yk07Dfte-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/202607291537.yk07Dfte-lkp@intel.com/

All errors (new ones prefixed by >>):

>> mm/memory-failure.c:2751:18: error: use of undeclared identifier 'hugetlb_lock'; did you mean 'hugetlb_walk'?
    2751 |                 spin_lock_irq(&hugetlb_lock);
         |                                ^~~~~~~~~~~~
         |                                hugetlb_walk
   include/linux/hugetlb.h:1349:1: note: 'hugetlb_walk' declared here
    1349 | hugetlb_walk(struct vm_area_struct *vma, unsigned long addr, unsigned long sz)
         | ^
>> mm/memory-failure.c:2751:17: error: incompatible pointer types passing 'pte_t *(*)(struct vm_area_struct *, unsigned long, unsigned long)' to parameter of type 'spinlock_t *' (aka 'struct spinlock *') [-Wincompatible-pointer-types]
    2751 |                 spin_lock_irq(&hugetlb_lock);
         |                               ^~~~~~~~~~~~~
   include/linux/spinlock.h:369:55: note: passing argument to parameter 'lock' here
     369 | static __always_inline void spin_lock_irq(spinlock_t *lock)
         |                                                       ^
   mm/memory-failure.c:2756:22: error: use of undeclared identifier 'hugetlb_lock'; did you mean 'hugetlb_walk'?
    2756 |                                 spin_unlock_irq(&hugetlb_lock);
         |                                                  ^~~~~~~~~~~~
         |                                                  hugetlb_walk
   include/linux/hugetlb.h:1349:1: note: 'hugetlb_walk' declared here
    1349 | hugetlb_walk(struct vm_area_struct *vma, unsigned long addr, unsigned long sz)
         | ^
   mm/memory-failure.c:2756:21: error: incompatible pointer types passing 'pte_t *(*)(struct vm_area_struct *, unsigned long, unsigned long)' to parameter of type 'spinlock_t *' (aka 'struct spinlock *') [-Wincompatible-pointer-types]
    2756 |                                 spin_unlock_irq(&hugetlb_lock);
         |                                                 ^~~~~~~~~~~~~
   include/linux/spinlock.h:399:57: note: passing argument to parameter 'lock' here
     399 | static __always_inline void spin_unlock_irq(spinlock_t *lock)
         |                                                         ^
   mm/memory-failure.c:2763:20: error: use of undeclared identifier 'hugetlb_lock'; did you mean 'hugetlb_walk'?
    2763 |                 spin_unlock_irq(&hugetlb_lock);
         |                                  ^~~~~~~~~~~~
         |                                  hugetlb_walk
   include/linux/hugetlb.h:1349:1: note: 'hugetlb_walk' declared here
    1349 | hugetlb_walk(struct vm_area_struct *vma, unsigned long addr, unsigned long sz)
         | ^
   mm/memory-failure.c:2763:19: error: incompatible pointer types passing 'pte_t *(*)(struct vm_area_struct *, unsigned long, unsigned long)' to parameter of type 'spinlock_t *' (aka 'struct spinlock *') [-Wincompatible-pointer-types]
    2763 |                 spin_unlock_irq(&hugetlb_lock);
         |                                 ^~~~~~~~~~~~~
   include/linux/spinlock.h:399:57: note: passing argument to parameter 'lock' here
     399 | static __always_inline void spin_unlock_irq(spinlock_t *lock)
         |                                                         ^
   6 errors generated.


vim +2751 mm/memory-failure.c

  2677	
  2678	/**
  2679	 * unpoison_memory - Unpoison a previously poisoned page
  2680	 * @pfn: Page number of the to be unpoisoned page
  2681	 *
  2682	 * Software-unpoison a page that has been poisoned by
  2683	 * memory_failure() earlier.
  2684	 *
  2685	 * This is only done on the software-level, so it only works
  2686	 * for linux injected failures, not real hardware failures
  2687	 *
  2688	 * Returns 0 for success, otherwise -errno.
  2689	 */
  2690	int unpoison_memory(unsigned long pfn)
  2691	{
  2692		struct folio *folio;
  2693		struct page *p;
  2694		int ret = -EBUSY, ghp;
  2695		unsigned long count;
  2696		bool huge = false;
  2697		static DEFINE_RATELIMIT_STATE(unpoison_rs, DEFAULT_RATELIMIT_INTERVAL,
  2698						DEFAULT_RATELIMIT_BURST);
  2699	
  2700		p = pfn_to_online_page(pfn);
  2701		if (!p)
  2702			return -EIO;
  2703		folio = page_folio(p);
  2704	
  2705		mutex_lock(&mf_mutex);
  2706	
  2707		if (hw_memory_failure) {
  2708			unpoison_pr_info("%#lx: disabled after HW memory failure\n",
  2709					 pfn, &unpoison_rs);
  2710			ret = -EOPNOTSUPP;
  2711			goto unlock_mutex;
  2712		}
  2713	
  2714		if (is_huge_zero_folio(folio)) {
  2715			unpoison_pr_info("%#lx: huge zero page is not supported\n",
  2716					 pfn, &unpoison_rs);
  2717			ret = -EOPNOTSUPP;
  2718			goto unlock_mutex;
  2719		}
  2720	
  2721		if (!is_page_hwpoison(p)) {
  2722			unpoison_pr_info("%#lx: page is not poisoned\n",
  2723					 pfn, &unpoison_rs);
  2724			goto unlock_mutex;
  2725		}
  2726	
  2727		if (folio_ref_count(folio) > 1) {
  2728			unpoison_pr_info("%#lx: someone grabs the hwpoison page\n",
  2729					 pfn, &unpoison_rs);
  2730			goto unlock_mutex;
  2731		}
  2732	
  2733		if (folio_test_slab(folio) || folio_test_pgtable(folio) ||
  2734		    folio_test_reserved(folio) || folio_test_offline(folio))
  2735			goto unlock_mutex;
  2736	
  2737		if (folio_mapped(folio)) {
  2738			unpoison_pr_info("%#lx: someone maps the hwpoison page\n",
  2739					 pfn, &unpoison_rs);
  2740			goto unlock_mutex;
  2741		}
  2742	
  2743		if (folio_mapping(folio)) {
  2744			unpoison_pr_info("%#lx: the hwpoison page has non-NULL mapping\n",
  2745					 pfn, &unpoison_rs);
  2746			goto unlock_mutex;
  2747		}
  2748	
  2749		ghp = get_hwpoison_page(p, MF_UNPOISON);
  2750		if (!ghp) {
> 2751			spin_lock_irq(&hugetlb_lock);
  2752			if (folio_test_hugetlb(folio)) {
  2753				huge = true;
  2754				count = folio_free_raw_hwp(folio, false);
  2755				if (count == 0) {
  2756					spin_unlock_irq(&hugetlb_lock);
  2757					goto unlock_mutex;
  2758				}
  2759				ret = hugetlb_clear_poison(folio);
  2760			} else {
  2761				ret = TestClearPageHWPoison(p) ? 0 : -EBUSY;
  2762			}
  2763			spin_unlock_irq(&hugetlb_lock);
  2764		} else if (ghp < 0) {
  2765			if (ghp == -EHWPOISON) {
  2766				ret = put_page_back_buddy(p) ? 0 : -EBUSY;
  2767			} else {
  2768				ret = ghp;
  2769				unpoison_pr_info("%#lx: failed to grab page\n",
  2770						 pfn, &unpoison_rs);
  2771			}
  2772		} else if (folio_test_hugetlb(folio)) {
  2773			huge = true;
  2774			count = folio_free_raw_hwp(folio, false);
  2775			if (count == 0) {
  2776				folio_put(folio);
  2777				goto unlock_mutex;
  2778			}
  2779			ret = hugetlb_clear_poison(folio);
  2780			folio_put(folio);
  2781			if (!ret)
  2782				folio_put(folio);
  2783		} else {
  2784			folio_put(folio);
  2785			if (TestClearPageHWPoison(p)) {
  2786				folio_put(folio);
  2787				ret = 0;
  2788			}
  2789		}
  2790	
  2791	unlock_mutex:
  2792		mutex_unlock(&mf_mutex);
  2793		if (!ret) {
  2794			if (!huge)
  2795				num_poisoned_pages_sub(pfn, 1);
  2796			unpoison_pr_info("%#lx: software-unpoisoned page\n",
  2797					 page_to_pfn(p), &unpoison_rs);
  2798		}
  2799		return ret;
  2800	}
  2801	EXPORT_SYMBOL(unpoison_memory);
  2802	

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

                 reply	other threads:[~2026-07-29  8:13 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202607291537.yk07Dfte-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.