All of lore.kernel.org
 help / color / mirror / Atom feed
* [kas:uffd/rfc-v3 2/9] mm/huge_memory.c:2644:43: error: 'PAGE_NONE' undeclared; did you mean 'PAGE_U_NONE'?
@ 2026-04-20 10:36 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2026-04-20 10:36 UTC (permalink / raw)
  To: Kiryl Shutsemau (Meta); +Cc: oe-kbuild-all

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/kas/linux.git uffd/rfc-v3
head:   fa6a4bc0ae172e756264bbe74bea1d95acb29b02
commit: 25dab3d3a0ffa02119bbf5873d46ba0af562a502 [2/9] mm: add MM_CP_UFFD_RWP change_protection() flag
config: arc-allyesconfig (https://download.01.org/0day-ci/archive/20260420/202604201849.LXRq9cVf-lkp@intel.com/config)
compiler: arc-linux-gcc (GCC) 15.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260420/202604201849.LXRq9cVf-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/202604201849.LXRq9cVf-lkp@intel.com/

All errors (new ones prefixed by >>):

   mm/huge_memory.c: In function 'change_huge_pmd':
>> mm/huge_memory.c:2644:43: error: 'PAGE_NONE' undeclared (first use in this function); did you mean 'PAGE_U_NONE'?
    2644 |                 entry = pmd_modify(entry, PAGE_NONE);
         |                                           ^~~~~~~~~
         |                                           PAGE_U_NONE
   mm/huge_memory.c:2644:43: note: each undeclared identifier is reported only once for each function it appears in


vim +2644 mm/huge_memory.c

  2550	
  2551	/*
  2552	 * Returns
  2553	 *  - 0 if PMD could not be locked
  2554	 *  - 1 if PMD was locked but protections unchanged and TLB flush unnecessary
  2555	 *      or if prot_numa but THP migration is not supported
  2556	 *  - HPAGE_PMD_NR if protections changed and TLB flush necessary
  2557	 */
  2558	int change_huge_pmd(struct mmu_gather *tlb, struct vm_area_struct *vma,
  2559			    pmd_t *pmd, unsigned long addr, pgprot_t newprot,
  2560			    unsigned long cp_flags)
  2561	{
  2562		struct mm_struct *mm = vma->vm_mm;
  2563		spinlock_t *ptl;
  2564		pmd_t oldpmd, entry;
  2565		bool prot_numa = cp_flags & MM_CP_PROT_NUMA;
  2566		bool uffd_rwp = cp_flags & MM_CP_UFFD_RWP;
  2567		bool uffd_rwp_resolve = cp_flags & MM_CP_UFFD_RWP_RESOLVE;
  2568		bool uffd_wp = cp_flags & MM_CP_UFFD_WP;
  2569		bool uffd_wp_resolve = cp_flags & MM_CP_UFFD_WP_RESOLVE;
  2570		int ret = 1;
  2571	
  2572		tlb_change_page_size(tlb, HPAGE_PMD_SIZE);
  2573	
  2574		if (prot_numa && !thp_migration_supported())
  2575			return 1;
  2576	
  2577		ptl = __pmd_trans_huge_lock(pmd, vma);
  2578		if (!ptl)
  2579			return 0;
  2580	
  2581		if (thp_migration_supported() && pmd_is_valid_softleaf(*pmd)) {
  2582			change_non_present_huge_pmd(mm, addr, pmd,
  2583						    uffd_wp || uffd_rwp,
  2584						    uffd_wp_resolve || uffd_rwp_resolve);
  2585			goto unlock;
  2586		}
  2587	
  2588		/* Already in the desired state */
  2589		if (prot_numa && pmd_protnone(*pmd))
  2590			goto unlock;
  2591		if (uffd_rwp && pmd_protnone(*pmd) && pmd_uffd_wp(*pmd))
  2592			goto unlock;
  2593	
  2594		if (prot_numa) {
  2595	
  2596			/*
  2597			 * Avoid trapping faults against the zero page. The read-only
  2598			 * data is likely to be read-cached on the local CPU and
  2599			 * local/remote hits to the zero page are not interesting.
  2600			 */
  2601			if (is_huge_zero_pmd(*pmd))
  2602				goto unlock;
  2603	
  2604			if (!folio_can_map_prot_numa(pmd_folio(*pmd), vma,
  2605						     vma_is_single_threaded_private(vma)))
  2606				goto unlock;
  2607		}
  2608		/*
  2609		 * In case prot_numa, we are under mmap_read_lock(mm). It's critical
  2610		 * to not clear pmd intermittently to avoid race with MADV_DONTNEED
  2611		 * which is also under mmap_read_lock(mm):
  2612		 *
  2613		 *	CPU0:				CPU1:
  2614		 *				change_huge_pmd(prot_numa=1)
  2615		 *				 pmdp_huge_get_and_clear_notify()
  2616		 * madvise_dontneed()
  2617		 *  zap_pmd_range()
  2618		 *   pmd_trans_huge(*pmd) == 0 (without ptl)
  2619		 *   // skip the pmd
  2620		 *				 set_pmd_at();
  2621		 *				 // pmd is re-established
  2622		 *
  2623		 * The race makes MADV_DONTNEED miss the huge pmd and don't clear it
  2624		 * which may break userspace.
  2625		 *
  2626		 * pmdp_invalidate_ad() is required to make sure we don't miss
  2627		 * dirty/young flags set by hardware.
  2628		 */
  2629		oldpmd = pmdp_invalidate_ad(vma, addr, pmd);
  2630	
  2631		entry = pmd_modify(oldpmd, newprot);
  2632		if (uffd_wp || uffd_rwp)
  2633			entry = pmd_mkuffd_wp(entry);
  2634		else if (uffd_wp_resolve || uffd_rwp_resolve)
  2635			/*
  2636			 * Leave the write bit to be handled by PF interrupt
  2637			 * handler, then things like COW could be properly
  2638			 * handled.
  2639			 */
  2640			entry = pmd_clear_uffd_wp(entry);
  2641	
  2642		/* See change_pte_range(): preserve RWP protection across mprotect() */
  2643		if (userfaultfd_rwp(vma) && pmd_uffd_wp(entry))
> 2644			entry = pmd_modify(entry, PAGE_NONE);
  2645	
  2646		/* See change_pte_range(). */
  2647		if ((cp_flags & MM_CP_TRY_CHANGE_WRITABLE) && !pmd_write(entry) &&
  2648		    can_change_pmd_writable(vma, addr, entry))
  2649			entry = pmd_mkwrite(entry, vma);
  2650	
  2651		ret = HPAGE_PMD_NR;
  2652		set_pmd_at(mm, addr, pmd, entry);
  2653	
  2654		if (huge_pmd_needs_flush(oldpmd, entry))
  2655			tlb_flush_pmd_range(tlb, addr, HPAGE_PMD_SIZE);
  2656	unlock:
  2657		spin_unlock(ptl);
  2658		return ret;
  2659	}
  2660	

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-04-20 10:37 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-20 10:36 [kas:uffd/rfc-v3 2/9] mm/huge_memory.c:2644:43: error: 'PAGE_NONE' undeclared; did you mean 'PAGE_U_NONE'? kernel test robot

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.