Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Borah, Chaitanya Kumar" <chaitanya.kumar.borah@intel.com>
To: Dnyaneshwar Bhadane <dnyaneshwar.bhadane@Intel.com>,
	"igt-dev@lists.freedesktop.org" <igt-dev@lists.freedesktop.org>
Cc: "Anirban, Sk" <sk.anirban@intel.com>,
	"Grzelak, Michal" <michal.grzelak@intel.com>,
	"B, Jeevan" <jeevan.b@intel.com>,
	"Sharma, Swati2" <swati2.sharma@intel.com>
Subject: Re: [PATCH i-g-t 3/3] tests/intel/xe_survivability: Reload audio driver on exit
Date: Wed, 28 Oct 2026 15:44:55 +0530	[thread overview]
Message-ID: <339f693d-189e-4ab4-8a9e-2fc01e9c0581@intel.com> (raw)
In-Reply-To: <fd707ea6-f501-4b2c-82e8-c3ad9055138a@Intel.com>



On 10/28/2026 1:43 PM, Dnyaneshwar Bhadane wrote:
> 
> 
> On 27-Oct-26 4:25 PM, Borah, Chaitanya Kumar wrote:
>>
>>
>> On 10/23/2026 10:58 AM, Bhadane, Dnyaneshwar wrote:
>>>
>>>
>>>> -----Original Message-----
>>>> From: Bhadane, Dnyaneshwar
>>>> Sent: Friday, October 23, 2026 10:32 AM
>>>> To: Chaitanya Kumar Borah <chaitanya.kumar.borah@intel.com>; igt-
>>>> dev@lists.freedesktop.org
>>>> Cc: Borah, Chaitanya Kumar <chaitanya.kumar.borah@intel.com>; 
>>>> Anirban, Sk
>>>> <sk.anirban@intel.com>; Grzelak, Michal <michal.grzelak@intel.com>; 
>>>> B, Jeevan
>>>> <Jeevan.B@intel.com>; Sharma, Swati2 <swati2.sharma@intel.com>
>>>> Subject: RE: [PATCH i-g-t 3/3] tests/intel/xe_survivability: Reload 
>>>> audio driver on
>>>> exit
>>>>
>>>>
>>>>
>>>>> -----Original Message-----
>>>>> From: igt-dev <igt-dev-bounces@lists.freedesktop.org> On Behalf Of
>>>>> Chaitanya Kumar Borah
>>>>> Sent: Thursday, October 15, 2026 7:31 PM
>>>>> To: igt-dev@lists.freedesktop.org
>>>>> Cc: Borah, Chaitanya Kumar <chaitanya.kumar.borah@intel.com>; Anirban,
>>>>> Sk <sk.anirban@intel.com>; Grzelak, Michal <michal.grzelak@intel.com>;
>>>>> B, Jeevan <jeevan.b@intel.com>; Sharma, Swati2
>>>>> <swati2.sharma@intel.com>
>>>>> Subject: [PATCH i-g-t 3/3] tests/intel/xe_survivability: Reload audio
>>>>> driver on exit
>>>>>
>>>>> Commit 117e9ecbdd1d ("xe/igt_kmod_unbind: release audio before
>>>>> unbinding
>>>>> xe") made igt_audio_driver_unload() be called before unbinding xe to
>>>>> avoid the audio-component bind warnings/errors that happen if xe is
>>>>> unbound while snd_hda_intel is still attached. Both call sites in this
>>>>> file passed NULL for the unloaded driver name, so it was never
>>>>> tracked, and nothing ever reloaded it afterwards.
>>>>>
>>>>> As a result snd_hda_intel/snd_hdmi_lpe_audio is left unloaded for the
>>>>> rest of the boot even when every subtest passes, since xe always ends
>>>>> up rebound by
>>>>> restore() but audio never does.
>>>>>
>>>>> Capture the unloaded driver name and reload it wherever xe gets bound
>>>>> again in restore().
>>>>>
>>>>> Cc: Sk Anirban <sk.anirban@intel.com>
>>>>> Cc: Michał Grzelak <michal.grzelak@intel.com>
>>>>> Cc: Jeevan B <jeevan.b@intel.com>
>>>>> Cc: Swati Sharma <swati2.sharma@intel.com>
>>>>> Signed-off-by: Chaitanya Kumar Borah <chaitanya.kumar.borah@intel.com>
>>>>> ---
>>>>>   tests/intel/xe_survivability.c | 11 +++++++++--
>>>>>   1 file changed, 9 insertions(+), 2 deletions(-)
>>>>>
>>>>> diff --git a/tests/intel/xe_survivability.c
>>>>> b/tests/intel/xe_survivability.c index
>>>>> bae9eca27..2be8e9ec0 100644
>>>>> --- a/tests/intel/xe_survivability.c
>>>>> +++ b/tests/intel/xe_survivability.c
>>>>> @@ -39,6 +39,7 @@
>>>>>    */
>>>>>
>>>>>   static char bus_addr[NAME_MAX];
>>>>> +static char *snd_driver;
>>>>>
>>>>>   static void ignore_wedged_in_dmesg(void)  { @@ -158,7 +159,7 @@
>>>>> static void restore(int sig)  {
>>>>>       int configfs_fd;
>>>>>
>>>>> -    igt_audio_driver_unload(NULL);
>>>>> +    igt_audio_driver_unload(&snd_driver);
>>>>>       igt_kmod_unbind("xe", bus_addr);
>>>>>
>>>>>       configfs_fd = igt_configfs_open("xe"); @@ -167,11 +168,17 @@ 
>>>>> static
>>>>> void restore(int sig)
>>>>>       close(configfs_fd);
>>>>>
>>>>>       igt_kmod_bind("xe", bus_addr);
>>>>> +
>>>>> +    if (snd_driver) {
>>>>> +        igt_kmod_load(snd_driver, NULL);
>>>> Hello Chaitanya,
>>>>
>>>> Would it be possible to have a helper like igt_audio_driver_load(), 
>>>> so we don't
>>>> have to maintain the driver's name in multiple files ?
>>> Something like default to "snd_hda_intel" if passed with NULL.
>>> int igt_audio_driver_load(const char *who)
>>> {
>>>     const char *drv = who ? who : "snd_hda_intel";
>>>     int ret;
>>>
>>>     if (igt_kmod_is_loaded(drv))
>>>         return 0;
>>>
>>>     ret = igt_kmod_load(drv, NULL);
>>>     if (ret)
>>>         igt_debug("Could not load audio driver %s (%s)\n",
>>>               drv, strerror(-ret));
>>>
>>>     return ret;
>>> }
>>
>> I would prefer keeping the exposure of the change to per file/test. I 
>> think "load back what I unloaded" is a good semantics to have instead 
>> of maintaining the driver name globally somewhere.
>>
>> But I would agree that there is a scope for a helper which can help 
>> get rid of the repeated if (snd_driver) {...} code block.
>>
>> I am thinking of something like.
>>
>> int igt_audio_driver_load(char **who)
>> {
>>      int ret;
>>
>>      if (!who || !*who)
>>          return 0;
>>
>>      ret = igt_kmod_load(*who, NULL);
>>      if (ret)
>>          igt_warn("Could not load audio driver %s (%s)\n", *who, 
>> strerror(-ret));
>>
>>      free(*who);
> Hi,
> Unwanted behavior if the order is igt_audio_driver_load(snd_driver) -> 
> igt_audio_driver_unload(snd_driver).  Freeing this will loose the audio 
> driver name.  Let testcase decide when they want to free this 
> 'snd_driver' mostly on testcase cleanup on exist.
> 
> 

Good catch. The memory handling of the string should be left to the 
caller. Will fix it in the next revision.

> 
> Dnyaneshwar,
> 
>  >      *who = NULL;
>>
>>      return ret;
>> }
>>
>> ==
>> Chaitanya
>>
>>
>>>
>>> Br,
>>> Dnyaneshwar,
>>>>
>>>> Br,
>>>> Dnyaneshwar
>>>>> +        free(snd_driver);
>>>>> +        snd_driver = NULL;
>>>>> +    }
>>>>>   }
>>>>>
>>>>>   static void set_survivability_mode(int configfs_device_fd, bool 
>>>>> value)  {
>>>>> -    igt_audio_driver_unload(NULL);
>>>>> +    igt_audio_driver_unload(&snd_driver);
>>>>>       igt_kmod_unbind("xe", bus_addr);
>>>>>       igt_sysfs_set_boolean(configfs_device_fd, 
>>>>> "survivability_mode", value);
>>>>>       igt_kmod_bind("xe", bus_addr);
>>>>> -- 
>>>>> 2.50.1
>>>
>>
> 


  reply	other threads:[~2026-10-28 10:16 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-15 14:00 [PATCH i-g-t 1/3] tests/intel/xe_fault_injection: Reload audio driver on exit Chaitanya Kumar Borah
2026-10-15 14:00 ` [PATCH i-g-t 2/3] tests/intel/xe_configfs: " Chaitanya Kumar Borah
2026-10-15 14:00 ` [PATCH i-g-t 3/3] tests/intel/xe_survivability: " Chaitanya Kumar Borah
2026-10-23  5:01   ` Bhadane, Dnyaneshwar
2026-10-23  5:28     ` Bhadane, Dnyaneshwar
2026-10-27 10:55       ` Borah, Chaitanya Kumar
2026-10-28  8:13         ` Dnyaneshwar Bhadane
2026-10-28 10:14           ` Borah, Chaitanya Kumar [this message]
2026-10-15 18:37 ` ✓ i915.CI.BAT: success for series starting with [i-g-t,1/3] tests/intel/xe_fault_injection: " Patchwork
2026-10-15 20:39 ` ✗ Xe.CI.BAT: failure " Patchwork
2026-10-16  1:56 ` ✗ i915.CI.Full: " Patchwork
2026-10-16  6:03 ` ✓ Xe.CI.FULL: success " Patchwork
2026-10-21  7:43 ` ✓ Xe.CI.BAT: success for series starting with [i-g-t,1/3] tests/intel/xe_fault_injection: Reload audio driver on exit (rev2) Patchwork
2026-10-21  8:03 ` ✓ i915.CI.BAT: " Patchwork
2026-10-21 10:40 ` ✗ Xe.CI.FULL: failure " Patchwork
2026-10-21 11:37 ` ✗ i915.CI.Full: " Patchwork
2026-10-23  6:13 ` [PATCH i-g-t 1/3] tests/intel/xe_fault_injection: Reload audio driver on exit Samala, Pranay
2026-10-27  9:07   ` Borah, Chaitanya Kumar

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=339f693d-189e-4ab4-8a9e-2fc01e9c0581@intel.com \
    --to=chaitanya.kumar.borah@intel.com \
    --cc=dnyaneshwar.bhadane@Intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=jeevan.b@intel.com \
    --cc=michal.grzelak@intel.com \
    --cc=sk.anirban@intel.com \
    --cc=swati2.sharma@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