Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp4359276rwr; Mon, 8 May 2023 06:43:42 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ67hpCltLyBEMRMhX3xAc5ba2rW98FP4S9d0KwezozeBObdwVXUJThSUwuwKTu5hDnHv/Os X-Received: by 2002:a17:902:7c07:b0:1aa:e739:4097 with SMTP id x7-20020a1709027c0700b001aae7394097mr10098948pll.5.1683553422100; Mon, 08 May 2023 06:43:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683553422; cv=none; d=google.com; s=arc-20160816; b=t5q5sfB5SzRSm5+NfiyrHx9y7bmPGaRr+qWUbyIaP5Jk20Vu0NYhVoE15bvAYS94qu FiS42I53d/vV1tfnceggQdmbRTu25XogD77UXSEMews6G7lw0ncDySO3XZ6rX2j/3HCV +AjhtJlKtPTZI2ropZgfrUX8d6282jGVDTR1wAY/X/KdPm4qNcU5gv3lARhvfcaZ3H9t NH0wUjtnwmvgNUP7ZDSGlFq2PfIFqmVwbkxIad2exDNx0aomnCCNtHo69V9LaJX3i9ab m3xX8Pd4ubFlLKtoaZvSagJAvFR4eDwX3q9FQnTVB4fP6sb7M9aOr4RtM/MiGI6A+IeD 6q/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=ZJZo66bmNey3lT9jFnB9bUIzDEHCyi70FsJKZ/DnTpA=; b=PkHHdBczmorBALmv1fKnSfgNWNT15ldnmO/mFySfiUfAIC2572jlrG0fv4/xAjCd9D fvbyoWdXfZaRnKoz93s50u1MjRpl9esbgYLMzwffzaU9M5cTrvjgxHf9T0/BSLwOzqId ktlryceELKJBXmn6CNCs/P/YseAmkxh23Fe9Eq1L8zL9wg2KRDJeFHTb30/oxXABgQvu ldQi/yc+v+zJtM8GxOgPYFeI+RtV/cBnOyphDdjC4TfFWqf6MBpQLxL5gsA+mZNMmDJW 2Cv4Ga3YywIh7vIwBE11ktC1Ab7qBkeE6ofZXtjS+E7IDefkmkLS6y3kC0En/YqoZyoQ TZGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=wn8f6IfT; dkim=neutral (no key) header.i=@linutronix.de header.b=ftuWG76R; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l6-20020a170903120600b001ab23cbe13bsi8432260plh.104.2023.05.08.06.43.28; Mon, 08 May 2023 06:43:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=wn8f6IfT; dkim=neutral (no key) header.i=@linutronix.de header.b=ftuWG76R; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233204AbjEHNmB (ORCPT + 99 others); Mon, 8 May 2023 09:42:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234200AbjEHNl5 (ORCPT ); Mon, 8 May 2023 09:41:57 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A94D719917; Mon, 8 May 2023 06:41:52 -0700 (PDT) Date: Mon, 08 May 2023 13:41:50 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1683553310; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZJZo66bmNey3lT9jFnB9bUIzDEHCyi70FsJKZ/DnTpA=; b=wn8f6IfTaN1+x8oBnYVZP3TBh2OWfttD89smYptRexO0AncSv/VyMEDflQpxmj9P36qc0L kCpTI19vMEzK50QkfHvm5+dlbm8Gnc1bL/ZaHD6gGvyGSp1GONFoxDqEF5u0XqA6+oOL4G PDJRwbXOzebmIHjnm8p1yRmp9u3iCjlHbTOtOQQcw2Jjvl8foy0i+D9Qm5UWLbI4W/3R9u Rx1ENacm8qfviqvXo/nECUkyADnsknlOaOjPB1crAUTcmAskton6ndGgRckfxNBw7sqnRa 1Nu3qSl9y4VAffQAmHOmtUMaFQKcAjI4OFqTfPniioJkRy/4BD59N94ifO7UEA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1683553310; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZJZo66bmNey3lT9jFnB9bUIzDEHCyi70FsJKZ/DnTpA=; b=ftuWG76R8UhgbnE/Us7FgvMELMoTWNfVaUcjHLC4Tj9xh31xnUUOtciM2E8RiLlMaRqJu+ euOtYLLwOCmZToDw== From: "tip-bot2 for Juergen Gross" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/mm] x86/mm: Fix __swp_entry_to_pte() for Xen PV guests Cc: Juergen Gross , "Borislav Petkov (AMD)" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20230306123259.12461-1-jgross@suse.com> References: <20230306123259.12461-1-jgross@suse.com> MIME-Version: 1.0 Message-ID: <168355331020.404.17123011230047801582.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the x86/mm branch of tip: Commit-ID: 0f88130e8a6fd185b0aeb5d8e286083735f2585a Gitweb: https://git.kernel.org/tip/0f88130e8a6fd185b0aeb5d8e286083735f2585a Author: Juergen Gross AuthorDate: Mon, 06 Mar 2023 13:32:59 +01:00 Committer: Borislav Petkov (AMD) CommitterDate: Mon, 08 May 2023 15:25:24 +02:00 x86/mm: Fix __swp_entry_to_pte() for Xen PV guests Normally __swp_entry_to_pte() is never called with a value translating to a valid PTE. The only known exception is pte_swap_tests(), resulting in a WARN splat in Xen PV guests, as __pte_to_swp_entry() did translate the PFN of the valid PTE to a guest local PFN, while __swp_entry_to_pte() doesn't do the opposite translation. Fix that by using __pte() in __swp_entry_to_pte() instead of open coding the native variant of it. For correctness do the similar conversion for __swp_entry_to_pmd(). Fixes: 05289402d717 ("mm/debug_vm_pgtable: add tests validating arch helpers for core MM features") Signed-off-by: Juergen Gross Signed-off-by: Borislav Petkov (AMD) Link: https://lore.kernel.org/r/20230306123259.12461-1-jgross@suse.com --- arch/x86/include/asm/pgtable_64.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/include/asm/pgtable_64.h b/arch/x86/include/asm/pgtable_64.h index 7929327..a629b1b 100644 --- a/arch/x86/include/asm/pgtable_64.h +++ b/arch/x86/include/asm/pgtable_64.h @@ -237,8 +237,8 @@ static inline void native_pgd_clear(pgd_t *pgd) #define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val((pte)) }) #define __pmd_to_swp_entry(pmd) ((swp_entry_t) { pmd_val((pmd)) }) -#define __swp_entry_to_pte(x) ((pte_t) { .pte = (x).val }) -#define __swp_entry_to_pmd(x) ((pmd_t) { .pmd = (x).val }) +#define __swp_entry_to_pte(x) (__pte((x).val)) +#define __swp_entry_to_pmd(x) (__pmd((x).val)) extern void cleanup_highmap(void);