[Intel-xe] [PATCH] drm/xe/tlb: fix expected_seqno calculation

Souza, Jose jose.souza at intel.com
Tue Apr 18 20:13:53 UTC 2023


On Tue, 2023-04-18 at 14:27 +0100, Matthew Auld wrote:
> It looks like when tlb_invalidation.seqno overflows
> TLB_INVALIDATION_SEQNO_MAX, we start counting again from one, as per
> send_tlb_invalidation(). This is also inline with initial value we give
> it in xe_gt_tlb_invalidation_init().  When calculating the
> expected_seqno we should also take this into account.
> 
> While we are here also print out the values if we ever trigger the
> warning.

More than 4 hours running a test suite without any warnings.

> 
> References: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/248
> Signed-off-by: Matthew Auld <matthew.auld at intel.com>
> Cc: José Roberto de Souza <jose.souza at intel.com>
> ---
>  drivers/gpu/drm/xe/xe_gt_tlb_invalidation.c | 7 ++++++-
>  1 file changed, 6 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 f279e21300aa..fdf092048287 100644
> --- a/drivers/gpu/drm/xe/xe_gt_tlb_invalidation.c
> +++ b/drivers/gpu/drm/xe/xe_gt_tlb_invalidation.c
> @@ -319,7 +319,12 @@ int xe_guc_tlb_invalidation_done_handler(struct xe_guc *guc, u32 *msg, u32 len)
>  	/* Sanity check on seqno */
>  	expected_seqno = (gt->tlb_invalidation.seqno_recv + 1) %
>  		TLB_INVALIDATION_SEQNO_MAX;
> -	XE_WARN_ON(expected_seqno != msg[0]);
> +	if (!expected_seqno)
> +		expected_seqno = 1;
> +	if (WARN_ON(expected_seqno != msg[0])) {

We should use drm_WARN_ON() to know from what gpu(in multi-gpu cases) this came from but there is several other places in Xe kmd that uses WARN_ON().

Reviewed-by: José Roberto de Souza <jose.souza at intel.com>

> +		drm_err(&gt->xe->drm, "TLB expected_seqno(%d) != msg(%u)\n",
> +			expected_seqno, msg[0]);
> +	}
>  
>  	gt->tlb_invalidation.seqno_recv = msg[0];
>  	smp_wmb();



More information about the Intel-xe mailing list