All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Laguna, Lukasz" <lukasz.laguna@intel.com>
To: Michal Wajdeczko <michal.wajdeczko@intel.com>,
	<intel-xe@lists.freedesktop.org>
Cc: <satyanarayana.k.v.p@intel.com>
Subject: Re: [PATCH] drm/xe/vf: Retry GuC state reset until timeout
Date: Mon, 31 Aug 2026 19:16:18 +0200	[thread overview]
Message-ID: <0d5ec949-e97c-49b6-922b-f4a2a07f1cf2@intel.com> (raw)
In-Reply-To: <602fcc3e-78bc-45e7-93ad-fa3f3ee43a1d@intel.com>


On 8/31/2026 12:06, Michal Wajdeczko wrote:
>
> On 8/31/2026 11:21 AM, Lukasz Laguna wrote:
>> Instead of using a fixed number of GuC state reset retries, keep
>> retrying until timeout with sleeps between attempts.
> why?
> why 10s?

In case of VF FLR or PF FLR with VFs enabled, GuC reprovisioning may 
complete much later, so a fixed 10 retry window may not be enough.
Instead of relying on a fixed retry count, I wanted to introduce a 
deterministic maximum wait window, with sleeps between attempts, to 
avoid spamming requests while GuC is not ready.

Why 10s?

On the PF side, VF FLR uses a 5s timeout. I used 10s on the VF side to 
keep a safety margin from the VF perspective. This is empirical and may 
need adjustment, but so far I didn't observe any issues with this value.

I decided to send this now as a standalone reliability improvement 
(sleep + timeout), but maybe it'll be better justified when sent 
together with the FLR series, where the dependency and timing context 
are more explicit.

Lukasz

>
> you should describe the problem first
>
>> Signed-off-by: Lukasz Laguna <lukasz.laguna@intel.com>
>> ---
>>   drivers/gpu/drm/xe/xe_gt_sriov_vf.c | 12 +++++++++---
>>   1 file changed, 9 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/xe/xe_gt_sriov_vf.c b/drivers/gpu/drm/xe/xe_gt_sriov_vf.c
>> index 37899fcf5b22..01873896f77b 100644
>> --- a/drivers/gpu/drm/xe/xe_gt_sriov_vf.c
>> +++ b/drivers/gpu/drm/xe/xe_gt_sriov_vf.c
>> @@ -31,6 +31,7 @@
>>   #include "xe_lrc.h"
>>   #include "xe_memirq.h"
>>   #include "xe_mmio.h"
>> +#include "xe_sleep.h"
>>   #include "xe_sriov.h"
>>   #include "xe_sriov_vf.h"
>>   #include "xe_sriov_vf_ccs.h"
>> @@ -86,18 +87,23 @@ static int guc_action_vf_reset(struct xe_guc *guc)
>>   	return ret > 0 ? -EPROTO : ret;
>>   }
>>   
>> -#define GUC_RESET_VF_STATE_RETRY_MAX	10
>> +#define GUC_RESET_VF_STATE_TIMEOUT_MS	10000
> 	10 * MSEC_PER_SEC /* 10s */
>
>> +#define GUC_RESET_VF_STATE_SLEEP_MS	10
>> +
>>   static int vf_reset_guc_state(struct xe_gt *gt)
>>   {
>> -	unsigned int retry = GUC_RESET_VF_STATE_RETRY_MAX;
>>   	struct xe_guc *guc = &gt->uc.guc;
>> +	unsigned long jiffies_end;
>>   	int err;
>>   
>> +	jiffies_end = jiffies + msecs_to_jiffies(GUC_RESET_VF_STATE_TIMEOUT_MS);
>>   	do {
>>   		err = guc_action_vf_reset(guc);
>>   		if (!err || err != -ETIMEDOUT)
>>   			break;
>> -	} while (--retry);
>> +
>> +		xe_sleep_relaxed_ms(GUC_RESET_VF_STATE_SLEEP_MS);
>> +	} while (time_before(jiffies, jiffies_end));
> btw, maybe we can use poll_timeout_us() here?
>
>>   
>>   	if (unlikely(err))
>>   		xe_gt_sriov_err(gt, "Failed to reset GuC state (%pe)\n", ERR_PTR(err));

  reply	other threads:[~2026-08-31 17:16 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-31  9:21 [PATCH] drm/xe/vf: Retry GuC state reset until timeout Lukasz Laguna
2026-08-31  9:45 ` K V P, Satyanarayana
2026-08-31 10:06 ` Michal Wajdeczko
2026-08-31 17:16   ` Laguna, Lukasz [this message]
2026-08-31 13:59 ` ✓ CI.KUnit: success for " Patchwork
2026-08-31 14:48 ` ✓ Xe.CI.BAT: " Patchwork
2026-08-31 16:27 ` ✓ Xe.CI.FULL: " 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=0d5ec949-e97c-49b6-922b-f4a2a07f1cf2@intel.com \
    --to=lukasz.laguna@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=michal.wajdeczko@intel.com \
    --cc=satyanarayana.k.v.p@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.