From nobody Thu Sep 03 16:36:43 2026 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4hbQGh276Jz6q2k3 for ; Thu, 03 Sep 2026 16:36:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "YR2" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4hbQGg3csSz3FQX for ; Thu, 03 Sep 2026 16:36:43 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1788453403; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=pwxfo4fFUrinC5XPv6oPK4lBZ1bVv0mytFYvb6oXs1E=; b=GcSrVX5+/horX/hXWoWZZi3IzJN76U2kPvLeepCaZfEMl87NAIMTDFri91f2HsZpRT2TXL lC/cFjSOytmprE7+Qtp2gqomeR3OS92Yi24LMTyEGa3825DbzzGQ+gd8TtOt08G57axdXp EYYuqfmpAmUiHQEv+yooomUwZanWwtBppkhTjzSoQ1nQuGHRGK+811a474F7Ij9L9OBJ5+ CfFeW1S8end7zb820VeeLP5hhgEmZe9D1xkktWoxmL3DuxAt/lO4q/yKBM6YjO6xa6Med8 k1oYJHD/92clXRYg6QTeZUPryWk410FplucFpTAvmhe7Xa/a2CojlUcG3q+08g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1788453403; a=rsa-sha256; cv=none; b=wJaFN5XQnM9JIjSsE3kM9MUcNayQllJJUXXCvKNL2M6WA36/3hFO163guXA+DGaMytpFnl d/BcSqnVFAUDc8zxqpRj04OS+X1xKBUZumpSOtEQuOYcXuZsQ8cHhkdOgFD8PQict1X7mt liTSnuMPJbAlgAf2igS9aF1jl2hWCFHDL4CSzAmSTDtaBUXmz0bZ7UZvm/Ns60XWu4XujV 0bobLQOAl5gfucaWWfcTp3+mphzV7PwGSlS18Lpix7xHHstFTEClUTi62lEEArNRI/S7F6 IEYsQt+XnXbbcqGTB+gDYvjnq7SOcEnS3fbobPyGm5Wq0006/J4YZhMv7pYUSg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1788453403; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=pwxfo4fFUrinC5XPv6oPK4lBZ1bVv0mytFYvb6oXs1E=; b=iiO/415D372YlJTf651zsrhkVu+EatS/h0owm6JbT9y1/AXF24tr+lCfdhpJniakrWWaju VBeMZamunWlT/42Y+2GeLgBO651EYVrmo59NwnPydFB0HUAAWTehOHr/oU0eQLEKnZ79Ie wGFPJQDaAeo+L3H+odisKJrzQaf3sQh8ff1VuDdcStsT9GYra2NyVtckJfnIXKHYY1dvyg fs+Hti+apf4UNNbxXvZYuD7joiRWl/OxLH2e8Rc3iKzD6I+6pKZ5Dr3/3wJZdS3luovbAP jRgSORMjGwh8PJIqVlr1Gt4NI68JsK4WFTZ7IDdd1zJPmeCPce7iuTIqiscmFA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4hbQGg2620z5xL for ; Thu, 03 Sep 2026 16:36:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 388e4 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 03 Sep 2026 16:36:43 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: 10ebbeb4d78c - stable/15 - subr_physmem_test: add tests for two edge-cases List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/stable/15 X-Git-Reftype: branch X-Git-Commit: 10ebbeb4d78cebdf6398e224a94edf8373de5c88 Auto-Submitted: auto-generated Date: Thu, 03 Sep 2026 16:36:43 +0000 Message-Id: <6a99a21b.388e4.5d0fd810@gitrepo.freebsd.org> The branch stable/15 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=10ebbeb4d78cebdf6398e224a94edf8373de5c88 commit 10ebbeb4d78cebdf6398e224a94edf8373de5c88 Author: Mitchell Horne AuthorDate: 2026-07-13 19:49:32 +0000 Commit: Mitchell Horne CommitDate: 2026-09-03 16:32:44 +0000 subr_physmem_test: add tests for two edge-cases Help validate my assertion that "physmem will never report empty ranges". Part of this is covered by the existing tests, which check the merging of adjacent/overlapping regions. The other part is to ensure that addition of zero-sized ranges is ignored. The physmem implementation also includes logic to ignore the first physical page of memory (physical addresses 0 to PAGE_SIZE-1). Add a second test case for this. Reviewed by: markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D45914 (cherry picked from commit 1b5ec2e466ee100161017ae2618f91829310f1d6) --- tests/sys/kern/subr_physmem_test.c | 43 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/tests/sys/kern/subr_physmem_test.c b/tests/sys/kern/subr_physmem_test.c index b810a2016473..dad7882c93ec 100644 --- a/tests/sys/kern/subr_physmem_test.c +++ b/tests/sys/kern/subr_physmem_test.c @@ -127,11 +127,54 @@ ATF_TC_BODY(hwregion_unordered, tc) ATF_CHECK_EQ(avail[1], 3 * PAGE_SIZE); } +ATF_TC_WITHOUT_HEAD(hwregion_ignore_empty); +ATF_TC_BODY(hwregion_ignore_empty, tc) +{ + vm_paddr_t avail[4]; + size_t len; + + /* Add a region. */ + physmem_hardware_region(PAGE_SIZE, 2 * PAGE_SIZE); + + /* Add full zero range (ignored) */ + physmem_hardware_region(0, 0); + + /* Add a zero-sized range (ignored) */ + physmem_hardware_region(4 * PAGE_SIZE, 0); + + len = physmem_avail(avail, nitems(avail)); + ATF_CHECK_EQ(len, 2); + ATF_CHECK_EQ(avail[0], PAGE_SIZE); + ATF_CHECK_EQ(avail[1], 3 * PAGE_SIZE); +} + +ATF_TC_WITHOUT_HEAD(hwregion_ignore_page0); +ATF_TC_BODY(hwregion_ignore_page0, tc) +{ + vm_paddr_t avail[4]; + size_t len; + + /* + * Physical addresses [0, PAGE_SIZE) are unusable in the VM layer. + * + * physmem will truncate this from the beginning of an otherwise valid + * memory range; test that this is the case. + */ + physmem_hardware_region(0, 2 * PAGE_SIZE); + + len = physmem_avail(avail, 4); + ATF_CHECK_EQ(len, 2); + ATF_CHECK_EQ(avail[0], PAGE_SIZE); + ATF_CHECK_EQ(avail[1], 2 * PAGE_SIZE); +} + ATF_TP_ADD_TCS(tp) { ATF_TP_ADD_TC(tp, hwregion); ATF_TP_ADD_TC(tp, hwregion_exclude); ATF_TP_ADD_TC(tp, hwregion_unordered); + ATF_TP_ADD_TC(tp, hwregion_ignore_empty); + ATF_TP_ADD_TC(tp, hwregion_ignore_page0); return (atf_no_error()); }