From nobody Sun Aug 04 20:08:04 2024 X-Original-To: dev-commits-src-main@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 4WcVxJ5N2tz5SwMM; Sun, 04 Aug 2024 20:08:04 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WcVxJ4rSlz4Xt0; Sun, 4 Aug 2024 20:08:04 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722802084; 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=0B22t7jOCZeSMtI/epBqf28eoDiUIEdmyxOrjkuWi5Q=; b=lterX7kXEHPF/GV3AzRMghjdHtyiRRE4YYZF01tVLYKgTJOTQW8r6AHhlZgd5+vC9BQcYE bUPYZMBRZ0QAsCM6eBd2yrnvzlC1+RFzUjE/xnXLfDQ3eoSHZLSrDVKKbjl9du36uJIW0x u6zFHRuxrtYDolKcjiid5fS8lkNTPrAY9eAHu4Y4vXaByWUdrpCwvt4uvC47zhccyk5A4s jBWqTVdMf9eugEUb5DazZhO1fsWkMpq5Ad3CVif/RUjJQ3we1NBfBIrL++AdYc8Qu1Ox2G Q6+XdRlgMkJyjz7E3V/eYAOoQh2eym2S9IAOh6jlYSgBzdaCBX45VTrj0zdTvg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1722802084; a=rsa-sha256; cv=none; b=OuLEjlTQY61EoFpPRsaym55wctLUJeB3KvYJYykhrNseSYnkaaDuACY8VocCwFKryUFNMo 9rgOLIpQ55cEuWy/uwXDEM/uPGXGjemcyRaopRy0JYfP1oEgRXlQTH5lnfqx1JubB3vGmd 9N9Geoi8ABy2bVudWivDZE8breWiYvvxLLLW5Lic4CtXlCJEx7IQwLyHV5/4UfRLohudGB ZJuS+y2mYllSZTZPxCOQXPMnCohPK7swUZsECrGXwayXJ0inEpYOaY2qincuKr/af8MD56 fFoNgBio4Sy7CPAfCGkcvR7kaBvsRr3gO9DKcJBxd4XyjJdofiB1w1+rWnhX2A== 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=1722802084; 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=0B22t7jOCZeSMtI/epBqf28eoDiUIEdmyxOrjkuWi5Q=; b=kq6A54R8WL6D9jdXl6kXcPZFBzE5OQ6MeuBwj308tiiRc6vyIZ024HbvCEX1AbloeLlnN8 ONsgAw4EWE+tdBYdqpdu5w8RthvlMUMKBnTsobRbfS+EqFIfTIck6wqx1B9by3aRplyXjB vp9Fo7ztvFAiMXe/fw8+/xfcMHEtI6xbrb4u5FWndtXczHVK+XMFd4mb+YOBCscUZREEX/ HX7AbNLnMPj8x0glrTwwvUrp4Eswphg8pzccaj4VpgSwevU96FU0tDrxTwi2GOEQjKWnDl K9r38GjqunWpzwe9FRevELhz5vJ7VBHk4wPl80o+BS0QD0gNm/RjVUhTJCMS5w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4WcVxJ4S1pz17XB; Sun, 4 Aug 2024 20:08:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 474K84Pw042915; Sun, 4 Aug 2024 20:08:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 474K84un042912; Sun, 4 Aug 2024 20:08:04 GMT (envelope-from git) Date: Sun, 4 Aug 2024 20:08:04 GMT Message-Id: <202408042008.474K84un042912@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alan Cox Subject: git: fa290859fa63 - main - vm: Assert that pagesizes[] is sorted List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: alc X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fa290859fa63d65b5da3014038ae289c1b336700 Auto-Submitted: auto-generated The branch main has been updated by alc: URL: https://cgit.FreeBSD.org/src/commit/?id=fa290859fa63d65b5da3014038ae289c1b336700 commit fa290859fa63d65b5da3014038ae289c1b336700 Author: Alan Cox AuthorDate: 2024-08-03 20:18:16 +0000 Commit: Alan Cox CommitDate: 2024-08-04 19:53:15 +0000 vm: Assert that pagesizes[] is sorted Ensure that pmap_init() properly initialized pagesizes[]. In part, we are making this change to document the requirement that the non-zero elements of pagesizes[] must be in ascending order. Reviewed by: kib, markj --- sys/vm/vm_init.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/sys/vm/vm_init.c b/sys/vm/vm_init.c index 0fd13f73a180..a0d3651ba266 100644 --- a/sys/vm/vm_init.c +++ b/sys/vm/vm_init.c @@ -100,6 +100,24 @@ long physmem; static void vm_mem_init(void *); SYSINIT(vm_mem, SI_SUB_VM, SI_ORDER_FIRST, vm_mem_init, NULL); +#ifdef INVARIANTS +/* + * Ensure that pmap_init() correctly initialized pagesizes[]. + */ +static void +vm_check_pagesizes(void) +{ + int i; + + KASSERT(pagesizes[0] == PAGE_SIZE, ("pagesizes[0] != PAGE_SIZE")); + for (i = 1; i < MAXPAGESIZES; i++) { + KASSERT((pagesizes[i - 1] != 0 && + pagesizes[i - 1] < pagesizes[i]) || pagesizes[i] == 0, + ("pagesizes[%d ... %d] are misconfigured", i - 1, i)); + } +} +#endif + /* * vm_mem_init() initializes the virtual memory system. * This is done only by the first cpu up. @@ -140,6 +158,10 @@ vm_mem_init(void *dummy) kmem_init_zero_region(); pmap_init(); vm_pager_init(); + +#ifdef INVARIANTS + vm_check_pagesizes(); +#endif } void