From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1F07DC3DA78 for ; Tue, 20 Dec 2022 01:10:43 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.466398.725274 (Exim 4.92) (envelope-from ) id 1p7R9G-0004TK-7r; Tue, 20 Dec 2022 01:10:26 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 466398.725274; Tue, 20 Dec 2022 01:10:26 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1p7R9G-0004TD-2g; Tue, 20 Dec 2022 01:10:26 +0000 Received: by outflank-mailman (input) for mailman id 466398; Tue, 20 Dec 2022 01:10:25 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1p7R9F-0004T7-6t for xen-devel@lists.xenproject.org; Tue, 20 Dec 2022 01:10:25 +0000 Received: from wout2-smtp.messagingengine.com (wout2-smtp.messagingengine.com [64.147.123.25]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 1286c6a8-8003-11ed-8fd4-01056ac49cbb; Tue, 20 Dec 2022 02:10:22 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id 321923200957; Mon, 19 Dec 2022 20:10:18 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Mon, 19 Dec 2022 20:10:19 -0500 Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 19 Dec 2022 20:10:16 -0500 (EST) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 1286c6a8-8003-11ed-8fd4-01056ac49cbb DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= invisiblethingslab.com; h=cc:cc:content-transfer-encoding :content-type:date:date:from:from:in-reply-to:message-id :mime-version:reply-to:sender:subject:subject:to:to; s=fm2; t= 1671498617; x=1671585017; bh=HxKwu1yHvQE4t0B7JD3h8oXtLX1A8wBvk77 m47Pevgo=; b=zTQrknzF1f7ibjycA25oDFa97HGSjXrr+S3G0dYFYBWrQWOCV1X G6aFu4bfwPbyKVQWMJ9HvXYFaxxE/Uym/HBid0gU91kvimqyb25A/Xr7FnWzSFGX HHqNVVu1ZFwKcebxY3+hhnO+JX6CSs7oQeyH9S3PtSO6Z3g8O4rAH7hm2R0DeY30 FpXwOVGfZSGsY7jgHOob3asL5JIXkzSYEdV5F332cCtRF3FCy8O5XUuhmCx+/P6t h804kKEG1ZPaAee+KxjttXksVlnlgKgE9wMv0HsAY7Cje8OJfqnpacCsy+QAr3VI ucZBZtLS35I/RhIzVpmMGFME79n3wsYmDrA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:message-id:mime-version:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; t=1671498617; x=1671585017; bh=HxKwu1yHvQE4t 0B7JD3h8oXtLX1A8wBvk77m47Pevgo=; b=s9LPDfcWgLFhWgpZuYe/22aHJ6DM3 Fop0eGs9BJmOVA4qn1xWrFd1jQV8JjeQB85gwQHbqF8zLWEAAWFKh2Eth3B2Dptv C3SsIJgH60NENgp6auVCqhFdidIxxLwsEME/B0h0t30uSe0CXTXM/eqokg+PmZja 77O7VpYfNQPB56SXsI6q5Dupwjzaio2PNcScCX+dYwXSCSoaHOBojlzt7kBLzX7C nq1OtxafvLzBrOM5T86ioiNC6n6KOhpGpPxvTIlEhbFSFiaz8WkNJfdzr2tKmzXK EbfDlMJE+aKerqYXJSosWsJlIzmzCsOEuvhcfZKKcZj82yqbUWKr2eGLw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrgeeggdefvdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvfevufffkffogggtgfesthekredtredtjeenucfhrhhomhepffgvmhhiucfo rghrihgvucfqsggvnhhouhhruceouggvmhhisehinhhvihhsihgslhgvthhhihhnghhslh grsgdrtghomheqnecuggftrfgrthhtvghrnhephfeggfeiiedtieejgedutdekgfetgeeh heegteekvefhfefgudehtdevleegueegnecuvehluhhsthgvrhfuihiivgeptdenucfrrg hrrghmpehmrghilhhfrhhomhepuggvmhhisehinhhvihhsihgslhgvthhhihhnghhslhgr sgdrtghomh X-ME-Proxy: Feedback-ID: iac594737:Fastmail From: Demi Marie Obenour To: xen-devel@lists.xenproject.org Cc: Demi Marie Obenour , =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= , Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Wei Liu , Jun Nakajima , Kevin Tian , George Dunlap , Tim Deegan Subject: [PATCH v5 00/10] Make PAT handling less brittle Date: Mon, 19 Dec 2022 20:07:02 -0500 Message-Id: X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit While working on Qubes OS Marek found out that there were some PAT hacks in the Linux i195 driver. I decided to make Xen use Linux’s PAT to see if it solved the graphics glitches that were observed; it did. This required a substantial amount of preliminary work that is useful even without using Linux’s PAT. Patches 1 through 9 are the preliminary work and I would like them to be accepted into upstream Xen. Patch 9 does break ABI by rejecting the unused PAT entries, but this will only impact buggy PV guests and can be disabled with a Xen command-line option. Patch 10 actually switches to Linux’s PAT and is NOT intended to be merged (at least for now) as it would at a minimum break migration of PV guests from hosts that do not have the patch. Only patches 9 and 10 actually change Xen’s observable behavior. Patches 1, 2, and 7 are prerequisites, and patches 3 through 6 are cleanups. Patch 8 makes changing the PAT much less error-prone, as problems with the PAT or with the associated _PAGE_* constants will be detected at compile time. Demi Marie Obenour (10): x86: Add memory type constants x86/mm: Avoid hard-coding PAT in get_page_from_l1e() x86: Replace PAT_* with X86_MT_* x86: Replace MTRR_* constants with X86_MT_* constants x86: Replace EPT_EMT_* constants with X86_MT_* x86: Remove MEMORY_NUM_TYPES and NO_HARDCODE_MEM_TYPE x86: Derive XEN_MSR_PAT from its individual entries x86/mm: make code robust to future PAT changes x86/mm: Reject invalid cacheability in PV guests by default x86: Use Linux's PAT xen/arch/x86/cpu/mtrr/generic.c | 10 +- xen/arch/x86/cpu/mtrr/main.c | 26 +++--- xen/arch/x86/e820.c | 4 +- xen/arch/x86/hvm/hvm.c | 12 +-- xen/arch/x86/hvm/mtrr.c | 100 ++++++++++---------- xen/arch/x86/hvm/vmx/vmcs.c | 2 +- xen/arch/x86/hvm/vmx/vmx.c | 18 ++-- xen/arch/x86/include/asm/hvm/vmx/vmcs.h | 2 +- xen/arch/x86/include/asm/hvm/vmx/vmx.h | 9 -- xen/arch/x86/include/asm/mtrr.h | 22 +---- xen/arch/x86/include/asm/page.h | 4 +- xen/arch/x86/include/asm/processor.h | 11 ++- xen/arch/x86/include/asm/x86-defns.h | 11 +++ xen/arch/x86/mm.c | 118 ++++++++++++++++++++++-- xen/arch/x86/mm/hap/nested_ept.c | 4 +- xen/arch/x86/mm/p2m-ept.c | 51 +++++----- xen/arch/x86/mm/shadow/multi.c | 8 +- 17 files changed, 253 insertions(+), 159 deletions(-) -- Sincerely, Demi Marie Obenour (she/her/hers) Invisible Things Lab