From patchwork Fri Oct 21 08:12:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dylan Yudaken X-Patchwork-Id: 13014378 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 11983C433FE for ; Fri, 21 Oct 2022 08:12:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229568AbiJUIMa (ORCPT ); Fri, 21 Oct 2022 04:12:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229766AbiJUIM2 (ORCPT ); Fri, 21 Oct 2022 04:12:28 -0400 Received: from mx0a-00082601.pphosted.com (mx0a-00082601.pphosted.com [67.231.145.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D59C824AAE4 for ; Fri, 21 Oct 2022 01:12:26 -0700 (PDT) Received: from pps.filterd (m0109333.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 29L193fI000780 for ; Fri, 21 Oct 2022 01:12:26 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=meta.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding : content-type; s=s2048-2021-q4; bh=nHIQPPlmlv4wqbz+l8cqctxe7JXXzihpFMTawj1y8CY=; b=BHNgBIKluNjnfvr/DjL4JitXRDIWJVFmI+vL5XrqSlizMdKcIVd2HUwcvy7po78sUXb1 rgGn/K2hUkPGKW0/Pkg/okktMIMo5iAoKFcW5tmCehU9ZqqwZEpfIUMndgsfbNgqpcuh iAvy1RW/dLRrb9gEwxeNTkypl0us+sDlvsqKXPWptAKDouvPHgRUj4ofcdI4JAgzVJyu E94p596pcztrZIm007XfSHeMGKWk39pVsP49a8oogfmrfIecqKBn2o28phwzhX5lfQXm K6gnTibhYI4pyPXddg3pZgTzoyhq0UU24+FNyIRshsgQzo0bCmNUUd0eGZT/jeu9DUGY DA== Received: from maileast.thefacebook.com ([163.114.130.16]) by mx0a-00082601.pphosted.com (PPS) with ESMTPS id 3kbhgjagft-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Fri, 21 Oct 2022 01:12:26 -0700 Received: from twshared5252.09.ash9.facebook.com (2620:10d:c0a8:1b::d) by mail.thefacebook.com (2620:10d:c0a8:83::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 21 Oct 2022 01:12:24 -0700 Received: by devbig038.lla2.facebook.com (Postfix, from userid 572232) id 7439080B4B91; Fri, 21 Oct 2022 01:12:10 -0700 (PDT) From: Dylan Yudaken To: Jens Axboe , Pavel Begunkov CC: , Dylan Yudaken Subject: [PATCH liburing] fix recv-multishot test skipping in 6.1 Date: Fri, 21 Oct 2022 01:12:07 -0700 Message-ID: <20221021081207.2607808-1-dylany@meta.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-FB-Internal: Safe X-Proofpoint-ORIG-GUID: 4srq4urqvEENbeAPJHSUpEqkOIh9gNrx X-Proofpoint-GUID: 4srq4urqvEENbeAPJHSUpEqkOIh9gNrx X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-10-21_03,2022-10-20_01,2022-06-22_01 Precedence: bulk List-ID: X-Mailing-List: io-uring@vger.kernel.org This test was skipping in IORING_SETUP_DEFER_TASKRUN as it was not flushing the work queue before checking for completions. Additionally fix the test to only skip if it is the first loop. Fixes: f91105d54955 ("update existing tests for defer taskrun") Signed-off-by: Dylan Yudaken --- test/recv-multishot.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) base-commit: 1ddd58dab67ea21b94463326ddfda0388ca21ca2 diff --git a/test/recv-multishot.c b/test/recv-multishot.c index 1a041f8e865a..e7c1a99dc0a6 100644 --- a/test/recv-multishot.c +++ b/test/recv-multishot.c @@ -13,7 +13,7 @@ #include "liburing.h" #include "helpers.h" -static int no_recv_mshot; +#define ENORECVMULTISHOT 9999 enum early_error_t { ERROR_NONE = 0, @@ -139,6 +139,7 @@ static int test(struct args *args) sqe = io_uring_get_sqe(&ring); io_uring_prep_provide_buffers(sqe, recv_buffs[i], buffer_size, 1, 7, i); + io_uring_sqe_set_data64(sqe, 0x999); memset(recv_buffs[i], 0xcc, buffer_size); if (io_uring_submit_and_wait_timeout(&ring, &cqe, 1, &timeout, NULL) != 0) { fprintf(stderr, "provide buffers failed: %d\n", ret); @@ -186,13 +187,19 @@ static int test(struct args *args) if (args->early_error == ERROR_EARLY_CLOSE_RECEIVER) { /* allow previous sends to complete */ usleep(1000); + io_uring_get_events(&ring); sqe = io_uring_get_sqe(&ring); io_uring_prep_recv(sqe, fds[0], NULL, 0, 0); io_uring_prep_cancel64(sqe, 1234, 0); + io_uring_sqe_set_data64(sqe, 0x888); sqe->flags |= IOSQE_CQE_SKIP_SUCCESS; io_uring_submit(&ring); early_error_started = true; + + /* allow the cancel to complete */ + usleep(1000); + io_uring_get_events(&ring); } if (args->early_error == ERROR_EARLY_CLOSE_SENDER) { early_error_started = true; @@ -246,12 +253,10 @@ static int test(struct args *args) at = &send_buff[0]; if (recv_cqes < min_cqes) { if (recv_cqes > 0 && recv_cqe[0].res == -EINVAL) { - no_recv_mshot = 1; - return 0; + return -ENORECVMULTISHOT; } /* some kernels apparently don't check ->ioprio, skip */ - ret = 0; - no_recv_mshot = 1; + ret = -ENORECVMULTISHOT; goto cleanup; } for (i = 0; i < recv_cqes; i++) { @@ -481,14 +486,18 @@ int main(int argc, char *argv[]) a.early_error = (enum early_error_t)early_error; ret = test(&a); if (ret) { + if (ret == -ENORECVMULTISHOT) { + if (loop == 0) + return T_EXIT_SKIP; + fprintf(stderr, + "ENORECVMULTISHOT received but loop>0\n"); + } fprintf(stderr, "test stream=%d wait_each=%d recvmsg=%d early_error=%d " " defer=%d failed\n", a.stream, a.wait_each, a.recvmsg, a.early_error, a.defer); return T_EXIT_FAIL; } - if (no_recv_mshot) - return T_EXIT_SKIP; } }