Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Nirmoy Das <nirmoy.das@intel.com>
To: Michal Wajdeczko <michal.wajdeczko@intel.com>,
	<intel-xe@lists.freedesktop.org>
Cc: Matthew Brost <matthew.brost@intel.com>,
	Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Subject: Re: [PATCH] drm/xe/guc: Configure TLB timeout based on CT buffer size
Date: Wed, 26 Jun 2024 09:15:25 +0200	[thread overview]
Message-ID: <0a51b375-e890-4cf2-b681-93721559a7d6@intel.com> (raw)
In-Reply-To: <7c2a77ab-64ab-4244-b533-cdbe0a51bcc7@intel.com>

[-- Attachment #1: Type: text/plain, Size: 3743 bytes --]

Hi Michal,

On 6/25/2024 9:55 PM, Michal Wajdeczko wrote:
> On 25.06.2024 10:49, Nirmoy Das wrote:
>> GuC TLB invalidation depends on GuC to process the request from the CT
>> queue and then the real time to invalidate TLB. Add a function to return
>> overestimated possible time a TLB inval H2G might take which can be used
>> as timeout value for TLB invalidation wait time.
>>
>> Closes:https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/1622
>> Cc: Matthew Brost<matthew.brost@intel.com>
>> Suggested-by: Daniele Ceraolo Spurio<daniele.ceraolospurio@intel.com>
>> Signed-off-by: Nirmoy Das<nirmoy.das@intel.com>
>> ---
>>   drivers/gpu/drm/xe/xe_gt_tlb_invalidation.c |  2 +-
>>   drivers/gpu/drm/xe/xe_guc_ct.c              | 12 ++++++++++++
>>   drivers/gpu/drm/xe/xe_guc_ct.h              |  2 ++
>>   3 files changed, 15 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/xe/xe_gt_tlb_invalidation.c b/drivers/gpu/drm/xe/xe_gt_tlb_invalidation.c
>> index e1f1ccb01143..fa61070d6201 100644
>> --- a/drivers/gpu/drm/xe/xe_gt_tlb_invalidation.c
>> +++ b/drivers/gpu/drm/xe/xe_gt_tlb_invalidation.c
>> @@ -17,7 +17,7 @@
>>   #include "xe_trace.h"
>>   #include "regs/xe_guc_regs.h"
>>   
>> -#define TLB_TIMEOUT	(HZ / 4)
>> +#define TLB_TIMEOUT	xe_guc_tlb_timeout_jiffies()
> if this is no longer a macro then maybe better get rid of it and use
> function call directly ?
Wanted to keep the diff to minimal.
>>   
>>   static void xe_gt_tlb_fence_timeout(struct work_struct *work)
>>   {
>> diff --git a/drivers/gpu/drm/xe/xe_guc_ct.c b/drivers/gpu/drm/xe/xe_guc_ct.c
>> index b4137fe195a4..e30c0da86acc 100644
>> --- a/drivers/gpu/drm/xe/xe_guc_ct.c
>> +++ b/drivers/gpu/drm/xe/xe_guc_ct.c
>> @@ -112,6 +112,18 @@ ct_to_xe(struct xe_guc_ct *ct)
>>   #define CTB_G2H_BUFFER_SIZE	(4 * CTB_H2G_BUFFER_SIZE)
>>   #define G2H_ROOM_BUFFER_SIZE	(CTB_G2H_BUFFER_SIZE / 4)
>>   
>> +/**
>> + * xe_guc_tlb_timeout_jiffies - Calculate the maximum time to process a tlb inval command
>> + *
>> + * This function computes the maximum time to process a tlb inval H2G commands
>> + * in jiffies. A 4KB buffer full of commands takes a little over a second to process,
> these numbers looks like from experiment - what commands did you use?
> do we have SLA from the GuC for max processing time of any command?

This is from i915 which was added with 
https://patchwork.freedesktop.org/patch/563102/

>> + * so this time is set to 2 seconds to be safe.
> nit: missing "Return:" tag
>
>> + */
>> +long xe_guc_tlb_timeout_jiffies(void)
> this function doesn't fit into xe_guc_ct component at all
>
> if you need to reflect CTB size in TLB timeout calculation then:
>
> a) from xe_guc_ct export function that will tell you max number of
> commands it can queue (or are already in the CTB queue)
>
> b) in xe_guc_tlb import above function and apply additional timeout per
> each H2G action in flight

Currently only information we have which is also validated /r-b-ed by 
GuC team is the above calculation.

I can export xe_guc_ct_max_queue_time_jiffies and use that in xe_guc_tlb 
so the function fits their component.

Regards,

Nirmoy

>> +{
>> +	return (CTB_H2G_BUFFER_SIZE * HZ) / SZ_2K;
>> +}
>> +
>>   static size_t guc_ct_size(void)
>>   {
>>   	return 2 * CTB_DESC_SIZE + CTB_H2G_BUFFER_SIZE +
>> diff --git a/drivers/gpu/drm/xe/xe_guc_ct.h b/drivers/gpu/drm/xe/xe_guc_ct.h
>> index 105bb8e99a8d..a9755574d6c9 100644
>> --- a/drivers/gpu/drm/xe/xe_guc_ct.h
>> +++ b/drivers/gpu/drm/xe/xe_guc_ct.h
>> @@ -64,4 +64,6 @@ xe_guc_ct_send_block_no_fail(struct xe_guc_ct *ct, const u32 *action, u32 len)
>>   	return xe_guc_ct_send_recv_no_fail(ct, action, len, NULL);
>>   }
>>   
>> +long xe_guc_tlb_timeout_jiffies(void);
>> +
>>   #endif

[-- Attachment #2: Type: text/html, Size: 5609 bytes --]

  reply	other threads:[~2024-06-26  7:15 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-25  8:49 [PATCH] drm/xe/guc: Configure TLB timeout based on CT buffer size Nirmoy Das
2024-06-25  9:09 ` ✓ CI.Patch_applied: success for " Patchwork
2024-06-25  9:09 ` ✓ CI.checkpatch: " Patchwork
2024-06-25  9:10 ` ✓ CI.KUnit: " Patchwork
2024-06-25  9:22 ` ✓ CI.Build: " Patchwork
2024-06-25  9:24 ` ✗ CI.Hooks: failure " Patchwork
2024-06-25  9:25 ` ✓ CI.checksparse: success " Patchwork
2024-06-25  9:48 ` ✓ CI.BAT: " Patchwork
2024-06-25 11:44 ` ✓ CI.FULL: " Patchwork
2024-06-25 19:55 ` [PATCH] " Michal Wajdeczko
2024-06-26  7:15   ` Nirmoy Das [this message]
2024-06-25 22:12 ` Matthew Brost
2024-06-26  7:33   ` Nirmoy Das
2024-06-26  7:41     ` Matthew Brost
2024-06-26  7:51       ` Nirmoy Das
2024-06-26  7:57     ` Matthew Brost

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=0a51b375-e890-4cf2-b681-93721559a7d6@intel.com \
    --to=nirmoy.das@intel.com \
    --cc=daniele.ceraolospurio@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=matthew.brost@intel.com \
    --cc=michal.wajdeczko@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox