From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 02C1C4F68A4; Tue, 13 Oct 2026 12:32:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791894737; cv=none; b=UtKDwzgjh51IyvMZyzQnP6aDXXKpZdmYOI3x+lr7enWQLn5R74k/q3xrGAMDd8RiBBUaAxURtDKV/7ZBVeSlWtZwn1d7mF9LBNT6uNw08HqCcHLAj62IivpCekf90oZjpWZpjxqpqXu/X4avjoKBC0ovPmy8XG6NDoNfyBZzQ6M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791894737; c=relaxed/simple; bh=fCKNR77W34/trWAheTZSK16EU9eBReKarA3vPtpu2KA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZSIXnrwx3vRnYZXSNwRJjwov2hW+T8iAZ8tZeprSrIusKOEYY01uqzDQs3iOkoSsNlwaAvUHTPzAwWMK9CNFaHJBh/uzDxZ/CMj9AXlqeWG2n81OvdiaEQU4LKZVUDpSrmApkHTb2VwJMy9WZ0kuJQy7wJzn/HIur6LnWp66z2U= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=XrS+w6va; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="XrS+w6va" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 554431F000FF; Tue, 13 Oct 2026 12:32:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1791894735; bh=/N8ivQ/DDpTo6GvddmWU7JRgK8vym9Tjpq7/8GbGKck=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=XrS+w6vaH0N9fW/+DR4xxPxZPmTjmsBu+oJgmP3kl6cm6wRJPwDOK+bCLCZNjKeeX lBcDVwTot+RizKPNNy3BS0CKAKZShV3PUFyXZTPAbEOiDOqFjHWx07yDMbss0ekIxS ZJ8GLDrZpumqACUtZneh8D0D7mQgQ1TPFVyTZmzs= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, "Mike Rapoport (Microsoft)" , Luiz Capitulino , Sarthak Sharma , Baolin Wang , Barry Song , David Hildenbrand , Dev Jain , Donet Tom , Jason Gunthorpe , John Hubbard , Lance Yang , Leon Romanovsky , Liam Howlett , Li Wang , Lorenzo Stoakes , Mark Brown , Michal Hocko , Nico Pache , Peter Xu , Ryan Roberts , Shuah Khan , Suren Baghdasaryan , Vlastimil Babka , Zi Yan , Andrew Morton , Sasha Levin Subject: [PATCH 6.12 005/497] selftests/mm: hugetlb-mremap: add setup of HugeTLB pages Date: Tue, 13 Oct 2026 13:32:52 +0200 Message-ID: <20261013112908.004514122@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261013112907.864180619@linuxfoundation.org> References: <20261013112907.864180619@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Mike Rapoport (Microsoft) commit a914785f6349da754e1226420bf4e51961956769 upstream. hugetlb-mremap test fails if there are no free huge pages prepared by a wrapper script. Add setup of HugeTLB pages to the test and make sure that the original settings are restored on the test exit. Link: https://lore.kernel.org/20260511162840.375890-42-rppt@kernel.org Signed-off-by: Mike Rapoport (Microsoft) Tested-by: Luiz Capitulino Tested-by: Sarthak Sharma Cc: Baolin Wang Cc: Barry Song Cc: David Hildenbrand Cc: Dev Jain Cc: Donet Tom Cc: Jason Gunthorpe Cc: John Hubbard Cc: Lance Yang Cc: Leon Romanovsky Cc: Liam Howlett Cc: Li Wang Cc: Lorenzo Stoakes Cc: Mark Brown Cc: Michal Hocko Cc: Nico Pache Cc: Peter Xu Cc: Ryan Roberts Cc: Shuah Khan Cc: Suren Baghdasaryan Cc: Vlastimil Babka Cc: Zi Yan Signed-off-by: Andrew Morton [ Backport-notes: this is a partial backport containing only the aligning of 'length' to the hugepage size. The hugepage_settings.h include line and the hugetlb_setup_default() call are omitted. Without this fix, the uffd_register() call always fails on arm64 with 64K base pages and 512 MiB default HugeTLB page size causing the test to fail with the error below as 'length' is 10 MiB and not aligned to the HugeTLB page size. # ------------------------- # running ./hugepage-mremap # ------------------------- # TAP version 13 # 1..1 # # Map haddr: Returned address is 0x7eaa40000000 # # Map daddr: Returned address is 0x7daa40000000 # # Map vaddr: Returned address is 0x7faa40000000 # Bail out! ioctl-UFFDIO_REGISTER: Invalid argument # # Planned tests != run tests (1 != 0) # # Totals: pass:0 fail:0 xfail:0 xpass:0 skip:0 error:0 # [FAIL] not ok 1 hugepage-mremap # exit=1 # NOTE: These hugetlb tests provide minimal coverage. Use # https://github.com/libhugetlbfs/libhugetlbfs.git for # hugetlb regression testing. # SKIP ./uffd-wp-mremap ] Signed-off-by: Luiz Capitulino Signed-off-by: Sasha Levin --- tools/testing/selftests/mm/hugepage-mremap.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/testing/selftests/mm/hugepage-mremap.c b/tools/testing/selftests/mm/hugepage-mremap.c index 3070484f9ed0a..164bbda8128f9 100644 --- a/tools/testing/selftests/mm/hugepage-mremap.c +++ b/tools/testing/selftests/mm/hugepage-mremap.c @@ -87,6 +87,7 @@ static void register_region_with_uffd(char *addr, size_t len) int main(int argc, char *argv[]) { + unsigned long hugepage_size; size_t length = 0; int ret = 0, fd; @@ -104,7 +105,11 @@ int main(int argc, char *argv[]) else length = DEFAULT_LENGTH_MB; + hugepage_size = default_huge_page_size(); + if (!hugepage_size) + ksft_exit_skip("Could not detect default hugetlb page size\n"); length = MB_TO_BYTES(length); + length = (length + hugepage_size - 1) & ~(hugepage_size - 1); fd = memfd_create(argv[0], MFD_HUGETLB); if (fd < 0) ksft_exit_fail_msg("Open failed: %s\n", strerror(errno)); -- 2.53.0