Hi all,
On 15/5/23 13:51, Dan Carpenter wrote:
The test is wrong. It doesn't accept -EINVAL as a valid failure.
tools/testing/selftests/mincore/mincore_selftest.c 139 TEST(check_huge_pages) 140 { 141 unsigned char vec[1]; 142 char *addr; 143 int retval; 144 int page_size; 145 146 page_size = sysconf(_SC_PAGESIZE); 147 148 errno = 0; 149 addr = mmap(NULL, page_size, PROT_READ | PROT_WRITE, 150 MAP_PRIVATE | MAP_ANONYMOUS | MAP_HUGETLB, 151 -1, 0); 152 if (addr == MAP_FAILED) { 153 if (errno == ENOMEM)
On Armv7 is a 32bit machine so HUGETLB isn't enabled and the errno can be -EINVAL. It's has returned this for 10 years.
154 SKIP(return, "No huge pages available."); 155 else 156 TH_LOG("mmap error: %s", strerror(errno)); 157 } 158 retval = mincore(addr, page_size, vec); 159 ASSERT_EQ(0, retval);
mm/mmap.c 1405 } 1406 } else if (flags & MAP_HUGETLB) { 1407 struct hstate *hs; 1408 1409 hs = hstate_sizelog((flags >> MAP_HUGE_SHIFT) & MAP_HUGE_MASK); 1410 if (!hs) 1411 return -EINVAL; ^^^^^^^^^^^^^^^ hstate_sizelog() return NULL when CONFIG_HUGETLB_PAGE is disabled.
1412 1413 len = ALIGN(len, huge_page_size(hs));
regards, dan carpenter
Thanks for the tip, Dan. I'll send a patch for it asap.
Cheers, Ricardo