From 758503bcb57cde5f30caa9b68ae072bef6073779 Mon Sep 17 00:00:00 2001 From: Dennis Kempin Date: Thu, 25 Mar 2021 11:07:25 -0700 Subject: [PATCH] io_uring: Disable multi_thread_submit_and_complete This CL reverts previous attempts at reducing the flakiness of the test and disables it completely. BUG=b:183722981 TEST=./test_all Change-Id: I36527d6404c67ff9e73792676a52f064d2f48d14 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2787246 Reviewed-by: Zach Reizner Reviewed-by: Daniel Verkamp Tested-by: kokoro Commit-Queue: Daniel Verkamp --- io_uring/src/uring.rs | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/io_uring/src/uring.rs b/io_uring/src/uring.rs index fc85ba9406..d67447379f 100644 --- a/io_uring/src/uring.rs +++ b/io_uring/src/uring.rs @@ -1423,7 +1423,9 @@ mod tests { ); } + // TODO(b/183722981): Fix and re-enable test #[test] + #[ignore] fn multi_thread_submit_and_complete() { const NUM_SUBMITTERS: usize = 7; const NUM_COMPLETERS: usize = 3; @@ -1504,13 +1506,30 @@ mod tests { t.join().unwrap(); } - // Make sure we didn't submit more entries than expected. - assert_eq!(uring.complete_ring.num_ready(), 0); + // Now that all submitters are finished, add NOPs to wake up any completers blocked on the + // syscall. + for i in 0..NUM_COMPLETERS { + uring + .add_nop((NUM_SUBMITTERS * ITERATIONS + i) as UserData) + .unwrap(); + } + uring.submit().unwrap(); + + for t in threads { + t.join().unwrap(); + } + + // Make sure we didn't submit more entries than expected. Only the last few NOPs added to + // wake up the completer threads may still be in the completion ring. + assert!(uring.complete_ring.num_ready() <= NUM_COMPLETERS as u32); assert_eq!( in_flight.lock().abs() as u32 + uring.complete_ring.num_ready(), - 0 + NUM_COMPLETERS as u32 + ); + assert_eq!(uring.submit_ring.lock().added, 0); + assert_eq!( + uring.stats.total_ops.load(Ordering::Relaxed), + (NUM_SUBMITTERS * ITERATIONS + NUM_COMPLETERS) as u64 ); - - // Leave the completer threads hanging to be cleaned up by the OS. } }