Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp5020999imw; Tue, 19 Jul 2022 18:58:55 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tCTYr202GdxCCafclzTEB26MQBzko28aXbO2EHnAYhimNIL4Sp2fUVC8TEBZHuPUvhJOdr X-Received: by 2002:a17:907:3f27:b0:72b:838e:f104 with SMTP id hq39-20020a1709073f2700b0072b838ef104mr33539203ejc.63.1658282334890; Tue, 19 Jul 2022 18:58:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658282334; cv=none; d=google.com; s=arc-20160816; b=uPBLcHYfQpDGNKJAFborAkH8mHk8xHLbUh79cvlnJEYmZraItQGaH7RUsB3oX0JovH ltJwh5MgK0n0OnruRwhitVsrSLTlI1pNnLr2/R7wO04PoQqgUXzZpqajAowmJzxQnsnA lzpk/h8/b7OelxjqTzL23jWIzg7ZlwliWXg9w8zX7cPPGGUdSJCIGLKxtjPu2DQ+C/X2 ILFd3745mfnxaqdGks/JA1ARWHQASUO0s/biIw3qguwzIEjIlNa+JHQHN4oDEBVAyARv 4sKhdYsOfgayvQKuhaCFQa7R1Xrfn0jN4ZQ3kUMfV9Binx5ixjsMeYfxi6oInoPAgQVK bUmg== 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 :content-language:references:cc:to:subject:from:user-agent :mime-version:date:message-id:dkim-signature; bh=iWifEwj9jXr+OJlYWHhKvQEskuKfIAM/4zntUXILFnY=; b=QctLVIyC4rDCAwVM+je9mF4zlIH54k3uVNq98/xHEiFNj/qumLMklJ3WZP8ankfy6M PKqDzsRDV15A0M2On83fnWC2ZXOiKi1v2D+fwyjvOmSzyKaF1GYF3HiGEFPkyXb339zR eDwxI5PAUUjqq7zyKyy+mFkO0jVkK8MMSBXGTMwXCh0RToHCbOatOzIJcaHMSkgqiROO KhgYdWmQIga+/YIDa/WGjDoFsMp9CIT7KkUKsVfhEiRHoZmAiH8skUJ1frcev5CAhLPZ hqk5ufUdD5T6eLdXpmuQDIfwakm88OA1SdhXnWlCl7wlOPm+O+t36VVulBSY2Vz35Jfg HgbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@netscape.net header.s=a2048 header.b=exWkcLCP; 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 c10-20020a05640227ca00b0043a6e795a19si24670587ede.517.2022.07.19.18.58.29; Tue, 19 Jul 2022 18:58:54 -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=exWkcLCP; 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 S240939AbiGTBOk (ORCPT + 99 others); Tue, 19 Jul 2022 21:14:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60914 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240964AbiGTBOH (ORCPT ); Tue, 19 Jul 2022 21:14:07 -0400 Received: from sonic316-55.consmr.mail.gq1.yahoo.com (sonic316-55.consmr.mail.gq1.yahoo.com [98.137.69.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C5A29675B0 for ; Tue, 19 Jul 2022 18:12:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netscape.net; s=a2048; t=1658279575; bh=iWifEwj9jXr+OJlYWHhKvQEskuKfIAM/4zntUXILFnY=; h=Date:From:Subject:To:Cc:References:In-Reply-To:From:Subject:Reply-To; b=exWkcLCPxO+hW4q4nym5lwdLYXXGPKihrdkNPqFWPQ0bJlQpL2z1Shc/S7+USYQz8x+IclfSyEU2gRSi2JDzq7hfz9ooYxGMX3+HjZsb7tmVp+hhQ7i3xv7JXQrPB1TqKKvvlsxzAZ3Lfsg35ntOJWeHgqGAoWDu5f1cCmu/5r1j58r+6alQ8qBh85Tc3wZZeFaKv1H5AEsqFBbQ8iwg3IV/W+c1sVYS2Dba7ZwAo9IhJ6jVmyJEXbj107v2q4L5BvdhIDjI72ZYUd35/nF0T+AUe+L3aOcx03AHzhBMlHlFink3K+ZFDq2me8t85yUYMKfq8a4dgbZ5LLnnjHT/YA== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1658279575; bh=ltLZEA8eNzEprIbhzvJZSEYmOFXhbEoexjddTnHQJe0=; h=X-Sonic-MF:Date:From:Subject:To:From:Subject; b=o04QgON2jXIorVudFo+weZ1JqkUDUyf0LhDxLtasf+wfwbVi3bimjfGZdaQfRa/5CZ+edusKouC0GGdnMfP+2DCOdFuVH17BdN7rozKS7Xj0S23TuN8e+pLkNJFJjzIkCwkM784sh/nDzs0mm8zQOp94SZy4sGHkL/F7HvHA/KObD/I0YDn52L+cedlcoMH6UyIQGzKmtUwKDRmSlFS/pZh03jgWVlncN4KepPoupQD5WHGW1YZVhEpnYzwRmkOsC1CqbAwqMfdoGFOf6vZR09M3/aK4GX13robVyo8yJcXdaJjbtzIg2rTcnNC3GjUZ9S7EQbjMT4gInZGGFoltNg== X-YMail-OSG: _YxVZCIVM1mdVS.6PZEvKwtUn9DEZEiI_daZt3JoDahEStm86JT2j22U.LY4Mu4 4XXxbUOFQBSoI73wQ0WRjNTy3tN8GBI0NnEI80mK0SMpFLCN6JcT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h0E4otvnGgXKBo_37ahHG5fA- X-Sonic-MF: Received: from sonic.gate.mail.ne1.yahoo.com by sonic316.consmr.mail.gq1.yahoo.com with HTTP; Wed, 20 Jul 2022 01:12:55 +0000 Received: by hermes--production-ne1-7864dcfd54-dxcrc (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID da1c1059c6f58b1197fb62eedc118138; Wed, 20 Jul 2022 01:12:51 +0000 (UTC) Message-ID: <9487b1ef-bc7c-b9c5-929f-0953756e9bd5@netscape.net> Date: Tue, 19 Jul 2022 21:12:48 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 From: Chuck Zmudzinski Subject: Re: [PATCH 3/3] x86: decouple pat and mtrr handling To: Juergen Gross , xen-devel@lists.xenproject.org, x86@kernel.org, linux-kernel@vger.kernel.org Cc: jbeulich@suse.com, Thomas Gleixner , Ingo Molnar , Dave Hansen , "H. Peter Anvin" , Andy Lutomirski , Peter Zijlstra , Boris Ostrovsky , Borislav Petkov , Thorsten Leemhuis References: <20220715142549.25223-1-jgross@suse.com> <20220715142549.25223-4-jgross@suse.com> Content-Language: en-US In-Reply-To: <20220715142549.25223-4-jgross@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, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS 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/15/22 10:25 AM, Juergen Gross wrote: > Today PAT is usable only with MTRR being active, with some nasty tweaks > to make PAT usable when running as Xen PV guest, which doesn't support > MTRR. > > The reason for this coupling is, that both, PAT MSR changes and MTRR > changes, require a similar sequence and so full PAT support was added > using the already available MTRR handling. > > Xen PV PAT handling can work without MTRR, as it just needs to consume > the PAT MSR setting done by the hypervisor without the ability and need > to change it. This in turn has resulted in a convoluted initialization > sequence and wrong decisions regarding cache mode availability due to > misguiding PAT availability flags. > > Fix all of that by allowing to use PAT without MTRR and by adding an > environment dependent PAT init function. > > Cc: # 5.17 > Fixes: bdd8b6c98239 ("drm/i915: replace X86_FEATURE_PAT with pat_enabled()") > Signed-off-by: Juergen Gross > --- ... > diff --git a/arch/x86/mm/pat/memtype.c b/arch/x86/mm/pat/memtype.c > index d5ef64ddd35e..3d4bc27ffebb 100644 > --- a/arch/x86/mm/pat/memtype.c > +++ b/arch/x86/mm/pat/memtype.c > ... > > +void pat_init_noset(void) > +{ > + pat_bp_enabled = true; > + init_cache_modes(); > +} This is what should fix the regression caused by commit bdd8b6c98239 ("drm/i915: replace X86_FEATURE_PAT with pat_enabled()"). Thanks for including this. This function might need a better name. Does noset refer to the fact that when we use this function, we do not set or write to the PAT MSR? Maybe it should be pat_init_noset_msr. Is Xen PV Dom0 the only case when this function will be called or is it also for unprivileged Xen PV domains? Then maybe it should be named pat_init_xen_pv_dom0 or maybe just pat_init_xen_pv if it is also used with unprivileged Xen PV domains. Or, if you want to keep the name as pat_init_noset, maybe it should be preceded by a comment clearly explaining this function is currently only for the Xen PV and/or the Xen PV Dom0 case when we don't write to the PAT MSR and we still want to report PAT as enabled in those cases. Chuck