public inbox for [email protected]
 help / color / mirror / Atom feed
From: Ziyang Zhang <[email protected]>
To: [email protected], [email protected]
Cc: [email protected], [email protected],
	Ziyang Zhang <[email protected]>
Subject: [PATCH tools/io_uring] tools/io_uring: correctly set "ret" for sq_poll case
Date: Tue, 21 Feb 2023 15:37:36 +0800	[thread overview]
Message-ID: <[email protected]> (raw)

For sq_poll case, "ret" is not initialized or cleared/set. In this way,
output of this test program is incorrect and we can not even stop this
program by pressing CTRL-C.

Reset "ret" to zero in each submission/completion round, and assign
"ret" to "this_reap".

Signed-off-by: Ziyang Zhang <[email protected]>
---
 tools/io_uring/io_uring-bench.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/io_uring/io_uring-bench.c b/tools/io_uring/io_uring-bench.c
index 7703f0118385..3c0feb48f6f6 100644
--- a/tools/io_uring/io_uring-bench.c
+++ b/tools/io_uring/io_uring-bench.c
@@ -289,6 +289,7 @@ static void *submitter_fn(void *data)
 	do {
 		int to_wait, to_submit, this_reap, to_prep;
 
+		ret = 0;
 		if (!prepped && s->inflight < DEPTH) {
 			to_prep = min(DEPTH - s->inflight, BATCH_SUBMIT);
 			prepped = prep_more_ios(s, to_prep);
@@ -334,6 +335,8 @@ static void *submitter_fn(void *data)
 				this_reap += r;
 		} while (sq_thread_poll && this_reap < to_wait);
 		s->reaps += this_reap;
+		if (sq_thread_poll)
+			ret = this_reap;
 
 		if (ret >= 0) {
 			if (!ret) {
-- 
2.18.4


             reply	other threads:[~2023-02-21  7:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-21  7:37 Ziyang Zhang [this message]
2023-02-23  3:46 ` [PATCH tools/io_uring] tools/io_uring: correctly set "ret" for sq_poll case Jens Axboe
2023-02-24  2:25   ` Ziyang Zhang
2023-02-24  2:29     ` Jens Axboe

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=20230221073736.628851-1-ZiyangZhang@linux.alibaba.com \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /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