From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6C14FC433F5 for ; Fri, 20 May 2022 05:56:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243880AbiETF4k (ORCPT ); Fri, 20 May 2022 01:56:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231455AbiETF4f (ORCPT ); Fri, 20 May 2022 01:56:35 -0400 Received: from sonic304-23.consmr.mail.gq1.yahoo.com (sonic304-23.consmr.mail.gq1.yahoo.com [98.137.68.204]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2FC7B39BB8 for ; Thu, 19 May 2022 22:56:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netscape.net; s=a2048; t=1653026192; bh=4Me/4JASdrdloQbgKafyPXvRt8VNrcs6HsuYguHjRzY=; h=Date:Subject:From:To:Cc:References:In-Reply-To:From:Subject:Reply-To; b=tyDM4I7Bq1sCFvdwy62MLgwnyUxAY1AhLZv1yxjv62Uq4ogSD1KShKZ5YQDNfbOvG/T9gnaTIca5Hx8QCRRmEONISsyoZr9fNSpvBwrMMJHqN4G3/O48BW8NQv3bAfVugmGERWTI6Ol+erEuVpZ9DrdyHDdpiQlKLByzeKIAKt7eCB1E9sPisoUTi/mcN1JvdAi/Ncr1n4D+zFOWtNxRJE7bWgDyxKVy++MiLvrW5x8tPpQnsIVQz4AQ50kPlELGoBCBRYGjTztZdKwtgv29yyMwVbQ7FN66veUTlDniLD+ndDEKXwjIju8VEveLYcwC2TE/hM7Pu6GFPfBx84iTmQ== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1653026192; bh=e1dpCefxzUdOh6XsXzGjZpGDOOQHZNMaNtJy0wzKme9=; h=X-Sonic-MF:Date:Subject:From:To:From:Subject; b=lcUhXzacJfSlTVSsR0qS16dvnxHnyHtwxhValk1PTwNaCc7BlgpdSPEjh5ZRCfZJs3ZM1uFryUceqa9aFuCZHUT70SRHn0RN0FBdQRUpk1JGhRAdhqrD33i2oEH9mdRRD8cQ/riOQCpkURxjQjEuuu1IWOFLmEFwYVFbqLQAQFmRDpq5/PPhc4LL4L3eFXpCHYx9E6GHb4FiOwJU8InSHsWCKkYqVmd+VlBiH+cEY1fNRXotP74fVyCiiEbw28NtJ5wc+/eXaigsuRRqZPhF9HsLCXeq8ry1as4OqXhR6BVXRmh/9pWjxy/YTC72wO/ZCwks/jqPqrakPbZINLnWFQ== X-YMail-OSG: KMm6aw8VM1kY.qTbM6378OyzYj34nnkGleDCLgcsyGmHjYVmVjI5kL_I8yckJv0 5qIVK6onGiyLpH4JcLnmoA.CVosZcSSvt0pjIQc6bmHTYBdTrTtDxhfTJvTQMzzLoqPtvjxYPR4x De_PbI4lMmJedPboG4is_29kRrHeEVdPXi2c7xqd.VpMCcWJL0zfvT624g9gJCGV.QeNPjfgvvTy C3GNWOCrmtQz._lkBgdvIRa1YIslCBFbdgu4YBA8gWr56C.ZuCwhwi65zhvNkZxID8Tdf6UQTq.B jnhhHnB9F6eVekh0nvJ19oit4Pb2lUE1FV6itTgLrkCwOV7iQyUxKlrdRvsK4SXsq4MV4p4iCWjP qmtY2itdLcEJGmqTCufNRrinb51RyijQW765aewQuRXiw_8iyNId2cUwEIJRHOhKXVv5vkeSkMC0 PEmW2DsWYJB40vVFPjr5gELDmUE1Cl2lEGb8adNsJVydygQkdLjOhmpQvVbk3vGoVtNyIeZiyWxL PlPkJrgVu.ZlzvH.oAV9k1P8oqn4Awx5ItyQolilndBtznCy0AbYSnuBo5Q3INmxmrYFfoByDblW XGmVQSqLZE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7uSehWza4u31OQPZ.tuHxvpqzrRON8AjzCvYDHFTJA93W3. LfIxxYUwcCaimCVdVta7vpjZJPZaXgvRU2_QlIYDi7oJR4TXrxDdwSy_6k2ziJUP3c.J_fInhToE 8YasVyj4UaHH4MwbOMzoiTX5aqbSnfVz0cLB9pBzaXLdg1Vrt8dh99POm0cKfyatH40WSWV9WhuZ wTG4E2mySRPEd0NWB7A.0Q.L1xBv5tTRGEj2qJVVy50ifILhoMAzWnfxrpfJ02HAbxuvnnFZcEJP jxmlCeFq8waUaeomuqUYC1hWw_9LRP5UW7Jy.e4BEhPwCeTA6WVCaMp5sDkPcnOuVMxnXTc3XZd8 AjLvsfSy5RlWaIMntI3URZXnisx4Rhi9mNBXGGV4in6qDmgYjQqzmvyEwnrPqHQdCfH43zC11LRW E9cvI112oFbS5iYDrG3EAnfXkUnfOBlB1woocD_gi9GfijgUt2Tfuu.IItCAoR5_PbZJsB_btMmT YJ2vUfEv83.OGFDrmXKa_ZdQi5jg2cDmgBS2m1ye6.HOUT16M6i4CBW93f7vJt.keQjUJzb5T_4_ z7huevnaSxw-- X-Sonic-MF: Received: from sonic.gate.mail.ne1.yahoo.com by sonic304.consmr.mail.gq1.yahoo.com with HTTP; Fri, 20 May 2022 05:56:32 +0000 Received: by hermes--canary-production-ne1-5495f4d555-7fknq (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID b06f9e3ae8187a718e33d020c3bbcec0; Fri, 20 May 2022 05:56:28 +0000 (UTC) Message-ID: Date: Fri, 20 May 2022 01:56:26 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.0 Subject: Re: [PATCH 2/2] x86/pat: add functions to query specific cache mode availability Content-Language: en-US From: Chuck Zmudzinski To: Juergen Gross , 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 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> In-Reply-To: <77255e5b-12bf-5390-6910-dafbaff18e96@netscape.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Mailer: WebService/1.1.20225 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.aol Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5/20/22 12:43 AM, 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: >>>> Some drivers are using pat_enabled() in order to test availability of >>>> special caching modes (WC and UC-). This will lead to false negatives >>>> in case the system was booted e.g. with the "nopat" variant and the >>>> BIOS did setup the PAT MSR supporting the queried mode, or if the >>>> system is running as a Xen PV guest. >>> ... >>>> Add test functions for those caching modes instead and use them at the >>>> appropriate places. >>>> >>>> Fixes: bdd8b6c98239 ("drm/i915: replace X86_FEATURE_PAT with >>>> pat_enabled()") >>>> Fixes: ae749c7ab475 ("PCI: Add arch_can_pci_mmap_wc() macro") >>>> Signed-off-by: Juergen Gross >>> ... >>> >>> >>> ... 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, but because of the confusion, The confusion is: does "nopat" only mean the kernel does not provide pat to device drivers, or does it mean kernel drivers are not to use pat even if the hypervisor provides it? I think the original purpose of bdd8b6c98239 was to enable "nopat" to disable the use or pat in the i915 driver even if the feature is present from either the kernel or the hypervisor. This interpretation of the meaning of "nopat" would favor Jan's approach, I think. Chuck From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 57B1BC433EF for ; Fri, 20 May 2022 07:59:51 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0791511B7B5; Fri, 20 May 2022 07:59:41 +0000 (UTC) Received: from sonic304-23.consmr.mail.gq1.yahoo.com (sonic304-23.consmr.mail.gq1.yahoo.com [98.137.68.204]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8E2D311B2E1 for ; Fri, 20 May 2022 05:56:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netscape.net; s=a2048; t=1653026192; bh=4Me/4JASdrdloQbgKafyPXvRt8VNrcs6HsuYguHjRzY=; h=Date:Subject:From:To:Cc:References:In-Reply-To:From:Subject:Reply-To; b=tyDM4I7Bq1sCFvdwy62MLgwnyUxAY1AhLZv1yxjv62Uq4ogSD1KShKZ5YQDNfbOvG/T9gnaTIca5Hx8QCRRmEONISsyoZr9fNSpvBwrMMJHqN4G3/O48BW8NQv3bAfVugmGERWTI6Ol+erEuVpZ9DrdyHDdpiQlKLByzeKIAKt7eCB1E9sPisoUTi/mcN1JvdAi/Ncr1n4D+zFOWtNxRJE7bWgDyxKVy++MiLvrW5x8tPpQnsIVQz4AQ50kPlELGoBCBRYGjTztZdKwtgv29yyMwVbQ7FN66veUTlDniLD+ndDEKXwjIju8VEveLYcwC2TE/hM7Pu6GFPfBx84iTmQ== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1653026192; bh=e1dpCefxzUdOh6XsXzGjZpGDOOQHZNMaNtJy0wzKme9=; h=X-Sonic-MF:Date:Subject:From:To:From:Subject; b=lcUhXzacJfSlTVSsR0qS16dvnxHnyHtwxhValk1PTwNaCc7BlgpdSPEjh5ZRCfZJs3ZM1uFryUceqa9aFuCZHUT70SRHn0RN0FBdQRUpk1JGhRAdhqrD33i2oEH9mdRRD8cQ/riOQCpkURxjQjEuuu1IWOFLmEFwYVFbqLQAQFmRDpq5/PPhc4LL4L3eFXpCHYx9E6GHb4FiOwJU8InSHsWCKkYqVmd+VlBiH+cEY1fNRXotP74fVyCiiEbw28NtJ5wc+/eXaigsuRRqZPhF9HsLCXeq8ry1as4OqXhR6BVXRmh/9pWjxy/YTC72wO/ZCwks/jqPqrakPbZINLnWFQ== X-YMail-OSG: KMm6aw8VM1kY.qTbM6378OyzYj34nnkGleDCLgcsyGmHjYVmVjI5kL_I8yckJv0 5qIVK6onGiyLpH4JcLnmoA.CVosZcSSvt0pjIQc6bmHTYBdTrTtDxhfTJvTQMzzLoqPtvjxYPR4x De_PbI4lMmJ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o.com by sonic304.consmr.mail.gq1.yahoo.com with HTTP; Fri, 20 May 2022 05:56:32 +0000 Received: by hermes--canary-production-ne1-5495f4d555-7fknq (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID b06f9e3ae8187a718e33d020c3bbcec0; Fri, 20 May 2022 05:56:28 +0000 (UTC) Message-ID: Date: Fri, 20 May 2022 01:56:26 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.0 Subject: Re: [PATCH 2/2] x86/pat: add functions to query specific cache mode availability Content-Language: en-US From: Chuck Zmudzinski To: Juergen Gross , Jan Beulich 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> In-Reply-To: <77255e5b-12bf-5390-6910-dafbaff18e96@netscape.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Mailer: WebService/1.1.20225 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.aol X-Mailman-Approved-At: Fri, 20 May 2022 07:59:06 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tvrtko Ursulin , Peter Zijlstra , intel-gfx@lists.freedesktop.org, Dave Hansen , x86@kernel.org, linux-kernel@vger.kernel.org, David Airlie , Rodrigo Vivi , Ingo Molnar , Borislav Petkov , dri-devel@lists.freedesktop.org, Andy Lutomirski , "H. Peter Anvin" , xen-devel@lists.xenproject.org, Thomas Gleixner Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On 5/20/22 12:43 AM, 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: >>>> Some drivers are using pat_enabled() in order to test availability of >>>> special caching modes (WC and UC-). This will lead to false negatives >>>> in case the system was booted e.g. with the "nopat" variant and the >>>> BIOS did setup the PAT MSR supporting the queried mode, or if the >>>> system is running as a Xen PV guest. >>> ... >>>> Add test functions for those caching modes instead and use them at the >>>> appropriate places. >>>> >>>> Fixes: bdd8b6c98239 ("drm/i915: replace X86_FEATURE_PAT with >>>> pat_enabled()") >>>> Fixes: ae749c7ab475 ("PCI: Add arch_can_pci_mmap_wc() macro") >>>> Signed-off-by: Juergen Gross >>> ... >>> >>> >>> ... 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, but because of the confusion, The confusion is: does "nopat" only mean the kernel does not provide pat to device drivers, or does it mean kernel drivers are not to use pat even if the hypervisor provides it? I think the original purpose of bdd8b6c98239 was to enable "nopat" to disable the use or pat in the i915 driver even if the feature is present from either the kernel or the hypervisor. This interpretation of the meaning of "nopat" would favor Jan's approach, I think. Chuck