From nobody Sat Oct 01 16:13:23 2022 X-Original-To: dev-commits-src-all@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 4Mfsb81pbFz4cvr3; Sat, 1 Oct 2022 16:13:24 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Mfsb81H4kz3wjr; Sat, 1 Oct 2022 16:13:24 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1664640804; 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=bN7ZK5u4HvJa4s+6LQwGd+/VycYDFWGQdO53YgX6PQA=; b=osaqfVcBeMuq7GpUpRlrfFyLAf8uUFY6S/mjh2pQmHvIR3kcq8zBO2CAeKCwm7b++Uy3b6 mrqyWwHt17Ji9oFnKBX1S61LZFqTW023N23aSZKDxMde6BlxYEMD6d53FbVZfGG11JvAu5 kpR/Ra3KCKChxcVE9E2o9aUQLkU/olZP9/rdn2wCfsTO+vmtjPzahhKgVGKPVwBS/RWcR7 ilazDylRqSOwxODLsT9WCrJHe9lKUPuiEgdGItMYC6j+M5tCNZMoAx3UxD5L2e5QEua8dm SaquDuBXWPnXdiTlCVuiqcgI/IXX8fzhfFMudeP8WOEPZU5kldEcGlhLt/AjsA== 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 4Mfsb80LMKzb34; Sat, 1 Oct 2022 16:13:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 291GDNRw048904; Sat, 1 Oct 2022 16:13:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 291GDN8b048903; Sat, 1 Oct 2022 16:13:23 GMT (envelope-from git) Date: Sat, 1 Oct 2022 16:13:23 GMT Message-Id: <202210011613.291GDN8b048903@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: fe9670298c07 - stable/13 - amd64: Handle 1GB mappings in pmap_enter_quick_locked() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: fe9670298c0792f6b14d7a8772b11c74eef4461d Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1664640804; 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=bN7ZK5u4HvJa4s+6LQwGd+/VycYDFWGQdO53YgX6PQA=; b=SXTi7hcqrOwJZsYwiRsH26Ls1Jj52UTzjHhfJuzxRJWtVEUVyvwOPrKrvV9CdDXcqma0+a pfjGZ+y5WK/FTFHZFJOgMYgK679Suc0Xe2zw5JWr7X6TZQ2IDrGhex0+cIN4HJqyEy8+kt xd6NgasDW9RSwJ9fdh4W54+r8mgGe/cLGMQUek62nhhFiU6gKZ5p5O6tU0gV7dP39M4f1y ag68oUn92hOYcTCVzjjRZCXFJFbCgxl06jb0u043sb+RGcURdY+gVfK40l67RESXS1nkAZ xVrqR5myfSdnSAwQet+ttUpKSAEV77t+GTNnEdxpSzuCixJBvjMNrV6413MkLw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1664640804; a=rsa-sha256; cv=none; b=ioRcfkIX54wjwKZi4QZ4fkBNgCMvRtnz5j2myZVLVhpefup935n09vMX8jtMr04GzHcAFw tDUpwIUknd+ycdBYBXUjXd51968JtFW0qXtgQoIMaOGKsZl3BXCm1S3Iq1fW7Wg5f1CKl5 hmJ5CGYOJE42kcVSzHhpxddm2mMWdXU3CSVuFYUGWoIvVviDwgomflRlvf0+s2PvDdMFw8 Rqb0GdjZFr0X8obEHeQgFyT/L/bxm/hzV/H4cBh5qEqpnPeZFv6X53yM5qeVnoql/G1aT0 5SBqNBCewLOMMFzyjCeIH3+Ps5dm1+qcplfDgYML3jLdrqRCbvC4+AG2iZQ0RQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=fe9670298c0792f6b14d7a8772b11c74eef4461d commit fe9670298c0792f6b14d7a8772b11c74eef4461d Author: Mark Johnston AuthorDate: 2022-09-24 13:20:29 +0000 Commit: Mark Johnston CommitDate: 2022-10-01 15:33:49 +0000 amd64: Handle 1GB mappings in pmap_enter_quick_locked() This code path can be triggered by applying MADV_WILLNEED to a 1GB mapping. Reviewed by: alc, kib (cherry picked from commit 6c2e9f4c32a44f3c239aba346322d871097eaed0) --- sys/amd64/amd64/pmap.c | 39 ++++++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index 5288cd7fbfef..aa3774524023 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -7404,8 +7404,9 @@ pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, vm_page_t m, * resident, we are creating it here. */ if (va < VM_MAXUSER_ADDRESS) { + pdp_entry_t *pdpe; + pd_entry_t *pde; vm_pindex_t ptepindex; - pd_entry_t *ptepa; /* * Calculate pagetable page index @@ -7414,31 +7415,35 @@ pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, vm_page_t m, if (mpte && (mpte->pindex == ptepindex)) { mpte->ref_count++; } else { - /* - * Get the page directory entry - */ - ptepa = pmap_pde(pmap, va); - /* * If the page table page is mapped, we just increment * the hold count, and activate it. Otherwise, we - * attempt to allocate a page table page. If this - * attempt fails, we don't retry. Instead, we give up. + * attempt to allocate a page table page, passing NULL + * instead of the PV list lock pointer because we don't + * intend to sleep. If this attempt fails, we don't + * retry. Instead, we give up. */ - if (ptepa && (*ptepa & PG_V) != 0) { - if (*ptepa & PG_PS) + pdpe = pmap_pdpe(pmap, va); + if (pdpe != NULL && (*pdpe & PG_V) != 0) { + if ((*pdpe & PG_PS) != 0) return (NULL); - mpte = PHYS_TO_VM_PAGE(*ptepa & PG_FRAME); - mpte->ref_count++; + pde = pmap_pdpe_to_pde(pdpe, va); + if ((*pde & PG_V) != 0) { + if ((*pde & PG_PS) != 0) + return (NULL); + mpte = PHYS_TO_VM_PAGE(*pde & PG_FRAME); + mpte->ref_count++; + } else { + mpte = pmap_allocpte_alloc(pmap, + ptepindex, NULL, va); + if (mpte == NULL) + return (NULL); + } } else { - /* - * Pass NULL instead of the PV list lock - * pointer, because we don't intend to sleep. - */ mpte = pmap_allocpte_alloc(pmap, ptepindex, NULL, va); if (mpte == NULL) - return (mpte); + return (NULL); } } pte = (pt_entry_t *)PHYS_TO_DMAP(VM_PAGE_TO_PHYS(mpte));