From nobody Sat Sep 24 13:38:17 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 4MZVTP6rmcz4cgmc; Sat, 24 Sep 2022 13:38:17 +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 4MZVTP6K7Cz424j; Sat, 24 Sep 2022 13:38:17 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1664026697; 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=MfDylodN6n9SCati9UWpz5JjAYiSQIuhKd7WNCFYyYc=; b=kymbn8DhqOxFSorBAOje4DgL4xse6/NLuh/QfxF46Q28Ulh1MUosb33eDzje8VlD826Sjs +OYp91qPWvgrF002i+dAT9r80nL9CY9OEFk7cCvHoTMPAU7BQ/BWUYeJ5Z0i9ZlovjVxX4 UXmEBy/OlLQa3SDvmMSP558XAek7nuWGT0Fp8G14JF+fNKIUlawUDr0hhC8ifykyLNre6T LJALnHOxQYLJmgXrZI+8uU0lm2zoLrcRFE2nkxPKuc8Q8i0DEuPQWUQ6B/tAKprzrbIhXp LAbSX/4jlUio16Ny35HnMvDYPxjYZN/cuUoGD4KMo1bbMWPIrQ1BTKqBgkpdpQ== 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 4MZVTP55Rtz15kS; Sat, 24 Sep 2022 13:38:17 +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 28ODcHRP023625; Sat, 24 Sep 2022 13:38:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 28ODcHVN023624; Sat, 24 Sep 2022 13:38:17 GMT (envelope-from git) Date: Sat, 24 Sep 2022 13:38:17 GMT Message-Id: <202209241338.28ODcHVN023624@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 6c2e9f4c32a4 - main - 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/main X-Git-Reftype: branch X-Git-Commit: 6c2e9f4c32a44f3c239aba346322d871097eaed0 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1664026697; 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=MfDylodN6n9SCati9UWpz5JjAYiSQIuhKd7WNCFYyYc=; b=dQZS94snBwsGdSDVtrCqjScfaiyUqbayEURVL0gnDzZ99U9RqkAfKfMNbc6L+q0RPbJQEv rkZK6mpFiCHlLpqiPyAErcQqF0aaZQ3coyEZV2SUWsFBEzitsxBDys+qYIomOnGz81aw4T O6QWm/hcEhApG/B22yVRWz4Z5t4n/3IZRoN+aY2wWYAMjU7SYCMOE5eEj3KMNzV4HxAaCw 8a9JYXtuONm/8ZifT+ygEEtmWqTa8NCCcF/kJhsyD4Jh7pCLsKWcxTtPAP7E6iRcEe+56m 7j66FRO/hk/gwbOdLAFMd8WJPurjvYRcDCNMjPrGnz59HI8OaUS5v/AZyQ0RYw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1664026697; a=rsa-sha256; cv=none; b=W1f7pmLDzSkORWxtBcxC5eNS4k1fup3sCk5SmEEblIs9vG7uAa8vbyoXfHtaapXwUVl6ZS iK1XpnH1FYxbwb1dYyA0//sRfwX+7TI3RwiwKPgMG+mm9NLP+7LUeTTe42ENwhxvsSKzbe hazPkL1bM81NhNxGS2voczt/tyIJwhoU//1xym1Z9qWjQ7vwb3HSTwb9AAihn1tZd7tA0A RpYXA5M6sf9SbAxoUIlygqhHUa4Q6fX8Ws8KMKNZtrtA0Y4LDtPL/W4ZvhB2ABlSKZ7UUx Dlhb9N1z6yZzsJn/TiKlbONr3mkJQ1eT50S6S/1WgAE28SAO9aYxR58u9ii0hQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=6c2e9f4c32a44f3c239aba346322d871097eaed0 commit 6c2e9f4c32a44f3c239aba346322d871097eaed0 Author: Mark Johnston AuthorDate: 2022-09-24 13:20:29 +0000 Commit: Mark Johnston CommitDate: 2022-09-24 13:28:41 +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 MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D36674 --- 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 9a33298944cc..358d016676d2 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -7545,8 +7545,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 @@ -7555,31 +7556,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));