Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp2381500iob; Fri, 20 May 2022 08:09:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwQTQbkQFV/Fetv+I+rOrDQf7ThDQgjnbbnIAPlX5IQ5mI7JJ7bVmE96vYaFxJ/0SbC0crj X-Received: by 2002:a50:ed12:0:b0:42a:a8d3:12c with SMTP id j18-20020a50ed12000000b0042aa8d3012cmr11477663eds.337.1653059371032; Fri, 20 May 2022 08:09:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653059371; cv=none; d=google.com; s=arc-20160816; b=AFcv/eS1ceLrNxmkDN508OePc1i0Tp5a/zsm07TqAT1oxwrkPq5HOp0A2wi9AFVT1E LEtLitnxIASYHhCaSyndMEFeLfBKIWB5ICEbYqZ/RQq9tbQgGIEEiRmB0c2L3y1Q5E9q j/cPxD73KsGYPMXs1iJrRlhqNt4DqOJSG0337Ju+mU+i3DBWuWlcONsBJKcf/7kPany/ Yx7aiKb60APSfLXNxF8v/CToM51iFVrTt44tkQ6+u5KnGtJDCXSeI4YZOjwc6FtyhON3 mx0iux18uXv/Qm7qRY34emEgNAO8+fHvlA4QoPp/gYRdIyEvhFAv6jgfgocWIFW7gdIT ymxg== 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=K5D2ddvcAFT7qU/7/cIEJD0V4lwIe18sO6+LKjoJkw4=; b=RWoS7KrSZGe7Gk5WT1UMgAHsZM7ujc8qABAPhVttmV3p9WOs6VbcU/1nPToyFym5zx BIQnm5scFWOixCSrghVinKsNLOOzRpJeYvhU3YjLeM+CUslvANKmHAOQ+ii9sEcQzPMw H0rF3eIzkXFugrDdwfiPo/FBh4rU3RRQerPWHlqSrtJyIt/yNGU8QF8rTWvIGvHkNqu/ WwYieCwKmja/WqDhEO0z4udC1YrYTM0g6h8SzHsYKjfwxUNNe60BuFUKPY/4XrkUL8/x Bo/pTY13nC/qaLBaFaV0pAeWz+5lWAlBR/KjpASJKMx3HFrllI1sfrPGpve9ROrNMp+U 2oeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@netscape.net header.s=a2048 header.b=PkYqpkku; 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 nd25-20020a170907629900b006f3be13d016si9119045ejc.37.2022.05.20.08.09.02; Fri, 20 May 2022 08:09: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=PkYqpkku; 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 S1345487AbiETNeG (ORCPT + 99 others); Fri, 20 May 2022 09:34:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348752AbiETNeC (ORCPT ); Fri, 20 May 2022 09:34:02 -0400 Received: from sonic301-21.consmr.mail.gq1.yahoo.com (sonic301-21.consmr.mail.gq1.yahoo.com [98.137.64.147]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA9D4169E3F for ; Fri, 20 May 2022 06:34:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netscape.net; s=a2048; t=1653053641; bh=K5D2ddvcAFT7qU/7/cIEJD0V4lwIe18sO6+LKjoJkw4=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From:Subject:Reply-To; b=PkYqpkkuQo45ByHHvchEhcebEAtp8AaC3/itk3+k6pOYzK1Vl/z8z2g9vmutXN7I+03ApExQ4Y6NLB+mJcTpxYKJvvgyubHih/MqBK1Y11BeD30vqVTc0y1MeyFfiy3rCLZWZIHEDBZC4ahH0inwNJWV4xCg2iwePPljxybrImoNt1fbIhLFEizqXiPa4oducIBTEgo/mA96tSRC+OvtAgX6rD6ayRTLgxi5VR/46+xLeyq6zj6iUiGngD9191uvtGbsX6W2THai8Km28tbUH07O+9GAxGU8OOdoTvL2OxR6ZVpzH1zVjegzIF7Rog41ycBWUqiR2YYy+asOTrHKlw== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1653053641; bh=k377TC4FGAEpIeRlbM1rv1iA2GuaofkGOp8RBu3yFHW=; h=X-Sonic-MF:Date:Subject:To:From:From:Subject; b=ugE6ujVanxC1STiP9viWDUWUTNr/7Wt7WN+8jsE/QCpermZtrtRAmb+JEtTaPCqWvzCLjKRzlFHmOmRlqly5nRy6Pco3dqpWzd+rCRd8nPoHcWX0uXI46JW+Rcxe4e5blbA0AB4+/e0weqdbzBQPr8Fj+4Jjrwt9l6wOn1ngb9jg77j3LsRIUF60sw2r0tJMr2WNI3fO9KAhu+ab9BOdtFRCES0M9WUvS9cMcQFIjtRgQJhFLbegsXhXPke0fJM2W56NR7EOVruOBmrw0REmQHnlmYmIqkHKMcbaTSBFZMhwyRP68X9o9jBO9UAYFlH3wkfHoWT3bBG2Bgi/TZVDoQ== X-YMail-OSG: Y48VktsVM1mw1z0tQFnDRFf5ZFKaFyl88afrKxRgVCgenPdgml44kt9snHULpVT 0hp3_yGN5gR8i1DwVi8RSa8Tjln6rXBvzF_mi6gMpilobbMMYPhnFUsBC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sonic.gate.mail.ne1.yahoo.com by sonic301.consmr.mail.gq1.yahoo.com with HTTP; Fri, 20 May 2022 13:34:01 +0000 Received: by hermes--canary-production-bf1-5d4b57496-srbfg (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 457ab9e3e0994f36cbc2ca446594030f; Fri, 20 May 2022 13:33:56 +0000 (UTC) Message-ID: <3ca084a9-768e-a6f5-ace4-cd347978dec7@netscape.net> Date: Fri, 20 May 2022 09:33:55 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 Subject: Re: [PATCH 2/2] x86/pat: add functions to query specific cache mode availability Content-Language: en-US To: Jan Beulich Cc: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , Andy Lutomirski , Peter Zijlstra , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , David Airlie , Daniel Vetter , xen-devel@lists.xenproject.org, x86@kernel.org, linux-kernel@vger.kernel.org, intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, Juergen Gross References: <20220503132207.17234-1-jgross@suse.com> <20220503132207.17234-3-jgross@suse.com> <1d86d8ff-6878-5488-e8c4-cbe8a5e8f624@suse.com> <0dcb05d0-108f-6252-e768-f75b393a7f5c@suse.com> <77255e5b-12bf-5390-6910-dafbaff18e96@netscape.net> <8b1ebea5-7820-69c4-2e2b-9866d55bc180@netscape.net> <3bff3562-bb1e-04e6-6eca-8d9bc355f2eb@suse.com> From: Chuck Zmudzinski In-Reply-To: <3bff3562-bb1e-04e6-6eca-8d9bc355f2eb@suse.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Mailer: WebService/1.1.20225 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.aol X-Spam-Status: No, score=-2.2 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=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 5/20/2022 5:41 AM, Jan Beulich wrote: > On 20.05.2022 10:30, Chuck Zmudzinski wrote: >> On 5/20/2022 2:59 AM, Chuck Zmudzinski wrote: >>> On 5/20/2022 2:05 AM, Jan Beulich wrote: >>>> On 20.05.2022 06:43, Chuck Zmudzinski wrote: >>>>> On 5/4/22 5:14 AM, Juergen Gross wrote: >>>>>> On 04.05.22 10:31, Jan Beulich wrote: >>>>>>> On 03.05.2022 15:22, Juergen Gross wrote: >>>>>>> >>>>>>> ... these uses there are several more. You say nothing on why >>>>>>> those want >>>>>>> leaving unaltered. When preparing my earlier patch I did inspect them >>>>>>> and came to the conclusion that these all would also better >>>>>>> observe the >>>>>>> adjusted behavior (or else I couldn't have left pat_enabled() as the >>>>>>> only predicate). In fact, as said in the description of my earlier >>>>>>> patch, in >>>>>>> my debugging I did find the use in i915_gem_object_pin_map() to be >>>>>>> the >>>>>>> problematic one, which you leave alone. >>>>>> Oh, I missed that one, sorry. >>>>> That is why your patch would not fix my Haswell unless >>>>> it also touches i915_gem_object_pin_map() in >>>>> drivers/gpu/drm/i915/gem/i915_gem_pages.c >>>>> >>>>>> I wanted to be rather defensive in my changes, but I agree at least >>>>>> the >>>>>> case in arch_phys_wc_add() might want to be changed, too. >>>>> I think your approach needs to be more aggressive so it will fix >>>>> all the known false negatives introduced by bdd8b6c98239 >>>>> such as the one in i915_gem_object_pin_map(). >>>>> >>>>> I looked at Jan's approach and I think it would fix the issue >>>>> with my Haswell as long as I don't use the nopat option. I >>>>> really don't have a strong opinion on that question, but I >>>>> think the nopat option as a Linux kernel option, as opposed >>>>> to a hypervisor option, should only affect the kernel, and >>>>> if the hypervisor provides the pat feature, then the kernel >>>>> should not override that, >>>> Hmm, why would the kernel not be allowed to override that? Such >>>> an override would affect only the single domain where the >>>> kernel runs; other domains could take their own decisions. >>>> >>>> Also, for the sake of completeness: "nopat" used when running on >>>> bare metal has the same bad effect on system boot, so there >>>> pretty clearly is an error cleanup issue in the i915 driver. But >>>> that's orthogonal, and I expect the maintainers may not even care >>>> (but tell us "don't do that then"). >> Actually I just did a test with the last official Debian kernel >> build of Linux 5.16, that is, a kernel before bdd8b6c98239 was >> applied. In fact, the nopat option does *not* break the i915 driver >> in 5.16. That is, with the nopat option, the i915 driver loads >> normally on both the bare metal and on the Xen hypervisor. >> That means your presumption (and the presumption of >> the author of bdd8b6c98239) that the "nopat" option was >> being observed by the i915 driver is incorrect. Setting "nopat" >> had no effect on my system with Linux 5.16. So after doing these >> tests, I am against the aggressive approach of breaking the i915 >> driver with the "nopat" option because prior to bdd8b6c98239, >> nopat did not break the i915 driver. Why break it now? > Because that's, in my understanding, is the purpose of "nopat" > (not breaking the driver of course - that's a driver bug -, but > having an effect on the driver). I wouldn't call it a driver bug, but an incorrect configuration of the kernel by the user.  I presume X86_FEATURE_PAT is required by the i915 driver and therefore the driver should refuse to disable it if the user requests to disable it and instead warn the user that the driver did not disable the feature, contrary to what the user requested with the nopat option. In any case, my test did not verify that when nopat is set in Linux 5.16, the thread takes the same code path as when nopat is not set, so I am not totally sure that the reason nopat does not break the i915 driver in 5.16 is that static_cpu_has(X86_FEATURE_PAT) returns true even when nopat is set. I could test it with a custom log message in 5.16 if that is necessary. Are you saying it was wrong for static_cpu_has(X86_FEATURE_PAT) to return true in 5.16 when the user requests nopat? I think that is just permitting a bad configuration to break the driver that a well-written operating system should not allow. The i915 driver was, in my opinion, correctly ignoring the nopat option in 5.16 because that option is not compatible with the hardware the i915 driver is trying to initialize and setup at boot time. At least that is my understanding now, but I will need to test it on 5.16 to be sure I understand it correctly. Also, AFAICT, your patch would break the driver when the nopat option is set and only fix the regression introduced by bdd8b6c98239 when nopat is not set on my box, so your patch would introduce a regression relative to Linux 5.16 and earlier for the case when nopat is set on my box. I think your point would be that it is not a regression if it is an incorrect user configuration. I respond by saying a well-written driver should refuse to honor the incorrect configuration requested by the user and instead warn the user that it did not honor the incorrect kernel option. I am only presuming what your patch would do on my box based on what I learned about this problem from my debugging. I can also test your patch on my box to verify that my understanding of it is correct. I also have not yet verified Juergen's patch will not fix it, but I am almost certain it will not unless it is expanded so it also touches i915_gem_object_pin_map() with the fix. I plan to test his patch, but expanded so it touches that function also. I also plan to test your patch with and without nopat and report the results in the thread where you posted your patch. Hopefully by tomorrow I will have the results. Chuck