Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: "Michal Wajdeczko" <michal.wajdeczko@intel.com>,
	"Thomas Hellström" <thomas.hellstrom@linux.intel.com>,
	"Lucas De Marchi" <lucas.demarchi@intel.com>
Cc: <intel-xe@lists.freedesktop.org>,
	Lucas De Marchi <lucas.demarchi@intel.com>
Subject: Re: [PATCH 13/14] drm/xe/pf: Allow to stop and reset VF using sysfs
Date: Fri, 24 Oct 2025 15:51:39 -0400	[thread overview]
Message-ID: <aPvYy5EH7KOYlqen@intel.com> (raw)
In-Reply-To: <20251020182414.576-14-michal.wajdeczko@intel.com>

On Mon, Oct 20, 2025 at 08:24:13PM +0200, 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 attributes to control GuC scheduling at VF level.
> 
>   /sys/bus/pci/drivers/xe/BDF/
>   ├── sriov_admin/
>       ├── vf1/
>       │   ├── reset		[WO] bool

This reset is the only thing in this series that I'm not 100% comfortable.
in the device symlink you already have the reset that does the right thing.

If I understood correctly this one here has the same behavior, but with
slightly different path... bypassing the pci subsystem.

I understand that your goal is to have it near the stop since you have to
stop and then reset. But It is still a bit strange.

If you get our only PF FLR supported case, we do need to unbind the driver
before echo 1 > /sys/../device/reset  and still the unbind is not a file
near the the reset.

So we can perhaps live without this double reset here.

Although not a big blocker from my side....

Lucas, Thomas, thoughts?

>       │   └── stop		[WO] bool
>       ├── vf2/
>       │   ├── reset		[WO] bool
>       │   └── stop		[WO] bool
> 
> Writing "1" or "y" (or whatever is recognized by the strtobool()
> function) to these files will trigger the change of the VF state
> to STOP (GuC will stop servicing the VF) or back to READY (GuC
> will start servicing this VF again but after completing the full
> sequence of the software initiated VF FLR).
> 
> 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_sysfs.c | 52 ++++++++++++++++++++++++++
>  1 file changed, 52 insertions(+)
> 
> diff --git a/drivers/gpu/drm/xe/xe_sriov_pf_sysfs.c b/drivers/gpu/drm/xe/xe_sriov_pf_sysfs.c
> index c68acf6cd34f..f872013313c1 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,8 @@ static int emit_choice(char *buf, int choice, const char * const *array, size_t
>   *     ├── vf1/
>   *     │   ├── ...
>   *     │   ├── device -> ../../../BDF.1
> + *     │   ├── reset
> + *     │   ├── stop
>   *     │   └── profile
>   *     │       ├── exec_quantum_ms
>   *     │       ├── preempt_timeout_us
> @@ -291,8 +294,57 @@ 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);
> +DEFINE_SIMPLE_CONTROL_SRIOV_VF_ATTR(reset);
> +
> +static struct attribute *control_vf_attrs[] = {
> +	&xe_sriov_vf_attr_stop.attr,
> +	&xe_sriov_vf_attr_reset.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;
> +
> +	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-24 19:51 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
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 [this message]
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=aPvYy5EH7KOYlqen@intel.com \
    --to=rodrigo.vivi@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=lucas.demarchi@intel.com \
    --cc=michal.wajdeczko@intel.com \
    --cc=thomas.hellstrom@linux.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