Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp5238imw; Tue, 12 Jul 2022 13:24:36 -0700 (PDT) X-Google-Smtp-Source: AGRyM1ugmxna/uiyhcUBLalC/5xY6PLfb6kIzaUBsdspzLPN4fvArJg3rYlx+VUOE8HSdrwzuFS9 X-Received: by 2002:a05:6402:5408:b0:435:60fa:5017 with SMTP id ev8-20020a056402540800b0043560fa5017mr34494888edb.223.1657657018354; Tue, 12 Jul 2022 13:16:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657657018; cv=none; d=google.com; s=arc-20160816; b=Ox6CIJbV1M0424EfWOpiSh92JVyFgyrCakAnzMIhJCarlzJYwMZZBpPrJbjZQMQADH KSM2aWA75/6XnnwAuf73GZ883l35DPP+kWheie2PsAGoeIoO4zE/F2cweS+3jxdQuuC+ ZhWzRwaL3eJBcZ7znuLQHCJXeHHfvMEeoYUKjXxJeprqO48ivtaE59G+XR4Ujx+Fgsxk 3EhadNunZIKX2FvHnpdH4UaICe0iYGTmGclm1V0hC9SvBbNrh7u/L+sjON1Ex9MRLgOj GblbfLXGQXdvcrdhCTrPK59YNZHnxfifxW8JkL/OZyjeaOSsFLfJ5DvNAAujNVVoPUbF P36g== 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:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=on6J7csCU3PcwxCxXr0iZWS/WY1846nNUPISliedjE0=; b=G/w0VMgYR4XREtufLqQebQs/L/2IhlNM3N3T9ZHjNfjdC1LA5t7DWuOjfV3rRsH9BP aJBCc57Yc2337mc+kMvmynznW3eXc1k2+NHoUydKCirEVWSjsyMOeg9nSjMCk6+tPvfA LyoQS37LvhHagL2XXt86DQLrLJoxW/2GgWS6VmDtP2KV6YH4LxGWnfegOBNUkj684nkY YLTajrbce6qwRkYsNVegSOdlklPD1oUX2vxXWU1g8JLP7B5UBsSZGPox3vxtGNK1D5U5 96hNsOLrtKHNp4qYaC1yJgL7uPJFoMxhfv1mRn1QuH4OuoHZbmFbbMH77uAT9flzUYkI nu/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@netscape.net header.s=a2048 header.b=FQHPbLPJ; 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 go31-20020a1709070d9f00b0072b3cd7beb8si19090863ejc.938.2022.07.12.13.16.32; Tue, 12 Jul 2022 13:16:58 -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=FQHPbLPJ; 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 S231567AbiGLTlh (ORCPT + 99 others); Tue, 12 Jul 2022 15:41:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51584 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233651AbiGLTlX (ORCPT ); Tue, 12 Jul 2022 15:41:23 -0400 Received: from sonic305-20.consmr.mail.gq1.yahoo.com (sonic305-20.consmr.mail.gq1.yahoo.com [98.137.64.83]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 50FA2DB2D8 for ; Tue, 12 Jul 2022 12:18:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netscape.net; s=a2048; t=1657653490; bh=on6J7csCU3PcwxCxXr0iZWS/WY1846nNUPISliedjE0=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From:Subject:Reply-To; b=FQHPbLPJ33tHYchaTw08ToyCPILhtoV6HxbTwP9Wyk1J3fMbImmh84W606a0h3lei+847d+RgLa5yB2ZgHH12B27lbA9mbTzEm4eJtrQhkk1uCheZj5bfn9yUQt5v3bjXK7Fse3PoXbV2BGRFgtCRGB/gnNVA/grMuik7+/TZNdYE7fwVyqiSl+L080f3Jm8PAmwuikXOvxuZjvEExLdCSCeR2A2noeBUPJ3quvfiU7LpbYy8W67QP51wfnakJbPg+bk73KAOp2AzgkLtlW9LignEm5UsMZq9QvNiND4M4qIwcqJq5R3ld6GL7RJcgkneTailaDjtBb5541M7uQpyw== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1657653490; bh=PL+4xfOMQnU+wxM7A5UDt/OlMtG69yUxOWd+m3+vF0c=; h=X-Sonic-MF:Date:Subject:To:From:From:Subject; b=Zd/LOoBB4jdEgIET55uod5LFgfErz2/FjoWI6zoLnMJ2bqICCLJHf8AsDUofinqTMdkxtejM2A2UBhYjAUVSa0Uc5GDMacN6/NYr4QFdt8foAVHJMXUsGPhTPaBTVhpnhp0/iNHlP58bCPD0TGyd8eMGwOgpsuiilGeQkIzAcvIZMyYVONOBGUyLfD5F2AxSfdeZeVSdlxZXYnRcqa4TEvYvJO8T8j2WE8tHtAN6iTLcUjPU/L3oyuwt2TPgCnYcX98BZQi4ZvTo36nk6Ll0y+Dabu+degoyFjRbSwgSK2UVMMgAETkuULOCYA/bMRrd4zkU+eQGdxliKmFQKMjZLg== X-YMail-OSG: 6uRzXoEVM1ktpBqV3wppqty5gdSRKu0q0pxT.ZTSrG6UTmg48JCt46.bH2t67rt bUtJyP_jQfLlVqIpjowOUcOILv31G5LGY70QiIYX_rIaD6AvueBgV7jAtmsOnXw5vhe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Dt RMw-- X-Sonic-MF: Received: from sonic.gate.mail.ne1.yahoo.com by sonic305.consmr.mail.gq1.yahoo.com with HTTP; Tue, 12 Jul 2022 19:18:10 +0000 Received: by hermes--production-bf1-58957fb66f-hznx2 (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 1f77b89044160acfa604b1a362430e8b; Tue, 12 Jul 2022 19:18:08 +0000 (UTC) Message-ID: Date: Tue, 12 Jul 2022 15:18:05 -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 To: Juergen Gross , Chuck Zmudzinski , linux-kernel@vger.kernel.org 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 , Jan Beulich , 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> From: Chuck Zmudzinski In-Reply-To: <388a3838-1681-dba4-dabd-a7f27817bf34@suse.com> 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 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