Message ID | 20230221073736.628851-1-ZiyangZhang@linux.alibaba.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1733962wrn; Tue, 21 Feb 2023 00:00:40 -0800 (PST) X-Google-Smtp-Source: AK7set8Qsc9V2Qpeftf13Qc9bP5IcY4VCrSYp7JCY+7pETZkeBiYsBVGz0EVUMLQdW0iAvX8ZbZn X-Received: by 2002:aa7:9e86:0:b0:5a9:c942:7294 with SMTP id p6-20020aa79e86000000b005a9c9427294mr4318222pfq.34.1676966440599; Tue, 21 Feb 2023 00:00:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676966440; cv=none; d=google.com; s=arc-20160816; b=FaC6V0i1Mgd0J2hZk+M72k3nmJ0BnyMVQvXsgrroGbW9IyBkTxsF7sQ/s4lLTMm0CP 8OfLgFekvmM44IyZevOBPx8DjQgb5iRXg5fzhqBc+olFd2pg4fBvJZW0wOwfypmmaIAx jFiZZOGbgtXYqjtzUekjpOxRq8shpABHJCbkTiJcxTO3gzwP1uUWliSXH9onUHQdB0mm bqwqgF3zsafu+5gUhOdPo1A48tIaGwPQQ9f/zLekBrBD0/7UwNR1VEafN1+/po1h67eq +OgA3WyTfC2HEvDYtSTOGDNI5DHphMlkO2vZ1BqcZ1ey2zX31ZBQ8mOR7IXUbucQEoDs HNNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=5thxMS5t67Q+j1JyYZN6i12ctcgcFCdD6bO6ckMHStY=; b=Xg5wShMaIH6MKHxiLCXui0CeWnRkK9irHcQAP6gqTlOakc2JBGNCL/DJugP7laQlv0 bQ0igEaQnK5h2z9/6psraxeJ2Ze5VSDW3TUMrXQHNetA+FgLXviJn1J1A3D0Qkf2be1n +YSRDRt+sR3nqsD+Ci/CdGU9QZ+k/Fv0UzemK4ECQ1oPIfN0guzULi3houUDN6sYNzQs t7U9B/EHRi81DIrYuCrIP+9ik7QElUNdCvCmXskVK6gnM+21S4GgsCIjReITHkdtSfAn 3BF5dIruFXVEsIz0glLN/Q2fkttN0T8LFCc4pr8MeBAUHaEskZYa8uebd/VZa/mvCHFq UtwA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a8-20020a056a000c8800b005a0c57eac92si20019007pfv.232.2023.02.21.00.00.27; Tue, 21 Feb 2023 00:00:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233668AbjBUHid (ORCPT <rfc822;kautuk.consul.80@gmail.com> + 99 others); Tue, 21 Feb 2023 02:38:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233214AbjBUHib (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 21 Feb 2023 02:38:31 -0500 Received: from out30-130.freemail.mail.aliyun.com (out30-130.freemail.mail.aliyun.com [115.124.30.130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 77331C178; Mon, 20 Feb 2023 23:37:56 -0800 (PST) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R151e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046060;MF=ziyangzhang@linux.alibaba.com;NM=1;PH=DS;RN=5;SR=0;TI=SMTPD_---0VcB7gWq_1676965067; Received: from localhost.localdomain(mailfrom:ZiyangZhang@linux.alibaba.com fp:SMTPD_---0VcB7gWq_1676965067) by smtp.aliyun-inc.com; Tue, 21 Feb 2023 15:37:51 +0800 From: Ziyang Zhang <ZiyangZhang@linux.alibaba.com> To: axboe@kernel.dk, asml.silence@gmail.com Cc: io-uring@vger.kernel.org, linux-kernel@vger.kernel.org, Ziyang Zhang <ZiyangZhang@linux.alibaba.com> Subject: [PATCH tools/io_uring] tools/io_uring: correctly set "ret" for sq_poll case Date: Tue, 21 Feb 2023 15:37:36 +0800 Message-Id: <20230221073736.628851-1-ZiyangZhang@linux.alibaba.com> X-Mailer: git-send-email 2.18.4 X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758426762548527828?= X-GMAIL-MSGID: =?utf-8?q?1758426762548527828?= |
Series |
[tools/io_uring] tools/io_uring: correctly set "ret" for sq_poll case
|
|
Commit Message
Ziyang Zhang
Feb. 21, 2023, 7:37 a.m. UTC
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 <ZiyangZhang@linux.alibaba.com>
---
tools/io_uring/io_uring-bench.c | 3 +++
1 file changed, 3 insertions(+)
Comments
On 2/21/23 12:37?AM, Ziyang Zhang wrote: > 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". Can you check if this issue also exists in the fio copy of this, which is t/io_uring.c in: git://git.kernel.dk/fio The copy in the kernel is pretty outdated at this point, and should probably get removed. But if the bug is in the above main version, then we should fix it there and then ponder if we want to remove the one in the kernel or just get it updated to match the upstream version.
On 2023/2/23 11:46, Jens Axboe wrote: > On 2/21/23 12:37?AM, Ziyang Zhang wrote: >> 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". > > Can you check if this issue also exists in the fio copy of this, which > is t/io_uring.c in: > > git://git.kernel.dk/fio > > The copy in the kernel is pretty outdated at this point, and should > probably get removed. But if the bug is in the above main version, then > we should fix it there and then ponder if we want to remove the one in > the kernel or just get it updated to match the upstream version. > Hi Jens, I have checked t/io_uring.c and the code is correct with sq_poll. Regards, Zhang
On 2/23/23 7:25 PM, Ziyang Zhang wrote: > On 2023/2/23 11:46, Jens Axboe wrote: >> On 2/21/23 12:37?AM, Ziyang Zhang wrote: >>> 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". >> >> Can you check if this issue also exists in the fio copy of this, which >> is t/io_uring.c in: >> >> git://git.kernel.dk/fio >> >> The copy in the kernel is pretty outdated at this point, and should >> probably get removed. But if the bug is in the above main version, then >> we should fix it there and then ponder if we want to remove the one in >> the kernel or just get it updated to match the upstream version. >> > > Hi Jens, > > I have checked t/io_uring.c and the code is correct with sq_poll. OK good, I'll attempt a sync with the kernel copy...
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) {