[PATCH 1/3] drm/xe/pf: Disable PF restart worker on device removal
Piotr Piórkowski
piotr.piorkowski at intel.com
Fri Aug 1 10:23:20 UTC 2025
Michal Wajdeczko <michal.wajdeczko at intel.com> wrote on śro [2025-lip-30 19:49:11 +0200]:
> We can't let restart worker run once device is removed, since other
> data that it might want to access could be already released.
> Explicitly disable worker as part of device cleanup action.
>
> Fixes: a4d1c5d0b99b ("drm/xe/pf: Move VFs reprovisioning to worker")
> Signed-off-by: Michal Wajdeczko <michal.wajdeczko at intel.com>
> ---
> drivers/gpu/drm/xe/xe_gt_sriov_pf.c | 30 ++++++++++++++++++++++++++++-
> 1 file changed, 29 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_gt_sriov_pf.c b/drivers/gpu/drm/xe/xe_gt_sriov_pf.c
> index 35489fa81825..2761319fdc26 100644
> --- a/drivers/gpu/drm/xe/xe_gt_sriov_pf.c
> +++ b/drivers/gpu/drm/xe/xe_gt_sriov_pf.c
> @@ -50,6 +50,11 @@ static void pf_init_workers(struct xe_gt *gt)
> INIT_WORK(>->sriov.pf.workers.restart, pf_worker_restart_func);
> }
>
> +static void pf_fini_workers(struct xe_gt *gt)
> +{
NIT: I wonder if xe_gt_assert should also be here.
It's good that we're keeping an eye on this in pf_init_late, during register fini action,
but theoretically someone could call it directly at some point.
> + disable_work_sync(>->sriov.pf.workers.restart);
> +}
> +
> /**
> * xe_gt_sriov_pf_init_early - Prepare SR-IOV PF data structures on PF.
> * @gt: the &xe_gt to initialize
> @@ -79,6 +84,21 @@ int xe_gt_sriov_pf_init_early(struct xe_gt *gt)
> return 0;
> }
>
> +static void pf_fini_action(void *arg)
> +{
> + struct xe_gt *gt = arg;
> +
> + pf_fini_workers(gt);
> +}
> +
> +static int pf_init_late(struct xe_gt *gt)
> +{
> + struct xe_device *xe = gt_to_xe(gt);
> +
> + xe_gt_assert(gt, IS_SRIOV_PF(xe));
> + return devm_add_action_or_reset(xe->drm.dev, pf_fini_action, gt);
> +}
> +
> /**
> * xe_gt_sriov_pf_init - Prepare SR-IOV PF data structures on PF.
> * @gt: the &xe_gt to initialize
> @@ -95,7 +115,15 @@ int xe_gt_sriov_pf_init(struct xe_gt *gt)
> if (err)
> return err;
>
> - return xe_gt_sriov_pf_migration_init(gt);
> + err = xe_gt_sriov_pf_migration_init(gt);
> + if (err)
> + return err;
> +
> + err = pf_init_late(gt);
> + if (err)
> + return err;
> +
> + return 0;
> }
>
LGTM:
Reviewed-by: Piotr Piórkowski <piotr.piorkowski at intel.com>
> static bool pf_needs_enable_ggtt_guest_update(struct xe_device *xe)
> --
> 2.47.1
>
--
More information about the Intel-xe
mailing list