Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Cheng <michael.cheng@intel.com>
To: "Lucas De Marchi" <lucas.demarchi@intel.com>,
	"Thomas Hellström (Intel)" <thomas_os@shipmail.org>
Cc: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH v3 2/3] drm/i915/gem: Remove logic for wbinvd_on_all_cpus
Date: Mon, 14 Mar 2022 16:06:12 -0700	[thread overview]
Message-ID: <109ec27b-3957-f13f-aec7-18fda2819ee0@intel.com> (raw)
In-Reply-To: <20220308175803.pszuli2ms3e7tah3@ldmartin-desk2>

On 2022-03-08 10:58 a.m., Lucas De Marchi wrote:

> On Tue, Feb 22, 2022 at 08:24:31PM +0100, Thomas Hellström (Intel) wrote:
>> Hi, Michael,
>>
>> On 2/22/22 18:26, Michael Cheng wrote:
>>> This patch removes logic for wbinvd_on_all_cpus and brings in
>>> drm_cache.h. This header has the logic that outputs a warning
>>> when wbinvd_on_all_cpus when its being used on a non-x86 platform.
>>>
>>> Signed-off-by: Michael Cheng <michael.cheng@intel.com>
>>
>> Linus has been pretty clear that he won't accept patches that add 
>> macros that works on one arch and warns on others anymore in i915 and 
>> I figure even less so in drm code.
>>
>> So we shouldn't try to move this out to drm. Instead we should 
>> restrict the wbinvd() inside our driver to integrated and X86 only. 
>> For discrete on all architectures we should be coherent and hence not 
>> be needing wbinvd().
>
> the warn is there to guarantee we don't forget a code path. However
> simply adding the warning is the real issue: we should rather guarantee
> we can't take that code path. I.e., as you said refactor the code to
> guarantee it works on discrete without that logic.
>
>     $ git grep wbinvd_on_all_cpus -- drivers/gpu/drm/
>     drivers/gpu/drm/drm_cache.c:    if (wbinvd_on_all_cpus())
>     drivers/gpu/drm/drm_cache.c:    if (wbinvd_on_all_cpus())
>     drivers/gpu/drm/drm_cache.c:    if (wbinvd_on_all_cpus())
>
>     drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c:      * Currently we 
> just do a heavy handed wbinvd_on_all_cpus() here since
>     drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c: wbinvd_on_all_cpus();
>
> It looks like we actually go through this on other discrete graphics. Is
> this missing an update like s/IS_DG1/IS_DGFX/? Or should we be doing
> something else?
>
>     drivers/gpu/drm/i915/gem/i915_gem_pm.c:#define wbinvd_on_all_cpus() \
>     drivers/gpu/drm/i915/gem/i915_gem_pm.c: wbinvd_on_all_cpus();
>
> Those are for suspend. Revert ac05a22cd07a ("drm/i915/gem: Almagamate 
> clflushes on suspend")
> or extract that part to a helper function and implement it differently
> for arches != x86?
>
>     drivers/gpu/drm/i915/gem/i915_gem_pm.c: wbinvd_on_all_cpus();
>
> Probably take a similar approach to the suspend case?
>
>     drivers/gpu/drm/i915/gt/intel_ggtt.c: wbinvd_on_all_cpus();

For a helper function, I have a #define for all non x86 architecture 
that gives a warn on [1] within drm_cache.h Or would it be better to 
implement a helper function instead?

[1]. https://patchwork.freedesktop.org/patch/475750/?series=99991&rev=5

>
> This one comes from 64b95df91f44 ("drm/i915: Assume exclusive access 
> to objects inside resume")
> Shouldn't that be doing the invalidate if the write domain is 
> I915_GEM_DOMAIN_CPU
>
> In the end I think the warning would be ok if it was the cherry on top,
> to guarantee we don't take those paths. We should probably have a
> warn_once() to avoid spamming the console. But we  also have to rework
> the code to guarantee we are the only ones who may eventually get that
> warning, and not the end user.
Could we first add the helper function/#define for now, and rework the 
code in a different patch series?
>
> Lucas De Marchi
>
>>
>> Thanks,
>>
>> /Thomas
>>
>>

  reply	other threads:[~2022-03-14 23:06 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-22 17:26 [Intel-gfx] [PATCH v3 0/3] Move #define wbvind_on_all_cpus Michael Cheng
2022-02-22 17:26 ` [Intel-gfx] [PATCH v3 1/3] drm_cache: Add logic for wbvind_on_all_cpus Michael Cheng
2022-02-22 21:07   ` kernel test robot
2022-02-22 23:31   ` kernel test robot
2022-02-22 23:31   ` kernel test robot
2022-02-22 17:26 ` [Intel-gfx] [PATCH v3 2/3] drm/i915/gem: Remove logic for wbinvd_on_all_cpus Michael Cheng
2022-02-22 19:24   ` Thomas Hellström (Intel)
2022-02-23  1:13     ` Michael Cheng
2022-03-08 17:58     ` Lucas De Marchi
2022-03-14 23:06       ` Michael Cheng [this message]
2022-03-15 16:59         ` Michael Cheng
2022-03-16  8:48           ` Thomas Hellström (Intel)
2022-02-22 17:26 ` [Intel-gfx] [PATCH v3 3/3] drm/i915/: Add drm_cache.h Michael Cheng
2022-02-23  2:33 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for Move #define wbvind_on_all_cpus (rev4) Patchwork
2022-02-23  2:33 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2022-02-23  3:05 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork
2022-02-24  1:26 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for Move #define wbvind_on_all_cpus (rev5) Patchwork
2022-02-24  1:27 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2022-02-24  2:00 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=109ec27b-3957-f13f-aec7-18fda2819ee0@intel.com \
    --to=michael.cheng@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=lucas.demarchi@intel.com \
    --cc=thomas_os@shipmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox