From nobody Thu Oct 13 04:46:09 2022 X-Original-To: dev-commits-src-branches@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 4Mnxmd60r9z4dyMX; Thu, 13 Oct 2022 04:46: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 4Mnxmd5S4lz3W7j; Thu, 13 Oct 2022 04:46:09 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1665636369; 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=3awhrajuFVTVlP5wsPIFiOaK2yZnPM+WBLcWEkkDECc=; b=UjjvdyaPyXjld2JD/CTcRBA6vMVGBTLK9AFBZ7dgZqMNoG6H4/gO5dj3gQ8jVYXrYMmCVN qor5UcE4D0MM+aAb7MiwPcuV82BheZR3bNO1ghgOYgODNtN1vQe6333zR6MPogXC/19aVN XY4r0ouvRFZQqby73Y6aflVzFBsPXeKP3qZS4OJRlbQO2dAiQnSNl5hZZJI9rFqddGm0xx pvbDY4xeF8j0zJyw6gsJw6PqlDV27owWiRKkgI/mkdKgIWaKvZfbDL6aCl4wzukkrPwlTJ 2ZynWvXO071hyqY0m4ypdXjWeXzBWYdlCsteb1QLU+G8GfGOpMONwigRU6vIXA== 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 4Mnxmd49BLzJY4; Thu, 13 Oct 2022 04:46:09 +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 29D4k9VD002667; Thu, 13 Oct 2022 04:46:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 29D4k9NG002666; Thu, 13 Oct 2022 04:46:09 GMT (envelope-from git) Date: Thu, 13 Oct 2022 04:46:09 GMT Message-Id: <202210130446.29D4k9NG002666@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: ba50bbb6a20e - stable/13 - amd64 pmap: add comment explaining why INVLPG is functional for PCID config List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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/stable/13 X-Git-Reftype: branch X-Git-Commit: ba50bbb6a20e2649aca73d1f205b0567f906f3ab Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1665636369; 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=3awhrajuFVTVlP5wsPIFiOaK2yZnPM+WBLcWEkkDECc=; b=cs0v8eeAYwGkD98RnWHX3hOodGfXv4nJmTGiZVEUoMUUydQ7VPud0lPg657Bxn74Vxhj2W Sa5u/6ViOt4nUR33Au/U9nRLoKmav1lc6N4m+dNRWGbWBLGw2lEAEDo5gYiD2lwXywI+Cj DWuqEbsSBZDknkW9UAgNxO/iA6CRGMuIMF/ZGGDMwDJ2Kba2yPl4GZg1ayZeRxL+jORCCX xyDBdp4zY5zyFryJC6+1//CguTVl0qWCf9fWcvvuEMu+XrfKnhbHKj6bmdcsiIAMYSUyhp vjDp1zL+trpHyv7BreAWKgXkRiKMAr4wjA5D+OzOseSVzkMk0EWzySjLrgcWTg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1665636369; a=rsa-sha256; cv=none; b=n3ONJcpd4MNdWpe+LGwkN3EufoGi7s9/kGprd0/O06OQvd46SjjsLX6LIjSdpmugUB6ADv cvK9ZTnqjBTt+GRrdIpfhI7FLZ2WF15dBxGYVSKLo377uFZTY8/KnCrP51P9Q2MZVnbIOE eoSfFcuEHlwXfhKj0FrkNoWIuT8Q94Sxlp9C7mJ6ft/LB3oMiZI9dbVn4XdDPqr11PDbVT OXf76uNBMMeALOX5nRI9Z4UhZQ4/WcSMNEFAmtw17iA21GUTH+xI9cAyoLiVvoqkJ/krZc SMDOsFcClF/LHKRacQmJH4HRGv9KBdZqEYHb1rJtk7fhSUHIQFFpBoQF44KgbA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=ba50bbb6a20e2649aca73d1f205b0567f906f3ab commit ba50bbb6a20e2649aca73d1f205b0567f906f3ab Author: Konstantin Belousov AuthorDate: 2022-10-10 00:19:45 +0000 Commit: Konstantin Belousov CommitDate: 2022-10-13 04:46:01 +0000 amd64 pmap: add comment explaining why INVLPG is functional for PCID config (cherry picked from commit e0612ed490c723174607823378d9e883a4b1c257) --- 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 548b7d66dd2b..5d8e636e183d 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -2855,8 +2855,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