Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp688877ioo; Sat, 21 May 2022 10:54:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwGjbhKfG1h4g1lK2GuZ9KMtRDpjFxxjH3IUw2Hv4eETn3bC9OwVZcZrvzkFbox8EK+nCLV X-Received: by 2002:a65:550a:0:b0:3db:a518:5417 with SMTP id f10-20020a65550a000000b003dba5185417mr13499083pgr.161.1653155659420; Sat, 21 May 2022 10:54:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653155659; cv=none; d=google.com; s=arc-20160816; b=gh9HYsG3Fe23DTZ0LRVK0MQF4KQ7BUu2CRTVSZ1ko8tRJCLdZpeeVaaPwDEGseMhrQ K0Xwdwge+q4ZzZfHl9G+6mIN9P2ep8/NebOAjpCNeWz7IJGFL7BypVE7q1OQoz3whHlj ecgvDOoJt1kg1rpYwvi+ZLm/AqRRtDlaOzT5Wg5joe6v8clJQV9FIxjppQcfeAae1Xgy ci7VtxPMtftbegdXd1z7aZXsjZCkmtw1X/c+YsVlMk469Zx+QNTcUvLqKwf2wcMh9x5I K5kK9VxjPfotUZghoIyDKSH/SyTEIh3VxaGn5Pskq91Fg2HOg6b84wkqy9yFe0FOWx7R gaWQ== 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=4Me/4JASdrdloQbgKafyPXvRt8VNrcs6HsuYguHjRzY=; b=ndUFjpHyJSWrm+WgrC/WXNvHeJPlu7T19HP5G7HF7VhGw39fh47ik6xkwDk20SA8C+ jsIC5hxih7lLG5z5yh+X6JZn0TrLxQOHW/swFF5JHrVX8LKHB+kFWCjk1hbtxHkTn449 4oWsfzqdP1WqPUCcWfBF19bgDmzmyYc4OaKKL7RW6qnDU1emSUmcOidewld5sxVDLXep PUK67t/jGJLFhV1C3zhqDDJHOO488o1pUWcLXW+gqB+V16NlzAgsQm2TCA69zwxvF8rD 5puL4OSlq5Rm3mwMbpXGEOqvPcPgn+P4HbAhR+0qlBfr8mQ6OhDH7n/cNkOxRBVzVrnP xgcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@netscape.net header.s=a2048 header.b=tyDM4I7B; 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 n2-20020a17090a9f0200b001df0b9b6d05si6816626pjp.186.2022.05.21.10.54.07; Sat, 21 May 2022 10:54:19 -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=tyDM4I7B; 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 S238798AbiETF4k (ORCPT + 99 others); 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.CVosZcSSvt0pjI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b5T_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 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/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