[PATCH v5 8/8] drm/xe/vf: Refresh utilization buffer during migration recovery
Lis, Tomasz
tomasz.lis at intel.com
Fri Jun 13 18:05:17 UTC 2025
This patch is now invalid as it uses setup_wa_bb() which calls kmalloc().
We try to avoid kmalloc() during post-migration recovery, so will have
to develop a different way of fixing WA BB.
Currently calling that would lead to a deadlock possibility (and even if
we've solved that somehow, possibility for fixups apply to fail).
-Tomasz
On 12.06.2025 12:24, Tomasz Lis wrote:
> The WA buffer we use to capture context utilization contains GGTT
> references. This means its instructions have to be either fixed or
> re-emitted during VF post-migration recovery.
>
> This patch adds re-emitting content of the utilization WA BB during
> the recovery.
>
> Signed-off-by: Tomasz Lis <tomasz.lis at intel.com>
> Cc: Michal Wajdeczko <michal.wajdeczko at intel.com>
> Cc: Michal Winiarski <michal.winiarski at intel.com>
> ---
> drivers/gpu/drm/xe/xe_exec_queue.c | 1 +
> drivers/gpu/drm/xe/xe_lrc.c | 10 ++++++++--
> drivers/gpu/drm/xe/xe_lrc.h | 1 +
> 3 files changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_exec_queue.c b/drivers/gpu/drm/xe/xe_exec_queue.c
> index d5ffb550bde7..dc2bcda1d636 100644
> --- a/drivers/gpu/drm/xe/xe_exec_queue.c
> +++ b/drivers/gpu/drm/xe/xe_exec_queue.c
> @@ -1041,6 +1041,7 @@ void xe_exec_queue_contexts_hwsp_rebase(struct xe_exec_queue *q)
> for (i = 0; i < q->width; ++i) {
> xe_lrc_update_memirq_regs_with_address(q->lrc[i], q->hwe);
> xe_lrc_update_hwctx_regs_with_address(q->lrc[i]);
> + xe_lrc_setup_wa_bb(q->lrc[i], q->hwe);
> }
> }
>
> diff --git a/drivers/gpu/drm/xe/xe_lrc.c b/drivers/gpu/drm/xe/xe_lrc.c
> index 8b08c416ccf0..9f3331779dae 100644
> --- a/drivers/gpu/drm/xe/xe_lrc.c
> +++ b/drivers/gpu/drm/xe/xe_lrc.c
> @@ -1011,7 +1011,13 @@ struct wa_bb_setup {
> u32 *batch, size_t max_size);
> };
>
> -static int setup_wa_bb(struct xe_lrc *lrc, struct xe_hw_engine *hwe)
> +/**
> + * xe_lrc_setup_wa_bb - Execute all wa bb setup callbacks.
> + * @lrc: the &xe_lrc struct instance
> + * @hwe: the &xe_hw_engine struct instance
> + * Return: 0 on success, negative error code on failure
> + */
> +int xe_lrc_setup_wa_bb(struct xe_lrc *lrc, struct xe_hw_engine *hwe)
> {
> const size_t max_size = lrc->bb_per_ctx_bo->size;
> static const struct wa_bb_setup funcs[] = {
> @@ -1218,7 +1224,7 @@ static int xe_lrc_init(struct xe_lrc *lrc, struct xe_hw_engine *hwe,
> map = __xe_lrc_start_seqno_map(lrc);
> xe_map_write32(lrc_to_xe(lrc), &map, lrc->fence_ctx.next_seqno - 1);
>
> - err = setup_wa_bb(lrc, hwe);
> + err = xe_lrc_setup_wa_bb(lrc, hwe);
> if (err)
> goto err_lrc_finish;
>
> diff --git a/drivers/gpu/drm/xe/xe_lrc.h b/drivers/gpu/drm/xe/xe_lrc.h
> index 801a6b943f6e..8f05620fc0f0 100644
> --- a/drivers/gpu/drm/xe/xe_lrc.h
> +++ b/drivers/gpu/drm/xe/xe_lrc.h
> @@ -127,6 +127,7 @@ u32 xe_lrc_ctx_timestamp_udw_ggtt_addr(struct xe_lrc *lrc);
> u64 xe_lrc_ctx_timestamp(struct xe_lrc *lrc);
> u32 xe_lrc_ctx_job_timestamp_ggtt_addr(struct xe_lrc *lrc);
> u32 xe_lrc_ctx_job_timestamp(struct xe_lrc *lrc);
> +int xe_lrc_setup_wa_bb(struct xe_lrc *lrc, struct xe_hw_engine *hwe);
>
> /**
> * xe_lrc_update_timestamp - readout LRC timestamp and update cached value
More information about the Intel-xe
mailing list