From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AD9DD606A322 for ; Sat, 5 Dec 2026 15:35:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Z48f/LBi Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1656E10E076; Sat, 5 Dec 2026 15:35:12 +0000 (UTC) Received: from tor.source.kernel.org (tor.source.kernel.org [172.105.4.254]) by gabe.freedesktop.org (Postfix) with ESMTPS id BFA0C10E076 for ; Sat, 5 Dec 2026 15:35:05 +0000 (UTC) Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id A61AA60E71; Sat, 5 Dec 2026 15:35:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 48B651F0092B; Sat, 5 Dec 2026 15:35:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796484904; bh=RWdD7OFu/qdH8DhNVsX1/2ty80d1w/IorZgXvTUqEt8=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=Z48f/LBiP76vMLHR6JWkCR2Zyf6bbjPf2GQw7axvTg5mLYue/dzbkksXAmLdaNIZJ TrfokHPDTj+DMaMfvYQZ/1my4V25EVVkcAPCa+ZQJMUTZzoN2pAooF/kaTX54x9t0x vTW+352pAYqnKoS0ifx1QAdP2j4pEgfmfOHIpC7bTKtst+puG49AaTO9ILVbO6ehQ7 qIM063P3g3mU7k1+IfRbMXDzdO9lhJzJp6uWsODT8GxlkbmbPUl35mUZI3HZ02DiMF YDhV+Z15vUGLCfuEuzECgLPJQAMIN5m/1OblmZpKunlvkyR0D+Q61kLsdNglY6f78r pLHYyxmyPyLtA== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v4 3/3] selftests/udmabuf: test mapping a huge page backed udmabuf To: "Qiliang Yuan" Cc: dri-devel@lists.freedesktop.org, media-ci@linuxtv.org In-Reply-To: <20261205-feat-udmabuf-huge-pfnmap-v4-3-c1e1a1d22e27@linux.dev> References: <20261205-feat-udmabuf-huge-pfnmap-v4-0-c1e1a1d22e27@linux.dev> <20261205-feat-udmabuf-huge-pfnmap-v4-3-c1e1a1d22e27@linux.dev> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Sat, 05 Dec 2026 15:35:03 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: sashiko-reviews@lists.linux.dev Sender: "dri-devel" X-Spam-Status: No, score=-11.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 X-Archived-By: Thank you for your contribution! Sashiko AI review found 3 potential issues to consider: - [Low] selftests/udmabuf: test_huge_mapping() fails instead of skipping on ENOMEM - [Low] selftests/udmabuf: missing skip reasons and broad madvise() skip - [Low] selftests/udmabuf: 32-bit size overflow in test_huge_mapping() and read_size() -- commit 7bf6e5af4a4c3adbec3f31e720d6121b01f5b50e Author: Qiliang Yuan selftests/udmabuf: test mapping a huge page backed udmabuf This commit adds four selftest cases in test_huge_mapping() to verify mapping a huge-page-backed udmabuf across PMD-aligned, unaligned, forked, PTE-only, and MADV_NOHUGEPAGE mappings. > diff --git a/tools/testing/selftests/drivers/dma-buf/udmabuf.c b/tools/te= sting/selftests/drivers/dma-buf/udmabuf.c > index d78aec662586b..1f4b7dd1f610e 100644 > --- a/tools/testing/selftests/drivers/dma-buf/udmabuf.c > +++ b/tools/testing/selftests/drivers/dma-buf/udmabuf.c [ ... ] > +static void test_huge_mapping(int devfd) > +{ > + size_t pmd =3D read_size("/sys/kernel/mm/transparent_hugepage/hpage_pmd= _size", > + NULL); > + size_t hpage =3D read_size("/proc/meminfo", "Hugepagesize"); > + struct udmabuf_create create =3D {}; > + int memfd, buf, sub, status, test; > + size_t unit, size; > + char *mem, *addr; > + pid_t pid; > + bool ok; > + > + if (!hpage) { > + for (test =3D 8; test <=3D 11; test++) > + ksft_test_result_skip("%s: [SKIP,test-%d]\n", > + TEST_PREFIX, test); > + return; > + } > + unit =3D hpage > pmd ? hpage : pmd; > + size =3D 8 * unit; [Severity: Low] Can 8 * unit overflow size_t on a 32-bit build? test_huge_mapping() explicitly handles 32-bit tasks via the sizeof(long) !=3D 8 check below, but when unit is 512 MiB or 1 GiB (for example on a 64-bit kernel with default_hugepagesz=3D1G), 8 * unit wraps to 0. mmap_fd(memfd, 0) then fails with EINVAL and aborts with KSFT_FAIL instead of skipping tests 8 through 11. Similarly, read_size() shifts a 32-bit unsigned long left by 10, which overflows silently if Hugepagesize is 4 GiB or larger. > + > + memfd =3D create_memfd_with_seals(size, true); > + mem =3D mmap_fd(memfd, size); [Severity: Low] Will mmap_fd() abort the test instead of skipping when fewer than 8 huge pages are free? /proc/meminfo reports a non-zero Hugepagesize whenever hugetlb is supported, even if the pool has fewer than 8 free huge pages (for instance with default_hugepagesz=3D1G and 2 to 7 free pages, where earlier tests pass). mmap_fd() calls exit(KSFT_FAIL) on ENOMEM, which fails the run and truncates output before tests 8 through 11 are reported. [ ... ] > + /* Map a PMD, disable THP for the mapping, then fault next to the PMD */ > + addr =3D mmap(NULL, size, PROT_READ, MAP_SHARED, buf, 0); > + ok =3D addr !=3D MAP_FAILED && addr[0] =3D=3D mem[0]; > + if (ok && madvise(addr, size, MADV_NOHUGEPAGE)) { > + munmap(addr, size); > + ksft_test_result_skip("%s: [SKIP,test-11]\n", TEST_PREFIX); > + } else { [Severity: Low] Should this skip test-11 only when madvise() fails with EINVAL, and include a skip reason? madvise(MADV_NOHUGEPAGE) returns EINVAL when transparent huge pages are disabled, but madvise_vma_behavior() can also return EAGAIN on ENOMEM, which would be masked as a skip instead of a failure here. Both this skip and the !hpage skip above also omit the missing-prerequisite reason string expected by kselftest. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261205-feat-udmab= uf-huge-pfnmap-v4-0-c1e1a1d22e27@linux.dev?part=3D3