Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Aravind Iddamsetty <aravind.iddamsetty@linux.intel.com>
To: Raag Jadav <raag.jadav@intel.com>,
	lucas.demarchi@intel.com, thomas.hellstrom@linux.intel.com,
	maarten.lankhorst@linux.intel.com, mripard@kernel.org,
	tzimmermann@suse.de, airlied@gmail.com, daniel@ffwll.ch
Cc: intel-xe@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
	linux-kernel@vger.kernel.org, himal.prasad.ghimiray@intel.com,
	francois.dugast@intel.com, rodrigo.vivi@intel.com,
	anshuman.gupta@intel.com
Subject: Re: [PATCH v1] drm/xe/uapi: Bring back reset uevent
Date: Tue, 6 Aug 2024 14:27:41 +0530	[thread overview]
Message-ID: <35971288-2142-4dc4-8ce1-62b730fa9b44@linux.intel.com> (raw)
In-Reply-To: <20240806043231.624645-1-raag.jadav@intel.com>


On 06/08/24 10:02, Raag Jadav wrote:

This change  was originally sent by Himal, so may be you should keep his authorship.


> From: Lucas De Marchi <lucas.demarchi@intel.com>
>
> Bring back uevent for gt reset failure with better uapi naming.
> With this in place we can receive failure event using udev.
>
> $ udevadm monitor --property --kernel
> monitor will print the received events for:
> KERNEL - the kernel uevent
>
> KERNEL[871.188570] change   /devices/pci0000:00/0000:00:01.0/0000:01:00.0/0000:02:01.0/0000:03:00.0 (pci)
> ACTION=change
> DEVPATH=/devices/pci0000:00/0000:00:01.0/0000:01:00.0/0000:02:01.0/0000:03:00.0
> SUBSYSTEM=pci
> DEVICE_STATUS=NEEDS_RESET
> REASON=GT_RESET_FAILED
> TILE_ID=0
> GT_ID=0
> DRIVER=xe
> PCI_CLASS=30000
> PCI_ID=8086:56B1
> PCI_SUBSYS_ID=8086:1210
> PCI_SLOT_NAME=0000:03:00.0
> MODALIAS=pci:v00008086d000056B1sv00008086sd00001210bc03sc00i00
> SEQNUM=6104
>
> Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
> Signed-off-by: Raag Jadav <raag.jadav@intel.com>
> ---
>  drivers/gpu/drm/xe/xe_gt.c | 27 +++++++++++++++++++++++++--
>  include/uapi/drm/xe_drm.h  | 17 +++++++++++++++++
>  2 files changed, 42 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_gt.c b/drivers/gpu/drm/xe/xe_gt.c
> index b04e47186f5b..5ceef0059861 100644
> --- a/drivers/gpu/drm/xe/xe_gt.c
> +++ b/drivers/gpu/drm/xe/xe_gt.c
> @@ -740,6 +740,30 @@ static int do_gt_restart(struct xe_gt *gt)
>  	return 0;
>  }
>  
> +static void xe_uevent_gt_reset_failure(struct pci_dev *pdev, u8 tile_id, u8 gt_id)
> +{
> +	char *reset_event[5];
> +
> +	reset_event[0] = DRM_XE_RESET_REQUIRED_UEVENT;
> +	reset_event[1] = DRM_XE_RESET_REQUIRED_UEVENT_REASON_GT;
> +	reset_event[2] = kasprintf(GFP_KERNEL, "TILE_ID=%d", tile_id);
> +	reset_event[3] = kasprintf(GFP_KERNEL, "GT_ID=%d", gt_id);
> +	reset_event[4] = NULL;
> +	kobject_uevent_env(&pdev->dev.kobj, KOBJ_CHANGE, reset_event);
> +
> +	kfree(reset_event[2]);
> +	kfree(reset_event[3]);
> +}
> +
> +static void gt_reset_failed(struct xe_gt *gt, int err)
> +{
> +	xe_gt_err(gt, "reset failed (%pe)\n", ERR_PTR(err));
> +
> +	/* Notify userspace about gt reset failure */
> +	xe_uevent_gt_reset_failure(to_pci_dev(gt_to_xe(gt)->drm.dev),
> +				   gt_to_tile(gt)->id, gt->info.id);
> +}
> +
>  static int gt_reset(struct xe_gt *gt)
>  {
>  	int err;
> @@ -795,8 +819,7 @@ static int gt_reset(struct xe_gt *gt)
>  	XE_WARN_ON(xe_uc_start(&gt->uc));
>  	xe_pm_runtime_put(gt_to_xe(gt));
>  err_fail:
> -	xe_gt_err(gt, "reset failed (%pe)\n", ERR_PTR(err));
> -
> +	gt_reset_failed(gt, err);
>  	xe_device_declare_wedged(gt_to_xe(gt));
Also, we might want to have a RESET_REQUIRED event whenever
device is wedged.


Thanks,
Aravind.
>  
>  	return err;
> diff --git a/include/uapi/drm/xe_drm.h b/include/uapi/drm/xe_drm.h
> index 19619d4952a8..9ea3be97535e 100644
> --- a/include/uapi/drm/xe_drm.h
> +++ b/include/uapi/drm/xe_drm.h
> @@ -20,6 +20,7 @@ extern "C" {
>   *   2. Extension definition and helper structs
>   *   3. IOCTL's Query structs in the order of the Query's entries.
>   *   4. The rest of IOCTL structs in the order of IOCTL declaration.
> + *   5. uEvents
>   */
>  
>  /**
> @@ -1686,6 +1687,22 @@ struct drm_xe_oa_stream_info {
>  	__u64 reserved[3];
>  };
>  
> +/**
> + * DOC: uevent generated by xe on it's pci node.
> + *
> + * DRM_XE_RESET_REQUIRED_UEVENT - Event is generated when device needs reset.
> + * The REASON is provided along with the event for which reset is required.
> + * On the basis of REASONS, additional information might be supplied.
> + */
> +#define DRM_XE_RESET_REQUIRED_UEVENT "DEVICE_STATUS=NEEDS_RESET"
> +
> +/**
> + * DRM_XE_RESET_REQUIRED_UEVENT_REASON_GT - Reason provided to DRM_XE_RESET_REQUIRED_UEVENT
> + * incase of gt reset failure. The additional information supplied is tile id and
> + * gt id of the gt unit for which reset has failed.
> + */
> +#define DRM_XE_RESET_REQUIRED_UEVENT_REASON_GT "REASON=GT_RESET_FAILED"
> +
>  #if defined(__cplusplus)
>  }
>  #endif

  parent reply	other threads:[~2024-08-06  8:54 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-06  4:32 [PATCH v1] drm/xe/uapi: Bring back reset uevent Raag Jadav
2024-08-06  4:16 ` ✓ CI.Patch_applied: success for " Patchwork
2024-08-06  4:16 ` ✗ CI.checkpatch: warning " Patchwork
2024-08-06  4:18 ` ✓ CI.KUnit: success " Patchwork
2024-08-06  4:33 ` ✓ CI.Build: " Patchwork
2024-08-06  4:45 ` ✓ CI.Hooks: " Patchwork
2024-08-06  4:46 ` ✓ CI.checksparse: " Patchwork
2024-08-06  5:16 ` ✓ CI.BAT: " Patchwork
2024-08-06  6:16 ` ✓ CI.FULL: " Patchwork
2024-08-06  8:57 ` Aravind Iddamsetty [this message]
2024-08-07 12:54 ` [PATCH v1] " Lucas De Marchi

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=35971288-2142-4dc4-8ce1-62b730fa9b44@linux.intel.com \
    --to=aravind.iddamsetty@linux.intel.com \
    --cc=airlied@gmail.com \
    --cc=anshuman.gupta@intel.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=francois.dugast@intel.com \
    --cc=himal.prasad.ghimiray@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lucas.demarchi@intel.com \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=raag.jadav@intel.com \
    --cc=rodrigo.vivi@intel.com \
    --cc=thomas.hellstrom@linux.intel.com \
    --cc=tzimmermann@suse.de \
    /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