From nobody Tue Jan 09 20:23:18 2024 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 4T8j6t6652z56Vdc; Tue, 9 Jan 2024 20:23:18 +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 4T8j6t5DLkz4nwh; Tue, 9 Jan 2024 20:23:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1704831798; 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=fSFChKjytCH6znT9zeEb7OY8LhO0Im9J2aQG0P00UVo=; b=it4VISxdkuSg4mpNuYbNAVeEcj/wjQB5HhCVt15rYU1S4dzNqq487UvpPG12g609xhEPh3 TGhnrCd1W3O4G5Vo82EVOe+KXIdJR3Nzk+nQ38fs5cP/nf6Y4BBE4oYenWLAZ0jy3h0Iu0 68WHEl3k34U8iKBJ62sSY8C2MGG6SPbC84xZFLYrSbx1gi7kNiBAfVavumscko5fWkPydF sXMVnPnS/Z11IL6cDux+2Uw1WHVurlerR+l4wLPMdIWGRCCOxIA66wXjs3VJeNtzBqLD2/ oJAIkp9E4sayKBVIgVd/u86mp7Ci+bHWbaZEm6uHHr0uVTy/N/HM4cZCT/PrLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1704831798; 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=fSFChKjytCH6znT9zeEb7OY8LhO0Im9J2aQG0P00UVo=; b=shqQIvZIvZXpJCuruzOEeGjKlIGW/9X9Pg+5JJ4ebl8wMCiLoTafWg21KFpC7EFY88iufQ iaqsilN0vO+/w7v1MmDSeTEPPihn9lTiDoZZIQ0/+iOUL7tsixpoC6GtZ3C/TkA62iB9f9 U9td0pa6lhvIQlkwHJoqWPw6Xc/AD29qur+s/QY1UwHl3g9sHoFwb2IN11m5HpfRo9A0I8 1WSHgdebwLDQ5RbWIEyf9PsVImVtxBDHTUuN4QokrazIroqiP1bKVsosYFoQLP3B0CF87s ZT7iZZgemhU3nNPX7Qhhf6XUdZol9Xaj89+36g0jyE1dBsHjLfhgka6f04fTMA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1704831798; a=rsa-sha256; cv=none; b=JWQhuUeWAEphkh0bgZx3WYxbWdmhG2GqadDwIjPQ83bPNbnCN3VOk6c1wnvYAaIn9I/szl JDzCw3EoTFPPDhs1oHwwLuWlplNF8NxjtEybInk6M4JtFbpvwn4gG5JIygyWCPvwRZEqLY 3pf1cDsNBBL+2kXH6anyDDhbAuh7HOS7UKYLFBGTlBQwv7xrc1GIeh093ZZKd/3Qob1dT7 CilAAPRLnvdWOd2WzrvRqlDUFxH0E0hTO0bnw82LKEbn1kNwYnlYXsE2knFPzRuHr56M3o j+yqdTY9Nku44I1fH8fdT/Ch5aUeHeoaSjU/FzsIpt/11Yqe06g4ElyTHLszOw== 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 4T8j6t4HbDz14cg; Tue, 9 Jan 2024 20:23:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 409KNIfQ032490; Tue, 9 Jan 2024 20:23:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 409KNImd032487; Tue, 9 Jan 2024 20:23:18 GMT (envelope-from git) Date: Tue, 9 Jan 2024 20:23:18 GMT Message-Id: <202401092023.409KNImd032487@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Robert Wing Subject: git: 0013741108bc - main - powerpc_mmu_radix: add leaf page for wired mappings when pmap_enter(psind=1) 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: rew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0013741108bc515dbaa56b2b9ca4043cdf6c9e5f Auto-Submitted: auto-generated The branch main has been updated by rew: URL: https://cgit.FreeBSD.org/src/commit/?id=0013741108bc515dbaa56b2b9ca4043cdf6c9e5f commit 0013741108bc515dbaa56b2b9ca4043cdf6c9e5f Author: Robert Wing AuthorDate: 2024-01-09 20:12:38 +0000 Commit: Robert Wing CommitDate: 2024-01-09 20:23:18 +0000 powerpc_mmu_radix: add leaf page for wired mappings when pmap_enter(psind=1) This applies the fix to powerpc's pmap as was done in commit aa3bcaad51076ceb and d0941ed9b5c39d92 for amd64 and riscv pmaps, respectively. Reported by: Jenkins Reviewed by: bojan.novkovic_fer.hr, markj Fixes: e4078494f344bcba8709216bd601efa3dd05f6b3 Differential Revision: https://reviews.freebsd.org/D43339 --- sys/powerpc/aim/mmu_radix.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/sys/powerpc/aim/mmu_radix.c b/sys/powerpc/aim/mmu_radix.c index abcb8ae151c4..45461b21dba1 100644 --- a/sys/powerpc/aim/mmu_radix.c +++ b/sys/powerpc/aim/mmu_radix.c @@ -607,6 +607,7 @@ static boolean_t pmap_unwire_ptp(pmap_t pmap, vm_offset_t va, vm_page_t m, struc static void pmap_invalidate_page(pmap_t pmap, vm_offset_t start); static void pmap_invalidate_all(pmap_t pmap); static int pmap_change_attr_locked(vm_offset_t va, vm_size_t size, int mode, bool flush); +static void pmap_fill_ptp(pt_entry_t *firstpte, pt_entry_t newpte); /* * Internal flags for pmap_enter()'s helper functions. @@ -3183,6 +3184,7 @@ pmap_enter_l3e(pmap_t pmap, vm_offset_t va, pml3_entry_t newpde, u_int flags, struct spglist free; pml3_entry_t oldl3e, *l3e; vm_page_t mt, pdpg; + vm_page_t uwptpg; KASSERT((newpde & (PG_M | PG_RW)) != PG_RW, ("pmap_enter_pde: newpde is missing PG_M")); @@ -3237,6 +3239,26 @@ pmap_enter_l3e(pmap_t pmap, vm_offset_t va, pml3_entry_t newpde, u_int flags, KASSERT(be64toh(*l3e) == 0, ("pmap_enter_pde: non-zero pde %p", l3e)); } + + /* + * Allocate leaf ptpage for wired userspace pages. + */ + uwptpg = NULL; + if ((newpde & PG_W) != 0 && pmap != kernel_pmap) { + uwptpg = vm_page_alloc_noobj(VM_ALLOC_WIRED); + if (uwptpg == NULL) + return (KERN_RESOURCE_SHORTAGE); + uwptpg->pindex = pmap_l3e_pindex(va); + if (pmap_insert_pt_page(pmap, uwptpg)) { + vm_page_unwire_noq(uwptpg); + vm_page_free(uwptpg); + return (KERN_RESOURCE_SHORTAGE); + } + pmap_resident_count_inc(pmap, 1); + uwptpg->ref_count = NPTEPG; + pmap_fill_ptp((pt_entry_t *)PHYS_TO_DMAP(VM_PAGE_TO_PHYS(uwptpg)), + newpde); + } if ((newpde & PG_MANAGED) != 0) { /* * Abort this mapping if its PV entry could not be created. @@ -3253,6 +3275,16 @@ pmap_enter_l3e(pmap_t pmap, vm_offset_t va, pml3_entry_t newpde, u_int flags, pmap_invalidate_page(pmap, va); vm_page_free_pages_toq(&free, true); } + if (uwptpg != NULL) { + mt = pmap_remove_pt_page(pmap, va); + KASSERT(mt == uwptpg, + ("removed pt page %p, expected %p", mt, + uwptpg)); + pmap_resident_count_dec(pmap, 1); + uwptpg->ref_count = 1; + vm_page_unwire_noq(uwptpg); + vm_page_free(uwptpg); + } CTR2(KTR_PMAP, "pmap_enter_pde: failure for va %#lx" " in pmap %p", va, pmap); return (KERN_RESOURCE_SHORTAGE);