All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Bernatowicz, Marcin" <marcin.bernatowicz@linux.intel.com>
To: "Piórkowski, Piotr" <piotr.piorkowski@intel.com>,
	intel-xe@lists.freedesktop.org
Subject: Re: [PATCH v1 4/5] drm/xe/pf: Provision VFs under mutex
Date: Tue, 10 Nov 2026 11:48:14 +0100	[thread overview]
Message-ID: <78cd3df5-90a2-4dbe-90c9-73a992700964@linux.intel.com> (raw)
In-Reply-To: <20261027103009.1259199-5-piotr.piorkowski@intel.com>

LGTM,

Reviewed-by: Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>

On 10/27/2026 11:30 AM, Piórkowski, Piotr wrote:
> From: Piotr Piórkowski <piotr.piorkowski@intel.com>
>
> The provisioning mode is now changed under the master mutex, but it
> is still checked without any locking when VFs are being provisioned,
> so the mode could change between the check and the provisioning.
>
> Use the locked variants of the fair provisioning functions and hold
> the master mutex while checking the mode and provisioning the VFs.
>
> This was the last user of the unlocked fair provisioning functions,
> so remove them.
>
> Signed-off-by: Piotr Piórkowski <piotr.piorkowski@intel.com>
> ---
>   drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c | 34 ----------------------
>   drivers/gpu/drm/xe/xe_gt_sriov_pf_config.h |  2 --
>   drivers/gpu/drm/xe/xe_sriov_pf_provision.c |  8 +++--
>   3 files changed, 6 insertions(+), 38 deletions(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c b/drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c
> index c8ab4138f6a8..cca2f837e90b 100644
> --- a/drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c
> +++ b/drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c
> @@ -2142,24 +2142,6 @@ int xe_gt_sriov_pf_config_set_fair_locked(struct xe_gt *gt, unsigned int vfid,
>   	return result;
>   }
>   
> -/**
> - * xe_gt_sriov_pf_config_set_fair - Provision many VFs with fair resources.
> - * @gt: the &xe_gt
> - * @vfid: starting VF identifier (can't be 0)
> - * @num_vfs: number of VFs to provision (can't be 0)
> - *
> - * This function can only be called on PF.
> - *
> - * Return: 0 on success or a negative error code on failure.
> - */
> -int xe_gt_sriov_pf_config_set_fair(struct xe_gt *gt, unsigned int vfid,
> -				   unsigned int num_vfs)
> -{
> -	guard(mutex)(xe_gt_sriov_pf_master_mutex(gt));
> -
> -	return xe_gt_sriov_pf_config_set_fair_locked(gt, vfid, num_vfs);
> -}
> -
>   static const char *exec_quantum_unit(u32 exec_quantum)
>   {
>   	return exec_quantum ? "ms" : "(infinity)";
> @@ -2855,22 +2837,6 @@ int xe_gt_sriov_pf_config_set_fair_sched_locked(struct xe_gt *gt, unsigned int n
>   	return result;
>   }
>   
> -/**
> - * xe_gt_sriov_pf_config_set_fair_sched() - Provision PF and VFs with fair scheduling.
> - * @gt: the &xe_gt
> - * @num_vfs: number of VFs to provision (can't be 0)
> - *
> - * This function can only be called on PF.
> - *
> - * Return: 0 on success or a negative error code on failure.
> - */
> -int xe_gt_sriov_pf_config_set_fair_sched(struct xe_gt *gt, unsigned int num_vfs)
> -{
> -	guard(mutex)(xe_gt_sriov_pf_master_mutex(gt));
> -
> -	return xe_gt_sriov_pf_config_set_fair_sched_locked(gt, num_vfs);
> -}
> -
>   static int pf_provision_threshold(struct xe_gt *gt, unsigned int vfid,
>   				  enum xe_guc_klv_threshold_index index, u32 value)
>   {
> diff --git a/drivers/gpu/drm/xe/xe_gt_sriov_pf_config.h b/drivers/gpu/drm/xe/xe_gt_sriov_pf_config.h
> index 69841b0fcddb..0d45dc9672e7 100644
> --- a/drivers/gpu/drm/xe/xe_gt_sriov_pf_config.h
> +++ b/drivers/gpu/drm/xe/xe_gt_sriov_pf_config.h
> @@ -89,9 +89,7 @@ u32 xe_gt_sriov_pf_config_get_threshold(struct xe_gt *gt, unsigned int vfid,
>   int xe_gt_sriov_pf_config_set_threshold(struct xe_gt *gt, unsigned int vfid,
>   					enum xe_guc_klv_threshold_index index, u32 value);
>   
> -int xe_gt_sriov_pf_config_set_fair_sched(struct xe_gt *gt, unsigned int num_vfs);
>   int xe_gt_sriov_pf_config_set_fair_sched_locked(struct xe_gt *gt, unsigned int num_vfs);
> -int xe_gt_sriov_pf_config_set_fair(struct xe_gt *gt, unsigned int vfid, unsigned int num_vfs);
>   int xe_gt_sriov_pf_config_set_fair_locked(struct xe_gt *gt, unsigned int vfid,
>   					  unsigned int num_vfs);
>   int xe_gt_sriov_pf_config_sanitize(struct xe_gt *gt, unsigned int vfid, long timeout);
> diff --git a/drivers/gpu/drm/xe/xe_sriov_pf_provision.c b/drivers/gpu/drm/xe/xe_sriov_pf_provision.c
> index e713a24b8864..6ea2a24fef6e 100644
> --- a/drivers/gpu/drm/xe/xe_sriov_pf_provision.c
> +++ b/drivers/gpu/drm/xe/xe_sriov_pf_provision.c
> @@ -40,10 +40,12 @@ static int pf_provision_vfs(struct xe_device *xe, unsigned int num_vfs)
>   	int result = 0;
>   	int err;
>   
> +	lockdep_assert_held(xe_sriov_pf_master_mutex(xe));
> +
>   	for_each_gt(gt, xe, id) {
> -		err = xe_gt_sriov_pf_config_set_fair_sched(gt, num_vfs);
> +		err = xe_gt_sriov_pf_config_set_fair_sched_locked(gt, num_vfs);
>   		result = result ?: err;
> -		err = xe_gt_sriov_pf_config_set_fair(gt, VFID(1), num_vfs);
> +		err = xe_gt_sriov_pf_config_set_fair_locked(gt, VFID(1), num_vfs);
>   		result = result ?: err;
>   	}
>   
> @@ -81,6 +83,8 @@ int xe_sriov_pf_provision_vfs(struct xe_device *xe, unsigned int num_vfs)
>   {
>   	xe_assert(xe, IS_SRIOV_PF(xe));
>   
> +	guard(mutex)(xe_sriov_pf_master_mutex(xe));
> +
>   	if (!pf_auto_provisioning_mode(xe))
>   		return 0;
>   

  reply	other threads:[~2026-11-10 10:48 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-27 10:30 [PATCH v1 0/5] Prepare SR-IOV provisioning for VGPU profiles Piórkowski, Piotr
2026-10-27 10:30 ` [PATCH v1 1/5] drm/xe/pf: Split the bulk priority provisioning function Piórkowski, Piotr
2026-11-10 10:44   ` Bernatowicz, Marcin
2026-10-27 10:30 ` [PATCH v1 2/5] drm/xe/pf: Change provisioning mode under mutex Piórkowski, Piotr
2026-11-10 10:46   ` Bernatowicz, Marcin
2026-10-27 10:30 ` [PATCH v1 3/5] drm/xe/pf: Add locked variant of the fair VFs provisioning Piórkowski, Piotr
2026-11-10 10:47   ` Bernatowicz, Marcin
2026-10-27 10:30 ` [PATCH v1 4/5] drm/xe/pf: Provision VFs under mutex Piórkowski, Piotr
2026-11-10 10:48   ` Bernatowicz, Marcin [this message]
2026-10-27 10:30 ` [PATCH v1 5/5] drm/xe/pf: Split the provisioning mode change function Piórkowski, Piotr
2026-11-10 10:49   ` Bernatowicz, Marcin
2026-10-27 10:39 ` ✓ CI.KUnit: success for Prepare SR-IOV provisioning for VGPU profiles Patchwork
2026-10-27 11:15 ` ✓ Xe.CI.BAT: " Patchwork
2026-10-27 13:07 ` ✗ Xe.CI.FULL: failure " Patchwork
2026-11-10 12:36   ` Piotr Piórkowski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=78cd3df5-90a2-4dbe-90c9-73a992700964@linux.intel.com \
    --to=marcin.bernatowicz@linux.intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=piotr.piorkowski@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.