[PATCH v3 1/1] drm/xe/guc/ct: Flush g2h worker in case of g2h response timeout

John Harrison john.c.harrison at intel.com
Fri Oct 18 00:05:58 UTC 2024


On 10/17/2024 04:14, Badal Nilawar wrote:
> In case if g2h worker doesn't get opportunity to within specified
> timeout delay then flush the g2h worker explicitly.
>
> v2:
>    - Describe change in the comment and add TODO (Matt B/John H)
>    - Add xe_gt_warn on fence done after G2H flush (John H)
> v3:
>    - Updated the comment with root cause
>    - Clean up xe_gt_warn message (John H)
>
> Closes: https://gitlab.freedesktop.org/drm/xe/kernel/issues/1620
> Closes: https://gitlab.freedesktop.org/drm/xe/kernel/issues/2902
> Signed-off-by: Badal Nilawar <badal.nilawar at intel.com>
> Cc: Matthew Brost <matthew.brost at intel.com>
> Cc: Matthew Auld <matthew.auld at intel.com>
> Cc: John Harrison <John.C.Harrison at Intel.com>
> Cc: Himal Prasad Ghimiray <himal.prasad.ghimiray at intel.com>
> ---
>   drivers/gpu/drm/xe/xe_guc_ct.c | 18 ++++++++++++++++++
>   1 file changed, 18 insertions(+)
>
> diff --git a/drivers/gpu/drm/xe/xe_guc_ct.c b/drivers/gpu/drm/xe/xe_guc_ct.c
> index c7673f56d413..c260d8840990 100644
> --- a/drivers/gpu/drm/xe/xe_guc_ct.c
> +++ b/drivers/gpu/drm/xe/xe_guc_ct.c
> @@ -1018,6 +1018,24 @@ static int guc_ct_send_recv(struct xe_guc_ct *ct, const u32 *action, u32 len,
>   
>   	ret = wait_event_timeout(ct->g2h_fence_wq, g2h_fence.done, HZ);
>   
> +	/*
> +	 * Occasionally it is seen that the G2H worker starts running after a delay of more than
> +	 * a second even after being queued and activated by the Linux workqueue subsystem. This
> +	 * leads to G2H timeout error. The root cause of issue lies with scheduling latency of
> +	 * Lunarlake Hybrid CPU. Issue dissappears if we disable Lunarlake atom cores from BIOS
> +	 * and this is beyond xe kmd.
> +	 *
> +	 * TODO: Drop this change once workqueue scheduling delay issue is fixed on LNL Hybrid CPU.
> +	 */
> +	if (!ret) {
> +		flush_work(&ct->g2h_worker);
> +		if (g2h_fence.done) {
> +			xe_gt_warn(gt, "G2H fence %u, action %04x, done\n",
> +				   g2h_fence.seqno, action[0]);
I'm not wanting to delay the merging of this as CI really needs it! 
But... The above is now a warning that basically says everything is 
fine. The previous said 'done after flush'. That tells you the warning 
is because a supposedly unnecessary flush was required. The above 
suggests it is a bad thing for fences to complete!

I'm fine with this being merged as is and a follow up patch to make the 
warning message clearer. But I do think it should be changed.

John.


> +			ret = 1;
> +		}
> +	}
> +
>   	/*
>   	 * Ensure we serialize with completion side to prevent UAF with fence going out of scope on
>   	 * the stack, since we have no clue if it will fire after the timeout before we can erase



More information about the Intel-xe mailing list