Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Roy <rongh7426@gmail.com>
To: igt-dev@lists.freedesktop.org
Cc: Roy <rongh7426@gmail.com>
Subject: [PATCH i-g-t] tests/kms_lease: Drain late lease uevents before lease-uevent
Date: Thu, 26 Nov 2026 11:04:24 +0800	[thread overview]
Message-ID: <20261126030425.641533-1-rongh7426@gmail.com> (raw)

lease-uevent flushes the uevent monitor and then asserts that creating
a lease does not send a lease uevent. The monitor from
igt_watch_uevents() listens for events after udevd has processed them,
so a lease uevent from the previous subtest can still be on its way
through udevd when the flush runs, and it then shows up as a lease
change for the new lease.

This happens every time on a Raspberry Pi 5 (vc4) when
implicit-plane-lease runs right before lease-uevent, as it does in a
full kms_lease run. The kernel uevents from implicit-plane-lease closing
its leases come 0.15 ms before lease-uevent starts, and udevd passes
them on 1-3 ms later:

  Starting subtest: lease-uevent
  (kms_lease) CRITICAL: Failed assertion: !igt_lease_change_detected(uevent_monitor, 1)
  Subtest lease-uevent: FAIL

lease-uevent passes when it runs on its own, or with a 200 ms sleep
before the flush.

Instead of flushing, consume events until no lease uevent arrives for a
second. The subtest takes one second longer.

Tested on a Raspberry Pi 5 (Raspberry Pi OS kernel 6.18.39):
- implicit-plane-lease followed by lease-uevent: 3/3 FAIL before,
  5/5 pass after
- full kms_lease run: 1 failure before, all 21 subtests pass after

This change and its description were written with the help of an AI
coding assistant (Claude); the test runs above were done on real
hardware.

Signed-off-by: Roy <rongh7426@gmail.com>
---
 tests/kms_lease.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/tests/kms_lease.c b/tests/kms_lease.c
index 4e9a69d..8e2b821 100644
--- a/tests/kms_lease.c
+++ b/tests/kms_lease.c
@@ -1215,7 +1215,13 @@ static void lease_uevent(data_t *data)
 
 	uevent_monitor = igt_watch_uevents();
 
-	igt_flush_uevents(uevent_monitor);
+	/*
+	 * The monitor sees events after udevd has processed them, so lease
+	 * events from an earlier subtest can still arrive after a flush.
+	 * Wait until no lease event comes in for a second.
+	 */
+	while (igt_lease_change_detected(uevent_monitor, 1))
+		;
 
 	lease_fd = create_simple_lease(data->master.fd, data);
 
-- 
2.51.1.windows.1


             reply	other threads:[~2026-11-26  8:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-26  3:04 Roy [this message]
2026-11-27  0:47 ` ✗ LGCI.VerificationFailed: failure for tests/kms_lease: Drain late lease uevents before lease-uevent 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=20261126030425.641533-1-rongh7426@gmail.com \
    --to=rongh7426@gmail.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