Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
To: Lucas De Marchi <lucas.demarchi@intel.com>
Cc: <igt-dev@lists.freedesktop.org>
Subject: Re: [PATCH i-g-t 1/2] lib/igt_kmod: Export igt_kmod_unbind()
Date: Tue, 29 Oct 2024 17:08:07 -0700	[thread overview]
Message-ID: <ZyF450skb7ukCuaw@orsosgc001> (raw)
In-Reply-To: <20241023050502.3049664-2-lucas.demarchi@intel.com>

On Tue, Oct 22, 2024 at 10:05:01PM -0700, Lucas De Marchi wrote:
>So it can be used directly by tests and other libs.
>
>Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
>---
> lib/igt_kmod.c | 6 +++---
> lib/igt_kmod.h | 2 ++
> 2 files changed, 5 insertions(+), 3 deletions(-)
>
>diff --git a/lib/igt_kmod.c b/lib/igt_kmod.c
>index 75a0d057c..039309328 100644
>--- a/lib/igt_kmod.c
>+++ b/lib/igt_kmod.c
>@@ -663,7 +663,7 @@ int __igt_intel_driver_unload(char **who, const char *driver)
> /*
>  * Unbind driver from devices. Currently supports only PCI bus
>  */
>-static int unbind(const char *driver)
>+int igt_kmod_unbind(const char *mod_name)
> {
> 	char path[PATH_MAX];
> 	struct dirent *de;
>@@ -671,7 +671,7 @@ static int unbind(const char *driver)
> 	DIR *dir;
>
> 	dirlen = snprintf(path, sizeof(path), "/sys/module/%s/drivers/pci:%s/",
>-			  driver, driver);
>+			  mod_name, mod_name);
> 	igt_assert(dirlen < sizeof(path));
>
> 	dir = opendir(path);

Maybe unrelated, but another issue I am seeing in this path is that 
power/control attribute is not present in some kernel configs. Can we 
add a check in igt_kmod_unbind that would check if the attribute exists 
and only then set it? If I do that, then unbind does go through and the 
test passes as expected (with this series).

Thanks,
Umesh
>@@ -744,7 +744,7 @@ igt_intel_driver_unload(const char *driver)
>
> int igt_xe_driver_unload(void)
> {
>-	unbind("xe");
>+	igt_kmod_unbind("xe");
>
> 	igt_kmod_unload("xe");
> 	if (igt_kmod_is_loaded("xe"))
>diff --git a/lib/igt_kmod.h b/lib/igt_kmod.h
>index ee1719a8f..193b95627 100644
>--- a/lib/igt_kmod.h
>+++ b/lib/igt_kmod.h
>@@ -36,6 +36,8 @@ bool igt_kmod_has_param(const char *mod_name, const char *param);
> int igt_kmod_load(const char *mod_name, const char *opts);
> int igt_kmod_unload(const char *mod_name);
>
>+int igt_kmod_unbind(const char *mod_name);
>+
> int igt_audio_driver_unload(char **whom);
>
> int igt_intel_driver_load(const char *opts, const char *driver);
>-- 
>2.47.0
>

  reply	other threads:[~2024-10-30  0:08 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-23  5:05 [PATCH i-g-t 0/2] Fix perf_pmu@unload Lucas De Marchi
2024-10-23  5:05 ` [PATCH i-g-t 1/2] lib/igt_kmod: Export igt_kmod_unbind() Lucas De Marchi
2024-10-30  0:08   ` Umesh Nerlige Ramappa [this message]
2024-10-30 14:11     ` Lucas De Marchi
2024-11-04 19:24   ` Umesh Nerlige Ramappa
2024-11-04 20:51     ` Lucas De Marchi
2024-10-23  5:05 ` [PATCH i-g-t 2/2] tests/intel/perf_pmu: Migrate to unbind + unload Lucas De Marchi
2024-11-04 19:25   ` Umesh Nerlige Ramappa
2024-11-04 20:49     ` Lucas De Marchi
2024-11-04 22:03       ` Umesh Nerlige Ramappa
2024-10-23  6:16 ` ✓ Fi.CI.BAT: success for Fix perf_pmu@unload Patchwork
2024-10-23  6:17 ` ✓ CI.xeBAT: " Patchwork
2024-10-23  9:10 ` ✗ Fi.CI.IGT: failure " Patchwork
2024-10-23 10:09 ` ✗ CI.xeFULL: " 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=ZyF450skb7ukCuaw@orsosgc001 \
    --to=umesh.nerlige.ramappa@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=lucas.demarchi@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