Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
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 v2 16/17] drm/xe/pf: Allow to stop and reset VF using sysfs
Date: Thu, 30 Oct 2025 14:50:09 +0100	[thread overview]
Message-ID: <4fd915b1-01b5-4113-947b-ff93a82e75b4@intel.com> (raw)
In-Reply-To: <e4gagt4kem37ogz3ccxzlggznmsveh6pfa44ybghma5zav4swe@edlwn47v2kzt>



On 10/30/2025 2:43 PM, Lucas De Marchi wrote:
> On Tue, Oct 28, 2025 at 06:58:30PM +0100, Michal Wajdeczko wrote:
>> It is expected that VFs activity will be monitored and in some
>> cases admin might want to silence specific VF without killing
>> the VM where it was attached.
>>
>> Add write-only attribute to stop GuC scheduling at VFs level.
>>
>>  /sys/bus/pci/drivers/xe/BDF/
>>  ├── sriov_admin/
>>      ├── vf1/
>>      │   └── stop        [WO] bool
>>      ├── vf2/
>>      │   └── stop        [WO] bool
>>
>> Writing "1" or "y" (or whatever is recognized by the strtobool()
>> function) to this file will trigger the change of the VF state
>> to STOP (GuC will stop servicing the VF). To go back to a READY
>> state (to allow GuC to service this VF again) the VF FLR must be
>> triggered (which can be done by writing 1 to device/reset file).
>>
>> Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
>> Cc: Lucas De Marchi <lucas.demarchi@intel.com>
>> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
>> ---
>> v2: drop reset file (Rodrigo, Lucas)
>> ---
>> drivers/gpu/drm/xe/xe_sriov_pf_sysfs.c | 49 ++++++++++++++++++++++++++
>> 1 file changed, 49 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/xe/xe_sriov_pf_sysfs.c b/drivers/gpu/drm/xe/xe_sriov_pf_sysfs.c
>> index 360b0ffd9cb4..3a8c488d183c 100644
>> --- a/drivers/gpu/drm/xe/xe_sriov_pf_sysfs.c
>> +++ b/drivers/gpu/drm/xe/xe_sriov_pf_sysfs.c
>> @@ -13,6 +13,7 @@
>> #include "xe_pm.h"
>> #include "xe_sriov.h"
>> #include "xe_sriov_pf.h"
>> +#include "xe_sriov_pf_control.h"
>> #include "xe_sriov_pf_helpers.h"
>> #include "xe_sriov_pf_provision.h"
>> #include "xe_sriov_pf_sysfs.h"
>> @@ -52,6 +53,7 @@ static int emit_choice(char *buf, int choice, const char * const *array, size_t
>>  *     ├── vf1/
>>  *     │   ├── ...
>>  *     │   ├── device -> ../../../BDF.1
>> + *     │   ├── stop
>>  *     │   └── profile
>>  *     │       ├── exec_quantum_ms
>>  *     │       ├── preempt_timeout_us
>> @@ -291,8 +293,55 @@ static const struct attribute_group profile_vf_attr_group = {
>>     .is_visible = profile_vf_attr_is_visible,
>> };
>>
>> +#define DEFINE_SIMPLE_CONTROL_SRIOV_VF_ATTR(NAME)                    \
>> +                                            \
>> +static ssize_t xe_sriov_vf_attr_##NAME##_store(struct xe_device *xe, unsigned int vfid,    \
>> +                           const char *buf, size_t count)        \
>> +{                                            \
>> +    bool yes;                                    \
>> +    int err;                                    \
>> +                                            \
>> +    if (!vfid)                                    \
>> +        return -EPERM;                                \
>> +                                            \
>> +    err = kstrtobool(buf, &yes);                            \
>> +    if (err)                                    \
>> +        return err;                                \
>> +    if (!yes)                                    \
>> +        return count;                                \
>> +                                            \
>> +    err = xe_sriov_pf_control_##NAME##_vf(xe, vfid);                \
>> +    return err ?: count;                                \
>> +}                                            \
>> +                                            \
>> +static XE_SRIOV_VF_ATTR_WO(NAME)
>> +
>> +DEFINE_SIMPLE_CONTROL_SRIOV_VF_ATTR(stop);
>> +
>> +static struct attribute *control_vf_attrs[] = {
>> +    &xe_sriov_vf_attr_stop.attr,
>> +    NULL
>> +};
>> +
>> +static umode_t control_vf_attr_is_visible(struct kobject *kobj,
>> +                      struct attribute *attr, int index)
>> +{
>> +    struct xe_sriov_kobj *vkobj = to_xe_sriov_kobj(kobj);
>> +
>> +    if (vkobj->vfid == PFID)
>> +        return 0;
> 
> I think this will be the case for the entire group, isn't it?
> Should we go ahead and just return SYSFS_GROUP_INVISIBLE so even the dir
> is invisible instead of having an empty dir?

today it can't be empty as at this level there is already a "device"
link and a "profile" dir - both for PF and all VFs.

> 
> Lucas De Marchi
> 
>> +
>> +    return attr->mode;
>> +}
>> +
>> +static const struct attribute_group control_vf_attr_group = {
>> +    .attrs = control_vf_attrs,
>> +    .is_visible = control_vf_attr_is_visible,
>> +};
>> +
>> static const struct attribute_group *xe_sriov_vf_attr_groups[] = {
>>     &profile_vf_attr_group,
>> +    &control_vf_attr_group,
>>     NULL
>> };
>>
>> -- 
>> 2.47.1
>>


  reply	other threads:[~2025-10-30 13:50 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-28 17:58 [PATCH v2 00/17] PF: Add sriov_admin sysfs tree Michal Wajdeczko
2025-10-28 17:58 ` [PATCH v2 01/17] drm/xe/pf: Prepare sysfs for SR-IOV admin attributes Michal Wajdeczko
2025-10-28 17:58 ` [PATCH v2 02/17] drm/xe/pf: Take RPM during calls to SR-IOV attr.store() Michal Wajdeczko
2025-10-28 17:58 ` [PATCH v2 03/17] drm/xe/pf: Add _locked variants of the VF EQ config functions Michal Wajdeczko
2025-10-29  8:47   ` Piotr Piórkowski
2025-10-29  9:00     ` Piotr Piórkowski
2025-10-30 19:47     ` Michal Wajdeczko
2025-10-28 17:58 ` [PATCH v2 04/17] drm/xe/pf: Add _locked variants of the VF PT " Michal Wajdeczko
2025-10-29 11:00   ` Piotr Piórkowski
2025-10-29 20:27   ` Lucas De Marchi
2025-10-28 17:58 ` [PATCH v2 05/17] drm/xe/pf: Allow change PF and VFs EQ/PT using sysfs Michal Wajdeczko
2025-10-29 11:17   ` Piotr Piórkowski
2025-10-29 20:26   ` Lucas De Marchi
2025-10-28 17:58 ` [PATCH v2 06/17] drm/xe/pf: Relax report helper to accept PF in bulk configs Michal Wajdeczko
2025-10-28 17:58 ` [PATCH v2 07/17] drm/xe/pf: Fix signature of internal config helpers Michal Wajdeczko
2025-10-29  8:02   ` Piotr Piórkowski
2025-10-28 17:58 ` [PATCH v2 08/17] drm/xe/pf: Add functions to bulk configure EQ/PT on GT Michal Wajdeczko
2025-10-29 13:59   ` Piotr Piórkowski
2025-10-29 20:32   ` Lucas De Marchi
2025-10-28 17:58 ` [PATCH v2 09/17] drm/xe/pf: Add functions to bulk provision EQ/PT Michal Wajdeczko
2025-10-29 20:33   ` Lucas De Marchi
2025-10-28 17:58 ` [PATCH v2 10/17] drm/xe/pf: Allow bulk change all VFs EQ/PT using sysfs Michal Wajdeczko
2025-10-28 17:58 ` [PATCH v2 11/17] drm/xe/pf: Add functions to provision scheduling priority Michal Wajdeczko
2025-10-28 17:58 ` [PATCH v2 12/17] drm/xe/pf: Allow bulk change all VFs priority using sysfs Michal Wajdeczko
2025-10-30 12:43   ` Lucas De Marchi
2025-10-30 13:47     ` Lucas De Marchi
2025-10-28 17:58 ` [PATCH v2 13/17] drm/xe/pf: Allow change PF scheduling " Michal Wajdeczko
2025-10-30 13:35   ` Lucas De Marchi
2025-10-30 13:49     ` Lucas De Marchi
2025-10-28 17:58 ` [PATCH v2 14/17] drm/xe/pf: Promote xe_pci_sriov_get_vf_pdev Michal Wajdeczko
2025-10-28 17:58 ` [PATCH v2 15/17] drm/xe/pf: Add sysfs device symlinks to enabled VFs Michal Wajdeczko
2025-10-30 13:40   ` Lucas De Marchi
2025-10-28 17:58 ` [PATCH v2 16/17] drm/xe/pf: Allow to stop and reset VF using sysfs Michal Wajdeczko
2025-10-30  8:45   ` Piotr Piórkowski
2025-10-30 13:43   ` Lucas De Marchi
2025-10-30 13:50     ` Michal Wajdeczko [this message]
2025-10-30 14:14       ` Lucas De Marchi
2025-10-28 17:58 ` [PATCH v2 17/17] drm/xe/pf: Add documentation for sriov_admin attributes Michal Wajdeczko
2025-10-30 17:25   ` Lucas De Marchi
2025-10-31 12:35     ` Michal Wajdeczko
2025-10-28 20:04 ` ✗ CI.checkpatch: warning for PF: Add sriov_admin sysfs tree (rev2) Patchwork
2025-10-28 20:05 ` ✓ CI.KUnit: success " Patchwork
2025-10-28 20:43 ` ✓ Xe.CI.BAT: " Patchwork
2025-10-29  7:15 ` ✗ Xe.CI.Full: failure " Patchwork
2025-10-29 10:11   ` Michal Wajdeczko

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=4fd915b1-01b5-4113-947b-ff93a82e75b4@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