From owner-dev-commits-src-all@freebsd.org Tue Jan 12 15:15:16 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CD0564DBC25; Tue, 12 Jan 2021 15:15:16 +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 "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DFYzS5M7qz3QZ8; Tue, 12 Jan 2021 15:15:16 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 AAA472EFC6; Tue, 12 Jan 2021 15:15:16 +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 10CFFGw2070096; Tue, 12 Jan 2021 15:15:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10CFFG1H070095; Tue, 12 Jan 2021 15:15:16 GMT (envelope-from git) Date: Tue, 12 Jan 2021 15:15:16 GMT Message-Id: <202101121515.10CFFG1H070095@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: 0628f6835702 - main - riscv pmap: add some pv list assertions 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/main X-Git-Reftype: branch X-Git-Commit: 0628f6835702943bd6da52fba30ee53971f9029c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jan 2021 15:15:16 -0000 The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=0628f6835702943bd6da52fba30ee53971f9029c commit 0628f6835702943bd6da52fba30ee53971f9029c Author: mhorne AuthorDate: 2020-11-04 17:51:10 +0000 Commit: Mitchell Horne CommitDate: 2021-01-12 15:12:02 +0000 riscv pmap: add some pv list assertions Ensure that we don't end up with a superpage in the vm_page_t's pv list. This may help with debugging the panic reported in PR 250866, in which l3 in pmap_remove_write() was found to be NULL. Adding a KASSERT to this function will help narrow down the cause of this panic the next time it occurs. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D28109 --- sys/riscv/riscv/pmap.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/sys/riscv/riscv/pmap.c b/sys/riscv/riscv/pmap.c index 4ad46731f158..f30dda17afae 100644 --- a/sys/riscv/riscv/pmap.c +++ b/sys/riscv/riscv/pmap.c @@ -3498,7 +3498,10 @@ restart: goto restart; } } - l3 = pmap_l3(pmap, pv->pv_va); + l2 = pmap_l2(pmap, pv->pv_va); + KASSERT((pmap_load(l2) & PTE_RWX) == 0, + ("%s: found a 2mpage in page %p's pv list", __func__, m)); + l3 = pmap_l2_to_l3(l2, pv->pv_va); if ((pmap_load(l3) & PTE_SW_WIRED) != 0) count++; PMAP_UNLOCK(pmap); @@ -3745,7 +3748,10 @@ restart: goto restart; } } - l3 = pmap_l3(pmap, pv->pv_va); + l2 = pmap_l2(pmap, pv->pv_va); + KASSERT((pmap_load(l2) & PTE_RWX) == 0, + ("%s: found a 2mpage in page %p's pv list", __func__, m)); + l3 = pmap_l2_to_l3(l2, pv->pv_va); rv = (pmap_load(l3) & mask) == mask; PMAP_UNLOCK(pmap); if (rv) @@ -3901,7 +3907,10 @@ retry_pv_loop: goto retry_pv_loop; } } - l3 = pmap_l3(pmap, pv->pv_va); + l2 = pmap_l2(pmap, pv->pv_va); + KASSERT((pmap_load(l2) & PTE_RWX) == 0, + ("%s: found a 2mpage in page %p's pv list", __func__, m)); + l3 = pmap_l2_to_l3(l2, pv->pv_va); oldl3 = pmap_load(l3); retry: if ((oldl3 & PTE_W) != 0) { @@ -4172,8 +4181,7 @@ restart: } l2 = pmap_l2(pmap, pv->pv_va); KASSERT((pmap_load(l2) & PTE_RWX) == 0, - ("pmap_clear_modify: found a 2mpage in page %p's pv list", - m)); + ("%s: found a 2mpage in page %p's pv list", __func__, m)); l3 = pmap_l2_to_l3(l2, pv->pv_va); if ((pmap_load(l3) & (PTE_D | PTE_W)) == (PTE_D | PTE_W)) { pmap_clear_bits(l3, PTE_D | PTE_W);