All of lore.kernel.org
 help / color / mirror / Atom feed
* [RESEND PATCH liburing 0/2] couple of fixes to tests
@ 2026-08-31 15:52 Gabriel Krisman Bertazi
  2026-08-31 15:52 ` [RESEND PATCH liburing 1/2] test/iowait.t: Skip if system is not quiesced for too long Gabriel Krisman Bertazi
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Gabriel Krisman Bertazi @ 2026-08-31 15:52 UTC (permalink / raw)
  To: axboe; +Cc: io-uring, Gabriel Krisman Bertazi

Two unrelated fixes that I sent a while ago.  Jiri Slaby reported iowait
sporadic failures and while patch 1 doesn't fix all of them, it makes the test
much more reliable.  Patch 2 is a trivial fix to CI builds.


Gabriel Krisman Bertazi (2):
  test/iowait.t: Skip if system is not quiesced for too long
  test/iopoll: Fix clang CI build failure

 test/iopoll.c |  5 +----
 test/iowait.c | 26 ++++++++++++++++++++------
 2 files changed, 21 insertions(+), 10 deletions(-)

-- 
2.55.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [RESEND PATCH liburing 1/2] test/iowait.t: Skip if system is not quiesced for too long
  2026-08-31 15:52 [RESEND PATCH liburing 0/2] couple of fixes to tests Gabriel Krisman Bertazi
@ 2026-08-31 15:52 ` Gabriel Krisman Bertazi
  2026-08-31 15:52 ` [RESEND PATCH liburing 2/2] test/iopoll: Fix clang CI build failure Gabriel Krisman Bertazi
  2026-08-31 23:00 ` (subset) [RESEND PATCH liburing 0/2] couple of fixes to tests Jens Axboe
  2 siblings, 0 replies; 6+ messages in thread
From: Gabriel Krisman Bertazi @ 2026-08-31 15:52 UTC (permalink / raw)
  To: axboe; +Cc: io-uring, Gabriel Krisman Bertazi

iowait.t reads the system-wide iowait metric, which is unreliable if the
cpu is busy with other tasks.  Identify this scenario by checking the
user+sys time, and retry to avoid spurious failures.

Signed-off-by: Gabriel Krisman Bertazi <krisman@suse.de>
---
 test/iowait.c | 26 ++++++++++++++++++++------
 1 file changed, 20 insertions(+), 6 deletions(-)

diff --git a/test/iowait.c b/test/iowait.c
index 542510c1..610fa4ea 100644
--- a/test/iowait.c
+++ b/test/iowait.c
@@ -11,7 +11,7 @@
 #include "liburing.h"
 #include "helpers.h"
 
-static int get_iowait(int cpu)
+static int get_iowait(int cpu, int *cpu_time)
 {
 	char cpu_buf[32], this_cpu[32];
 	int user, nice, system, idle, iowait, ret;
@@ -33,6 +33,7 @@ static int get_iowait(int cpu)
 			continue;
 		if (strncmp(cpu_buf, this_cpu, strlen(this_cpu)))
 			continue;
+		*cpu_time = user + system;
 		ret = iowait;
 		break;
 	} while (1);
@@ -45,14 +46,20 @@ static int test(struct io_uring *ring, int with_iowait, int cpu)
 {
 	struct io_uring_sqe *sqe;
 	struct io_uring_cqe *cqe;
-	int iowait_pre, iowait_post;
+	int iowait_pre, iowait_post, cputime_pre, cputime_post;
 	struct __kernel_timespec ts;
-	int ret, fds[2], diff;
+	int ret, fds[2], diff, diff_cputime, retry = 5;
 	char buf[32];
 
 	if (!(ring->features & IORING_FEAT_NO_IOWAIT))
 		return T_EXIT_SKIP;
 
+retry:
+	if (retry < 0) {
+		fprintf(stderr,
+			"System is not quiesced for too long. skipping\n");
+		return T_EXIT_SKIP;
+	}
 	if (pipe(fds) < 0) {
 		perror("pipe");
 		return T_EXIT_FAIL;
@@ -70,14 +77,15 @@ static int test(struct io_uring *ring, int with_iowait, int cpu)
 
 	ts.tv_sec = 1;
 	ts.tv_nsec = 0;
-	iowait_pre = get_iowait(cpu);
+	iowait_pre = get_iowait(cpu, &cputime_pre);
 	ret = io_uring_wait_cqe_timeout(ring, &cqe, &ts);
 	if (ret != -ETIME) {
 		fprintf(stderr, "Unexpected wait ret: %d\n", ret);
 		return T_EXIT_FAIL;
 	}
-	iowait_post = get_iowait(cpu);
+	iowait_post = get_iowait(cpu, &cputime_post);
 	diff = iowait_post - iowait_pre;
+	diff_cputime = cputime_post - cputime_pre;
 
 	close(fds[0]);
 	close(fds[1]);
@@ -91,7 +99,13 @@ static int test(struct io_uring *ring, int with_iowait, int cpu)
 
 	if (with_iowait) {
 		if (diff < 50) {
-			fprintf(stderr, "iowait diff too small: %d\n", diff);
+			if (diff_cputime > 10) {
+				/* System is not quiesced. iowait is unreliable. */
+				retry--;
+				sleep(2);
+				goto retry;
+			}
+			fprintf(stderr, "iowait diff too small: %d (u=%d)\n", diff, diff_cputime);
 			return T_EXIT_FAIL;
 		}
 	} else {
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [RESEND PATCH liburing 2/2] test/iopoll: Fix clang CI build failure
  2026-08-31 15:52 [RESEND PATCH liburing 0/2] couple of fixes to tests Gabriel Krisman Bertazi
  2026-08-31 15:52 ` [RESEND PATCH liburing 1/2] test/iowait.t: Skip if system is not quiesced for too long Gabriel Krisman Bertazi
@ 2026-08-31 15:52 ` Gabriel Krisman Bertazi
  2026-08-31 23:00   ` Jens Axboe
  2026-08-31 23:00 ` (subset) [RESEND PATCH liburing 0/2] couple of fixes to tests Jens Axboe
  2 siblings, 1 reply; 6+ messages in thread
From: Gabriel Krisman Bertazi @ 2026-08-31 15:52 UTC (permalink / raw)
  To: axboe; +Cc: io-uring, Gabriel Krisman Bertazi

Clang CI builds in liburing repo do -Werror,-Wunused-but-set-global when
building with clang.  commit c5eead26 ("test/iopoll: fix over-eager
no_hybrid check") left a lingering variable that was not used, and clang
got smart enough to find for it, causing the build to fail for every
commit ever since.

https://github.com/axboe/liburing/actions/runs/30404555586/job/90427017716
https://github.com/axboe/liburing/actions/runs/30404555586/job/90427017742

Fixes: c5eead26 ("test/iopoll: fix over-eager no_hybrid check")
Signed-off-by: Gabriel Krisman Bertazi <krisman@suse.de>
---
 test/iopoll.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/test/iopoll.c b/test/iopoll.c
index 98230657..d68fde10 100644
--- a/test/iopoll.c
+++ b/test/iopoll.c
@@ -23,7 +23,6 @@
 static struct iovec *vecs;
 static int no_buf_select;
 static int no_iopoll;
-static int no_hybrid;
 
 static int provide_buffers(struct io_uring *ring)
 {
@@ -372,10 +371,8 @@ static int test_io(const char *file, int write, int sqthread, int fixed,
 		return 0;
 	}
 	if (ret != T_SETUP_OK) {
-		if (ring_flags & IORING_SETUP_HYBRID_IOPOLL) {
-			no_hybrid = 1;
+		if (ring_flags & IORING_SETUP_HYBRID_IOPOLL)
 			return 0;
-		}
 		fprintf(stderr, "ring create failed: %d\n", ret);
 		return 1;
 	}
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [RESEND PATCH liburing 2/2] test/iopoll: Fix clang CI build failure
  2026-08-31 15:52 ` [RESEND PATCH liburing 2/2] test/iopoll: Fix clang CI build failure Gabriel Krisman Bertazi
@ 2026-08-31 23:00   ` Jens Axboe
  2026-08-31 23:18     ` Gabriel Krisman Bertazi
  0 siblings, 1 reply; 6+ messages in thread
From: Jens Axboe @ 2026-08-31 23:00 UTC (permalink / raw)
  To: Gabriel Krisman Bertazi; +Cc: io-uring

On 8/31/26 9:52 AM, Gabriel Krisman Bertazi wrote:
> Clang CI builds in liburing repo do -Werror,-Wunused-but-set-global when
> building with clang.  commit c5eead26 ("test/iopoll: fix over-eager
> no_hybrid check") left a lingering variable that was not used, and clang
> got smart enough to find for it, causing the build to fail for every
> commit ever since.
> 
> https://github.com/axboe/liburing/actions/runs/30404555586/job/90427017716
> https://github.com/axboe/liburing/actions/runs/30404555586/job/90427017742

What's this against? Doesn't apply.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: (subset) [RESEND PATCH liburing 0/2] couple of fixes to tests
  2026-08-31 15:52 [RESEND PATCH liburing 0/2] couple of fixes to tests Gabriel Krisman Bertazi
  2026-08-31 15:52 ` [RESEND PATCH liburing 1/2] test/iowait.t: Skip if system is not quiesced for too long Gabriel Krisman Bertazi
  2026-08-31 15:52 ` [RESEND PATCH liburing 2/2] test/iopoll: Fix clang CI build failure Gabriel Krisman Bertazi
@ 2026-08-31 23:00 ` Jens Axboe
  2 siblings, 0 replies; 6+ messages in thread
From: Jens Axboe @ 2026-08-31 23:00 UTC (permalink / raw)
  To: Gabriel Krisman Bertazi; +Cc: io-uring


On Mon, 31 Aug 2026 12:52:20 -0300, Gabriel Krisman Bertazi wrote:
> Two unrelated fixes that I sent a while ago.  Jiri Slaby reported iowait
> sporadic failures and while patch 1 doesn't fix all of them, it makes the test
> much more reliable.  Patch 2 is a trivial fix to CI builds.
> 
> 
> Gabriel Krisman Bertazi (2):
>   test/iowait.t: Skip if system is not quiesced for too long
>   test/iopoll: Fix clang CI build failure
> 
> [...]

Applied, thanks!

[1/2] test/iowait.t: Skip if system is not quiesced for too long
      commit: 4cf73437863c2e492d2a1d0f24330f391c0f075b

Best regards,
-- 
Jens Axboe




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [RESEND PATCH liburing 2/2] test/iopoll: Fix clang CI build failure
  2026-08-31 23:00   ` Jens Axboe
@ 2026-08-31 23:18     ` Gabriel Krisman Bertazi
  0 siblings, 0 replies; 6+ messages in thread
From: Gabriel Krisman Bertazi @ 2026-08-31 23:18 UTC (permalink / raw)
  To: Jens Axboe; +Cc: io-uring

Jens Axboe <axboe@kernel.dk> writes:

> On 8/31/26 9:52 AM, Gabriel Krisman Bertazi wrote:
>> Clang CI builds in liburing repo do -Werror,-Wunused-but-set-global when
>> building with clang.  commit c5eead26 ("test/iopoll: fix over-eager
>> no_hybrid check") left a lingering variable that was not used, and clang
>> got smart enough to find for it, causing the build to fail for every
>> commit ever since.
>> 
>> https://github.com/axboe/liburing/actions/runs/30404555586/job/90427017716
>> https://github.com/axboe/liburing/actions/runs/30404555586/job/90427017742
>
> What's this against? Doesn't apply.

Ah, it was fixed by Ammar in parallel through a github PR:

  ca274ec7 ("test: Remove unused global variables found by clang-23")

Thanks for merging the rest.


-- 
Gabriel Krisman Bertazi

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-08-31 23:18 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-31 15:52 [RESEND PATCH liburing 0/2] couple of fixes to tests Gabriel Krisman Bertazi
2026-08-31 15:52 ` [RESEND PATCH liburing 1/2] test/iowait.t: Skip if system is not quiesced for too long Gabriel Krisman Bertazi
2026-08-31 15:52 ` [RESEND PATCH liburing 2/2] test/iopoll: Fix clang CI build failure Gabriel Krisman Bertazi
2026-08-31 23:00   ` Jens Axboe
2026-08-31 23:18     ` Gabriel Krisman Bertazi
2026-08-31 23:00 ` (subset) [RESEND PATCH liburing 0/2] couple of fixes to tests Jens Axboe

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.