From: Lucas De Marchi <lucas.demarchi@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Lucas De Marchi <lucas.demarchi@intel.com>
Subject: [PATCH i-g-t 2/2] tests/intel/perf_pmu: Migrate to unbind + unload
Date: Tue, 22 Oct 2024 22:05:02 -0700 [thread overview]
Message-ID: <20241023050502.3049664-3-lucas.demarchi@intel.com> (raw)
In-Reply-To: <20241023050502.3049664-1-lucas.demarchi@intel.com>
There isn't much point in testing we can't remove the module directly
after removing *some* known dependencies. The point in this test is to
make sure that if the HW vanishes, driver still behaves. That is
currently not true, as it will cause perf to explode.
Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
---
tests/intel/perf_pmu.c | 22 ++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)
diff --git a/tests/intel/perf_pmu.c b/tests/intel/perf_pmu.c
index bfa2d501a..6eb4f09d1 100644
--- a/tests/intel/perf_pmu.c
+++ b/tests/intel/perf_pmu.c
@@ -2282,7 +2282,6 @@ static void test_unload(unsigned int num_engines)
int fd[4 + num_engines * 3], i;
uint64_t *buf;
int count = 0, ret;
- char *who = NULL;
int i915;
i915 = __drm_open_driver(DRIVER_INTEL);
@@ -2337,23 +2336,26 @@ static void test_unload(unsigned int num_engines)
igt_debug("Read %d events from perf and trial unload\n", count);
pmu_read_multi(fd[0], count, buf);
- ret = __igt_i915_driver_unload(&who);
- igt_debug("__igt_i915_driver_unload: ret %d who %s\n", ret, who);
- igt_assert(ret != 0 && !strcmp(who, "i915"));
- free(who);
- pmu_read_multi(fd[0], count, buf);
- igt_debug("Close perf\n");
+ /*
+ * We can't unload the module with perf event registered, but
+ * we can make the HW go away by unbinding it from the driver.
+ */
+ ret = igt_kmod_unbind("i915");
+ igt_assert_eq(ret, 0);
+ igt_debug("Close perf\n");
for (i = 0; i < count; i++)
close(fd[i]);
+ igt_debug("Final unload\n");
+ /* After perf is closed, we should be able to remove the module */
+ ret = igt_i915_driver_unload();
+ igt_assert_eq(ret, 0);
+
free(buf);
}
igt_waitchildren();
-
- igt_debug("Final unload\n");
- igt_assert_eq(__igt_i915_driver_unload(NULL), 0);
}
static void pmu_read(int i915)
--
2.47.0
next prev parent reply other threads:[~2024-10-23 5:05 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
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 ` Lucas De Marchi [this message]
2024-11-04 19:25 ` [PATCH i-g-t 2/2] tests/intel/perf_pmu: Migrate to unbind + unload 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=20241023050502.3049664-3-lucas.demarchi@intel.com \
--to=lucas.demarchi@intel.com \
--cc=igt-dev@lists.freedesktop.org \
/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