Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp185839imw; Wed, 13 Jul 2022 22:41:26 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vahQ27RboiQtXuqdNocLvnUWhamegfbm75dpRGhSoIM2u6O4YXNEklrimZYhD9jZ+3hKDd X-Received: by 2002:a63:6c49:0:b0:419:a4c5:cab5 with SMTP id h70-20020a636c49000000b00419a4c5cab5mr3813251pgc.123.1657777286690; Wed, 13 Jul 2022 22:41:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657777286; cv=none; d=google.com; s=arc-20160816; b=udw12ZrxbXPxOw1YWV2d3M5jpszeA0KDPiufUq+Gso4rV2KsZFOnYO1NSGJxgV7XIv mQo41P28HGrX63ybnCx1x6uoqZcuZ1QOhfcpOe24Ka7UXvIO3y68X0MqBDlMYKKdi7H3 KayM5mN5qm6QNsp7TXPLr6ContqzW0+k2HQOs8cCo2jwoLJt9Q7ZcVG3r2BdhRTAXZ4A 22b4+yQvlbOcQPlJJq7+3gYVOCd42nNxIHhqr9funHOeCZzL2AernYkoSamruuCR1tHL k2OQXqoH2rFdVdE8aRLtmdcXtAUIq5WGB1x6egm2/JgJmaRONC9vqG6nAtAIupnSxUlH HO/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:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=fXBELy01K6M90z4En6C9sRiLAskcrjsZvjMJrAyNjAo=; b=00P50UIIUW/gPLPD+JEfZKu50vxJcRvDWvMAiqg4Qf/3tfg/k7i1gMFd/qBV81Pnx7 x45hRHHWG46DrSIDWwKjjnrtz4k4XbvSiV6jU57QLL8DLi+zNz9WyLtrhqzGEoOUDIy+ 93u/dB61gguEGDZ2IhyGEiW+of/EAWd2B4XuzuJwiVRk97kJNjkCpX8ndD3euRBw/npI CcMtKuwYnjdRS5tZ2fcVdyLfGSzyeE56N+Cai926R7mTEllFg+oaDjF1oydedfcksqiu Mw/3Cbri3DF/1ceH150ibcHIYjeHBTzvFiLSCKjZr5DJt940z91+iroGm4bcelCV/pp7 3rqg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a71-20020a63904a000000b004161b3b9565si611120pge.590.2022.07.13.22.41.14; Wed, 13 Jul 2022 22:41:26 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234573AbiGNFa4 (ORCPT + 99 others); Thu, 14 Jul 2022 01:30:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234312AbiGNFax (ORCPT ); Thu, 14 Jul 2022 01:30:53 -0400 Received: from wp530.webpack.hosteurope.de (wp530.webpack.hosteurope.de [IPv6:2a01:488:42:1000:50ed:8234::]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C708021277; Wed, 13 Jul 2022 22:30:51 -0700 (PDT) Received: from [2a02:8108:963f:de38:eca4:7d19:f9a2:22c5]; authenticated by wp530.webpack.hosteurope.de running ExIM with esmtpsa (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) id 1oBrR1-0001Nh-2x; Thu, 14 Jul 2022 07:30:47 +0200 Message-ID: <5ea45b0d-32b5-1a13-de86-9988144c0dbe@leemhuis.info> Date: Thu, 14 Jul 2022 07:30:45 +0200 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 v2] Subject: x86/PAT: Report PAT on CPUs that support PAT without MTRR Content-Language: en-US To: 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 , Jane Chu , Tianyu Lan , Randy Dunlap , Sean Christopherson , Jan Beulich , Juergen Gross , xen-devel@lists.xenproject.org, stable@vger.kernel.org References: <9d5070ae4f3e956a95d3f50e24f1a93488b9ff52.1657671676.git.brchuckz.ref@aol.com> <9d5070ae4f3e956a95d3f50e24f1a93488b9ff52.1657671676.git.brchuckz@aol.com> From: Thorsten Leemhuis In-Reply-To: <9d5070ae4f3e956a95d3f50e24f1a93488b9ff52.1657671676.git.brchuckz@aol.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-bounce-key: webpack.hosteurope.de;regressions@leemhuis.info;1657776651;878720af; X-HE-SMSGID: 1oBrR1-0001Nh-2x X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,NICE_REPLY_A, 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 On 13.07.22 03:36, 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 approach arranges for pat_enabled() to return true in the Xen PV > environment without undermining the rest of PAT MSR management logic > that considers PAT to be disabled: Specifically, no writes to the PAT > MSR should occur. > > 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. Some users > are experiencing system hangs in Xen PV Dom0 and all users on Xen PV > Dom0 are experiencing reduced graphics performance because 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 are quite a bit > less performant than possible without this patch. > > Also, with the current code, in the Xen PV environment, PAT will not be > disabled if the administrator sets the "nopat" boot option. Introduce > a new boolean variable, pat_force_disable, to forcibly disable PAT > when the administrator sets the "nopat" option to override the default > behavior of using the PAT configuration that Xen has provided. > > 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). > > Fixes: 99c13b8c8896d7bcb92753bf ("x86/mm/pat: Don't report PAT on CPUs that don't support it") BTW, "submitting-patches.rst" says it should just be "the first 12 characters of the SHA-1 ID" > Co-developed-by: Jan Beulich > Cc: stable@vger.kernel.org > Signed-off-by: Chuck Zmudzinski Sorry, have to ask: is this supposed to finally fix this regression? https://lore.kernel.org/regressions/YnHK1Z3o99eMXsVK@mail-itl/ If yes, please include Link: and Reported-by: tags, as explained in submitting-patches.rst (I only care about the link tag, as I'm tacking that regression). Ciao, Thorsten (wearing his 'the Linux kernel's regression tracker' hat) P.S.: As the Linux kernel's regression tracker I deal with a lot of reports and sometimes miss something important when writing mails like this. If that's the case here, don't hesitate to tell me in a public reply, it's in everyone's interest to set the public record straight.