All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Mika Kuoppala <mika.kuoppala@linux.intel.com>,
	Michael Cheng <michael.cheng@intel.com>,
	intel-gfx@lists.freedesktop.org
Cc: lucas.demarchi@intel.com, matthew.auld@intel.com
Subject: Re: [Intel-gfx] [PATCH v2 2/4] drm/i915/gt: Re-work invalidate_csb_entries
Date: Tue, 1 Feb 2022 09:32:11 +0000	[thread overview]
Message-ID: <2d6255ee-fc85-8e8e-84bd-8b9839d65dd8@linux.intel.com> (raw)
In-Reply-To: <87ilu09ejk.fsf@gaia.fi.intel.com>


On 31/01/2022 14:15, Mika Kuoppala wrote:
> Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com> writes:
> 
>> On 28/01/2022 22:10, Michael Cheng wrote:
>>> Re-work invalidate_csb_entries to use drm_clflush_virt_range. This will
>>> prevent compiler errors when building for non-x86 architectures.
>>>
>>> Signed-off-by: Michael Cheng <michael.cheng@intel.com>
>>> ---
>>>    drivers/gpu/drm/i915/gt/intel_execlists_submission.c | 4 ++--
>>>    1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/i915/gt/intel_execlists_submission.c b/drivers/gpu/drm/i915/gt/intel_execlists_submission.c
>>> index 960a9aaf4f3a..90b5daf9433d 100644
>>> --- a/drivers/gpu/drm/i915/gt/intel_execlists_submission.c
>>> +++ b/drivers/gpu/drm/i915/gt/intel_execlists_submission.c
>>> @@ -1647,8 +1647,8 @@ cancel_port_requests(struct intel_engine_execlists * const execlists,
>>>    
>>>    static void invalidate_csb_entries(const u64 *first, const u64 *last)
>>>    {
>>> -	clflush((void *)first);
>>> -	clflush((void *)last);
>>> +	drm_clflush_virt_range((void *)first, sizeof(*first));
>>> +	drm_clflush_virt_range((void *)last, sizeof(*last));
>>
>> How about dropping the helper and from the single call site do:
>>
>> drm_clflush_virt_range(&buf[0], num_entries * sizeof(buf[0]));
>>
>> One less function call and CSB is a single cacheline before Gen11 ayway,
>> two afterwards, so overall better conversion I think. How does that sound?
> 
> It would definitely work. Now trying to remember why it went into
> explicit clflushes: iirc as this is gpu/cpu coherency, the
> wbinvd_on_all_cpus we get with *virt_range would then be just
> unnecessary perf hit.

Right, apart that AFAICS wbinvd_on_all_cpus does not run on the 
X86_FEATURE_CLFLUSH path of drm_clflush_virt_range, which made me think 
invalidate_csb_entries might have been an a) optimisation which used the 
knowledge CSB is at most two cachelines large, and b) there is no need 
for the memory barrier since as you say it is about CPU/GPU effect so 
CPU ordering is not a concern.

Anyway, larger hammer probably does not harm much, apart that it really 
should be one call to drm_clflush_virt_range.

Regards,

Tvrtko

  reply	other threads:[~2022-02-01  9:32 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-28 22:10 [Intel-gfx] [PATCH v2 0/4] Use drm_clflush* instead of clflush Michael Cheng
2022-01-28 22:10 ` [Intel-gfx] [PATCH v2 1/4] drm/i915/gt: Re-work intel_write_status_page Michael Cheng
2022-01-29  7:21   ` Bowman, Casey G
2022-01-28 22:10 ` [Intel-gfx] [PATCH v2 2/4] drm/i915/gt: Re-work invalidate_csb_entries Michael Cheng
2022-01-29  7:21   ` Bowman, Casey G
2022-01-31 13:51   ` Tvrtko Ursulin
2022-01-31 14:15     ` Mika Kuoppala
2022-02-01  9:32       ` Tvrtko Ursulin [this message]
2022-01-28 22:10 ` [Intel-gfx] [PATCH v2 3/4] drm/i915/gt: Re-work reset_csb Michael Cheng
2022-01-29  7:23   ` Bowman, Casey G
2022-01-28 22:10 ` [Intel-gfx] [PATCH v2 4/4] drm/i915/: Re-work clflush_write32 Michael Cheng
2022-01-29  7:24   ` Bowman, Casey G
2022-01-31 14:55   ` Tvrtko Ursulin
2022-01-31 17:02     ` Michael Cheng
2022-02-01  9:25       ` Tvrtko Ursulin
2022-02-01 15:41         ` Michael Cheng
2022-02-01 16:32           ` Tvrtko Ursulin
2022-02-02 16:35             ` Michael Cheng
2022-01-28 22:31 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for Use drm_clflush* instead of clflush (rev2) Patchwork
2022-01-28 22:33 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2022-01-28 22:59 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2022-01-29  3:00 ` [Intel-gfx] ✗ Fi.CI.IGT: 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=2d6255ee-fc85-8e8e-84bd-8b9839d65dd8@linux.intel.com \
    --to=tvrtko.ursulin@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=lucas.demarchi@intel.com \
    --cc=matthew.auld@intel.com \
    --cc=michael.cheng@intel.com \
    --cc=mika.kuoppala@linux.intel.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.