Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Wajdeczko <michal.wajdeczko@intel.com>
To: Tejas Upadhyay <tejas.upadhyay@intel.com>,
	<intel-xe@lists.freedesktop.org>
Cc: <himal.prasad.ghimiray@intel.com>, <rodrigo.vivi@intel.com>
Subject: Re: [PATCH V18 09/14] drm/xe/configfs: Add bad_page_reservation attribute
Date: Thu, 27 Aug 2026 17:00:37 +0200	[thread overview]
Message-ID: <fe134d36-779a-41f0-87a3-c6dfb8abe10f@intel.com> (raw)
In-Reply-To: <20260826135136.204044-25-tejas.upadhyay@intel.com>



On 8/26/2026 3:51 PM, Tejas Upadhyay wrote:
> Add a new configfs attribute 'bad_page_reservation' to control how bad
> VRAM pages are handled:
>   0 - Logging only (report in dmesg, no offlining)
>   1 - Offlining (default)
> 
> The attribute can only be set before binding to the device and defaults
> to true (offlining enabled). This gives administrators control over
> whether corrupted VRAM pages detected by hardware (e.g., ECC errors)
> are actively offlined or only logged.
> 
> Signed-off-by: Tejas Upadhyay <tejas.upadhyay@intel.com>
> ---
>  drivers/gpu/drm/xe/xe_configfs.c | 67 +++++++++++++++++++++++++++++++-
>  drivers/gpu/drm/xe/xe_configfs.h |  2 +
>  2 files changed, 68 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_configfs.c b/drivers/gpu/drm/xe/xe_configfs.c
> index 052cce962161..80c4c5f66e4c 100644
> --- a/drivers/gpu/drm/xe/xe_configfs.c
> +++ b/drivers/gpu/drm/xe/xe_configfs.c
> @@ -61,7 +61,8 @@
>   *	    ├── survivability_mode
>   *	    ├── gt_types_allowed
>   *	    ├── engines_allowed
> - *	    └── enable_psmi
> + *          ├── enable_psmi
> + *          └── bad_page_reservation

please double check alignment - look for \t

>   *
>   * After configuring the attributes as per next section, the device can be
>   * probed with::
> @@ -159,6 +160,19 @@
>   *
>   * This attribute can only be set before binding to the device.
>   *
> + * Bad pages reservation:
> + * ---------------------
> + *
> + * Controls how bad VRAM pages are handled:
> + *  0 - Logging only (report in dmesg, no offlining)
> + *  1 - Offlining (default)

this is bool, so Y/N/y/n will also work

> + *
> + *  Example to disable offlining::
> + *
> + *      # echo 0 > /sys/kernel/config/xe/0000:03:00.0/bad_page_reservation

if this is about VRAM, why attribute name does not say that?

maybe
	"enable_vram_offline"
or
	"disable_vram_offline"

to benefit from default '0' ?

> + *
> + * This attribute can only be set before binding to the device.

shouldn't we say that it is "available only on CRI+" or something?

> + *
>   * Context restore BB
>   * ------------------
>   *
> @@ -275,6 +289,7 @@ struct xe_config_group_device {
>  		bool survivability_mode;
>  		bool enable_psmi;
>  		bool enable_multi_queue;
> +		bool bad_page_reservation;
>  		struct {
>  			unsigned int max_vfs;
>  			bool admin_only_pf;
> @@ -295,6 +310,7 @@ static const struct xe_config_device device_defaults = {
>  	.survivability_mode = false,
>  	.enable_psmi = false,
>  	.enable_multi_queue = true,
> +	.bad_page_reservation = true,
>  	.sriov = {
>  		.max_vfs = XE_DEFAULT_MAX_VFS,
>  		.admin_only_pf = XE_DEFAULT_ADMIN_ONLY_PF,
> @@ -616,6 +632,32 @@ static ssize_t enable_multi_queue_store(struct config_item *item, const char *pa
>  	return len;
>  }
>  
> +static ssize_t bad_page_reservation_show(struct config_item *item, char *page)
> +{
> +	struct xe_config_device *dev = to_xe_config_device(item);
> +
> +	return sprintf(page, "%d\n", dev->bad_page_reservation);

	%s and str_yes_no() ?> +}
> +
> +static ssize_t bad_page_reservation_store(struct config_item *item, const char *page, size_t len)
> +{
> +	struct xe_config_group_device *dev = to_xe_config_group_device(item);
> +	bool val;
> +	int ret;
> +
> +	ret = kstrtobool(page, &val);
> +	if (ret)
> +		return ret;
> +
> +	guard(mutex)(&dev->lock);
> +	if (is_bound(dev))
> +		return -EBUSY;
> +
> +	dev->config.bad_page_reservation = val;
> +
> +	return len;
> +}
> +
>  static bool wa_bb_read_advance(bool dereference, char **p,
>  			       const char *append, size_t len,
>  			       size_t *max_size)
> @@ -855,6 +897,7 @@ CONFIGFS_ATTR(, ctx_restore_mid_bb);
>  CONFIGFS_ATTR(, ctx_restore_post_bb);
>  CONFIGFS_ATTR(, enable_multi_queue);
>  CONFIGFS_ATTR(, enable_psmi);
> +CONFIGFS_ATTR(, bad_page_reservation);
>  CONFIGFS_ATTR(, engines_allowed);
>  CONFIGFS_ATTR(, gt_types_allowed);
>  CONFIGFS_ATTR(, survivability_mode);

shouldn't you also update xe_config_device_is_visible() to make it CRI+ only?
> @@ -864,6 +907,7 @@ static struct configfs_attribute *xe_config_device_attrs[] = {
>  	&attr_ctx_restore_post_bb,
>  	&attr_enable_multi_queue,
>  	&attr_enable_psmi,
> +	&attr_bad_page_reservation,
>  	&attr_engines_allowed,
>  	&attr_gt_types_allowed,
>  	&attr_survivability_mode,
> @@ -1142,6 +1186,7 @@ static void dump_custom_dev_config(struct pci_dev *pdev,
>  	PRI_CUSTOM_ATTR("%llx", engines_allowed);
>  	PRI_CUSTOM_ATTR("%d", enable_multi_queue);
>  	PRI_CUSTOM_ATTR("%d", enable_psmi);
> +	PRI_CUSTOM_ATTR("%d", bad_page_reservation);
>  	PRI_CUSTOM_ATTR("%d", survivability_mode);
>  	PRI_CUSTOM_ATTR("%u", sriov.admin_only_pf);
>  
> @@ -1290,6 +1335,26 @@ bool xe_configfs_get_enable_multi_queue(struct pci_dev *pdev)
>  	return ret;
>  }
>  
> +/**
> + * xe_configfs_get_bad_page_reservation - get configfs bad_page_reservation setting
> + * @pdev: pci device
> + *
> + * Return: bad_page_reservation setting in configfs
> + */
> +bool xe_configfs_get_bad_page_reservation(struct pci_dev *pdev)
> +{
> +	struct xe_config_group_device *dev = find_xe_config_group_device(pdev);
> +	bool ret;
> +
> +	if (!dev)
> +		return device_defaults.bad_page_reservation;
> +
> +	ret = dev->config.bad_page_reservation;
> +	config_group_put(&dev->group);
> +
> +	return ret;
> +}
> +
>  /**
>   * xe_configfs_get_ctx_restore_mid_bb - get configfs ctx_restore_mid_bb setting
>   * @pdev: pci device
> diff --git a/drivers/gpu/drm/xe/xe_configfs.h b/drivers/gpu/drm/xe/xe_configfs.h
> index 4fbbeafba473..7405cc5f3207 100644
> --- a/drivers/gpu/drm/xe/xe_configfs.h
> +++ b/drivers/gpu/drm/xe/xe_configfs.h
> @@ -24,6 +24,7 @@ bool xe_configfs_media_gt_allowed(struct pci_dev *pdev);
>  u64 xe_configfs_get_engines_allowed(struct pci_dev *pdev);
>  bool xe_configfs_get_psmi_enabled(struct pci_dev *pdev);
>  bool xe_configfs_get_enable_multi_queue(struct pci_dev *pdev);
> +bool xe_configfs_get_bad_page_reservation(struct pci_dev *pdev);
>  u32 xe_configfs_get_ctx_restore_mid_bb(struct pci_dev *pdev,
>  				       enum xe_engine_class class,
>  				       const u32 **cs);
> @@ -44,6 +45,7 @@ static inline bool xe_configfs_media_gt_allowed(struct pci_dev *pdev) { return t
>  static inline u64 xe_configfs_get_engines_allowed(struct pci_dev *pdev) { return U64_MAX; }
>  static inline bool xe_configfs_get_psmi_enabled(struct pci_dev *pdev) { return false; }
>  static inline bool xe_configfs_get_enable_multi_queue(struct pci_dev *pdev) { return true; }
> +static inline bool xe_configfs_get_bad_page_reservation(struct pci_dev *pdev) { return true; }
>  static inline u32 xe_configfs_get_ctx_restore_mid_bb(struct pci_dev *pdev,
>  						     enum xe_engine_class class,
>  						     const u32 **cs) { return 0; }


  parent reply	other threads:[~2026-08-27 15:00 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-26 13:51 [PATCH V18 00/14] Add memory page offlining support Tejas Upadhyay
2026-08-26 13:51 ` [PATCH V18 01/14] drm/xe: Link VRAM object with gpu buddy Tejas Upadhyay
2026-08-26 22:31   ` Andi Shyti
2026-08-26 13:51 ` [PATCH V18 02/14] drm/xe: Link LRC BO and its execution Queue Tejas Upadhyay
2026-08-26 22:34   ` Andi Shyti
2026-08-26 13:51 ` [PATCH V18 03/14] drm/xe: Extend BO purge to handle vram pages as well Tejas Upadhyay
2026-08-26 14:07   ` sashiko-bot
2026-08-26 22:42   ` Andi Shyti
2026-08-27  6:17     ` Upadhyay, Tejas
2026-08-27 14:40       ` Andi Shyti
2026-08-27 14:48         ` Upadhyay, Tejas
2026-08-28  5:25         ` Upadhyay, Tejas
2026-08-28  7:39           ` Andi Shyti
2026-08-28 17:29             ` Upadhyay, Tejas
2026-08-26 13:51 ` [PATCH V18 04/14] drm/xe/bo: Make xe_bo_is_user() public Tejas Upadhyay
2026-08-26 22:44   ` Andi Shyti
2026-08-26 13:51 ` [PATCH V18 05/14] drm/xe: Guard teardown paths against purged BOs Tejas Upadhyay
2026-08-26 14:12   ` sashiko-bot
2026-08-27  6:08   ` Ghimiray, Himal Prasad
2026-08-27  8:27     ` Upadhyay, Tejas
2026-08-26 13:51 ` [PATCH V18 06/14] drm/xe/vram: Extract buddy alloc and free helpers Tejas Upadhyay
2026-08-26 22:50   ` Andi Shyti
2026-08-26 13:51 ` [PATCH V18 07/14] drm/xe/vram: Add page offline data structures and lifecycle Tejas Upadhyay
2026-08-26 23:09   ` Andi Shyti
2026-08-27  6:19   ` Ghimiray, Himal Prasad
2026-08-26 13:51 ` [PATCH V18 08/14] drm/xe/vram: Add VRAM page offline fault handler Tejas Upadhyay
2026-08-26 14:05   ` sashiko-bot
2026-08-26 13:51 ` [PATCH V18 09/14] drm/xe/configfs: Add bad_page_reservation attribute Tejas Upadhyay
2026-08-27  6:42   ` Ghimiray, Himal Prasad
2026-08-27 15:00   ` Michal Wajdeczko [this message]
2026-08-28 17:48     ` Upadhyay, Tejas
2026-08-26 13:51 ` [PATCH V18 10/14] drm/xe/ras: Cache bad_page_reservation policy at init Tejas Upadhyay
2026-08-26 14:11   ` sashiko-bot
2026-08-27  6:45   ` Ghimiray, Himal Prasad
2026-08-26 13:51 ` [PATCH V18 11/14] drm/xe/vram: Check bad_page_reservation policy in fault handler Tejas Upadhyay
2026-08-26 14:08   ` sashiko-bot
2026-08-27  6:46   ` Ghimiray, Himal Prasad
2026-08-27 15:04   ` Michal Wajdeczko
2026-08-26 13:51 ` [PATCH V18 12/14] drm/xe: Expose bad VRAM pages via debugfs Tejas Upadhyay
2026-08-26 14:13   ` sashiko-bot
2026-08-27 15:16   ` Michal Wajdeczko
2026-08-28 19:06     ` Upadhyay, Tejas
2026-08-28 15:04   ` Rodrigo Vivi
2026-08-26 13:51 ` [PATCH V18 13/14] drm/xe/uapi: Expose ban reason in EXEC_QUEUE_GET_PROPERTY_BAN Tejas Upadhyay
2026-08-26 14:20   ` sashiko-bot
2026-08-27 18:26   ` Andi Shyti
2026-08-28  5:31     ` Upadhyay, Tejas
2026-08-26 13:51 ` [PATCH V18 14/14] drm/xe: Add fault-inject based VRAM page offline injection Tejas Upadhyay
2026-08-27  7:10   ` Ghimiray, Himal Prasad
2026-08-27  8:23     ` Upadhyay, Tejas
2026-08-26 14:37 ` ✗ CI.checkpatch: warning for Add memory page offlining support (rev21) Patchwork
2026-08-26 14:39 ` ✓ CI.KUnit: success " Patchwork
2026-08-26 15:21 ` ✓ Xe.CI.BAT: " Patchwork
2026-08-26 19:01 ` ✓ Xe.CI.FULL: " 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=fe134d36-779a-41f0-87a3-c6dfb8abe10f@intel.com \
    --to=michal.wajdeczko@intel.com \
    --cc=himal.prasad.ghimiray@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=rodrigo.vivi@intel.com \
    --cc=tejas.upadhyay@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