Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Kamil Konieczny <kamil.konieczny@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t v7 3/3] lib/drmtest: drop checks for opened device for filters
Date: Tue,  3 Oct 2023 16:59:20 +0200	[thread overview]
Message-ID: <20231003145920.51148-4-kamil.konieczny@linux.intel.com> (raw)
In-Reply-To: <20231003145920.51148-1-kamil.konieczny@linux.intel.com>

When using filters honor user choice and don't restrict opens
to non-opened devices. This will allow a user to test some
multiGPU tests with repeated filter for card zero:

--device=pci:vendor=Intel,device=discrete,card=0\;pci:vendor=Intel,device=discrete,card=0

If the user want it just allow this. Also while at this, move
debug print into filter loop as there is already one for
non-filter.

Cc: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
Cc: Petri Latvala <adrinael@adrinael.net>
Cc: Arkadiusz Hiler <arek@hiler.eu>
Signed-off-by: Kamil Konieczny <kamil.konieczny@linux.intel.com>
---
 lib/drmtest.c | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/lib/drmtest.c b/lib/drmtest.c
index 43524c5ad..dbfa0282d 100644
--- a/lib/drmtest.c
+++ b/lib/drmtest.c
@@ -454,8 +454,8 @@ static bool __get_card_for_nth_filter(int idx, struct igt_device_card *card)
  *   * device scanning is executed,
  *   * idx-th filter (starting with 0, filters are semicolon separated) is used
  *   * if there is no idx-th filter, goto 2
- *   * first device maching the filter is selected
- *   * if it's already opened (for indexes = 0..idx-1) we fail with -1
+ *   * device maching the requested filter is selected
+ *   * if it's not matched we fail with -1
  *   * otherwise open the device and return the fd
  *
  * 2. compatibility mode - open the first DRM device we can find that is not
@@ -497,11 +497,11 @@ int __drm_open_driver_another(int idx, int chipset)
 {
 	int fd = -1;
 
-	igt_debug("card idx: %d chipset: %d\n", idx, chipset);
 	if (chipset != DRIVER_VGEM && igt_device_filter_count() > idx) {
 		struct igt_device_card card;
 		bool found;
 
+		igt_debug("card idx: %d chipset: %d\n", idx, chipset);
 		found = __get_card_for_nth_filter(idx, &card);
 
 		if (!found) {
@@ -510,16 +510,14 @@ int __drm_open_driver_another(int idx, int chipset)
 			found = __get_card_for_nth_filter(idx, &card);
 		}
 
-		if (!found || !strlen(card.card))
-			igt_warn("No card matches the filter! [%s]\n",
-				 igt_device_filter_get(idx));
-		else if (_is_already_opened(card.card, idx))
-			igt_warn("card maching filter %d is already opened\n", idx);
-		else {
-			igt_debug("card idx: %d found: %s\n", idx, card.card);
+		if (!found || !strlen(card.card)) {
+			igt_warn("No card matches the filter! [%s]%s\n",
+				 igt_device_filter_get(idx),
+				 found && !strlen(card.card) ? " (card empty)" : "");
+		} else {
+			igt_debug("card %d found: [%s]\n", idx, card.card);
 			fd = __open_driver_exact(card.card, chipset);
 		}
-
 	} else {
 		/* no filter for device idx, let's open whatever is available */
 		igt_debug("No filter for device idx: %d\n", idx);
-- 
2.42.0

  parent reply	other threads:[~2023-10-03 14:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-03 14:59 [igt-dev] [PATCH i-g-t v7 0/3] drmtest changes for running tests on multi-gpu Kamil Konieczny
2023-10-03 14:59 ` [igt-dev] [PATCH i-g-t v7 1/3] lib/drmtest: allow out of order device opening Kamil Konieczny
2023-10-03 14:59 ` [igt-dev] [PATCH i-g-t v7 2/3] tests/intel/xe_create: extend massive subtest to multi-gpu Kamil Konieczny
2023-10-03 14:59 ` Kamil Konieczny [this message]
2023-10-03 16:02 ` [igt-dev] ✗ Fi.CI.BAT: failure for drmtest changes for running tests on multi-gpu (rev6) Patchwork
2023-10-03 16:12 ` [igt-dev] ✓ CI.xeBAT: success " 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=20231003145920.51148-4-kamil.konieczny@linux.intel.com \
    --to=kamil.konieczny@linux.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