[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <lyv2y2mvfrhqtpzmgfiwsh2dde7wc7ts6lkibjqhoryt3gjxk6@fmh4dys7vbgl>
Date: Mon, 20 Oct 2025 16:50:56 +0200
From: Michał Winiarski <michal.winiarski@...el.com>
To: Matthew Brost <matthew.brost@...el.com>
CC: Alex Williamson <alex.williamson@...hat.com>, Lucas De Marchi
<lucas.demarchi@...el.com>, Thomas Hellström
<thomas.hellstrom@...ux.intel.com>, Rodrigo Vivi <rodrigo.vivi@...el.com>,
Jason Gunthorpe <jgg@...pe.ca>, Yishai Hadas <yishaih@...dia.com>, Kevin Tian
<kevin.tian@...el.com>, Shameer Kolothum
<shameerali.kolothum.thodi@...wei.com>, <intel-xe@...ts.freedesktop.org>,
<linux-kernel@...r.kernel.org>, <kvm@...r.kernel.org>,
<dri-devel@...ts.freedesktop.org>, Michal Wajdeczko
<michal.wajdeczko@...el.com>, Jani Nikula <jani.nikula@...ux.intel.com>,
Joonas Lahtinen <joonas.lahtinen@...ux.intel.com>, Tvrtko Ursulin
<tursulin@...ulin.net>, David Airlie <airlied@...il.com>, Simona Vetter
<simona@...ll.ch>, Lukasz Laguna <lukasz.laguna@...el.com>
Subject: Re: [PATCH 04/26] drm/xe/pf: Extract migration mutex out of its
struct
On Sun, Oct 12, 2025 at 12:08:34PM -0700, Matthew Brost wrote:
> On Sat, Oct 11, 2025 at 09:38:25PM +0200, Michał Winiarski wrote:
> > As part of upcoming changes, the struct xe_gt_sriov_pf_migration will be
> > used as a per-VF data structure.
> > The mutex (which is currently the only member of this structure) will
> > have slightly different semantics.
> > Extract the mutex to free up the struct name and simplify the future
> > changes.
> >
> > Signed-off-by: Michał Winiarski <michal.winiarski@...el.com>
> > ---
> > drivers/gpu/drm/xe/xe_gt_sriov_pf_migration.c | 4 ++--
> > drivers/gpu/drm/xe/xe_gt_sriov_pf_migration_types.h | 2 --
> > drivers/gpu/drm/xe/xe_gt_sriov_pf_types.h | 2 +-
> > 3 files changed, 3 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/xe/xe_gt_sriov_pf_migration.c b/drivers/gpu/drm/xe/xe_gt_sriov_pf_migration.c
> > index ca28f45aaf481..f8604b172963e 100644
> > --- a/drivers/gpu/drm/xe/xe_gt_sriov_pf_migration.c
> > +++ b/drivers/gpu/drm/xe/xe_gt_sriov_pf_migration.c
> > @@ -122,7 +122,7 @@ static bool pf_migration_supported(struct xe_gt *gt)
> > static struct mutex *pf_migration_mutex(struct xe_gt *gt)
> > {
> > xe_gt_assert(gt, IS_SRIOV_PF(gt_to_xe(gt)));
> > - return >->sriov.pf.migration.snapshot_lock;
> > + return >->sriov.pf.snapshot_lock;
>
> By the end of series this function looks like:
>
> 14 static struct mutex *pf_migration_mutex(struct xe_device *xe, unsigned int vfid)
> 15 {
> 16 xe_assert(xe, IS_SRIOV_PF(xe));
> 17 xe_assert(xe, vfid <= xe_sriov_pf_get_totalvfs(xe));
> 18 return &xe->sriov.pf.vfs[vfid].migration.lock;
> 19 }
>
> And...
>
> grep snapshot_lock *.c *.h
> xe_gt_sriov_pf_migration.c: err = drmm_mutex_init(&xe->drm, >->sriov.pf.snapshot_lock);
> xe_gt_sriov_pf_types.h: struct mutex snapshot_lock;
>
> So 'snapshot_lock' isn't used at the end of the series. Maybe drop this
> patch, delete the snapshot_lock in the patch which restructures the
> above code / remove the snapshot_lock usage.
>
> Matt
It should actually be removed later in the series, but looks like it got
left over by mistake.
I'll squash it with:
drm/xe/pf: Switch VF migration GuC save/restore to struct migration data
Thanks,
-Michał
>
> > }
> >
> > static struct xe_gt_sriov_state_snapshot *pf_pick_vf_snapshot(struct xe_gt *gt,
> > @@ -400,7 +400,7 @@ int xe_gt_sriov_pf_migration_init(struct xe_gt *gt)
> > if (!pf_migration_supported(gt))
> > return 0;
> >
> > - err = drmm_mutex_init(&xe->drm, >->sriov.pf.migration.snapshot_lock);
> > + err = drmm_mutex_init(&xe->drm, >->sriov.pf.snapshot_lock);
> > if (err)
> > return err;
> >
> > diff --git a/drivers/gpu/drm/xe/xe_gt_sriov_pf_migration_types.h b/drivers/gpu/drm/xe/xe_gt_sriov_pf_migration_types.h
> > index 9d672feac5f04..fdc5a31dd8989 100644
> > --- a/drivers/gpu/drm/xe/xe_gt_sriov_pf_migration_types.h
> > +++ b/drivers/gpu/drm/xe/xe_gt_sriov_pf_migration_types.h
> > @@ -30,8 +30,6 @@ struct xe_gt_sriov_state_snapshot {
> > * Used by the PF driver to maintain non-VF specific per-GT data.
> > */
> > struct xe_gt_sriov_pf_migration {
> > - /** @snapshot_lock: protects all VFs snapshots */
> > - struct mutex snapshot_lock;
> > };
> >
> > #endif
> > diff --git a/drivers/gpu/drm/xe/xe_gt_sriov_pf_types.h b/drivers/gpu/drm/xe/xe_gt_sriov_pf_types.h
> > index a64a6835ad656..9a856da379d39 100644
> > --- a/drivers/gpu/drm/xe/xe_gt_sriov_pf_types.h
> > +++ b/drivers/gpu/drm/xe/xe_gt_sriov_pf_types.h
> > @@ -58,7 +58,7 @@ struct xe_gt_sriov_pf {
> > struct xe_gt_sriov_pf_service service;
> > struct xe_gt_sriov_pf_control control;
> > struct xe_gt_sriov_pf_policy policy;
> > - struct xe_gt_sriov_pf_migration migration;
> > + struct mutex snapshot_lock;
> > struct xe_gt_sriov_spare_config spare;
> > struct xe_gt_sriov_metadata *vfs;
> > };
> > --
> > 2.50.1
> >
Powered by blists - more mailing lists