Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4715687imw; Tue, 12 Jul 2022 12:56:20 -0700 (PDT) X-Google-Smtp-Source: AGRyM1seWx/28i0fwEJug4DwLAnaf3yYY3wqCQ3ddQH86kuNV90SQzStEdnHRedaHW7m8s3nDn30 X-Received: by 2002:a63:a1d:0:b0:412:9d39:3af with SMTP id 29-20020a630a1d000000b004129d3903afmr21183549pgk.45.1657655780135; Tue, 12 Jul 2022 12:56:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657655780; cv=none; d=google.com; s=arc-20160816; b=Hu9fRlsFORjnG8SQIHMceFXvpUHfVbQEGoPFJIXyywD5nog+Aw+MF/1rwIjJ3ICAJp enHOClOs9JIc3vqAY2sW/U4jM4xUFwQJlN83fpm5WqSeQ3Gu6+dFaKLYCgb5kRTJSJTu O39hcyjZVE1IJoAUnXygzL3WtzZgp5vI/qGLKE+WGDYCpGiiVj2Wu40fT25br2bMNikd TiAjmtiQK/YdQOzE5WHWKKeDg0D+fyTCVwbg6on8SOnLl0jkb/CIFy8iTwix7wCs4R3W XP0lKmzVkLnrVbwl2SwKhzWOqXKS0q/TeqKZef90BJGF3WysuWDEt1EtBAi+yF9pMf6Y vu9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:references :cc:to:from:content-language:subject:user-agent:mime-version:date :message-id:dkim-signature; bh=pgrpjNqb385gEEgRLF0Q/rt+9pomAz4bgE3sZ8LNtkM=; b=hiU8DOeVMMi9q/p0Vy6eFSiMgwAmMc2Q8nJdBx2IzO2AH99711TPx/f+0Q0h2MbgZV l30UyNLXbyW5XYF5cG2n51Ztp012hUayFgGnGYH6BbxrKOSr/sU6qXSTNdnBLO8Z1vyS LE3T+ed+GmD1YRiSCTomw/UQOhC7it/uaIEW3vvLyWk8q89zUi7/RQ02ECirgXEdHac7 tH9bx4QLt/hXDKcoL69cZI6C7W7UC1uvdTLC/qOn+QCNXAfGlWrsciFqePw+RTXxnVYh QEYwhg85Sd5CdByv8vzFwPaK5NTqhA5FCJJ43RsF3X19Y3YrougMPtjoQfDqeQT7aXQ6 Rfjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@netscape.net header.s=a2048 header.b=cGK1XAum; 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=REJECT sp=REJECT dis=NONE) header.from=netscape.net Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lk11-20020a17090b33cb00b001ecfcc0a97dsi23588931pjb.71.2022.07.12.12.55.16; Tue, 12 Jul 2022 12:56:20 -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=@netscape.net header.s=a2048 header.b=cGK1XAum; 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=REJECT sp=REJECT dis=NONE) header.from=netscape.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233797AbiGLTxt (ORCPT + 99 others); Tue, 12 Jul 2022 15:53:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34822 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233682AbiGLTx2 (ORCPT ); Tue, 12 Jul 2022 15:53:28 -0400 Received: from sonic309-21.consmr.mail.gq1.yahoo.com (sonic309-21.consmr.mail.gq1.yahoo.com [98.137.65.147]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 25789BAA99 for ; Tue, 12 Jul 2022 12:48:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netscape.net; s=a2048; t=1657655310; bh=pgrpjNqb385gEEgRLF0Q/rt+9pomAz4bgE3sZ8LNtkM=; h=Date:Subject:From:To:Cc:References:In-Reply-To:From:Subject:Reply-To; b=cGK1XAumi8ewsF02TDfEwvDxKjXEE/9dyYBYKSwydfPHvLpmv8AXuXlWouC0txtVox6a4tuf1/ZEbNeprbOdN+MpnPWHSKsPYE/tpoM28eGUdjY3ncxa/bzZ8sMq5o+dWSvZJUP/jGYd0S/+TZhfmjWlgZWJVb55iBqtty3fD9nmfsWhp1HpoDnN2TdrQ7FY9bzAb2myFGBkPzucdxIHKcXwsfEvbQjC+nr2qS6D7ct5pS/pKLdWW/hlrgyZ8vO32M7qBJNQD9K4n9KRi++dS42Z+KvuweDe/fmNU2/KkzFwIXybY0uOsmJ2kD5Obl/+4bUEadN4MNT+7HbbDUBJyA== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1657655310; bh=h/lH+nNJqzfnjk2ZuaQqpRQOd5bw1El5erq2VjEJbzC=; h=X-Sonic-MF:Date:Subject:From:To:From:Subject; b=iPoSOZtBsKACXCciYie15Rq8Perhe6oJ9HL/fN+KRuNjcGdFPEcN+EoXh3BzdpvtY0ScMF6y4RLSKBZDrvsJ9zfzGvPWURZ/b4kUhDA2mDukGb+6SBLyANhSjXNWK3MlowYA+9XOL/IjiulZ7RiAZzj8U8nMGQom5V+SLO+UWV8qdv11xFnmJPBFWdflBDbDTKICnyASpNHt4Gws3kk6HW9p4phG8ZE5MSQRmKzCHJuBAtIoheYusTbPh7afmKfo7o7pEFL/t351W5lrjVqwsyrwkiLN2wSRw1kYiJ+azATUSQJJHmohC/2SZ87bey1aMP5Cb87Vi9TvwnBmyKh/cQ== X-YMail-OSG: f0kMs3UVM1nloicb8jexJ_OKjrYz7NLzq7Mukf1rrF8mhZWIkQCqPlJdj4i0JKh AMAlWciZnf_KHh1uRKHdB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OJscmdXyussGcSV5vPXbJ7bIp.lg6XjZHhBHA92SwAGX4ZSm SwmY- X-Sonic-MF: Received: from sonic.gate.mail.ne1.yahoo.com by sonic309.consmr.mail.gq1.yahoo.com with HTTP; Tue, 12 Jul 2022 19:48:30 +0000 Received: by hermes--production-bf1-58957fb66f-fvhff (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 971ea9941bc8ae4c927179b995a77a93; Tue, 12 Jul 2022 19:48:28 +0000 (UTC) Message-ID: <32c86239-c434-369d-b6a7-f6f88cf5430a@netscape.net> Date: Tue, 12 Jul 2022 15:48:25 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCH] x86/PAT: Report PAT on CPUs that support PAT without MTRR Content-Language: en-US From: Chuck Zmudzinski To: Juergen Gross , linux-kernel@vger.kernel.org, Jan Beulich Cc: Dave Hansen , Andy Lutomirski , Peter Zijlstra , Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, "H. Peter Anvin" , Dan Williams , "Kirill A. Shutemov" , Tom Lendacky , Brijesh Singh , Jane Chu , Tianyu Lan , Randy Dunlap , Sean Christopherson , xen-devel@lists.xenproject.org, stable@vger.kernel.org References: <2885cdcaccffd287ef69c7509056ddf183a38a0e.1657647656.git.brchuckz.ref@aol.com> <2885cdcaccffd287ef69c7509056ddf183a38a0e.1657647656.git.brchuckz@aol.com> <388a3838-1681-dba4-dabd-a7f27817bf34@suse.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Mailer: WebService/1.1.20407 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.aol X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no 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 On 7/12/22 3:18 PM, Chuck Zmudzinski wrote: > On 7/12/22 2:27 PM, Juergen Gross wrote: > > On 12.07.22 20:20, Chuck Zmudzinski wrote: > > > The commit 99c13b8c8896d7bcb92753bf > > > ("x86/mm/pat: Don't report PAT on CPUs that don't support it") > > > incorrectly failed to account for the case in init_cache_modes() when > > > CPUs do support PAT and falsely reported PAT to be disabled when in > > > fact PAT is enabled. In some environments, notably in Xen PV domains, > > > MTRR is disabled but PAT is still enabled, and that is the case > > > that the aforementioned commit failed to account for. > > > > > > As an unfortunate consequnce, the pat_enabled() function currently does > > > not correctly report that PAT is enabled in such environments. The fix > > > is implemented in init_cache_modes() by setting pat_bp_enabled to true > > > in init_cache_modes() for the case that commit 99c13b8c8896d7bcb92753bf > > > ("x86/mm/pat: Don't report PAT on CPUs that don't support it") failed > > > to account for. > > > > > > This patch fixes a regression that some users are experiencing with > > > Linux as a Xen Dom0 driving particular Intel graphics devices by > > > correctly reporting to the Intel i915 driver that PAT is enabled where > > > previously it was falsely reporting that PAT is disabled. > > > > > > Fixes: 99c13b8c8896d7bcb92753bf ("x86/mm/pat: Don't report PAT on CPUs that don't support it") > > > Cc: stable@vger.kernel.org > > > Signed-off-by: Chuck Zmudzinski > > > --- > > > Reminder: This patch is a regression fix that is needed on stable > > > versions 5.17 and later. > > > > > > arch/x86/mm/pat/memtype.c | 12 ++++++++++++ > > > 1 file changed, 12 insertions(+) > > > > > > diff --git a/arch/x86/mm/pat/memtype.c b/arch/x86/mm/pat/memtype.c > > > index d5ef64ddd35e..0f2417bd1b40 100644 > > > --- a/arch/x86/mm/pat/memtype.c > > > +++ b/arch/x86/mm/pat/memtype.c > > > @@ -315,6 +315,18 @@ void init_cache_modes(void) > > > PAT(4, WB) | PAT(5, WT) | PAT(6, UC_MINUS) | PAT(7, UC); > > > } > > > > > > + else if (!pat_bp_enabled) { > > > > Please put the "else if {" into the same line as the "}" above. > > > > > + /* > > > + * In some environments, specifically Xen PV, PAT > > > + * initialization is skipped because MTRRs are disabled even > > > + * though PAT is available. In such environments, set PAT to > > > + * enabled to correctly indicate to callers of pat_enabled() > > > + * that CPU support for PAT is available. > > > + */ > > > + pat_bp_enabled = true; > > > + pr_info("x86/PAT: PAT enabled by init_cache_modes\n"); > > > > Wrong indentation. > > > > > + } > > > + > > > __init_cache_modes(pat); > > > } > > > > > > > Any reason you didn't fix the "nopat" issue Jan mentioned? > > > > I asked you twice to add this fix. > > > > > > Juergen > > Sorry, I did not see your request. I will resend with the fix > for "nopat" and the other style issues you mentioned. > > Chuck I will also re-compile and test the new patch before sending v2 and unless Jan objects, I should acknowledge Jan as co-author of the patch since I will be using parts of his proposed patch to fix the "nopat" issue, so I also need to get his sign-off before sending v2. Jan, how should I obtain your sign-off? Chuck Chuck