From: Michal Wajdeczko <michal.wajdeczko@intel.com>
To: Lucas De Marchi <lucas.demarchi@intel.com>
Cc: <intel-xe@lists.freedesktop.org>, Rodrigo Vivi <rodrigo.vivi@intel.com>
Subject: Re: [PATCH 03/14] drm/xe/pf: Allow change PF and VFs EQ/PT using sysfs
Date: Mon, 27 Oct 2025 19:09:07 +0100 [thread overview]
Message-ID: <fceef34b-0124-431d-98f1-fcf3149ae333@intel.com> (raw)
In-Reply-To: <ztlryvb6mschuesh5k77i2ldehaa3ed7asriokgnqkajrxzcij@j6lezpryhquk>
On 10/27/2025 6:27 PM, Lucas De Marchi wrote:
> On Mon, Oct 20, 2025 at 08:24:03PM +0200, Michal Wajdeczko wrote:
>> On current platforms, in SR-IOV virtualization, the GPU is shared
>> between VFs on the time-slice basis. The 'execution quantum' (EQ)
>> and 'preemption timeout' (PT) are two main scheduling parameters
>> that could be set individually per each VF.
>>
>> Add EQ/PT read-write attributes for the PF and all VFs.
>>
>> By exposing those two parameters over sysfs, the admin can change
>> their default values (infinity) and let the GuC scheduler enforce
>> that settings.
>>
>> /sys/bus/pci/drivers/xe/BDF/
>> ├── sriov_admin/
>> ├── pf/
>> │ └── profile
>> │ ├── exec_quantum_ms [RW] unsigned integer
>> │ └── preempt_timeout_us [RW] unsigned integer
>> ├── vf1/
>> │ └── profile
>> │ ├── exec_quantum_ms [RW] unsigned integer
>> │ └── preempt_timeout_us [RW] unsigned integer
>>
>> Writing 0 to these files will set infinity EQ/PT for the VF on all
>> tiles/GTs. This is a default value. Writing non-zero integers to
>> these files will change EQ/PT to new value (in their respective
>> units: msec or usec).
>>
>> Reading from these files will return EQ/PT as previously set on
>> all tiles/GTs. In case of inconsistent values detected, due to
>> errors or low-level configuration done using debugfs, -EUCLEAN
>> error will be returned.
>>
>> Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
>> Cc: Lucas De Marchi <lucas.demarchi@intel.com>
>> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
>> ---
>> drivers/gpu/drm/xe/xe_sriov_pf_provision.c | 116 +++++++++++++++++++++
>> drivers/gpu/drm/xe/xe_sriov_pf_provision.h | 8 ++
>> drivers/gpu/drm/xe/xe_sriov_pf_sysfs.c | 54 +++++++++-
>> 3 files changed, 176 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/xe/xe_sriov_pf_provision.c b/drivers/gpu/drm/xe/xe_sriov_pf_provision.c
>> index 663fb0c045e9..f2e14103c9aa 100644
>> --- a/drivers/gpu/drm/xe/xe_sriov_pf_provision.c
>> +++ b/drivers/gpu/drm/xe/xe_sriov_pf_provision.c
>> @@ -152,3 +152,119 @@ int xe_sriov_pf_provision_set_mode(struct xe_device *xe, enum xe_sriov_provision
>> xe->sriov.pf.provision.mode = mode;
>> return 0;
>> }
>> +
>> +/**
>> + * xe_sriov_pf_provision_apply_vf_eq() - Change VF's execution quantum.
>> + * @xe: the PF &xe_device
>> + * @vfid: the VF identifier
>> + * @eq: execution quantum in [ms] to set
>> + *
>> + * Change VF's execution quantum (EQ) provisioning on all tiles/GTs.
>> + *
>> + * This function can only be called on PF.
>> + *
>> + * Return: 0 on success or a negative error code on failure.
>> + */
>> +int xe_sriov_pf_provision_apply_vf_eq(struct xe_device *xe, unsigned int vfid, u32 eq)
>> +{
>> + struct xe_gt *gt;
>> + unsigned int id;
>> + int result = 0;
>> + int err;
>> +
>> + for_each_gt(gt, xe, id) {
>> + err = xe_gt_sriov_pf_config_set_exec_quantum(gt, vfid, eq);
>
>
> I find it weird that a race on multiple writes would basically give
> undeterministic results for the device. We are locking/releaseing
> xe_gt_sriov_pf_master_mutex on the gt, but shouldn't we syncronize
> multiple writes at the device level?
but we still expose more granular attributes over debugfs, so even if
we would be successful in this protected round here, the actual
configuration could became "unclean" soon anyway, so I'm not sure there
is any benefit trying to add this extra protection
>
>> + result = result ?: err;
>> + }
>> +
>> + return result;
>> +}
>> +
>> +/**
>> + * xe_sriov_pf_provision_query_vf_eq() - Query VF's execution quantum.
>> + * @xe: the PF &xe_device
>> + * @vfid: the VF identifier
>> + * @eq: placeholder for the returned execution quantum in [ms]
>> + *
>> + * Query VF's execution quantum (EQ) provisioning from all tiles/GTs.
>> + * If values across tiles/GTs are inconsistent then -EUCLEAN error will be returned.
>
> or if you had multiple userspace components trying to set the value
> creating the race above.
yes, this "inconsistency" can be mostly introduced by the userspace and
concurrency / race is not only sysfs vs sysfs but also sysfs vs debugfs
>
> Lucas De Marchi
next prev parent reply other threads:[~2025-10-27 18:09 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-20 18:24 [PATCH 00/14] PF: Add sriov_admin sysfs tree Michal Wajdeczko
2025-10-20 18:24 ` [PATCH 01/14] drm/xe/pf: Prepare sysfs for SR-IOV admin attributes Michal Wajdeczko
2025-10-24 19:43 ` Rodrigo Vivi
2025-10-27 17:11 ` Lucas De Marchi
2025-10-27 17:59 ` Michal Wajdeczko
2025-10-27 18:30 ` Lucas De Marchi
2025-10-20 18:24 ` [PATCH 02/14] drm/xe/pf: Take RPM during calls to SR-IOV attr.store() Michal Wajdeczko
2025-10-27 17:14 ` Lucas De Marchi
2025-10-20 18:24 ` [PATCH 03/14] drm/xe/pf: Allow change PF and VFs EQ/PT using sysfs Michal Wajdeczko
2025-10-24 19:45 ` Rodrigo Vivi
2025-10-27 17:27 ` Lucas De Marchi
2025-10-27 18:09 ` Michal Wajdeczko [this message]
2025-10-27 18:32 ` Lucas De Marchi
2025-10-20 18:24 ` [PATCH 04/14] drm/xe/pf: Relax report helper to accept PF in bulk configs Michal Wajdeczko
2025-10-27 18:50 ` Lucas De Marchi
2025-10-20 18:24 ` [PATCH 05/14] drm/xe/pf: Add functions to bulk configure EQ/PT on GT Michal Wajdeczko
2025-10-27 19:03 ` Lucas De Marchi
2025-10-27 20:12 ` Michal Wajdeczko
2025-10-20 18:24 ` [PATCH 06/14] drm/xe/pf: Add functions to bulk provision EQ/PT Michal Wajdeczko
2025-10-27 19:18 ` Lucas De Marchi
2025-10-20 18:24 ` [PATCH 07/14] drm/xe/pf: Allow bulk change all VFs EQ/PT using sysfs Michal Wajdeczko
2025-10-24 19:46 ` Rodrigo Vivi
2025-10-27 19:28 ` Lucas De Marchi
2025-10-27 20:15 ` Michal Wajdeczko
2025-10-20 18:24 ` [PATCH 08/14] drm/xe/pf: Add functions to provision scheduling priority Michal Wajdeczko
2025-10-28 11:17 ` Piotr Piórkowski
2025-10-20 18:24 ` [PATCH 09/14] drm/xe/pf: Allow bulk change all VFs priority using sysfs Michal Wajdeczko
2025-10-24 19:47 ` Rodrigo Vivi
2025-10-20 18:24 ` [PATCH 10/14] drm/xe/pf: Allow change PF scheduling " Michal Wajdeczko
2025-10-24 19:47 ` Rodrigo Vivi
2025-10-20 18:24 ` [PATCH 11/14] drm/xe/pf: Promote xe_pci_sriov_get_vf_pdev Michal Wajdeczko
2025-10-28 9:57 ` Piotr Piórkowski
2025-10-28 12:22 ` Michal Wajdeczko
2025-10-28 16:03 ` Piotr Piórkowski
2025-10-20 18:24 ` [PATCH 12/14] drm/xe/pf: Add sysfs device symlinks to enabled VFs Michal Wajdeczko
2025-10-24 19:47 ` Rodrigo Vivi
2025-10-20 18:24 ` [PATCH 13/14] drm/xe/pf: Allow to stop and reset VF using sysfs Michal Wajdeczko
2025-10-24 19:51 ` Rodrigo Vivi
2025-10-27 20:58 ` Lucas De Marchi
2025-10-20 18:24 ` [PATCH 14/14] drm/xe/pf: Add documentation for sriov_admin attributes Michal Wajdeczko
2025-10-27 16:44 ` Rodrigo Vivi
2025-10-21 4:35 ` ✗ CI.checkpatch: warning for PF: Add sriov_admin sysfs tree Patchwork
2025-10-21 4:36 ` ✓ CI.KUnit: success " Patchwork
2025-10-21 10:19 ` ✗ Xe.CI.Full: failure " Patchwork
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=fceef34b-0124-431d-98f1-fcf3149ae333@intel.com \
--to=michal.wajdeczko@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=lucas.demarchi@intel.com \
--cc=rodrigo.vivi@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox