From nobody Tue May 02 11:39:52 2023 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 4Q9dRD2gNhz48tLw; Tue, 2 May 2023 11:39:52 +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 4Q9dRD1ws0z3q1v; Tue, 2 May 2023 11:39:52 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1683027592; 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=kEMz9Q848nF/TqBsfRurMbq9DWY6yE/++wuG/YScsFQ=; b=X+kLNEP70yCyyW/Go9rskFX5KAuPURI8TLBIROHMrgYFqsRsB8u37xUeY4oQNLRDinvGA3 /2627NEWf4jLTgVisS1u5+H6QNlft6ugmsnOgLLsPZz2B1Nb+lmzxsKwplo72rBfXFEZ3O 3lMR3AzwvLdgp9oRo8FCVw5+wIqrOO5d+gbnH+8j1qoYShZY09EakiSTOyNdfLzJYGoqiv cuUfD9/BG8OdmhbTEEyHVrLQ8LX2v1eQVoXAWuRjHKcaamSHhgQgS9XNlwht0VoQCcTat0 EChIzDJgnGWbEro2hWbUUsPOUdKdtJ31OYTnw3a6/fNE9tNy5tMloiYDTBN6xQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1683027592; 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=kEMz9Q848nF/TqBsfRurMbq9DWY6yE/++wuG/YScsFQ=; b=ca6ZOgwJyaghkVa6QjP3OX/13nUITz4v/9BxyuZ1vy4kpbLjoeOeKWmlIAGZlbPg5QODF+ xpIhUjZMTHgiuH8P3OEh/M1EICcW+eA1UmJbiGvmebcrnMT/IMCQE+W4Iiy2vkVsYeDxMe Wf2SF31xeqB/D20vyP6AlaHLztPhoOdjrZwHxRrfWIJYAafyaTPYbKmbS59UYJUCdqqtdd BZ6H01fMMpJS0FFSLHowKfkpzphIulA4HyK9Yy6RSVyA68VhC9XRNsvhNVtRV5XPDlxNNX L8gNL157MlxS6OOnRyZ/4GfR78YW6OAxiPRKUUeVEwE6prYZsY//ptvqlYAJrw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1683027592; a=rsa-sha256; cv=none; b=mp7m+5XPv1bg6uUJO5oG33C7Vuj8+kgLBnpQ1sTLQdA3oRJSoqsefKdfuaCq6EGy5sdNte u9oy20qJxHCrX/XdRqaxFNk/B9p+T5kJo0h7EtgpbKQaXBfqqxtABvHv6SpYTHjVh83Hor LsYI4+ki6Vd11fEy7BRD0AZIuGW+6YIJCCmDP+PV+5nrArDQEsAUEToMGOSEqlGGendIZC ZnN66IdLzQmGoLboAskrJWwFsxXYCbJUV1qI4DnN7+WW1nJNvuD32oQqK3GkGYk0QWvpwm tujW4ZsRKrtUF9Lu2wYlr3WU6AGG+lMZx9MsT2sXbPkKij4fLmTuHnSeOpr08A== 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 4Q9dRD0vhrzmB0; Tue, 2 May 2023 11:39:52 +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 342BdqfA092305; Tue, 2 May 2023 11:39:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 342BdqT1092304; Tue, 2 May 2023 11:39:52 GMT (envelope-from git) Date: Tue, 2 May 2023 11:39:52 GMT Message-Id: <202305021139.342BdqT1092304@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 86b61ccb34d4 - main - amd64 pmap: add pmap_pinit_pcids() helper 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 86b61ccb34d44e0e73dd2a68174ebc869ebccf8e Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=86b61ccb34d44e0e73dd2a68174ebc869ebccf8e commit 86b61ccb34d44e0e73dd2a68174ebc869ebccf8e Author: Konstantin Belousov AuthorDate: 2023-05-01 11:21:10 +0000 Commit: Konstantin Belousov CommitDate: 2023-05-02 11:32:29 +0000 amd64 pmap: add pmap_pinit_pcids() helper to initialize pm_pcids array for a new user pmap Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D39890 --- sys/amd64/amd64/pmap.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index 92d9a66837cd..3b125041bb29 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -4193,12 +4193,24 @@ pmap_abort_ptp(pmap_t pmap, vm_offset_t va, vm_page_t mpte) } } +static void +pmap_pinit_pcids(pmap_t pmap, uint32_t pcid, int gen) +{ + struct pmap_pcid *pcidp; + int i; + + CPU_FOREACH(i) { + pcidp = &pmap->pm_pcids[i]; + pcidp->pm_pcid = pcid; + pcidp->pm_gen = gen; + } +} + void pmap_pinit0(pmap_t pmap) { struct proc *p; struct thread *td; - int i; PMAP_LOCK_INIT(pmap); pmap->pm_pmltop = kernel_pmap->pm_pmltop; @@ -4211,10 +4223,7 @@ pmap_pinit0(pmap_t pmap) TAILQ_INIT(&pmap->pm_pvchunk); bzero(&pmap->pm_stats, sizeof pmap->pm_stats); pmap->pm_flags = pmap_flags; - CPU_FOREACH(i) { - pmap->pm_pcids[i].pm_pcid = PMAP_PCID_KERN + 1; - pmap->pm_pcids[i].pm_gen = 1; - } + pmap_pinit_pcids(pmap, PMAP_PCID_KERN + 1, 1); pmap_activate_boot(pmap); td = curthread; if (pti) { @@ -4373,7 +4382,6 @@ pmap_pinit_type(pmap_t pmap, enum pmap_type pm_type, int flags) { vm_page_t pmltop_pg, pmltop_pgu; vm_paddr_t pmltop_phys; - int i; bzero(&pmap->pm_stats, sizeof pmap->pm_stats); @@ -4397,9 +4405,8 @@ pmap_pinit_type(pmap_t pmap, enum pmap_type pm_type, int flags) pmltop_phys = VM_PAGE_TO_PHYS(pmltop_pg); pmap->pm_pmltop = (pml5_entry_t *)PHYS_TO_DMAP(pmltop_phys); - CPU_FOREACH(i) { - pmap->pm_pcids[i].pm_pcid = PMAP_PCID_NONE; - pmap->pm_pcids[i].pm_gen = 0; + if (pmap_pcid_enabled) { + pmap_pinit_pcids(pmap, PMAP_PCID_NONE, 0); } pmap->pm_cr3 = PMAP_NO_CR3; /* initialize to an invalid value */ pmap->pm_ucr3 = PMAP_NO_CR3;