CC: [email protected] CC: [email protected] CC: Mike Rapoport <[email protected]> CC: [email protected] TO: Mike Rapoport <[email protected]>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/rppt/linux.git gfp-unmapped/v0 head: 53acd000a0eef1457aaa4930c0d2003d7785f799 commit: 253f456a5cb652a16a59cc4ac2e18669997d79cd [1/3] mm/page_alloc: introduce __GFP_UNMAPPED and MIGRETE_UNMAPPED :::::: branch date: 34 hours ago :::::: commit date: 35 hours ago config: x86_64-randconfig-c007 (https://download.01.org/0day-ci/archive/20220122/[email protected]/config) compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project d4baf3b1322b84816aa623d8e8cb45a49cb68b84) reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://git.kernel.org/pub/scm/linux/kernel/git/rppt/linux.git/commit/?id=253f456a5cb652a16a59cc4ac2e18669997d79cd git remote add rppt https://git.kernel.org/pub/scm/linux/kernel/git/rppt/linux.git git fetch --no-tags rppt gfp-unmapped/v0 git checkout 253f456a5cb652a16a59cc4ac2e18669997d79cd # save the config file to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 clang-analyzer If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <[email protected]> clang-analyzer warnings: (new ones prefixed by >>) ^ mm/page_alloc.c:1512:20: note: Left side of '||' is true int prefetch_nr = READ_ONCE(pcp->batch); ^ include/asm-generic/rwonce.h:49:2: note: expanded from macro 'READ_ONCE' compiletime_assert_rwonce_type(x); \ ^ include/asm-generic/rwonce.h:36:21: note: expanded from macro 'compiletime_assert_rwonce_type' compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long), \ ^ include/linux/compiler_types.h:314:28: note: expanded from macro '__native_word' sizeof(t) == sizeof(int) || sizeof(t) == sizeof(long)) ^ mm/page_alloc.c:1512:20: note: Taking false branch int prefetch_nr = READ_ONCE(pcp->batch); ^ include/asm-generic/rwonce.h:49:2: note: expanded from macro 'READ_ONCE' compiletime_assert_rwonce_type(x); \ ^ include/asm-generic/rwonce.h:36:2: note: expanded from macro 'compiletime_assert_rwonce_type' compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long), \ ^ include/linux/compiler_types.h:346:2: note: expanded from macro 'compiletime_assert' _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) ^ include/linux/compiler_types.h:334:2: note: expanded from macro '_compiletime_assert' __compiletime_assert(condition, msg, prefix, suffix) ^ include/linux/compiler_types.h:326:3: note: expanded from macro '__compiletime_assert' if (!(condition)) \ ^ mm/page_alloc.c:1512:20: note: Loop condition is false. Exiting loop int prefetch_nr = READ_ONCE(pcp->batch); ^ include/asm-generic/rwonce.h:49:2: note: expanded from macro 'READ_ONCE' compiletime_assert_rwonce_type(x); \ ^ include/asm-generic/rwonce.h:36:2: note: expanded from macro 'compiletime_assert_rwonce_type' compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long), \ ^ include/linux/compiler_types.h:346:2: note: expanded from macro 'compiletime_assert' _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) ^ include/linux/compiler_types.h:334:2: note: expanded from macro '_compiletime_assert' __compiletime_assert(condition, msg, prefix, suffix) ^ include/linux/compiler_types.h:318:2: note: expanded from macro '__compiletime_assert' do { \ ^ mm/page_alloc.c:1521:10: note: '__UNIQUE_ID___x910' is >= '__UNIQUE_ID___y911' count = min(pcp->count, count); ^ include/linux/minmax.h:45:19: note: expanded from macro 'min' #define min(x, y) __careful_cmp(x, y, <) ^~~~~~~~~~~~~~~~~~~~~~ include/linux/minmax.h:38:3: note: expanded from macro '__careful_cmp' __cmp_once(x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y), op)) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/minmax.h:33:3: note: expanded from macro '__cmp_once' __cmp(unique_x, unique_y, op); }) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/minmax.h:28:26: note: expanded from macro '__cmp' #define __cmp(x, y, op) ((x) op (y) ? (x) : (y)) ^~~ mm/page_alloc.c:1521:10: note: '?' condition is false count = min(pcp->count, count); ^ include/linux/minmax.h:45:19: note: expanded from macro 'min' #define min(x, y) __careful_cmp(x, y, <) ^ include/linux/minmax.h:38:3: note: expanded from macro '__careful_cmp' __cmp_once(x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y), op)) ^ include/linux/minmax.h:33:3: note: expanded from macro '__cmp_once' __cmp(unique_x, unique_y, op); }) ^ include/linux/minmax.h:28:26: note: expanded from macro '__cmp' #define __cmp(x, y, op) ((x) op (y) ? (x) : (y)) ^ mm/page_alloc.c:1522:9: note: Assuming 'count' is <= 0 while (count > 0) { ^~~~~~~~~ mm/page_alloc.c:1522:2: note: Loop condition is false. Execution continues on line 1576 while (count > 0) { ^ mm/page_alloc.c:1589:2: note: Assigned value is garbage or undefined list_for_each_entry_safe(page, tmp, &head, lru) { ^ include/linux/list.h:726:7: note: expanded from macro 'list_for_each_entry_safe' n = list_next_entry(pos, member); \ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/list.h:564:2: note: expanded from macro 'list_next_entry' list_entry((pos)->member.next, typeof(*(pos)), member) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/list.h:520:2: note: expanded from macro 'list_entry' container_of(ptr, type, member) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/container_of.h:18:2: note: expanded from macro 'container_of' void *__mptr = (void *)(ptr); \ ^ ~~~~~~~~~~~~~ >> mm/page_alloc.c:2656:16: warning: Value stored to 'start_addr' during its >> initialization is never read [clang-analyzer-deadcode.DeadStores] unsigned long start_addr = PFN_PHYS(start_pfn); ^~~~~~~~~~ mm/page_alloc.c:2656:16: note: Value stored to 'start_addr' during its initialization is never read unsigned long start_addr = PFN_PHYS(start_pfn); ^~~~~~~~~~ >> mm/page_alloc.c:2657:16: warning: Value stored to 'end_addr' during its >> initialization is never read [clang-analyzer-deadcode.DeadStores] unsigned long end_addr = PFN_PHYS(end_pfn); ^~~~~~~~ mm/page_alloc.c:2657:16: note: Value stored to 'end_addr' during its initialization is never read unsigned long end_addr = PFN_PHYS(end_pfn); ^~~~~~~~ mm/page_alloc.c:5462:29: warning: Array access (from variable 'page_array') results in a null pointer dereference [clang-analyzer-core.NullDereference] page_array[nr_populated] = page; ~~~~~~~~~~ ^ mm/page_alloc.c:5364:9: note: Assuming 'page_array' is null while (page_array && nr_populated < nr_pages && page_array[nr_populated]) ^~~~~~~~~~ mm/page_alloc.c:5364:20: note: Left side of '&&' is false while (page_array && nr_populated < nr_pages && page_array[nr_populated]) ^ mm/page_alloc.c:5368:15: note: Assuming 'nr_pages' is > 0 if (unlikely(nr_pages <= 0)) ^ include/linux/compiler.h:78:42: note: expanded from macro 'unlikely' # define unlikely(x) __builtin_expect(!!(x), 0) ^ mm/page_alloc.c:5368:2: note: Taking false branch if (unlikely(nr_pages <= 0)) ^ mm/page_alloc.c:5372:15: note: 'page_array' is null if (unlikely(page_array && nr_pages - nr_populated == 0)) ^ include/linux/compiler.h:78:42: note: expanded from macro 'unlikely' # define unlikely(x) __builtin_expect(!!(x), 0) ^ mm/page_alloc.c:5372:26: note: Left side of '&&' is false if (unlikely(page_array && nr_pages - nr_populated == 0)) ^ mm/page_alloc.c:5372:2: note: Taking false branch if (unlikely(page_array && nr_pages - nr_populated == 0)) ^ mm/page_alloc.c:5376:6: note: Calling 'memcg_kmem_enabled' if (memcg_kmem_enabled() && (gfp & __GFP_ACCOUNT)) ^~~~~~~~~~~~~~~~~~~~ include/linux/memcontrol.h:1747:2: note: Returning zero, which participates in a condition later return false; ^~~~~~~~~~~~ mm/page_alloc.c:5376:6: note: Returning from 'memcg_kmem_enabled' if (memcg_kmem_enabled() && (gfp & __GFP_ACCOUNT)) ^~~~~~~~~~~~~~~~~~~~ mm/page_alloc.c:5376:27: note: Left side of '&&' is false if (memcg_kmem_enabled() && (gfp & __GFP_ACCOUNT)) ^ mm/page_alloc.c:5380:6: note: Assuming the condition is false if (nr_pages - nr_populated == 1) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ mm/page_alloc.c:5380:2: note: Taking false branch if (nr_pages - nr_populated == 1) ^ mm/page_alloc.c:5384:6: note: Assuming the condition is false if (gfp & __GFP_UNMAPPED) ^~~~~~~~~~~~~~~~~~~~ mm/page_alloc.c:5384:2: note: Taking false branch if (gfp & __GFP_UNMAPPED) ^ mm/page_alloc.c:5402:7: note: Calling 'prepare_alloc_pages' if (!prepare_alloc_pages(gfp, 0, preferred_nid, nodemask, &ac, &alloc_gfp, &alloc_flags)) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ mm/page_alloc.c:5288:2: note: Taking false branch if (cpusets_enabled()) { ^ mm/page_alloc.c:5303:2: note: Taking true branch might_sleep_if(gfp_mask & __GFP_DIRECT_RECLAIM); ^ include/linux/kernel.h:188:35: note: expanded from macro 'might_sleep_if' #define might_sleep_if(cond) do { if (cond) might_sleep(); } while (0) ^ mm/page_alloc.c:5303:2: note: Loop condition is false. Exiting loop might_sleep_if(gfp_mask & __GFP_DIRECT_RECLAIM); ^ include/linux/kernel.h:188:45: note: expanded from macro 'might_sleep_if' #define might_sleep_if(cond) do { if (cond) might_sleep(); } while (0) ^ include/linux/kernel.h:138:2: note: expanded from macro 'might_sleep' do { __might_sleep(__FILE__, __LINE__); might_resched(); } while (0) ^ mm/page_alloc.c:5303:2: note: Loop condition is false. Exiting loop might_sleep_if(gfp_mask & __GFP_DIRECT_RECLAIM); ^ include/linux/kernel.h:188:30: note: expanded from macro 'might_sleep_if' #define might_sleep_if(cond) do { if (cond) might_sleep(); } while (0) ^ mm/page_alloc.c:5305:2: note: Taking false branch if (should_fail_alloc_page(gfp_mask, order)) ^ mm/page_alloc.c:5321:2: note: Returning the value 1, which participates in a condition later return true; ^~~~~~~~~~~ mm/page_alloc.c:5402:7: note: Returning from 'prepare_alloc_pages' if (!prepare_alloc_pages(gfp, 0, preferred_nid, nodemask, &ac, &alloc_gfp, &alloc_flags)) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ mm/page_alloc.c:5402:2: note: Taking false branch if (!prepare_alloc_pages(gfp, 0, preferred_nid, nodemask, &ac, &alloc_gfp, &alloc_flags)) ^ mm/page_alloc.c:5407:2: note: Loop condition is true. Entering loop body for_each_zone_zonelist_nodemask(zone, z, ac.zonelist, ac.highest_zoneidx, ac.nodemask) { vim +/start_addr +2656 mm/page_alloc.c c361be55b31284 Mel Gorman 2007-10-16 2649 253f456a5cb652 Mike Rapoport 2022-01-04 2650 static int set_pageblock_unmapped(struct zone *zone, struct page *page, 253f456a5cb652 Mike Rapoport 2022-01-04 2651 unsigned int order) 253f456a5cb652 Mike Rapoport 2022-01-04 2652 { 253f456a5cb652 Mike Rapoport 2022-01-04 2653 #ifdef CONFIG_ARCH_WANTS_GFP_UNMAPPED 253f456a5cb652 Mike Rapoport 2022-01-04 2654 unsigned long start_pfn = page_to_pfn(page) & ~(pageblock_nr_pages - 1); 253f456a5cb652 Mike Rapoport 2022-01-04 2655 unsigned long end_pfn = start_pfn + pageblock_nr_pages; 253f456a5cb652 Mike Rapoport 2022-01-04 @2656 unsigned long start_addr = PFN_PHYS(start_pfn); 253f456a5cb652 Mike Rapoport 2022-01-04 @2657 unsigned long end_addr = PFN_PHYS(end_pfn); 253f456a5cb652 Mike Rapoport 2022-01-04 2658 unsigned long pfn, err; 253f456a5cb652 Mike Rapoport 2022-01-04 2659 253f456a5cb652 Mike Rapoport 2022-01-04 2660 BUILD_BUG_ON(pageblock_order != PMD_ORDER); 253f456a5cb652 Mike Rapoport 2022-01-04 2661 253f456a5cb652 Mike Rapoport 2022-01-04 2662 if (is_migrate_unmapped_page(page)) 253f456a5cb652 Mike Rapoport 2022-01-04 2663 return 0; 253f456a5cb652 Mike Rapoport 2022-01-04 2664 253f456a5cb652 Mike Rapoport 2022-01-04 2665 /* 253f456a5cb652 Mike Rapoport 2022-01-04 2666 * Calling set_direct_map_invalid_noflush() for the first page in a 253f456a5cb652 Mike Rapoport 2022-01-04 2667 * pageblock will split PMD entry and it may fail to allocat the 253f456a5cb652 Mike Rapoport 2022-01-04 2668 * PMD page. Subsequent calls will only update the PTEs, so they 253f456a5cb652 Mike Rapoport 2022-01-04 2669 * cannot fail. 253f456a5cb652 Mike Rapoport 2022-01-04 2670 */ 253f456a5cb652 Mike Rapoport 2022-01-04 2671 err = set_direct_map_invalid_noflush(page); 253f456a5cb652 Mike Rapoport 2022-01-04 2672 if (err) { 253f456a5cb652 Mike Rapoport 2022-01-04 2673 int migratetype = get_pageblock_migratetype(page); 253f456a5cb652 Mike Rapoport 2022-01-04 2674 253f456a5cb652 Mike Rapoport 2022-01-04 2675 move_to_free_list(page, zone, order, migratetype); 253f456a5cb652 Mike Rapoport 2022-01-04 2676 return err; 253f456a5cb652 Mike Rapoport 2022-01-04 2677 } 253f456a5cb652 Mike Rapoport 2022-01-04 2678 253f456a5cb652 Mike Rapoport 2022-01-04 2679 for (pfn = start_pfn; pfn < end_pfn; pfn++) { 253f456a5cb652 Mike Rapoport 2022-01-04 2680 page = pfn_to_page(pfn); 253f456a5cb652 Mike Rapoport 2022-01-04 2681 if (PageBuddy(page)) 253f456a5cb652 Mike Rapoport 2022-01-04 2682 set_direct_map_invalid_noflush(page); 253f456a5cb652 Mike Rapoport 2022-01-04 2683 } 253f456a5cb652 Mike Rapoport 2022-01-04 2684 253f456a5cb652 Mike Rapoport 2022-01-04 2685 flush_tlb_kernel_range(start_addr, end_addr); 253f456a5cb652 Mike Rapoport 2022-01-04 2686 set_pageblock_migratetype(page, MIGRATE_UNMAPPED); 253f456a5cb652 Mike Rapoport 2022-01-04 2687 move_freepages_block(zone, page, MIGRATE_UNMAPPED, NULL); 253f456a5cb652 Mike Rapoport 2022-01-04 2688 #endif 253f456a5cb652 Mike Rapoport 2022-01-04 2689 253f456a5cb652 Mike Rapoport 2022-01-04 2690 return 0; 253f456a5cb652 Mike Rapoport 2022-01-04 2691 } 253f456a5cb652 Mike Rapoport 2022-01-04 2692 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/[email protected] _______________________________________________ kbuild mailing list -- [email protected] To unsubscribe send an email to [email protected]
