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] i915/gem_madvise: fix dontneed-*-mmap subtests
Date: Wed, 28 Jun 2023 10:45:28 +0200	[thread overview]
Message-ID: <20230628084528.18779-1-kamil.konieczny@linux.intel.com> (raw)

Introduction of drm_close_driver() and following changes which
uses it caught a bug in two dontneed subtests:

Starting subtest: dontneed-after-mmap
(gem_madvise:1464) drmtest-WARNING: Don't attempt to close standard/invalid file descriptor: 5

Starting subtest: dontneed-before-mmap
(gem_madvise:1708) drmtest-WARNING: Don't attempt to close standard/invalid file descriptor: 5

It turns out that closing fd was done regardless of mmap
failure or success, that leads to stopping testing due to closed
fd and later at test exit or loop iteration there is attempt to
close already closed fd.

Fixed that by doing close just before actual testing. Also while
at this, fix style and remove one unnecessery empty line.

Signed-off-by: Kamil Konieczny <kamil.konieczny@linux.intel.com>
---
 tests/i915/gem_madvise.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/tests/i915/gem_madvise.c b/tests/i915/gem_madvise.c
index 765809e7f..06b3ddf32 100644
--- a/tests/i915/gem_madvise.c
+++ b/tests/i915/gem_madvise.c
@@ -109,11 +109,10 @@ dontneed_before_mmap(void)
 		ptr = __gem_mmap_offset(fd, handle, 0, OBJECT_SIZE,
 					PROT_READ | PROT_WRITE,
 					t->type);
-
-		drm_close_driver(fd);
 		if (!ptr)
 			continue;
 
+		drm_close_driver(fd);
 		old_sigsegv = signal(SIGSEGV, sigtrap);
 		old_sigbus = signal(SIGBUS, sigtrap);
 		switch (sigsetjmp(jmp, SIGBUS | SIGSEGV)) {
@@ -156,10 +155,10 @@ dontneed_after_mmap(void)
 					t->type);
 
 		gem_madvise(fd, handle, I915_MADV_DONTNEED);
-		drm_close_driver(fd);
 		if (!ptr)
 			continue;
 
+		drm_close_driver(fd);
 		old_sigsegv = signal(SIGSEGV, sigtrap);
 		old_sigbus = signal(SIGBUS, sigtrap);
 		switch (sigsetjmp(jmp, SIGBUS | SIGSEGV)) {
-- 
2.39.2

             reply	other threads:[~2023-06-28  8:45 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-28  8:45 Kamil Konieczny [this message]
2023-06-28 10:58 ` [igt-dev] ✗ Fi.CI.BAT: failure for i915/gem_madvise: fix dontneed-*-mmap subtests Patchwork
2023-06-28 14:24   ` Kamil Konieczny
2023-06-30  7:33     ` Yedireswarapu, SaiX Nandan
2023-06-30  5:50 ` [igt-dev] ✓ Fi.CI.BAT: success " Patchwork
2023-06-30 13:12 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2023-06-30 13:25   ` Kamil Konieczny
2023-07-03  3:31     ` Yedireswarapu, SaiX Nandan
2023-06-30 18:40 ` Patchwork
2023-06-30 18:48 ` [igt-dev] ✓ Fi.CI.IGT: success " Patchwork
     [not found] <20230630172518.lq6o5l365kh4oxqg@kamilkon-desk1>
2023-06-30 17:30 ` [igt-dev] [PATCH i-g-t] " Cavitt, Jonathan

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=20230628084528.18779-1-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