From: Bommu Krishnaiah <krishnaiah.bommu@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Bommu Krishnaiah <krishnaiah.bommu@intel.com>
Subject: [PATCH v2] tests/core_setmaster: Handle the test even if cards are non-continuous
Date: Tue, 10 Sep 2024 11:07:47 +0530 [thread overview]
Message-ID: <20240910053747.14305-1-krishnaiah.bommu@intel.com> (raw)
Although most of user space assumes drm cards to be populated continuously,
this assumption may not be always true. After hot unpluging and repluging
of card, the card may be non-continuous. To address such scenarios where
the cards can be non-continuous Modify the tweak_perm function to loop all
possible card numbers(card0-card255) and break after first card found.
Problem Description:
The test fails after running the `core_hotunplug@hot*` subtest, where
Card0 is populated as card1, This leads to a failure in the subsequent
`master-drop-set-user` test.
Command sequence for reproducing the issue:
- Check available cards: `ls /dev/dri/`
- Output: by-path card0 renderD128
- Run the test: `# ./core_hotunplug --r hotrebind-lateclose`
- Check again: ‘ls /dev/dri/’
- Output after core_hotunplug : by-path card1 renderD129
- Run the test: `# ./core_setmaster --r master-drop-set-user`
- Output: gta@ core_setmaster@master-drop-set-user failure
This failures on both XE and i915 for above sequence.
v2: Break the loop after first card found and check return value of chmod.
Signed-off-by: Bommu Krishnaiah krishnaiah.bommu@intel.com
Cc: Emil Velikov emil.l.velikov@gmail.com
Cc: Himal Prasad Ghimiray himal.prasad.ghimiray@intel.com
Cc: Kamil Konieczny kamil.konieczny@linux.intel.com
---
tests/core_setmaster.c | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/tests/core_setmaster.c b/tests/core_setmaster.c
index 9c2083f66..bfcfb5d25 100644
--- a/tests/core_setmaster.c
+++ b/tests/core_setmaster.c
@@ -107,18 +107,20 @@ static void check_drop_set(void)
drm_close_driver(master);
}
-static unsigned tweak_perm(uint8_t *saved_perm, unsigned max_perm, bool save)
+static int tweak_perm(uint8_t *saved_perm, unsigned max_perm, bool save)
{
char path[256];
struct stat st;
- unsigned i;
+ int i;
for (i = 0; i < max_perm; i++) {
+ int ret = 0;
+
snprintf(path, sizeof(path), "/dev/dri/card%u", i);
/* Existing userspace assumes there's no gaps, do the same. */
if (stat(path, &st) != 0)
- break;
+ continue;
if (save) {
/* Save and toggle */
@@ -136,7 +138,12 @@ static unsigned tweak_perm(uint8_t *saved_perm, unsigned max_perm, bool save)
* - __drm_open_driver() can open another device, aka the
* failure may be irrelevant.
*/
- chmod(path, st.st_mode);
+ ret = chmod(path, st.st_mode);
+ if (ret)
+ return ret;
+
+ if (save)
+ return i;
}
return i;
}
@@ -161,7 +168,7 @@ igt_main
igt_subtest_group {
uint8_t saved_perm[255];
- unsigned num;
+ int num;
/* Upon dropping root we end up as random user, which
* a) is not in the video group, and
--
2.25.1
next reply other threads:[~2024-09-10 5:50 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-10 5:37 Bommu Krishnaiah [this message]
2024-09-10 16:29 ` [PATCH v2] tests/core_setmaster: Handle the test even if cards are non-continuous Kamil Konieczny
2024-09-12 1:31 ` ✓ CI.xeBAT: success for tests/core_setmaster: Handle the test even if cards are non-continuous (rev4) Patchwork
2024-09-12 1:49 ` ✓ Fi.CI.BAT: " Patchwork
2024-09-12 4:41 ` ✗ CI.xeFULL: failure " Patchwork
2024-09-12 9:06 ` ✗ Fi.CI.IGT: " 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=20240910053747.14305-1-krishnaiah.bommu@intel.com \
--to=krishnaiah.bommu@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