From nobody Sun Jun 16 16:20:09 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 4W2JBx5LRxz5P3mX; Sun, 16 Jun 2024 16:20:09 +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 4W2JBx1lhfz4PH1; Sun, 16 Jun 2024 16:20:09 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1718554809; 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=W8IW7SCRqmQ5FcAC4ozfMlg4eXsLOFhxcnSqs7iFSmU=; b=R0g63UITdI6y8Jijn2MFwqATc+m6sGDuTg0mwxOpOEWwA2LlBLqynzd5YgKuXLUqUub+Sl zHzInP2r7MEiv1FU2sG9ZKmoWW1O0CHeZq2DwU7hPqvjvN275pQpB3Qu3WT4QWVC+vygIw f+CWpgY8fJxSb9fPTVSN75ICEbj2yBu8TzGELi/6Ebp81xOQzpywCi0WcJ2WKaKdwaO5r3 ciXOhYvUTIlByHMEcvk9TFSLb1bscn5G3/yXsOoocEvkG7HU2TInJ+NH4oZUTa98WHE01T P9mjgYn3wYZabdsghjUvPgG/ehGzJU0a+bYOdgqYMegKbMIQDXq8xCXRN7bkcQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1718554809; a=rsa-sha256; cv=none; b=C1w3tGcYAAyVmpxj8qEpkvAIwq1Qecwjqs2Dt/JLKNTEjpBKQ++QSAimXdYiQUtDYQsBn+ yXzPLdnIjS8qpDdOuwNC46zz13yspMQ3xUOIMqnN7XB65ZTOnvvh4fAs6x8Kis/eUA+807 mnLNk6l1XrYm8qy0F6dfXUk41/bIKye4IsghQjQhOe27gRmcg5cPKVm7BsPXHgN9/m4E7l tmepC2aQ923fKYSgjyGppMuKdFTm3iBgcJU1tpPEoKN+kmJm8v0X0xLZCm+j+UuEFvqXNa flNQ0Ot9+0Qo91fxaUh5JgWnJak03t2a1S+pD+iUwRt69uIdgKDH0YueR06fgg== 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=1718554809; 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=W8IW7SCRqmQ5FcAC4ozfMlg4eXsLOFhxcnSqs7iFSmU=; b=ToxIHr0aNoVtOuxS1dkTq5wg1BSDJtGp1Li9tzvrtL3w7QpHIsXeMpwHEuJefSRu/FzrIk ArlP/a+caux+C7LMaIOo8WqvyfqoQUii0t/UaY86A+SbAVPDlP9xEVZudoeypespjm39Yz LgIPtDO6z2tqBXNnQ4X85oNzass5xZpP6gwLwEvNKK6R9nGKokkPBdWUtqQwN+DAI3zkR0 bosfu9wbEtcsJkzqraNYo88saquxDRU3M5Md85xQOg+3DqLjoMMt7j31HhA7WSCWz/HLRD tWlXLrGaOV5RS1Vzm81nzNe0o6vZnEC4Rn8vXHn6Yzwy5+dHzwbzUvdqjrYLOw== 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 4W2JBx12Y8zvcq; Sun, 16 Jun 2024 16:20:09 +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 45GGK9aN042249; Sun, 16 Jun 2024 16:20:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 45GGK9bu042244; Sun, 16 Jun 2024 16:20:09 GMT (envelope-from git) Date: Sun, 16 Jun 2024 16:20:09 GMT Message-Id: <202406161620.45GGK9bu042244@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Bojan =?utf-8?Q?Novkovi=C4=87?= Subject: git: e8816b4b66ad - main - riscv pmap: Introduce 'pmap_abort_ptp' 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: bnovkov X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e8816b4b66adf2e6052803cd0eb609ee63fbb3ed Auto-Submitted: auto-generated The branch main has been updated by bnovkov: URL: https://cgit.FreeBSD.org/src/commit/?id=e8816b4b66adf2e6052803cd0eb609ee63fbb3ed commit e8816b4b66adf2e6052803cd0eb609ee63fbb3ed Author: Bojan Novković AuthorDate: 2024-06-13 16:13:53 +0000 Commit: Bojan Novković CommitDate: 2024-06-16 16:19:27 +0000 riscv pmap: Introduce 'pmap_abort_ptp' This commit moves code for releasing pagetable page references into a separate function. No functional change intended. Approved by: markj (mentor) Differential Revision: https://reviews.freebsd.org/D45579 --- sys/riscv/riscv/pmap.c | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/sys/riscv/riscv/pmap.c b/sys/riscv/riscv/pmap.c index 1902f1f4009b..4f6305ed651d 100644 --- a/sys/riscv/riscv/pmap.c +++ b/sys/riscv/riscv/pmap.c @@ -3137,6 +3137,28 @@ out: return (rv); } +/* + * Release a page table page reference after a failed attempt to create a + * mapping. + */ +static void +pmap_abort_ptp(pmap_t pmap, vm_offset_t va, vm_page_t l2pg) +{ + struct spglist free; + + SLIST_INIT(&free); + if (pmap_unwire_ptp(pmap, va, l2pg, &free)) { + /* + * Although "va" is not mapped, paging-structure + * caches could nonetheless have entries that + * refer to the freed page table pages. + * Invalidate those entries. + */ + pmap_invalidate_page(pmap, va); + vm_page_free_pages_toq(&free, true); + } +} + /* * Tries to create a read- and/or execute-only 2MB page mapping. Returns * KERN_SUCCESS if the mapping was created. Otherwise, returns an error @@ -3285,17 +3307,7 @@ pmap_enter_l2(pmap_t pmap, vm_offset_t va, pd_entry_t new_l2, u_int flags, * Abort this mapping if its PV entry could not be created. */ if (!pmap_pv_insert_l2(pmap, va, new_l2, flags, lockp)) { - SLIST_INIT(&free); - if (pmap_unwire_ptp(pmap, va, l2pg, &free)) { - /* - * Although "va" is not mapped, paging-structure - * caches could nonetheless have entries that - * refer to the freed page table pages. - * Invalidate those entries. - */ - pmap_invalidate_page(pmap, va); - vm_page_free_pages_toq(&free, true); - } + pmap_abort_ptp(pmap, va, l2pg); if (uwptpg != NULL) { mt = pmap_remove_pt_page(pmap, va); KASSERT(mt == uwptpg,