Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp571036lqe; Sat, 6 Apr 2024 13:33:16 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWXt2jYEOdH2nogbamem45bwTW6s2xM1IyD6ol+rfagDoAS0FwgMr3AxTMLA5EHGFu3pM6Yk+ER7ld/zFG3KZ32Ju7vU9siENZhRSgA1g== X-Google-Smtp-Source: AGHT+IHcy2mKwQ4sDcoWzl1VJv9r39CfT2vSE9sCFxoum1rSOaMizZOE6xgaqwePI+Tng2ZV+9w2 X-Received: by 2002:a17:90a:ba82:b0:2a4:e9d:9888 with SMTP id t2-20020a17090aba8200b002a40e9d9888mr4297467pjr.16.1712435596218; Sat, 06 Apr 2024 13:33:16 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712435596; cv=pass; d=google.com; s=arc-20160816; b=YvxF8BTPx3CvFzgYskGXsL0F1chBtO9XSarZ/od9av6a91k8Zi1XsbR7IbySgqD3Qh aCKhJrJ5CVYQpUNsAsAD8rOCVucP7aVs1UIXaPJyG00CqWIzvrdUqnSYg9UPXDn8IgrR kp1oAO1gkZqEupV8wPqA/vwvbS3De4oNbP6CsiyB+8ADuWl/8r3duWnEzQzm3Kv5vAC4 38AWbOqldF+3TymJkxceWMRyS9hY3eq7/8H50gh0YdGJyXADNFMTA/ROd4DxVOXEaFDw uye1Gy5JhptVc+wYLq2XRMQIiZ9Gimj4SMhrhKX8AqqwPJm6G4Yz/xeRcyg5AM5yN5vs 97jw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:cc:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=eZtNT1K4lz88ArQobV9gQ8kWIU9sBgBHD6hqez8JfTw=; fh=ppmER0oWwdSAJTpoGCNXiqh3ReHcUrHWUq1w2S1Rk1g=; b=eJ4/L9puSMdx/M2ODpXlnEQQyCXF3XagA4pYOz6iqROCbEUQuJwsisivrVYhCroj6G DpJmv7szbLyGcniSRuWaxSQYKSADtEwSow249MPGGHu5w51iE3/mL24o9vPxNG8LQtVR L2mHToLfxulOG8nosElaYNO25x085Fu9UFfjqBbylUkZHxiM6jwNUX7490EcUksbuHlh OvIm8UQttSIeuXFjkE3MgguJzLrST/f85nX25SrA1L+14iVhCVEhr+04ZiZRRTwsxuoA MHEKyz4WIDw80u30YYOVD06cNVsUzjmPgF0uTVFQZ5UtwgmXFd74K3TmbfRrsb/B3zoJ xXdQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=XVZqoPTK; arc=pass (i=1 spf=pass spfdomain=collabora.com dkim=pass dkdomain=collabora.com dmarc=pass fromdomain=collabora.com); spf=pass (google.com: domain of linux-kernel+bounces-134073-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-134073-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id p9-20020a63e649000000b005dc430e6e30si3602274pgj.788.2024.04.06.13.33.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Apr 2024 13:33:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-134073-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=XVZqoPTK; arc=pass (i=1 spf=pass spfdomain=collabora.com dkim=pass dkdomain=collabora.com dmarc=pass fromdomain=collabora.com); spf=pass (google.com: domain of linux-kernel+bounces-134073-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-134073-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 6A44DB22324 for ; Sat, 6 Apr 2024 20:33:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D45684E1C1; Sat, 6 Apr 2024 20:32:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="XVZqoPTK" Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1FBF5184D; Sat, 6 Apr 2024 20:32:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.235.227.194 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712435578; cv=none; b=BHHr69eIAMSYpQz3Dnk4hfqM4PKqeqMptHVAtfvWc3ehuERAaTJ6sHoyJ5ANfIEZ79qPHmCvPXJtACapRhnvyLD3/Os+8fYYqcMJmMKC1lf+EnAVmnF9mTOhwU9NrrJgpqjI2xAiVr4qkZmRhNeL9LWg5Zxc21SJNKOMGmNr/Y4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712435578; c=relaxed/simple; bh=LAEg5Ivu9HF4b4fa+ZIoBLhuYmj8ETr3wPzmxKiEkbs=; h=Message-ID:Date:MIME-Version:Cc:Subject:To:References:From: In-Reply-To:Content-Type; b=oZplvxCmN87/wlJOGuEj7DMlUQw+jKqaZcdL3mM6ZoS4ikXdFAJXuRtz2wdqGIRt3lZBd1YPQiKXby2YzPDlLZUL1l/1aJu4v27h9WdX3B1q1jwBpR8B1zaXHlaeTlJwgf3r49WSxrZYkSd9nrt6GQNgRPJb6L3uZmr8A3m5DhM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=XVZqoPTK; arc=none smtp.client-ip=46.235.227.194 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1712435568; bh=LAEg5Ivu9HF4b4fa+ZIoBLhuYmj8ETr3wPzmxKiEkbs=; h=Date:Cc:Subject:To:References:From:In-Reply-To:From; b=XVZqoPTKbgPtCX95A5JD+hPA+TmRg609YYOU4+m1BJc2vwrl2MtpRW2HfuH0HynOZ oZurHqDTC5tTLiD0fg18tTDxWyHUKlIjyVsTUklIgxH2uoOjNW/GmM3Oox37HvTci/ d29wkDwGTS0fuRjMT4jaYj3tW48eXQ9GJpNVgqNemPbPk04KMQcwjQI+viW7EoTJc8 4EZJei+qUhYf8K1u36DZeOuvET9pQN8eqKQuuTZy9qPNFFb8FQ67eQSqXJcDSEVYkO 8pIEcNjTQKGq+rlRSugYTXPp0EfTZmpE0B09E+OFppZ+DcC9m+6ilaJhyVJDlxq+K1 u8Fxsw2oxifqQ== Received: from [100.113.15.66] (ec2-34-240-57-77.eu-west-1.compute.amazonaws.com [34.240.57.77]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: usama.anjum) by madrid.collaboradmins.com (Postfix) with ESMTPSA id 7F15D37809D1; Sat, 6 Apr 2024 20:32:43 +0000 (UTC) Message-ID: <4123ead2-9071-4ca2-8612-8999ed1140b3@collabora.com> Date: Sun, 7 Apr 2024 01:33:16 +0500 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Cc: Muhammad Usama Anjum , io-uring@vger.kernel.org, netdev@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 3/3] io_uring: Support IOSQE_CQE_SKIP_SUCCESS in io_uring zerocopy test To: Oliver Crumrine , axboe@kernel.dk, asml.silence@gmail.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, shuah@kernel.org, leitao@debian.org References: Content-Language: en-US From: Muhammad Usama Anjum In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 4/5/24 3:19 AM, Oliver Crumrine wrote: > Add support for the IOSQE_CQE_SKIP_SUCCESS flag in the io_uring_zerocopy_tx > test, using the "-a" option. Instead of incrementing when > IORING_CQE_F_MORE is set, remember how many SQEs are sent and simply > wait on notifs instead of regular completions. For non-zc stuff, there > won't be notifs or completions, so don't wait on either of those, but > check the completion queue for errors at the end to make sure none have > popped up. > > The changes to the shell script run the tests both with and without the > "-a" option. > > Signed-off-by: Oliver Crumrine Acked-by: Muhammad Usama Anjum > --- > .../selftests/net/io_uring_zerocopy_tx.c | 38 +++++++++++++++++-- > .../selftests/net/io_uring_zerocopy_tx.sh | 7 +++- > 2 files changed, 39 insertions(+), 6 deletions(-) > > diff --git a/tools/testing/selftests/net/io_uring_zerocopy_tx.c b/tools/testing/selftests/net/io_uring_zerocopy_tx.c > index 76e604e4810e..11a43594935f 100644 > --- a/tools/testing/selftests/net/io_uring_zerocopy_tx.c > +++ b/tools/testing/selftests/net/io_uring_zerocopy_tx.c > @@ -50,8 +50,10 @@ enum { > }; > > static bool cfg_cork = false; > +static bool cfg_nocqe = false; > static int cfg_mode = MODE_ZC_FIXED; > static int cfg_nr_reqs = 8; > +static int cfg_nr_completions = 8; > static int cfg_family = PF_UNSPEC; > static int cfg_payload_len; > static int cfg_port = 8000; > @@ -134,11 +136,21 @@ static void do_tx(int domain, int type, int protocol) > if (mode == MODE_NONZC) { > io_uring_prep_send(sqe, fd, payload, > cfg_payload_len, msg_flags); > + if (cfg_nocqe) { > + sqe->flags |= IOSQE_CQE_SKIP_SUCCESS; > + cfg_nr_completions--; > + } > sqe->user_data = NONZC_TAG; > } else { > io_uring_prep_sendzc(sqe, fd, payload, > cfg_payload_len, > msg_flags, zc_flags); > + if (cfg_nocqe) { > + sqe->flags |= IOSQE_CQE_SKIP_SUCCESS; > + packets++; > + compl_cqes++; > + bytes += cfg_payload_len; > + } > if (mode == MODE_ZC_FIXED) { > sqe->ioprio |= IORING_RECVSEND_FIXED_BUF; > sqe->buf_index = buf_idx; > @@ -153,7 +165,7 @@ static void do_tx(int domain, int type, int protocol) > > if (cfg_cork) > do_setsockopt(fd, IPPROTO_UDP, UDP_CORK, 0); > - for (i = 0; i < cfg_nr_reqs; i++) { > + for (i = 0; i < cfg_nr_completions; i++) { > ret = io_uring_wait_cqe(&ring, &cqe); > if (ret) > error(1, ret, "wait cqe"); > @@ -168,7 +180,9 @@ static void do_tx(int domain, int type, int protocol) > if (compl_cqes <= 0) > error(1, -EINVAL, "notification mismatch"); > compl_cqes--; > - i--; > + if (!cfg_nocqe) > + i--; > io_uring_cqe_seen(&ring); > continue; > } > @@ -200,6 +214,17 @@ static void do_tx(int domain, int type, int protocol) > compl_cqes--; > } > > + /* The above code does not account for a send error when > + * IOSQE_CQE_SKIP_SUCCESS is set. This is operating under the > + * assumption that an error CQE will get put on the ring before > + * the above code completes: > + */ > + while (!io_uring_peek_cqe(&ring, &cqe)) { > + if (cqe->res == -EAGAIN) > + continue; > + error(1, -EINVAL, "send failed"); > + } > + > fprintf(stderr, "tx=%lu (MB=%lu), tx/s=%lu (MB/s=%lu)\n", > packets, bytes >> 20, > packets / (cfg_runtime_ms / 1000), > @@ -221,7 +246,7 @@ static void do_test(int domain, int type, int protocol) > static void usage(const char *filepath) > { > error(1, 0, "Usage: %s (-4|-6) (udp|tcp) -D [-s] " > - "[-t