Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp135091rwb; Fri, 2 Sep 2022 11:24:31 -0700 (PDT) X-Google-Smtp-Source: AA6agR6nAx6bh1xsvGrDpsKxoWxPYPcSxzI4cbyG1cFSNknr6Rmn+m/4O87dJHUJ58fSo4MBL8mt X-Received: by 2002:a17:903:189:b0:175:45ee:8591 with SMTP id z9-20020a170903018900b0017545ee8591mr13368641plg.103.1662143071485; Fri, 02 Sep 2022 11:24:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662143071; cv=none; d=google.com; s=arc-20160816; b=nc1dxeOknwktnbqXYu4iGq2qBqVJ6+qUU6WWGFt6woUgAds09cQ9k6I3bm1h/sVX+Z Q26AXObZtaX0IH75HHIZ0sS7YQyE9M8hPIcYJPwmQhl/L50+Fx6y6Y9crppnuBkKVAtD glEQA/gDyzPp7tScKSZ2EEsvWmeGM5vwcfs87PKT90QUMFx9LhfXmPDw41n3WPu7g0dO doAbWcoFbS4uxoQE0ZRKexONPnXRejZw4Tk+aFgWAfRuUMTrr09XrTAapazOKRcVkadz kQV7N/9Yt/87bwsoFbT6EK73TNh+fE9E7npE2MBsVWLG+ll+0294iB3DU4soO/974Zta 9TLQ== 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 :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=s3DCCzDNWNr2o0vPxVJ9J8EDP7JjOQZ9oV86ErYAcgk=; b=YBp2cdsjfYhkG0AvtBrM+AJw/5k1TtKdRDHT6tEYNbS5XCUDhlsgOklGyH7R38KLJ6 2xxEKGzSsIvfbSWmmO6wG9FeIxOoLhOWIWQQk5Oohhzvk1QxrnGnSrpYeI6LucroY6qu 5xc3Ok2usfKNVxyzsmEIb9uoarw1Cb+FQrHygKWJ5dvtnvKRHernGYg8Ta8m/RONPhvy ViPBVB66f3sV1wvqNphJY1hBS/KcuvFynifyhxVimfO6Ip4s2RmwU36Q2NkKiGimF84X lM9mu6svD7JWBpCAq+IpS1DkYRsv9OFclP7rVyojvVb/aCDpk93NuGoBej713PCeybcx 8u0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@netscape.net header.s=a2048 header.b=UuNBq5tr; 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 16-20020a631350000000b0042aff6abae6si2609302pgt.277.2022.09.02.11.24.16; Fri, 02 Sep 2022 11:24:31 -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=UuNBq5tr; 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 S229658AbiIBSQe (ORCPT + 99 others); Fri, 2 Sep 2022 14:16:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229659AbiIBSQb (ORCPT ); Fri, 2 Sep 2022 14:16:31 -0400 Received: from sonic307-55.consmr.mail.gq1.yahoo.com (sonic307-55.consmr.mail.gq1.yahoo.com [98.137.64.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AAEABFB0E5 for ; Fri, 2 Sep 2022 11:16:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netscape.net; s=a2048; t=1662142589; bh=s3DCCzDNWNr2o0vPxVJ9J8EDP7JjOQZ9oV86ErYAcgk=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From:Subject:Reply-To; b=UuNBq5trwqOT1Zuujm0ArLr2nPzjtmN8ffppps8EfjK/dn5fgp+PUz21acySDzXRwIeSWYzGMpPNc2VuN7nSz+cig4tZXavIy8QAWayhAqNfNcO4yGyHBoWLKa0sSc8R3tnHPujLHXBB9nKhM4PUV1ARfzbLKcKwAmlXGyCXoRraXqyz+NDaUlRsmmmO9NTe3J1n5dpsUPu+unZ5Iv8WbiW9iD1QJqIaAoWl+s5zUCxKN//Zdxh6Bi0tnVk/+dTGVOH/Ffy53rZi7+3+UntrD9JQfqaAANsHWpJBrfLWy6YKKc+AhqrTKBCV/HluDpf1R7CWLQ32xXUdMndX/NY5Yg== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1662142589; bh=VvLErFLgLh+5dIOl2uvWFYlDdU0cahVwaqvOzOwjaAM=; h=X-Sonic-MF:Date:Subject:To:From:From:Subject; b=bDTK+ytkf9CMrXOGh18DUQOUnyn6R68Qaxvp83PR5LkB90bNK1Q84Ke81P5YWfhSVxb7QGSPBXHru5MgKeDCEVGixi7g42GeGhP8jTUFSK81SPvj6tIYNcVJ+oys0qUkQ5gxPM0t4lBBeNRO6Rj5k7Gl2WHsay7cO858ky5RwUQvLWp05AG/HoDQPYlZGxmh+FkYRhqZyKpnFPKsct4gdaXGn2BajAC+wnq814et8+thMG7g/k9+bHGCY5fiMcxKd5Ot3/hY9ZnfT0wkDbhbZakxlBreVEhJJ4Tu/RDRxSKsai0ZIaIMOQhw2pkirc97krvXZgiE2tpU24XYm8T0CA== X-YMail-OSG: elTm_NQVM1lvo38G3pIAoKx5MoK89Uun0JR2_1wE044d8L.ehf_ryNlBRjgcYPY YZG0ZfhLxIMgKOS6ZLcWskXATrt36jxl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ilYN6nxUaRj5LcP _OuE5sVtFO0Fw1xYbL78umu0dQzh7ZJE2fj7x X-Sonic-MF: Received: from sonic.gate.mail.ne1.yahoo.com by sonic307.consmr.mail.gq1.yahoo.com with HTTP; Fri, 2 Sep 2022 18:16:29 +0000 Received: by hermes--production-bf1-64b498bbdd-ds6cg (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 0e5b82ec19e7d0722a50a09162dc19e5; Fri, 02 Sep 2022 18:16:26 +0000 (UTC) Message-ID: Date: Fri, 2 Sep 2022 14:16:25 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:102.0) Gecko/20100101 Thunderbird/102.2.1 Subject: Re: [PATCH 5.19 109/158] x86/PAT: Have pat_enabled() properly reflect state when running on Xen To: Greg Kroah-Hartman , Jan Beulich , Borislav Petkov , Juergen Gross , Thorsten Leemhuis Cc: stable@vger.kernel.org, Ingo Molnar , Lucas De Marchi , regressions@lists.linux.dev, lkml References: <20220829105808.828227973@linuxfoundation.org> <20220829105813.685677959@linuxfoundation.org> Content-Language: en-US From: Chuck Zmudzinski In-Reply-To: <20220829105813.685677959@linuxfoundation.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Mailer: WebService/1.1.20612 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 8/29/2022 6:59 AM, Greg Kroah-Hartman wrote: > From: Jan Beulich > > commit 72cbc8f04fe2fa93443c0fcccb7ad91dfea3d9ce upstream. > > After commit ID in the Fixes: tag, pat_enabled() returns false (because > of PAT initialization being suppressed in the absence of MTRRs being > announced to be available). > > This has become a problem: the i915 driver now fails to initialize when > running PV on Xen (i915_gem_object_pin_map() is where I located the > induced failure), and its error handling is flaky enough to (at least > sometimes) result in a hung system. > > Yet even beyond that problem the keying of the use of WC mappings to > pat_enabled() (see arch_can_pci_mmap_wc()) means that in particular > graphics frame buffer accesses would have been quite a bit less optimal > than possible. > > Arrange for the function to return true in such environments, without > undermining the rest of PAT MSR management logic considering PAT to be > disabled: specifically, no writes to the PAT MSR should occur. > > For the new boolean to live in .init.data, init_cache_modes() also needs > moving to .init.text (where it could/should have lived already before). > > [ bp: This is the "small fix" variant for stable. It'll get replaced > with a proper PAT and MTRR detection split upstream but that is too > involved for a stable backport. > - additional touchups to commit msg. Use cpu_feature_enabled(). ] > > Fixes: bdd8b6c98239 ("drm/i915: replace X86_FEATURE_PAT with pat_enabled()") > Signed-off-by: Jan Beulich > Signed-off-by: Borislav Petkov > Acked-by: Ingo Molnar > Cc: > Cc: Juergen Gross > Cc: Lucas De Marchi > Link: https://lore.kernel.org/r/9385fa60-fa5d-f559-a137-6608408f88b0@suse.com > Signed-off-by: Greg Kroah-Hartman > --- > arch/x86/mm/pat/memtype.c | 10 +++++++++- > 1 file changed, 9 insertions(+), 1 deletion(-) > > --- a/arch/x86/mm/pat/memtype.c > +++ b/arch/x86/mm/pat/memtype.c > @@ -62,6 +62,7 @@ > > static bool __read_mostly pat_bp_initialized; > static bool __read_mostly pat_disabled = !IS_ENABLED(CONFIG_X86_PAT); > +static bool __initdata pat_force_disabled = !IS_ENABLED(CONFIG_X86_PAT); > static bool __read_mostly pat_bp_enabled; > static bool __read_mostly pat_cm_initialized; > > @@ -86,6 +87,7 @@ void pat_disable(const char *msg_reason) > static int __init nopat(char *str) > { > pat_disable("PAT support disabled via boot option."); > + pat_force_disabled = true; > return 0; > } > early_param("nopat", nopat); > @@ -272,7 +274,7 @@ static void pat_ap_init(u64 pat) > wrmsrl(MSR_IA32_CR_PAT, pat); > } > > -void init_cache_modes(void) > +void __init init_cache_modes(void) > { > u64 pat = 0; > > @@ -313,6 +315,12 @@ void init_cache_modes(void) > */ > pat = PAT(0, WB) | PAT(1, WT) | PAT(2, UC_MINUS) | PAT(3, UC) | > PAT(4, WB) | PAT(5, WT) | PAT(6, UC_MINUS) | PAT(7, UC); > + } else if (!pat_force_disabled && cpu_feature_enabled(X86_FEATURE_HYPERVISOR)) { > + /* > + * Clearly PAT is enabled underneath. Allow pat_enabled() to > + * reflect this. > + */ > + pat_bp_enabled = true; > } > > __init_cache_modes(pat); > > Dear Boris, Jan, Juergen, Thorsten, and Greg, Just a note to say thanks to everyone who worked on this regression. I just upgraded my Xen PV dom0 on fc36 that was affected with the Fedora build of 5.19.6, which has the fix, and it works fine. Thanks again, Chuck