Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Raag Jadav <raag.jadav@intel.com>
To: Sk Anirban <sk.anirban@intel.com>
Cc: igt-dev@lists.freedesktop.org, anshuman.gupta@intel.com,
	badal.nilawar@intel.com, riana.tauro@intel.com,
	karthik.poosa@intel.com, soham.purkait@intel.com,
	mallesh.koujalagi@intel.com, hiresh.kumar.yadav@intel.com
Subject: Re: [PATCH] tests/intel/xe_wedged: Fix DEVPATH check for cold-reset wedge
Date: Wed, 2 Dec 2026 14:26:56 +0100	[thread overview]
Message-ID: <axAcoOrZqsJBnHnU@black.igk.intel.com> (raw)
In-Reply-To: <20261202115748.775971-2-sk.anirban@intel.com>

On Wed, Dec 02, 2026 at 05:27:49PM +0530, Sk Anirban wrote:
> The cold-reset-wedged subtest validated the uevent DEVPATH by
> looking for the device's PCI BDF in it.
> 
> Recent kernel RAS changes moved probe-time error processing to an
> earlier point in device initialization. A cold-reset wedge is now
> declared before the DRM device is registered, so the uevent
> DEVPATH no longer contains the PCI hierarchy. It holds only the
> card node, e.g. "DEVPATH=/card0".
> 
> Drop the BDF match and compare the last DEVPATH component with
> the card name predicted before rebind.
> 
> Signed-off-by: Sk Anirban <sk.anirban@intel.com>
> ---
>  tests/intel/xe_wedged.c | 39 ++++++++++++++++++++++++++++++++-------
>  1 file changed, 32 insertions(+), 7 deletions(-)
> 
> diff --git a/tests/intel/xe_wedged.c b/tests/intel/xe_wedged.c
> index c67a4dda5..07e04927b 100644
> --- a/tests/intel/xe_wedged.c
> +++ b/tests/intel/xe_wedged.c
> @@ -93,7 +93,27 @@ static void force_wedged(int fd)
>  	sleep(1);
>  }
>  
> -static void wait_for_wedged_uevent(struct udev_monitor *mon)
> +/*
> + * The card index may change across rebind and the bound device is wedged, so
> + * predict it: DRM reuses the lowest minor that is not held by another device.
> + */
> +static void predict_card_name_after_rebind(char *card, size_t len)
> +{
> +	char path[PATH_MAX], real[PATH_MAX];
> +	unsigned int idx;
> +
> +	for (idx = 0; idx < 64; idx++) {

Curious, why 64?

> +		snprintf(path, sizeof(path), "/sys/class/drm/card%u", idx);
> +
> +		/* Free slot, or our own card which gets released by the unbind */
> +		if (!realpath(path, real) || strstr(real, pci_slot))

This may seem to work but looks a bit fragile. Let me think of something.

Raag

> +			break;
> +	}
> +
> +	snprintf(card, len, "card%u", idx);
> +}
> +
> +static void wait_for_wedged_uevent(struct udev_monitor *mon, const char *card)
>  {
>  	struct udev_device *dev;
>  	const char *prop_val;
> @@ -118,9 +138,10 @@ static void wait_for_wedged_uevent(struct udev_monitor *mon)
>  
>  		if (prop_val && !strcmp(prop_val, "cold-reset")) {
>  			event_received = true;
> -			igt_assert_f(dev_path && strstr(dev_path, pci_slot),
> -				     "Expected bus address '%s' to be part of DEVPATH '%s'",
> -				     pci_slot, dev_path);
> +			igt_assert_f(dev_path &&
> +				     !strcmp(strrchr(dev_path, '/') + 1, card),
> +				     "Expected '%s' in DEVPATH '%s'",
> +				     card, dev_path);
>  			udev_device_unref(dev);
>  			break;
>  		}
> @@ -415,6 +436,7 @@ int igt_main()
>  
>  	igt_subtest_f("cold-reset-wedged") {
>  		struct udev_monitor *mon;
> +		char card[NAME_MAX];
>  
>  		errno = 0;
>  		igt_skip_on_f(!IS_CRESCENTISLAND(intel_get_drm_devid(fd)),
> @@ -430,15 +452,18 @@ int igt_main()
>  		ignore_wedged_in_dmesg();
>  		mon = igt_watch_uevents();
>  
> +		predict_card_name_after_rebind(card, sizeof(card));
> +
>  		drm_close_driver(fd);
>  		igt_kmod_rebind("xe", pci_slot);
> -		wait_for_wedged_uevent(mon);
> +		wait_for_wedged_uevent(mon, card);
>  		/*
> -		 * Rebind to restore device operation. The first wedge decrements
> +		 * Bind again to restore device operation. The first wedge decrements
>  		 * times to zero, disabling further fault injection even though
>  		 * probability remains at 100.
>  		 */
> -		igt_kmod_rebind("xe", pci_slot);
> +		igt_kmod_bind("xe", pci_slot);
> +
>  		fd = drm_open_driver(DRIVER_XE);
>  		test_spinner_after_recovery(fd);
>  	}
> -- 
> 2.43.0
> 

      reply	other threads:[~2026-12-02 13:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-02 11:57 [PATCH] tests/intel/xe_wedged: Fix DEVPATH check for cold-reset wedge Sk Anirban
2026-12-02 13:26 ` Raag Jadav [this message]

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=axAcoOrZqsJBnHnU@black.igk.intel.com \
    --to=raag.jadav@intel.com \
    --cc=anshuman.gupta@intel.com \
    --cc=badal.nilawar@intel.com \
    --cc=hiresh.kumar.yadav@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=karthik.poosa@intel.com \
    --cc=mallesh.koujalagi@intel.com \
    --cc=riana.tauro@intel.com \
    --cc=sk.anirban@intel.com \
    --cc=soham.purkait@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