All of lore.kernel.org
 help / color / mirror / Atom feed
From: Riana Tauro <riana.tauro@intel.com>
To: Lucas De Marchi <lucas.demarchi@intel.com>,
	<intel-xe@lists.freedesktop.org>
Cc: <prashanth.kumar@intel.com>, <dnyaneshwar.bhadane@intel.com>
Subject: Re: [PATCH v3 09/13] drm/xe/configfs: Block runtime attribute changes
Date: Wed, 13 Aug 2025 16:33:16 +0530	[thread overview]
Message-ID: <c76bbc10-507e-4f6f-b559-30f1bf924806@intel.com> (raw)
In-Reply-To: <20250808-psmi-v3-9-a111e9f1e4b7@intel.com>



On 8/8/2025 10:59 PM, Lucas De Marchi wrote:
> Although it's possible to change the attributes in runtime, they have no
> effect after the driver is already bound to the device. Check for that
> and return -EBUSY in that case.
> 
> This should help users understand what's going on when the behavior is
> not changing even if the value from the configfs is "right", but it got
> to that state too late.
> 
> Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
> ---
>   drivers/gpu/drm/xe/xe_configfs.c | 38 ++++++++++++++++++++++++++++++++++++++
>   1 file changed, 38 insertions(+)
> 
> diff --git a/drivers/gpu/drm/xe/xe_configfs.c b/drivers/gpu/drm/xe/xe_configfs.c
> index 4c2d4ff6a70f5..489c5c67001dc 100644
> --- a/drivers/gpu/drm/xe/xe_configfs.c
> +++ b/drivers/gpu/drm/xe/xe_configfs.c
> @@ -54,6 +54,8 @@
>    *	# echo 1 > /sys/kernel/config/xe/0000:03:00.0/survivability_mode
>    *	# echo 0000:03:00.0 > /sys/bus/pci/drivers/xe/bind  (Enters survivability mode if supported)
>    *
> + * This attribute can only be set before binding to the device.
> + *
>    * Allowed engines:
>    * ----------------
>    *
> @@ -78,6 +80,8 @@
>    * available for migrations, but it's disabled. This is intended for debugging
>    * purposes only.
>    *
> + * This attribute can only be set before binding to the device.
> + *
>    * PSMI
>    * ----
>    *
> @@ -88,6 +92,8 @@
>    *
>    *	# echo 1 > /sys/kernel/config/xe/0000:03:00.0/enable_psmi
>    *
> + * This attribute can only be set before binding to the device.
> + *
>    * Remove devices
>    * ==============
>    *
> @@ -148,6 +154,29 @@ static struct xe_config_device *to_xe_config_device(struct config_item *item)
>   	return &to_xe_config_group_device(item)->config;
>   }
>   
> +static bool is_bound(struct xe_config_group_device *dev)
> +{
> +	unsigned int domain, bus, slot, function;
> +	struct pci_dev *pdev;
> +	const char *name;
> +	bool ret;
> +
> +	lockdep_assert_held(&dev->lock);
> +
> +	name = dev->group.cg_item.ci_name;
> +	if (sscanf(name, "%x:%x:%x.%x", &domain, &bus, &slot, &function) != 4)
> +		return false;
> +
> +	pdev = pci_get_domain_bus_and_slot(domain, bus, PCI_DEVFN(slot, function));
> +	if (!pdev)
> +		return false;
> +
> +	ret = pci_get_drvdata(pdev);
> +	pci_dev_put(pdev);

It would be useful to have a dbg log here to inform users about the 
expectation if device is bound

With that
Reviewed-by: Riana Tauro <riana.tauro@intel.com>

> +
> +	return ret;
> +}
> +
>   static ssize_t survivability_mode_show(struct config_item *item, char *page)
>   {
>   	struct xe_config_device *dev = to_xe_config_device(item);
> @@ -166,6 +195,9 @@ static ssize_t survivability_mode_store(struct config_item *item, const char *pa
>   		return ret;
>   
>   	guard(mutex)(&dev->lock);
> +	if (is_bound(dev))
> +		return -EBUSY;
> +
>   	dev->config.survivability_mode = survivability_mode;
>   
>   	return len;
> @@ -249,6 +281,9 @@ static ssize_t engines_allowed_store(struct config_item *item, const char *page,
>   	}
>   
>   	guard(mutex)(&dev->lock);
> +	if (is_bound(dev))
> +		return -EBUSY;
> +
>   	dev->config.engines_allowed = val;
>   
>   	return len;
> @@ -272,6 +307,9 @@ static ssize_t enable_psmi_store(struct config_item *item, const char *page, siz
>   		return ret;
>   
>   	guard(mutex)(&dev->lock);
> +	if (is_bound(dev))
> +		return -EBUSY;
> +
>   	dev->config.enable_psmi = val;
>   
>   	return len;
> 


  reply	other threads:[~2025-08-13 11:03 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-08 17:29 [PATCH v3 00/13] drm/xe: Add psmi support Lucas De Marchi
2025-08-08 17:29 ` [PATCH v3 01/13] drm/xe/psmi: Add GuC flag to enable PSMI Lucas De Marchi
2025-08-13  0:38   ` Belgaumkar, Vinay
2025-08-15 21:34     ` Lucas De Marchi
2025-08-08 17:29 ` [PATCH v3 02/13] drm/xe/psmi: Add debugfs interface for PSMI Lucas De Marchi
2025-08-13  1:41   ` Belgaumkar, Vinay
2025-08-13 10:42   ` Matthew Auld
2025-08-15 21:35     ` Lucas De Marchi
2025-08-08 17:29 ` [PATCH v3 03/13] drm/xe/rtp: Add match for psmi Lucas De Marchi
2025-08-14 21:28   ` Belgaumkar, Vinay
2025-08-08 17:29 ` [PATCH v3 04/13] drm/xe/psmi: Add Wa_14020001231 Lucas De Marchi
2025-08-13 17:44   ` Riana Tauro
2025-08-14 11:13     ` Lucas De Marchi
2025-08-08 17:29 ` [PATCH v3 05/13] drm/xe/psmi: Add Wa_16023683509 Lucas De Marchi
2025-08-13 11:15   ` Bhadane, Dnyaneshwar
2025-08-08 17:29 ` [PATCH v3 06/13] drm/xe/configfs: Simplify kernel doc Lucas De Marchi
2025-08-13  6:23   ` Riana Tauro
2025-08-08 17:29 ` [PATCH v3 07/13] drm/xe/configfs: Allow to enable PSMI Lucas De Marchi
2025-08-13  6:58   ` Riana Tauro
2025-08-13 11:23     ` Lucas De Marchi
2025-08-13 17:38       ` Riana Tauro
2025-08-08 17:29 ` [PATCH v3 08/13] drm/xe/configfs: Use guard() for dev->lock Lucas De Marchi
2025-08-12 10:23   ` Bhadane, Dnyaneshwar
2025-08-08 17:29 ` [PATCH v3 09/13] drm/xe/configfs: Block runtime attribute changes Lucas De Marchi
2025-08-13 11:03   ` Riana Tauro [this message]
2025-08-08 17:29 ` [PATCH v3 10/13] drm/xe/configfs: Use tree-like output in documentation Lucas De Marchi
2025-08-14 21:31   ` Bhadane, Dnyaneshwar
2025-08-08 17:29 ` [PATCH v3 11/13] drm/xe/configfs: Improve documentation steps Lucas De Marchi
2025-08-13 11:08   ` Riana Tauro
2025-08-08 17:29 ` [PATCH v3 12/13] drm/xe/configfs: Minor fixes to documentation Lucas De Marchi
2025-08-12 10:24   ` Bhadane, Dnyaneshwar
2025-08-08 17:29 ` [PATCH v3 13/13] drm/xe/configfs: Dump custom settings when binding Lucas De Marchi
2025-08-15  0:48   ` Belgaumkar, Vinay

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=c76bbc10-507e-4f6f-b559-30f1bf924806@intel.com \
    --to=riana.tauro@intel.com \
    --cc=dnyaneshwar.bhadane@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=lucas.demarchi@intel.com \
    --cc=prashanth.kumar@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.