Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp1327803imw; Sat, 16 Jul 2022 04:17:40 -0700 (PDT) X-Google-Smtp-Source: AGRyM1s7nMFsn3Aw6LxD/CxW7JqpIwIvWk6m7yIvQUj4N14A9f0qSZqHWJFwfJJryOl2MQIXkgFS X-Received: by 2002:a05:6830:22d4:b0:61c:519b:feea with SMTP id q20-20020a05683022d400b0061c519bfeeamr6916028otc.258.1657970260441; Sat, 16 Jul 2022 04:17:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657970260; cv=none; d=google.com; s=arc-20160816; b=veTpHpvzawuQkYKu7/eFpjKJAWRd5f6Xy+BgihJaOM9+mmVJ8cQegM4FqZo/E7p1qQ rrAF4kqsS2yVevusRSsW7EVrhJiXUNC193lNpAU99dhv98iwErWf4iMwXHcDfcedwlr/ F5l+NpPCqVAdP6HGhV7Z+QsDed2I082bSfElEqWgXjmMj+s91Ai8/p24izTwf1+MKSqJ UzoaoEAPainPfw/xaXE129YwW35/JKNgQOywME3RSJrBmIQH2/B2bfq1eQrbDtvoGdeh b2zqpNprbD47bLg9s9VgZuCBWoxQ5nCyv5QlCIrk619IZ/7vPAMSdA3GSl9vo1uWRrNY BYOA== 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=9kCVGUMpl2oWSCZYJC+fW/uAOWc3h3qV4xzemUT96SE=; b=Tvw98oXAMvkwD5scmals8NuM0aFJEOl+WfNexS0z7d4Na8ky1hvM2NSpFdbDRSsbIj bW5+9uusfIhFdB++kCI96sOqyReuXsdATK6ezYLIx2sv3HSul87kfaqmhD32h9OXdeez JVZTwpFbpFLkADqvz71JbqDee6Sb77QmnHckNd0ypzPjydVbnjoI9mAFFcc3zQTfJh81 OkeoFqdauuFl9NpMD354B5idueoqxZdoy69lIVpyrbvqKfplATzNdW/mos/kXBzFeHNq gxfxjbr5izAdagKPLJDh9JLhTsGPk7EDiRxI5SXZz1lAhzHgTJiMTT3MQ8CLKwS+uT+d J6wA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@netscape.net header.s=a2048 header.b=GujfvsK3; 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 63-20020a4a1542000000b00425a0ba72dcsi5308927oon.47.2022.07.16.04.16.59; Sat, 16 Jul 2022 04:17:40 -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=GujfvsK3; 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 S229882AbiGPLEb (ORCPT + 99 others); Sat, 16 Jul 2022 07:04:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50044 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229521AbiGPLE3 (ORCPT ); Sat, 16 Jul 2022 07:04:29 -0400 Received: from sonic311-50.consmr.mail.gq1.yahoo.com (sonic311-50.consmr.mail.gq1.yahoo.com [98.137.65.232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 80FABDF6A for ; Sat, 16 Jul 2022 04:04:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netscape.net; s=a2048; t=1657969467; bh=9kCVGUMpl2oWSCZYJC+fW/uAOWc3h3qV4xzemUT96SE=; h=Date:Subject:From:To:Cc:References:In-Reply-To:From:Subject:Reply-To; b=GujfvsK3tbeKL650aaxCePnYUZ+BCHW6RyYhVhTtwzmjtMCy4UE76Bg1eTFVFWVbmQl3dNyC+bicRyQ4mktA3cpdzi7aIf/lDpc5fjhSQT8+Yktz4pgheMWNfCBJGytJPHsktdrqVNZwsMF7Vs1RJ6vy/WsyyhmKCbH9a9D4Df0gxnaA5YzVpvTtsBLceikdGRQ0yQQcsc6F/ANtJbyq7w0j1t0HNQKv5w104XLcXvVFVleeCzZMSvn2ANRXQPUs2nlePEWaakL2TBaL4vHUc9u/d8xdoZ6MdU7E7wgVSpGUKcsjWvgqMfuglOGMS4ucLM6xS0u3yDvFh55ki+V+Pg== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1657969467; bh=pALuA2PaqkJcZFg6nSOqnMnN/y9LNS4HKyh+F3Huagi=; h=X-Sonic-MF:Date:Subject:From:To:From:Subject; b=DyLPwWJ//DNjw29UXmL9nnGyACsUzRP/XRiW/H4zxVpJUO3hIqSVVk0WNRjXWv4nNEa6gLrhAl9z4rmP+5PSemyymB83RsI5GJIHYl1POEY3uDqDL45kgyXOpwcuP2dmBSFawqmW3/qhXZUqssZu+jeXoLxAQm0Naohz5TZWGuaphrrvRgWt6on2iCymhTgPqKmlfWqct0K8zpC7fyGcEIm7/gVxdbflXP7QOMkjMOuM7r1MRMwXTOmihH3aQEQf61rV9eHVfvCNuIeVzDfOSgqQjt3ZDjZbuiE9/cex3396ziRDLDoYQrnHtB4jrEh69WDAWaYvUNpsXxKQ2f1YQg== X-YMail-OSG: S306_2UVM1n7GGGk3qFOuAulwIAj3xRtTyH_jeOihl0nI2.mN5zvtlDgTr88v_. YAGkQDbmRJLdZ8_ONmncnqU0vwKvLqPdKw70fu9fz1a6LpHUN_3kqQNS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YfLP _6w-- X-Sonic-MF: Received: from sonic.gate.mail.ne1.yahoo.com by sonic311.consmr.mail.gq1.yahoo.com with HTTP; Sat, 16 Jul 2022 11:04:27 +0000 Received: by hermes--production-bf1-58957fb66f-fvhff (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 0c6d0fae316bf9b3c37baf18a7fd0b51; Sat, 16 Jul 2022 11:02:25 +0000 (UTC) Message-ID: <03ae6425-6d99-4ec8-9f94-005a4d79ca16@netscape.net> Date: Sat, 16 Jul 2022 07:02:25 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; 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 From: Chuck Zmudzinski To: 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 , Jane Chu , Tianyu Lan , Randy Dunlap , Sean Christopherson , Juergen Gross , xen-devel@lists.xenproject.org, stable@vger.kernel.org, Thorsten Leemhuis , linux-kernel@vger.kernel.org References: <9d5070ae4f3e956a95d3f50e24f1a93488b9ff52.1657671676.git.brchuckz.ref@aol.com> <9d5070ae4f3e956a95d3f50e24f1a93488b9ff52.1657671676.git.brchuckz@aol.com> <5ea45b0d-32b5-1a13-de86-9988144c0dbe@leemhuis.info> <56a6ab5f-06fb-fa11-5966-cb23cb276fa6@netscape.net> <1309c3f5-86c7-e4f8-9f35-e0d430951d49@netscape.net> In-Reply-To: <1309c3f5-86c7-e4f8-9f35-e0d430951d49@netscape.net> 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 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/2022 3:53 PM, Chuck Zmudzinski wrote: > On 7/15/2022 6:05 AM, Jan Beulich wrote: > > On 15.07.2022 04:07, Chuck Zmudzinski wrote: > > > On 7/14/2022 1:30 AM, Thorsten Leemhuis wrote: > > >> 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" > > > > > > Actually it says "at least", so more that 12 is It is probably safest > > > to put the entire SHA-1 ID in because of the possibility of > > > a collision. At least that's how I understand what > > > submitting-patches.rst. > > > > > >> > > >>> 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/ > > > > > > Yes that's the first report I saw to lkml about this isssue. So if I submit > > > a v3 I will include that. But my patch does not have a sign-off from the > > > Co-developer as I mentioned in a message earlier today, and the > > > discussion that has ensued leads me to think a better solution is to just > > > revert the commit in the i915 driver instead, and leave the bigger questions > > > for Juergen Gross and his plans to re-work the x86/PAT code in September, > > > as he said on this thread in the last couple of days. This patch is dead > > > now, > > > as far as I can tell, because the Co-developer is not cooperating. > > > > ??? > > > > Jan > > I think I recall you said my patch proves I don't want your S-o-b. I > also want > to add some useful logs with your approach, probably a pr_warn, which you > are not interested in doing. I think it is probably necessary, under the > current > situation, to warn all users of Xen/Linux that Linux on Xen is not > guaranteed > to be secure and full-featured anymore. That is also why I think the Linux > maintainers are ignoring your patch. They are basically saying Xen is just > some weird one-off thing, I can't remember who said it, but I did read > it here > in some of the comments on your patch, and you do not seem to be listening > to and responding to what the Linux developers are asking you to do. > > Two things I see here in my efforts to get a patch to fix this regression: > > 1. Does Xen have plans to give Linux running in Dom0 write-access to the > PAT MSR? > > 2. Does Xen have plans to expose MTRRs to Linux running in Dom0? > > These don't have to be the defaults for Dom0. But can Xen at least make > these as supported configurations for Linux? Then, the problem of Xen > being some weird one-off thing goes away. At least that's how I see > the situation. Maybe Xen can provide these for Linux in Dom0, but > from what I've read here, it seems Xen is not willing to do that for > Linux. Do I understand that correctly? > > Chuck ??? Chuck