Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: Stuart Summers <stuart.summers@intel.com>
Cc: <intel-xe@lists.freedesktop.org>, <matthew.brost@intel.com>,
	<umesh.nerlige.ramappa@intel.com>, <gustavo.sousa@intel.com>,
	<matthew.d.roper@intel.com>, <daniele.ceraolospurio@intel.com>,
	<shuicheng.lin@intel.com>
Subject: Re: [PATCH 04/15] drm/xe: Invert vram_page_offline configfs attribute
Date: Tue, 13 Oct 2026 15:13:41 -0400	[thread overview]
Message-ID: <as6C5UM-OZsBx2YE@intel.com> (raw)
In-Reply-To: <20261005220636.602826-21-stuart.summers@intel.com>

On Mon, Oct 05, 2026 at 10:06:40PM +0000, Stuart Summers wrote:
> Rename disable_vram_page_offline to enable_vram_page_offline The default
> is now true, matching the previous default of offlining being active.
> 
> Negative-logic flags are error prone once they get combined with other
> conditions, so carry the positive sense all the way down to the RAS
> consumer rather than inverting at the configfs boundary. The internal
> xe->ras field is explicitly initialized for every platform since a
> zeroed struct no longer means "offlining enabled".

yes, please!

I never forget our disable_power_well_enable where power_well_enable
already means power disabling! :)

Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>

> 
> Signed-off-by: Stuart Summers <stuart.summers@intel.com>
> Assisted-by: LLM> ---
>  drivers/gpu/drm/xe/xe_configfs.c      | 44 +++++++++++++--------------
>  drivers/gpu/drm/xe/xe_configfs.h      |  2 +-
>  drivers/gpu/drm/xe/xe_drm_ras_types.h |  4 +--
>  drivers/gpu/drm/xe/xe_ras.c           |  8 +++--
>  drivers/gpu/drm/xe/xe_ttm_vram_mgr.c  |  2 +-
>  5 files changed, 31 insertions(+), 29 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_configfs.c b/drivers/gpu/drm/xe/xe_configfs.c
> index 6e62fdccb4c4..0ccf163306fc 100644
> --- a/drivers/gpu/drm/xe/xe_configfs.c
> +++ b/drivers/gpu/drm/xe/xe_configfs.c
> @@ -63,7 +63,7 @@
>   *	    ├── engines_allowed
>   *	    ├── migrate_ulls_period_ms
>   *	    ├── enable_psmi
> - *	    └── disable_vram_page_offline
> + *	    └── enable_vram_page_offline
>   *
>   * After configuring the attributes as per next section, the device can be
>   * probed with::
> @@ -161,15 +161,15 @@
>   *
>   * This attribute can only be set before binding to the device.
>   *
> - * Disable VRAM page offline:
> - * ----------------------------
> + * Enable VRAM page offline:
> + * -------------------------
>   *
> - *  0, n, N, false - Do not disable (Offlining is active - default)
> - *  1, y, Y, true  - Disable vram page offline (Logging only)
> + *  0, n, N, false - Disable vram page offline (Logging only)
> + *  1, y, Y, true  - Enable vram page offline (Offlining is active - default)
>   *
>   *  Example to disable VRAM offline::
>   *
> - *      # echo 1 > /sys/kernel/config/xe/0000:03:00.0/disable_vram_page_offline
> + *      # echo 0 > /sys/kernel/config/xe/0000:03:00.0/enable_vram_page_offline
>   *
>   * This attribute can only be set on CRI before binding to the device.
>   *
> @@ -304,7 +304,7 @@ struct xe_config_group_device {
>  		bool survivability_mode;
>  		bool enable_psmi;
>  		bool enable_multi_queue;
> -		bool disable_vram_page_offline;
> +		bool enable_vram_page_offline;
>  		struct {
>  			unsigned int max_vfs;
>  			bool admin_only_pf;
> @@ -326,7 +326,7 @@ static const struct xe_config_device device_defaults = {
>  	.survivability_mode = false,
>  	.enable_psmi = false,
>  	.enable_multi_queue = true,
> -	.disable_vram_page_offline = false,
> +	.enable_vram_page_offline = true,
>  	.sriov = {
>  		.max_vfs = XE_DEFAULT_MAX_VFS,
>  		.admin_only_pf = XE_DEFAULT_ADMIN_ONLY_PF,
> @@ -675,15 +675,15 @@ static ssize_t migrate_ulls_period_ms_store(struct config_item *item,
>  	return len;
>  }
>  
> -static ssize_t disable_vram_page_offline_show(struct config_item *item, char *page)
> +static ssize_t enable_vram_page_offline_show(struct config_item *item, char *page)
>  {
>  	struct xe_config_device *dev = to_xe_config_device(item);
>  
> -	return sprintf(page, "%s\n", str_yes_no(dev->disable_vram_page_offline));
> +	return sprintf(page, "%s\n", str_yes_no(dev->enable_vram_page_offline));
>  }
>  
> -static ssize_t disable_vram_page_offline_store(struct config_item *item,
> -					       const char *page, size_t len)
> +static ssize_t enable_vram_page_offline_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;
> @@ -697,7 +697,7 @@ static ssize_t disable_vram_page_offline_store(struct config_item *item,
>  	if (is_bound(dev))
>  		return -EBUSY;
>  
> -	dev->config.disable_vram_page_offline = val;
> +	dev->config.enable_vram_page_offline = val;
>  
>  	return len;
>  }
> @@ -946,7 +946,7 @@ CONFIGFS_ATTR(, ctx_restore_post_bb);
>  CONFIGFS_ATTR(, enable_multi_queue);
>  CONFIGFS_ATTR(, migrate_ulls_period_ms);
>  CONFIGFS_ATTR(, enable_psmi);
> -CONFIGFS_ATTR(, disable_vram_page_offline);
> +CONFIGFS_ATTR(, enable_vram_page_offline);
>  CONFIGFS_ATTR(, engines_allowed);
>  CONFIGFS_ATTR(, gt_types_allowed);
>  CONFIGFS_ATTR(, survivability_mode);
> @@ -957,7 +957,7 @@ static struct configfs_attribute *xe_config_device_attrs[] = {
>  	&attr_enable_multi_queue,
>  	&attr_migrate_ulls_period_ms,
>  	&attr_enable_psmi,
> -	&attr_disable_vram_page_offline,
> +	&attr_enable_vram_page_offline,
>  	&attr_engines_allowed,
>  	&attr_gt_types_allowed,
>  	&attr_survivability_mode,
> @@ -989,7 +989,7 @@ static bool xe_config_device_is_visible(struct config_item *item,
>  			return false;
>  	}
>  
> -	if (attr == &attr_disable_vram_page_offline) {
> +	if (attr == &attr_enable_vram_page_offline) {
>  		if (!dev->desc->is_dgfx || dev->desc->platform != XE_CRESCENTISLAND)
>  			return false;
>  	}
> @@ -1242,7 +1242,7 @@ static void dump_custom_dev_config(struct pci_dev *pdev,
>  	PRI_CUSTOM_ATTR("%u", migrate_ulls_period_ms);
>  	PRI_CUSTOM_ATTR("%d", enable_multi_queue);
>  	PRI_CUSTOM_ATTR("%d", enable_psmi);
> -	PRI_CUSTOM_ATTR("%d", disable_vram_page_offline);
> +	PRI_CUSTOM_ATTR("%d", enable_vram_page_offline);
>  	PRI_CUSTOM_ATTR("%d", survivability_mode);
>  	PRI_CUSTOM_ATTR("%u", sriov.admin_only_pf);
>  
> @@ -1417,21 +1417,21 @@ u32 xe_configfs_get_migrate_ulls_period_ms(struct pci_dev *pdev)
>  }
>  
>  /**
> - * xe_configfs_get_disable_vram_page_offline - get configfs disable_vram_page_offline setting
> + * xe_configfs_get_enable_vram_page_offline - get configfs enable_vram_page_offline setting
>   * @pdev: pci device
>   *
> - * Return: disable_vram_page_offline setting in configfs
> + * Return: enable_vram_page_offline setting in configfs
>   */
> -bool xe_configfs_get_disable_vram_page_offline(struct pci_dev *pdev)
> +bool xe_configfs_get_enable_vram_page_offline(struct pci_dev *pdev)
>  {
>  	struct xe_config_group_device *dev = find_xe_config_group_device(pdev);
>  	bool ret;
>  
>  	if (!dev)
> -		return device_defaults.disable_vram_page_offline;
> +		return device_defaults.enable_vram_page_offline;
>  
>  	scoped_guard(mutex, &dev->lock)
> -		ret = dev->config.disable_vram_page_offline;
> +		ret = dev->config.enable_vram_page_offline;
>  	config_group_put(&dev->group);
>  
>  	return ret;
> diff --git a/drivers/gpu/drm/xe/xe_configfs.h b/drivers/gpu/drm/xe/xe_configfs.h
> index 14e49f23306f..1d538ce0ed2c 100644
> --- a/drivers/gpu/drm/xe/xe_configfs.h
> +++ b/drivers/gpu/drm/xe/xe_configfs.h
> @@ -25,7 +25,7 @@ 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);
>  u32 xe_configfs_get_migrate_ulls_period_ms(struct pci_dev *pdev);
> -bool xe_configfs_get_disable_vram_page_offline(struct pci_dev *pdev);
> +bool xe_configfs_get_enable_vram_page_offline(struct pci_dev *pdev);
>  ssize_t xe_configfs_get_ctx_restore_mid_bb(struct pci_dev *pdev,
>  					   enum xe_engine_class class,
>  					   u32 *cs, size_t max_len);
> diff --git a/drivers/gpu/drm/xe/xe_drm_ras_types.h b/drivers/gpu/drm/xe/xe_drm_ras_types.h
> index 0be218ba2db7..60cbc35a6b35 100644
> --- a/drivers/gpu/drm/xe/xe_drm_ras_types.h
> +++ b/drivers/gpu/drm/xe/xe_drm_ras_types.h
> @@ -44,8 +44,8 @@ struct xe_drm_ras {
>  	/** @info: info array for all types of errors */
>  	struct xe_drm_ras_counter *info[DRM_XE_RAS_ERR_SEV_MAX];
>  
> -	/** @disable_vram_page_offline: cached configfs policy, immutable after init */
> -	bool disable_vram_page_offline;
> +	/** @enable_vram_page_offline: cached configfs policy, immutable after init */
> +	bool enable_vram_page_offline;
>  };
>  
>  #endif
> diff --git a/drivers/gpu/drm/xe/xe_ras.c b/drivers/gpu/drm/xe/xe_ras.c
> index 7a85735c57d5..ce9b57b3eede 100644
> --- a/drivers/gpu/drm/xe/xe_ras.c
> +++ b/drivers/gpu/drm/xe/xe_ras.c
> @@ -916,13 +916,15 @@ void xe_ras_init(struct xe_device *xe)
>  {
>  	int ret;
>  
> +	xe->ras.enable_vram_page_offline = true;
> +
>  	/*
> -	 * TODO: Replace platform check with xe->info.has_disable_vram_page_offline
> +	 * TODO: Replace platform check with xe->info.has_vram_page_offline
>  	 * once the feature flag is plumbed through device info.
>  	 */
>  	if (xe->info.platform == XE_CRESCENTISLAND)
> -		xe->ras.disable_vram_page_offline =
> -			xe_configfs_get_disable_vram_page_offline(to_pci_dev(xe->drm.dev));
> +		xe->ras.enable_vram_page_offline =
> +			xe_configfs_get_enable_vram_page_offline(to_pci_dev(xe->drm.dev));
>  
>  	xe_drm_ras_init(xe);
>  
> diff --git a/drivers/gpu/drm/xe/xe_ttm_vram_mgr.c b/drivers/gpu/drm/xe/xe_ttm_vram_mgr.c
> index 9a514d983e90..1dad94a153b7 100644
> --- a/drivers/gpu/drm/xe/xe_ttm_vram_mgr.c
> +++ b/drivers/gpu/drm/xe/xe_ttm_vram_mgr.c
> @@ -933,7 +933,7 @@ int xe_ttm_vram_handle_addr_fault(struct xe_device *xe, u64 addr)
>  	vram_mgr = &vr->ttm;
>  	mm = &vram_mgr->mm;
>  
> -	if (xe->ras.disable_vram_page_offline) {
> +	if (!xe->ras.enable_vram_page_offline) {
>  		xe_err(xe, "0x%llx is reported as corrupted address by HW\n",
>  		       addr);
>  		return -EOPNOTSUPP;
> -- 
> 2.43.0
> 

  reply	other threads:[~2026-10-13 19:14 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-05 22:06 [PATCH 00/15] Add new debug infrastructure for configfs Stuart Summers
2026-10-05 22:06 ` [PATCH 01/15] drm/xe: Guard configfs attribute reads in getters Stuart Summers
2026-10-05 22:06 ` [PATCH 02/15] drm/xe/configfs: Fix out-of-bounds read in parse_wa_bb_lines() Stuart Summers
2026-10-13 19:08   ` Rodrigo Vivi
2026-10-05 22:06 ` [PATCH 03/15] drm/xe/configfs: Copy wa_bb out under the configfs lock Stuart Summers
2026-10-13 19:10   ` Rodrigo Vivi
2026-10-13 20:35     ` Summers, Stuart
2026-10-05 22:06 ` [PATCH 04/15] drm/xe: Invert vram_page_offline configfs attribute Stuart Summers
2026-10-13 19:13   ` Rodrigo Vivi [this message]
2026-10-05 22:06 ` [PATCH 05/15] drm/xe: Make survivability_mode configfs attribute a bitmap Stuart Summers
2026-10-13 19:14   ` Rodrigo Vivi
2026-10-05 22:06 ` [PATCH 06/15] drm/xe: Sort xe_config_device fields Stuart Summers
2026-10-05 22:06 ` [PATCH 07/15] drm/xe: Split out configfs data structures Stuart Summers
2026-10-05 22:06 ` [PATCH 08/15] drm/xe: Add a new debug focused configfs group Stuart Summers
2026-10-05 22:06 ` [PATCH 09/15] drm/xe: Move debug configfs entries to xe_configfs_debug.c Stuart Summers
2026-10-13 19:16   ` Rodrigo Vivi
2026-10-05 22:06 ` [PATCH 10/15] drm/xe/guc: Add configfs support for guc_log_level Stuart Summers
2026-10-05 22:06 ` [PATCH 11/15] drm/xe/guc: Add support for NPK as a GuC log target Stuart Summers
2026-10-05 22:06 ` [PATCH 12/15] drm/xe: Add infrastructure for debug configfs parameters Stuart Summers
2026-10-05 22:06 ` [PATCH 13/15] drm/xe: Migrate existing debug configfs entries to params infrastructure Stuart Summers
2026-10-05 22:06 ` [PATCH 14/15] drm/xe: Taint kernel when debug configfs parameters are set Stuart Summers
2026-10-05 22:06 ` [PATCH 15/15] drm/xe: Add enable_media module parameter Stuart Summers
2026-10-05 22:13 ` ✗ CI.checkpatch: warning for Add new debug infrastructure for configfs (rev10) Patchwork
2026-10-05 22:15 ` ✓ CI.KUnit: success " Patchwork
2026-10-05 23:17 ` ✓ Xe.CI.BAT: " Patchwork
2026-10-06  6:22 ` ✗ Xe.CI.FULL: failure " Patchwork
2026-10-07 19:13   ` Summers, Stuart
  -- strict thread matches above, loose matches on Subject: below --
2026-10-05 19:06 [PATCH 00/15] Add new debug infrastructure for configfs Stuart Summers
2026-10-05 19:06 ` [PATCH 04/15] drm/xe: Invert vram_page_offline configfs attribute Stuart Summers

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=as6C5UM-OZsBx2YE@intel.com \
    --to=rodrigo.vivi@intel.com \
    --cc=daniele.ceraolospurio@intel.com \
    --cc=gustavo.sousa@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=matthew.brost@intel.com \
    --cc=matthew.d.roper@intel.com \
    --cc=shuicheng.lin@intel.com \
    --cc=stuart.summers@intel.com \
    --cc=umesh.nerlige.ramappa@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