From nobody Mon Oct 10 21:34:02 2022 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 4MmXGy4bfjz4f4HN; Mon, 10 Oct 2022 21:34:02 +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 4MmXGy47JQz3TtQ; Mon, 10 Oct 2022 21:34:02 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1665437642; 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=pIe0DsrqkUq/hWhgbN8aNcqbtgNQYfhFD2NS1UeNOr8=; b=JRkLALMqBbzQKzJ4L7a9+tsu+VqmmiKtqFyjP2LKx4iPmZzVp9+nblb1P8rY3TyTD6LTjN kVTDXxz8GgCcOMMEb8W5oAyATOcDD8cM2Wqlix+eHGAvqHxVp6Ltkv5Mp/vws44czmtLWh p3z1aHVkVFfv7g2HLPtDJaDHSe5NJj7RG5R2oLJ4PqAc5HHzlQOru3r/tRVyIaweYqiQX5 e2eid+9Mvf4UVRLIKVsdDqhikxx1u0rVd5UcFZ5y3WKCE9i0h8emQ9TUGhGVhPRAPLFR9m p2ZMbWhP60uI2chTrxtVVqsEoXHpDpJxi3HXGiUUo6I8cDn6P4UIhH8RZzFxlQ== 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 4MmXGy390QzlST; Mon, 10 Oct 2022 21:34:02 +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 29ALY2ep084030; Mon, 10 Oct 2022 21:34:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 29ALY2xU084029; Mon, 10 Oct 2022 21:34:02 GMT (envelope-from git) Date: Mon, 10 Oct 2022 21:34:02 GMT Message-Id: <202210102134.29ALY2xU084029@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: e0612ed490c7 - main - amd64 pmap: add comment explaining why INVLPG is functional for PCID config 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: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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: e0612ed490c723174607823378d9e883a4b1c257 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1665437642; 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=pIe0DsrqkUq/hWhgbN8aNcqbtgNQYfhFD2NS1UeNOr8=; b=YK71rE+fcwVhykXN7tHf7ZpjCWaNIxyVdsRlTUh/+IomrAbNTxjGTL8KY5RzjBzrVSE7e7 3veWjl8daCxa7TIhvAW++eRTSI/OxspL1rTdXwxRbZaMOu5CBYMpOlPBczpdt25HIPMnHY j5zXRDCoLnmzqxjkkqrnzTaazQtgJdJH95jH6VaY/cOHcaRpQ1DtdBRauUfo9JkzxElVtx hjjatECwmulBI/3EEczfzSnVuA1QMq+BzbLnBCUWyiLTYBP9OAkRoYMmrw24Ys1Z+728lx G37mn3h6FHgkfnF/+bX10Vq2fJzwYNj0YQ5HdGEQvN//Dn6oaABNUuxJ28BIpQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1665437642; a=rsa-sha256; cv=none; b=QNub6hCbtB35LL52BZhO+Jhy3JJ6e1dZrorv929asF4nHBQw+Z165/b9gWz6E5h/BaySq0 wqgSEgkFhBTKMzCs2izMUpgVqQ1O9lA6VH45qlfPtSqqaLu/K2i9hWRMQ8xtUzRGitkniD Y2nCWTOGVnIRFqwc+dyHTkG7j//u7TeYocbCfSsM0tHPZRa4Z9q2OVkR85NVPv77Togsni d1QW+JrnKMUxcRbprF9+ttnAY6Uk26pacInb4kjgU3agFTv7VTN+HOM4JieLSGkgKv7GgS G6eDZoBZl2MWqVb5UE1PSs6kogGsNRY4ChUwiUtBoe/jYnoHP3p0BWbR/4UqTg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=e0612ed490c723174607823378d9e883a4b1c257 commit e0612ed490c723174607823378d9e883a4b1c257 Author: Konstantin Belousov AuthorDate: 2022-10-10 00:19:45 +0000 Commit: Konstantin Belousov CommitDate: 2022-10-10 21:33:17 +0000 amd64 pmap: add comment explaining why INVLPG is functional for PCID config Reviewed by: alc, markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D36919 --- sys/amd64/amd64/pmap.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index f69f452bcced..2dddc7a4c582 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -2897,8 +2897,16 @@ pmap_update_pde_invalidate(pmap_t pmap, vm_offset_t va, pd_entry_t newpde) * page table, and INVPCID(INVPCID_CTXGLOB)/invltlb_glob() for a * user space page table(s). * - * If the INVPCID instruction is available, it is used to flush entries - * from the kernel page table. + * If the INVPCID instruction is available, it is used to flush user + * entries from the kernel page table. + * + * When PCID is enabled, the INVLPG instruction invalidates all TLB + * entries for the given page that either match the current PCID or + * are global. Since TLB entries for the same page under different + * PCIDs are unaffected, kernel pages which reside in all address + * spaces could be problematic. We avoid the problem by creating + * all kernel PTEs with the global flag (PG_G) set, when PTI is + * disabled. * * * mode: PTI disabled, PCID present. The kernel reserves PCID 0 for its * address space, all other 4095 PCIDs are used for user mode spaces