From patchwork Tue Feb 21 01:05:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Begunkov X-Patchwork-Id: 13147228 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 EFE08C64EC4 for ; Tue, 21 Feb 2023 01:07:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229560AbjBUBHG (ORCPT ); Mon, 20 Feb 2023 20:07:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47320 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232650AbjBUBHF (ORCPT ); Mon, 20 Feb 2023 20:07:05 -0500 Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE05021969 for ; Mon, 20 Feb 2023 17:07:02 -0800 (PST) Received: by mail-wm1-x32c.google.com with SMTP id o14so2424291wms.1 for ; Mon, 20 Feb 2023 17:07:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Rhrr1oicBaGJb+5NjdEr++Wc9UTuIi4g2aMijxtMqn8=; b=kFPpIxOdFTc+FVitCgobA3fEv+Th38Yu+vK2R7Ex76ikWweop+M2BtC359dp5uQD9Y 2hKG7tGGS2Xe4jK4/NmJsyPyaz4l8QfmiGQYvDOnqBoUNVmw7A4C/Eyex2QyOaP69HVL 81NNI1hJtVZDa2UZHOwGUDPZ7gxHVirOrG42O07qqcduJBzWpZ/Wr95BZ7+UIxQbUqFU VWv1Rm3wYrDbFl2eAUWMzlFwXhTI53MvE/p4jyDF34hMbDEJ9HXseJWObMHpGOIy2Cpe zAAU6Av45Qo31P18SQh3DjqgnWKKct0K1rh9MPrYUYxi5SaOsBiCKEP+zOJCIFwyNc9Y BevA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Rhrr1oicBaGJb+5NjdEr++Wc9UTuIi4g2aMijxtMqn8=; b=Zcns53rLIv8D5tf/JomL10R2BYUK0FwkS2LyE4hjag/EUyTo+i+m2sYlUDWdKCbfrU Dab1ywFjhoJjCqloUuQpeM5NigJmMCGO/OBE0yLORxr4ni1YHGyhgx2cysxOfxMaXksB nB/FHSUiDKWRN0Mw5HhfWJ53IpmRPW9hcT288Akyqrl5V3aZi8SVMb+kz25/dP7j8b8w HpvqlAMvLA65blPgglSn0PgLpVn+ig6zL8xMKY3cqVAuWnW3MQamaEpW6fuGI/vqtzS2 +rZeGC6Fi1R1WP7CwLRtUSBYAFCOa1NZEL4pD4kiw+TLXRqP/8VRc1dvcg4xyFFO6kZ6 fZvw== X-Gm-Message-State: AO0yUKVc/77D7AR17dPUJUyr9vgM43e/lF7cgRewcmJXHAGqyTg6W2jq Jj6AIoMmpHGmQsfkJcImnL0d21BzPgM= X-Google-Smtp-Source: AK7set8uggAldBCb+TDqlsp0IgIdsbyJPqgMweKDDHFoWPZ9AD89WoadNksXEGUJr86mYJQGlwCFoQ== X-Received: by 2002:a05:600c:3088:b0:3df:ed95:d757 with SMTP id g8-20020a05600c308800b003dfed95d757mr7752811wmn.34.1676941621152; Mon, 20 Feb 2023 17:07:01 -0800 (PST) Received: from 127.0.0.1localhost (94.196.95.64.threembb.co.uk. [94.196.95.64]) by smtp.gmail.com with ESMTPSA id k17-20020a7bc411000000b003dfee43863fsm2092469wmi.26.2023.02.20.17.07.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Feb 2023 17:07:00 -0800 (PST) From: Pavel Begunkov To: io-uring@vger.kernel.org Cc: Jens Axboe , asml.silence@gmail.com Subject: [PATCH liburing 1/7] tests/send: don't use a constant for page size Date: Tue, 21 Feb 2023 01:05:52 +0000 Message-Id: X-Mailer: git-send-email 2.39.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: io-uring@vger.kernel.org Signed-off-by: Pavel Begunkov --- test/send-zerocopy.c | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/test/send-zerocopy.c b/test/send-zerocopy.c index 86a31cd..2e30e49 100644 --- a/test/send-zerocopy.c +++ b/test/send-zerocopy.c @@ -58,6 +58,10 @@ enum { BUF_T_LARGE, }; +/* 32MB, should be enough to trigger a short send */ +#define LARGE_BUF_SIZE (1U << 25) + +static size_t page_sz; static char *tx_buffer, *rx_buffer; static struct iovec buffers_iov[4]; static bool has_sendmsg; @@ -706,6 +710,8 @@ int main(int argc, char *argv[]) if (argc > 1) return T_EXIT_SKIP; + page_sz = sysconf(_SC_PAGESIZE); + /* create TCP IPv6 pair */ ret = create_socketpair_ip(&addr, &sp[0], &sp[1], true, true, false, true); if (ret) { @@ -713,30 +719,35 @@ int main(int argc, char *argv[]) return T_EXIT_FAIL; } - len = 1U << 25; /* 32MB, should be enough to trigger a short send */ - tx_buffer = aligned_alloc(4096, len); - rx_buffer = aligned_alloc(4096, len); + len = LARGE_BUF_SIZE; + tx_buffer = aligned_alloc(page_sz, len); + rx_buffer = aligned_alloc(page_sz, len); if (tx_buffer && rx_buffer) { buffers_iov[BUF_T_LARGE].iov_base = tx_buffer; buffers_iov[BUF_T_LARGE].iov_len = len; } else { + if (tx_buffer) + free(tx_buffer); + if (rx_buffer) + free(rx_buffer); + printf("skip large buffer tests, can't alloc\n"); - len = 8192; - tx_buffer = aligned_alloc(4096, len); - rx_buffer = aligned_alloc(4096, len); + len = 2 * page_sz; + tx_buffer = aligned_alloc(page_sz, len); + rx_buffer = aligned_alloc(page_sz, len); } if (!tx_buffer || !rx_buffer) { fprintf(stderr, "can't allocate buffers\n"); return T_EXIT_FAIL; } - buffers_iov[BUF_T_NORMAL].iov_base = tx_buffer + 4096; - buffers_iov[BUF_T_NORMAL].iov_len = 4096; + buffers_iov[BUF_T_NORMAL].iov_base = tx_buffer + page_sz; + buffers_iov[BUF_T_NORMAL].iov_len = page_sz; buffers_iov[BUF_T_SMALL].iov_base = tx_buffer; buffers_iov[BUF_T_SMALL].iov_len = 137; buffers_iov[BUF_T_NONALIGNED].iov_base = tx_buffer + BUFFER_OFFSET; - buffers_iov[BUF_T_NONALIGNED].iov_len = 8192 - BUFFER_OFFSET - 13; + buffers_iov[BUF_T_NONALIGNED].iov_len = 2 * page_sz - BUFFER_OFFSET - 13; ret = io_uring_queue_init(32, &ring, 0); if (ret) { From patchwork Tue Feb 21 01:05:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Begunkov X-Patchwork-Id: 13147230 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 4FAC8C636D6 for ; Tue, 21 Feb 2023 01:07:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232686AbjBUBHJ (ORCPT ); Mon, 20 Feb 2023 20:07:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232650AbjBUBHI (ORCPT ); Mon, 20 Feb 2023 20:07:08 -0500 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 86B2321A0E for ; Mon, 20 Feb 2023 17:07:03 -0800 (PST) Received: by mail-wm1-x335.google.com with SMTP id p3-20020a05600c358300b003e206711347so2026458wmq.0 for ; Mon, 20 Feb 2023 17:07:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=pDVStzJ29cUMYfFVfAm67LRJPivRqwrBt7LnrDp5v3k=; b=l7eOQLP+NUN61QDOLnENuuk5TJ/lzFRa7hEsPLwUkMK8SJh1C1BDh62KYwXSLFJ4ZA 4xFDXnZ243p6jiksbAkKmqvQI2OTFaIe6uItTuP9x2XcailXWbfpwg+632svLCcy84yA htAmIOj14RMuerGNWgwJ62jRFCGh1A7ZgUAEuuBkpv4XuGxTGXKoiYnjaOK/y4HwbuAD BWsjeSAvX8/LFlXn4UsdNwS9vAgOZAuMmrDuov6pcy59lbFYeZFwmVcfIWFpx8Fe3OrN UFnGXChGifmt5pEjAQri635j98j6rpaOm3slbLfD72JfVY6cp5Q/KfJIo1WuD87lWJFb ZqIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pDVStzJ29cUMYfFVfAm67LRJPivRqwrBt7LnrDp5v3k=; b=vVKWlgyI+slVi/3Ikyj2UmatM4PP50iQa7TAutQcV8qeOj0B48R5eCDvueZHxoHVmD lv4+vUXMRUy59FObjvly+q3GMTyUKaOyiklmkEyMQOPiYwDkEU19GzyMjXJ4BPqnarrl 7ZnnD4DlNsoceFzfhCkmETP3q7vfu1FzMzhUR+PA6uI7FpYsG31cCP8vF97igJOweEQR lYQcnPS/Lhq650ChEt3DMYTMxMCojDh/11C2qTp5x4sjCB33AihLqrLMVfXNi8gmZtHm Wi/nAu/2hATQChUIjcPKT85OmMIfVHs4NqjEtx5gjiTJT6FGNbJqws0PkkYpb1YFnk5L pEhw== X-Gm-Message-State: AO0yUKU1jtNaooYR2AWQuNInR8MfzLUBeCRf+cMNaUoM2onyphdJTLdV bvV81II3JQGshE4QLY/HX1lRXmmXOXo= X-Google-Smtp-Source: AK7set/eafs8FdCfBInBou/ji8RFUpJt6l7XNROEhhbwLLvBDfLJCgINTKRJOBMPuAErWFGY94Nnqw== X-Received: by 2002:a05:600c:1609:b0:3e2:1592:ccf5 with SMTP id m9-20020a05600c160900b003e21592ccf5mr11349612wmn.8.1676941621855; Mon, 20 Feb 2023 17:07:01 -0800 (PST) Received: from 127.0.0.1localhost (94.196.95.64.threembb.co.uk. [94.196.95.64]) by smtp.gmail.com with ESMTPSA id k17-20020a7bc411000000b003dfee43863fsm2092469wmi.26.2023.02.20.17.07.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Feb 2023 17:07:01 -0800 (PST) From: Pavel Begunkov To: io-uring@vger.kernel.org Cc: Jens Axboe , asml.silence@gmail.com Subject: [PATCH liburing 2/7] send: improve buffer iteration Date: Tue, 21 Feb 2023 01:05:53 +0000 Message-Id: X-Mailer: git-send-email 2.39.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: io-uring@vger.kernel.org Signed-off-by: Pavel Begunkov --- test/send-zerocopy.c | 42 ++++++++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/test/send-zerocopy.c b/test/send-zerocopy.c index 2e30e49..e663be7 100644 --- a/test/send-zerocopy.c +++ b/test/send-zerocopy.c @@ -484,6 +484,7 @@ static int test_inet_send(struct io_uring *ring) struct sockaddr_storage addr; int sock_client = -1, sock_server = -1; int ret, j, i; + int buf_index; for (j = 0; j < 32; j++) { bool ipv6 = j & 1; @@ -510,20 +511,19 @@ static int test_inet_send(struct io_uring *ring) sock_server = tmp_sock; } - for (i = 0; i < 4096; i++) { + for (i = 0; i < 1024; i++) { bool regbuf; - conf.buf_index = i & 3; + conf.use_sendmsg = i & 1; + conf.poll_first = i & 2; conf.fixed_buf = i & 4; conf.addr = (i & 8) ? &addr : NULL; conf.cork = i & 16; conf.mix_register = i & 32; conf.force_async = i & 64; - conf.use_sendmsg = i & 128; - conf.zc = i & 256; - conf.iovec = i & 512; - conf.long_iovec = i & 1024; - conf.poll_first = i & 2048; + conf.zc = i & 128; + conf.iovec = i & 256; + conf.long_iovec = i & 512; conf.tcp = tcp; regbuf = conf.mix_register || conf.fixed_buf; @@ -539,10 +539,6 @@ static int test_inet_send(struct io_uring *ring) if (conf.addr && !has_sendmsg) continue; } - if (conf.buf_index == BUF_T_LARGE && !tcp) - continue; - if (!buffers_iov[conf.buf_index].iov_base) - continue; if (tcp && (conf.cork || conf.addr)) continue; if (conf.mix_register && (!conf.cork || conf.fixed_buf)) @@ -554,13 +550,23 @@ static int test_inet_send(struct io_uring *ring) if (msg_zc_set && !conf.zc) continue; - ret = do_test_inet_send(ring, sock_client, sock_server, &conf); - if (ret) { - fprintf(stderr, "send failed fixed buf %i, conn %i, addr %i, " - "cork %i\n", - conf.fixed_buf, client_connect, !!conf.addr, - conf.cork); - return 1; + for (buf_index = 0; buf_index < ARRAY_SIZE(buffers_iov); buf_index++) { + size_t len = buffers_iov[buf_index].iov_len; + + if (!buffers_iov[buf_index].iov_base) + continue; + if (!tcp && len > 4 * page_sz) + continue; + + conf.buf_index = buf_index; + ret = do_test_inet_send(ring, sock_client, sock_server, &conf); + if (ret) { + fprintf(stderr, "send failed fixed buf %i, " + "conn %i, addr %i, cork %i\n", + conf.fixed_buf, client_connect, + !!conf.addr, conf.cork); + return 1; + } } } From patchwork Tue Feb 21 01:05:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Begunkov X-Patchwork-Id: 13147234 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 CA079C64EC4 for ; Tue, 21 Feb 2023 01:07:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232971AbjBUBHK (ORCPT ); Mon, 20 Feb 2023 20:07:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47362 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232965AbjBUBHI (ORCPT ); Mon, 20 Feb 2023 20:07:08 -0500 Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 55C4B22030 for ; Mon, 20 Feb 2023 17:07:04 -0800 (PST) Received: by mail-wm1-x336.google.com with SMTP id p3-20020a05600c358300b003e206711347so2026477wmq.0 for ; Mon, 20 Feb 2023 17:07:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=OMVNMVd8aSkCu82AxH2WGVGFz2ZJ4OqZ2LItsoW1tpA=; b=NvnFUSnHOiyDJ9pYIONsKlbo+1DA/p755XNrAnRQ8jgMp9lWU3vZdM2Y9R5cRHDsxD 3IOv7n0GGXCouqFGbt/LTDp3x6QpP2ipUQnGf3w3s3tIDGBreaDEf0kuFYefXveHiO79 UZSDQ/pXvqOnxFZORt3irdgdwlxCxCo0R/xk4Rl0CJikhLmOXH85n9CiYRkGTpYxKVNW X2hJNE3Z56KJCNTRqaXAGgi9zeYEaIKL5+RCF8u8zZ4mKfIP/Ak3hgbXPOBllLrfiBTY 2F0bF/GotmubyS4x8lzNosPVFqSch7NEv7W4Nz4zmYqgQ4myuBMkW5lrG+ShOaVl8Sh/ FxCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=OMVNMVd8aSkCu82AxH2WGVGFz2ZJ4OqZ2LItsoW1tpA=; b=DobD53Lgc9Ighhy65d6Mb2PMsDm+/wQlY0P7+LKkWrEdPb9vR8soBw0MOEiaveIJy2 lwJh31qLC1DQVsqysNTNrCwm5g9rkK/mrctijZQxFGjglA+Zyv3EQykUYYakpXuGz3t0 9n4NSDW9xOH7o/HprHnao2NX2uKx5Hy8aPUMmkZgviCJ/bCKkFa+lAWyha8llGPcvD2F B1eLcdABb8rlZT/p4v9aUbrOjxmoR6iB2U6z5G1sl4Qq72On0eWHhnu7R8cxDoPKh8Wa cHIJpErMmKdN8tY907uQZwNwi9NuMRlyOnRViZepla2RLETfR6eYxGd8wTH3k9YB7xRw ZEiA== X-Gm-Message-State: AO0yUKWHpQ4ZO1CbFACTZuVAtvI36Pd6cMfKSJU4EtPcJWZOEKVo4te+ 2kQQQITr2nY0J+5zt4sNfUdXPsin99Q= X-Google-Smtp-Source: AK7set+NMsgXGBUmZY6XDJZnb3T7nmOovtOun9naV9Fx4lRsHFjaIouN2FLdVGxY5rHkAHOLXYx33g== X-Received: by 2002:a05:600c:3b11:b0:3e2:669:757 with SMTP id m17-20020a05600c3b1100b003e206690757mr1739705wms.10.1676941622730; Mon, 20 Feb 2023 17:07:02 -0800 (PST) Received: from 127.0.0.1localhost (94.196.95.64.threembb.co.uk. [94.196.95.64]) by smtp.gmail.com with ESMTPSA id k17-20020a7bc411000000b003dfee43863fsm2092469wmi.26.2023.02.20.17.07.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Feb 2023 17:07:02 -0800 (PST) From: Pavel Begunkov To: io-uring@vger.kernel.org Cc: Jens Axboe , asml.silence@gmail.com Subject: [PATCH liburing 3/7] send: test send with hugetlb Date: Tue, 21 Feb 2023 01:05:54 +0000 Message-Id: X-Mailer: git-send-email 2.39.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: io-uring@vger.kernel.org Signed-off-by: Pavel Begunkov --- test/send-zerocopy.c | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/test/send-zerocopy.c b/test/send-zerocopy.c index e663be7..f1277fa 100644 --- a/test/send-zerocopy.c +++ b/test/send-zerocopy.c @@ -33,6 +33,8 @@ #include #include #include +#include +#include #include "liburing.h" #include "helpers.h" @@ -56,6 +58,9 @@ enum { BUF_T_SMALL, BUF_T_NONALIGNED, BUF_T_LARGE, + BUF_T_HUGETLB, + + __BUF_NR, }; /* 32MB, should be enough to trigger a short send */ @@ -63,7 +68,7 @@ enum { static size_t page_sz; static char *tx_buffer, *rx_buffer; -static struct iovec buffers_iov[4]; +static struct iovec buffers_iov[__BUF_NR]; static bool has_sendmsg; static bool check_cq_empty(struct io_uring *ring) @@ -748,6 +753,11 @@ int main(int argc, char *argv[]) return T_EXIT_FAIL; } + srand((unsigned)time(NULL)); + for (i = 0; i < len; i++) + tx_buffer[i] = i; + memset(rx_buffer, 0, len); + buffers_iov[BUF_T_NORMAL].iov_base = tx_buffer + page_sz; buffers_iov[BUF_T_NORMAL].iov_len = page_sz; buffers_iov[BUF_T_SMALL].iov_base = tx_buffer; @@ -755,17 +765,26 @@ int main(int argc, char *argv[]) buffers_iov[BUF_T_NONALIGNED].iov_base = tx_buffer + BUFFER_OFFSET; buffers_iov[BUF_T_NONALIGNED].iov_len = 2 * page_sz - BUFFER_OFFSET - 13; + if (len == LARGE_BUF_SIZE) { + void *huge_page; + int off = page_sz + 27; + + len = 1U << 22; + huge_page = mmap(NULL, len, PROT_READ|PROT_WRITE, + MAP_PRIVATE | MAP_HUGETLB | MAP_HUGE_2MB | MAP_ANONYMOUS, + -1, 0); + if (huge_page != MAP_FAILED) { + buffers_iov[BUF_T_HUGETLB].iov_base = huge_page + off; + buffers_iov[BUF_T_HUGETLB].iov_len = len - off; + } + } + ret = io_uring_queue_init(32, &ring, 0); if (ret) { fprintf(stderr, "queue init failed: %d\n", ret); return T_EXIT_FAIL; } - srand((unsigned)time(NULL)); - for (i = 0; i < len; i++) - tx_buffer[i] = i; - memset(rx_buffer, 0, len); - ret = test_basic_send(&ring, sp[0], sp[1]); if (ret == T_EXIT_SKIP) return ret; From patchwork Tue Feb 21 01:05:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Begunkov X-Patchwork-Id: 13147229 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 92675C61DA3 for ; Tue, 21 Feb 2023 01:07:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232966AbjBUBHI (ORCPT ); Mon, 20 Feb 2023 20:07:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47356 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232686AbjBUBHI (ORCPT ); Mon, 20 Feb 2023 20:07:08 -0500 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 31510212AF for ; Mon, 20 Feb 2023 17:07:05 -0800 (PST) Received: by mail-wm1-x335.google.com with SMTP id j2-20020a05600c1c0200b003e1e754657aso2332985wms.2 for ; Mon, 20 Feb 2023 17:07:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=PxtyHXpUeeZ5x2CT7DOcmWvZuW372J15FIqrjokY6vs=; b=ZaV52/bCUvSo3QL3gvBvH4t2sV3RW0gD4hlqix5bvf9Qd3QDdUhaGsPgmWQQpVOPfU lwz7GtxIv9fAGRUZMzdpyu/EDmsrss/29NQ8ElcgBJ7JoA2+RMWNl98L8LTjy/HXr9nX XPXXmsGYJBcS8iYX98VwdeVcL3S9dbkFaKzbpZw4B4r+ZK/bDcpj20G23uQnZJMxE7Y4 1SCxNnQmc6RCpdZBcNETGtBCbmaae8+JtmRkC/wrQkSe+gx2JcZegtOmhN+K0saFD2um M6Wmz/OAYmqky2xset4Rx2Anpd2Z3I0W+k5p0o/9isIu3ZfYQOv8wkkN0lNFVn0lseVT b4nQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PxtyHXpUeeZ5x2CT7DOcmWvZuW372J15FIqrjokY6vs=; b=NLaw8ek4BkL6J+U6g4vzl7mI5/re7pYPq0CoPjvClngEtrnp38p8YWUwBvAaQWqXkB fWS1E2qfci4Lcu+gMYgyWvd0wcLp8XBMM7RZLKwkJB5lAtWFeCGm1pz+fGQNDNURtrPg I0tBERJzAxWgL/ZC/m6Lv7g71pMjJU3F1fQbpe+4goIAR4Vwx+LIgphC4Akfg5sTk8CF eW4mR6+uHL0hUg1fr86YGqUqZV3nU4tL+gm+OeDAU1p+TMyrKh69UODwHvOO4AHVcEN/ fhX+5XIX6BML7KENBiHug/WZn9qEeV6AJ0KPgQB1OA9Imwgm42bCxJSKAqL3TS6erJaN M2Fg== X-Gm-Message-State: AO0yUKXxtiHNAMlSWUHFILxgSF4cPgErYp65j4MwMRpWROLquaNSdDUQ eFWsZY0nscWxQTINnB1+Q64tqx/x84M= X-Google-Smtp-Source: AK7set8MQguAD0f/c2sFUdzTKYTPBALvXxgXZyp0jG5yCcR/U9oscp7HPLaLKZHcKRwdgCAkcStJ+g== X-Received: by 2002:a05:600c:2e84:b0:3e0:fda8:7e26 with SMTP id p4-20020a05600c2e8400b003e0fda87e26mr1630777wmn.33.1676941623422; Mon, 20 Feb 2023 17:07:03 -0800 (PST) Received: from 127.0.0.1localhost (94.196.95.64.threembb.co.uk. [94.196.95.64]) by smtp.gmail.com with ESMTPSA id k17-20020a7bc411000000b003dfee43863fsm2092469wmi.26.2023.02.20.17.07.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Feb 2023 17:07:03 -0800 (PST) From: Pavel Begunkov To: io-uring@vger.kernel.org Cc: Jens Axboe , asml.silence@gmail.com Subject: [PATCH liburing 4/7] examples/zc: add a hugetlb option Date: Tue, 21 Feb 2023 01:05:55 +0000 Message-Id: <5173d9761815d23800c1b32e95e9f6ebfe10433b.1676941370.git.asml.silence@gmail.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: io-uring@vger.kernel.org Benchmark hugetlb sends Signed-off-by: Pavel Begunkov --- examples/send-zerocopy.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/examples/send-zerocopy.c b/examples/send-zerocopy.c index 6092af9..3a80d3d 100644 --- a/examples/send-zerocopy.c +++ b/examples/send-zerocopy.c @@ -35,6 +35,8 @@ #include #include #include +#include +#include #include "liburing.h" @@ -46,6 +48,7 @@ static bool cfg_fixed_files = 1; static bool cfg_zc = 1; static int cfg_nr_reqs = 8; static bool cfg_fixed_buf = 1; +static bool cfg_hugetlb = 0; static int cfg_family = PF_UNSPEC; static int cfg_payload_len; @@ -55,7 +58,8 @@ static int cfg_runtime_ms = 4200; static socklen_t cfg_alen; static struct sockaddr_storage cfg_dst_addr; -static char payload[IP_MAXPACKET] __attribute__((aligned(4096))); +static char payload_buf[IP_MAXPACKET] __attribute__((aligned(4096))); +static char *payload; /* * Implementation of error(3), prints an error message and exits. @@ -277,7 +281,7 @@ static void usage(const char *filepath) static void parse_opts(int argc, char **argv) { - const int max_payload_len = sizeof(payload) - + const int max_payload_len = IP_MAXPACKET - sizeof(struct ipv6hdr) - sizeof(struct tcphdr) - 40 /* max tcp options */; @@ -289,7 +293,7 @@ static void parse_opts(int argc, char **argv) cfg_payload_len = max_payload_len; - while ((c = getopt(argc, argv, "46D:p:s:t:n:z:b:k")) != -1) { + while ((c = getopt(argc, argv, "46D:p:s:t:n:z:b:l:")) != -1) { switch (c) { case '4': if (cfg_family != PF_UNSPEC) @@ -324,6 +328,9 @@ static void parse_opts(int argc, char **argv) case 'b': cfg_fixed_buf = strtoul(optarg, NULL, 0); break; + case 'l': + cfg_hugetlb = strtoul(optarg, NULL, 0); + break; } } @@ -344,6 +351,17 @@ int main(int argc, char **argv) parse_opts(argc, argv); + payload = payload_buf; + if (cfg_hugetlb) { + payload = mmap(NULL, 2*1024*1024, PROT_READ | PROT_WRITE, + MAP_PRIVATE | MAP_HUGETLB | MAP_HUGE_2MB | MAP_ANONYMOUS, + -1, 0); + if (payload == MAP_FAILED) { + fprintf(stderr, "hugetlb alloc failed\n"); + return 1; + } + } + cfg_test = argv[argc - 1]; if (!strcmp(cfg_test, "tcp")) do_test(cfg_family, SOCK_STREAM, 0); From patchwork Tue Feb 21 01:05:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Begunkov X-Patchwork-Id: 13147231 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 E3329C678D5 for ; Tue, 21 Feb 2023 01:07:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232965AbjBUBHL (ORCPT ); Mon, 20 Feb 2023 20:07:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47364 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232967AbjBUBHJ (ORCPT ); Mon, 20 Feb 2023 20:07:09 -0500 Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EFFF121969 for ; Mon, 20 Feb 2023 17:07:05 -0800 (PST) Received: by mail-wm1-x32a.google.com with SMTP id p3-20020a05600c358300b003e206711347so2026506wmq.0 for ; Mon, 20 Feb 2023 17:07:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=9q6Z2EIeHPOpA/P1M1xO/wwloJ7HKSJ8ogHi9NQ5BT8=; b=eWLvjE7S5OdY0JFG5uE0YeAB0QfSUPesUe6LEGfvvTjioruI6EMTP763jquErzjAPT nsKUTViWwZt0ZOxm1J1V8NwR/tBWrjMi2glaXuViprieF285OeV/iTUB/bpIYZtO5xo8 2Tr5VXuVQLWSWTVAqXsOkgZlmqeiyd/efoaCvB0Ituuk74iSWMwUWBwEhmDE2I+S+K2x 3VI+m54MEzM5vt/AWpvAn0dCqUDLz12KUYNZ6lS+SsvcuoaCd1SRPbMgrBSpY4UPqX3D S29gGQI2yhMoj7R6brnKINBi4+d9d09nt7ieWwq0Fy7eyC7xrOvor1sU8rgpD6TKrWVh cSgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9q6Z2EIeHPOpA/P1M1xO/wwloJ7HKSJ8ogHi9NQ5BT8=; b=70jfK/zvdUnCyMJo6tbRW8OHrJygyjDHtqGwSGRY4i3YQ1nUVhfbfQRAzudegcGy5s TJmh1aFKpC8qDubxvu7twpmc6o3cVMA4G14RlznzOGTZ7F6aOAKQ2B9Rk2n4FncjEnLi n9EiyH4q00jNYoIMYTZlf6ACdaR1miBJBabod6bZeck6Vy19/Xb/pI57QTF52gH3WFSt 9qXwFQXQN+vjhqjmnu2CjVdpvU87TTxy0I0LhxmORaM/aHxcMivDzFLi3TW1AVv7n6DB u4O58IOOl1HTCaaqaRIpHXWRzVZ6Rqw0Pb1xs7nJXBu7Q4/+xP7plOo0JUkb9z1TItt1 3SiQ== X-Gm-Message-State: AO0yUKUgAXSyZ+FZxqq2v/JKKdUTzmUXyBdYD1iAIvEWA8FQp2C3WUk6 0XC2REeucdfRP/br2cM0rmlhhFkLQZ0= X-Google-Smtp-Source: AK7set+mtdMSb2VU1Y6Wpz2pC+qY/G8SlY/TtFVcAPd4zII1nBzMapYy99IozeGk/XfvlVEm1W/Bjw== X-Received: by 2002:a05:600c:1d16:b0:3df:f860:3089 with SMTP id l22-20020a05600c1d1600b003dff8603089mr2536896wms.32.1676941624400; Mon, 20 Feb 2023 17:07:04 -0800 (PST) Received: from 127.0.0.1localhost (94.196.95.64.threembb.co.uk. [94.196.95.64]) by smtp.gmail.com with ESMTPSA id k17-20020a7bc411000000b003dfee43863fsm2092469wmi.26.2023.02.20.17.07.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Feb 2023 17:07:04 -0800 (PST) From: Pavel Begunkov To: io-uring@vger.kernel.org Cc: Jens Axboe , asml.silence@gmail.com Subject: [PATCH liburing 5/7] test/send: don't use SO_ZEROCOPY if not available Date: Tue, 21 Feb 2023 01:05:56 +0000 Message-Id: X-Mailer: git-send-email 2.39.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: io-uring@vger.kernel.org Signed-off-by: Pavel Begunkov --- test/send-zerocopy.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/test/send-zerocopy.c b/test/send-zerocopy.c index f1277fa..481aa28 100644 --- a/test/send-zerocopy.c +++ b/test/send-zerocopy.c @@ -197,11 +197,9 @@ static int create_socketpair_ip(struct sockaddr_storage *addr, bool ipv6, bool client_connect, bool msg_zc, bool tcp) { - int family; socklen_t addr_size; - int ret, val; - int listen_sock = -1; - int sock; + int family, sock, listen_sock = -1; + int ret; memset(addr, 0, sizeof(*addr)); if (ipv6) { @@ -278,11 +276,17 @@ static int create_socketpair_ip(struct sockaddr_storage *addr, } } if (msg_zc) { - val = 1; +#ifdef SO_ZEROCOPY + int val = 1; + if (setsockopt(*sock_client, SOL_SOCKET, SO_ZEROCOPY, &val, sizeof(val))) { perror("setsockopt zc"); return 1; } +#else + fprintf(stderr, "no SO_ZEROCOPY\n"); + return 1; +#endif } if (tcp) { *sock_server = accept(listen_sock, NULL, NULL); @@ -502,7 +506,10 @@ static int test_inet_send(struct io_uring *ring) continue; if (swap_sockets && !tcp) continue; - +#ifndef SO_ZEROCOPY + if (msg_zc_set) + continue; +#endif ret = create_socketpair_ip(&addr, &sock_client, &sock_server, ipv6, client_connect, msg_zc_set, tcp); if (ret) { From patchwork Tue Feb 21 01:05:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Begunkov X-Patchwork-Id: 13147232 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 75665C678DB for ; Tue, 21 Feb 2023 01:07:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232967AbjBUBHL (ORCPT ); Mon, 20 Feb 2023 20:07:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232969AbjBUBHJ (ORCPT ); Mon, 20 Feb 2023 20:07:09 -0500 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 94AAC22DF7 for ; Mon, 20 Feb 2023 17:07:06 -0800 (PST) Received: by mail-wm1-x32d.google.com with SMTP id bg28so2097229wmb.0 for ; Mon, 20 Feb 2023 17:07:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=LmPGyA48xExHwZbJfO8OmSdVoAQXWZWG73WGeqnX5w4=; b=DV0jJcG76WMAAIoX4Zk98aR7ha2BrVbs36SMEyw/5Vzw2tR9ncN389DIiCiFWNq5m4 OZVwMZs7pu4Gz4rpdGgqSS4y6Rn4bpvnj/lhH60MatHdodyFe8k0BVNvyOHxJvav1gjZ b/3Ka3ksplhWnSkqRgsXcSixJz9t1aNb/7iAT9PFxfcReUxxaaxG2fkadKjxEZ6ZWbRI jAswlH+VoVSprKtAok/b4sVmxkSs5Bg+VLktTrY3l90sOjOCvyMwhq/t3un/yrLTwFQ/ YrtOFR04vjMywuVS6K5inmtrXzkpZ2M6HCsEdPGuEtzN581QZpVRBZZXkIT1BaWfBZ1p gr7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LmPGyA48xExHwZbJfO8OmSdVoAQXWZWG73WGeqnX5w4=; b=x5Xw3Os7IiJvW0gbDCXrGOP6BOvrtZGRI65Kqy7wCUUMqaxPZqIXu/rNgUy+0k3z2g 75HrzFFHThXfdlrPo1DXAsuYVeiZ4xJ3MrB1ETdP0IrRZ+cQncKJwnElP0RQ3Z6eJVnb IS5A7+29KsTLU7UECue7YJi3MRt5MR1AMjVXB8ptpceTWlkih+bOTc/i51ZBWtDxLgBS dgjzrdAU5jYzmiUj9H/fns4/ixkNpGQo0QzStk2Jp8FWhMyHi+8ssm75svZQLcsztum/ KmO/SrDHpRXKFgrBezlRwnDwHz37KUhX3bArMCl2d0rvXELWIgWFS2oiVQoiH1M3mTZ7 Lg7A== X-Gm-Message-State: AO0yUKXhpcgCEzlZeT43qfoRZHjvacuFcv8Zvhd9A6nAvBjnCPgW3MRI nhn/7mmtDyJeNU6WeoUiH9cGLqhvDqg= X-Google-Smtp-Source: AK7set+ro4NYaatFkJz02dy6lk9E6S/tOZpSjXb2axACoo16pVI/GyDlEEXMctm71F6m2iUGUNmbpA== X-Received: by 2002:a05:600c:3d8c:b0:3e0:c5e:ad78 with SMTP id bi12-20020a05600c3d8c00b003e00c5ead78mr1898394wmb.7.1676941625045; Mon, 20 Feb 2023 17:07:05 -0800 (PST) Received: from 127.0.0.1localhost (94.196.95.64.threembb.co.uk. [94.196.95.64]) by smtp.gmail.com with ESMTPSA id k17-20020a7bc411000000b003dfee43863fsm2092469wmi.26.2023.02.20.17.07.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Feb 2023 17:07:04 -0800 (PST) From: Pavel Begunkov To: io-uring@vger.kernel.org Cc: Jens Axboe , asml.silence@gmail.com Subject: [PATCH liburing 6/7] tests/send: improve error reporting Date: Tue, 21 Feb 2023 01:05:57 +0000 Message-Id: <077207aff1e31d30bdcdacbb6b0379d24798cea9.1676941370.git.asml.silence@gmail.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: io-uring@vger.kernel.org Signed-off-by: Pavel Begunkov --- test/send-zerocopy.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/send-zerocopy.c b/test/send-zerocopy.c index 481aa28..8ddec39 100644 --- a/test/send-zerocopy.c +++ b/test/send-zerocopy.c @@ -447,7 +447,8 @@ static int do_test_inet_send(struct io_uring *ring, int sock_client, int sock_se } if (cqe->user_data == RX_TAG) { if (cqe->res != send_size) { - fprintf(stderr, "rx failed %i\n", cqe->res); + fprintf(stderr, "rx failed res: %i, expected %i\n", + cqe->res, (int)send_size); return 1; } io_uring_cqe_seen(ring, cqe); From patchwork Tue Feb 21 01:05:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Begunkov X-Patchwork-Id: 13147233 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 8196EC677F1 for ; Tue, 21 Feb 2023 01:07:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232650AbjBUBHK (ORCPT ); Mon, 20 Feb 2023 20:07:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232970AbjBUBHJ (ORCPT ); Mon, 20 Feb 2023 20:07:09 -0500 Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A7ED23109 for ; Mon, 20 Feb 2023 17:07:07 -0800 (PST) Received: by mail-wm1-x32f.google.com with SMTP id j3so155781wms.2 for ; Mon, 20 Feb 2023 17:07:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Qwv89hARzKNGP8KHrbG8R/UPgKVlvHM9AJKeoW7+km0=; b=VfQUdh8jPNVx/8iW1ETqenJgd0BTfHCltz8lodPcM8Vra5qN5PmweB0z3at3OBOdDJ 0rrfVvakWQU7rJ17Tj2ZEWhkDbfXzEO86IuzoskjO0hHemdy/LfPJipoc+e7bNZfR/u3 eXDtTMVwqC1zNe1/bfuKft2d8peVLwyA7f98QttNgufqXxmXzkab6IVPp33n9uQkDlsX P/gk43nFS7zB0JS+0VvuJZ8wAWMgxb0yWD+FHoH9G48J1dpD4vY4vi+CPmlu1sSqw/LD Nb3ovQQNceMcd4/Xo/VcGEvAMuFprS2RqACN+G7RWXF6aCtiMN3jv5TNzyc0NuELO83L LL9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Qwv89hARzKNGP8KHrbG8R/UPgKVlvHM9AJKeoW7+km0=; b=7DBDgjYT1TxS7m5p1d+3VVUq7NnfirFJ0ifbLH0j3bghPuhcoW1yxJnApLBwaaijZF RJJ26OLOu7zQWm+KiQXIGEbGHUSG50qtA3k4i82BSlVoTJmU3/PO9JpXT5UQXFIX+WEG NtOd7pLFo2AQ9lk7HCkLISHmhkigso7FVUKMX1K9EGMnqzA4gO+f7e9C/0E08G2GYUEG glDaM8qolfZpucw+Lhx+MdzV6EVtMn0o8PJb4uK97KMeRo4IQaZ//LtELlfGij8hS6en F4CYLokPWmpDBR59njRybZ4wG+7fELqd5jxHrJmNBIWn1gX/hCczSPFRQL0//dAxpFcn /WPQ== X-Gm-Message-State: AO0yUKV3JMRVEAJBx9YP8LnMU9gSOdxgM9Az0ple/EMXQ4txYqSwYyf9 XBsTj0p2fVz1wE+fV52SLzHwPbQjqk8= X-Google-Smtp-Source: AK7set/xEvsTmxlS6Sf7nlrT9IGwAZxxRhYXh/bIJZgsNDnfKmEnpJnMoPMe1hMyB8J+jDLY1Wlo3A== X-Received: by 2002:a05:600c:3095:b0:3dc:555c:dd30 with SMTP id g21-20020a05600c309500b003dc555cdd30mr7170697wmn.27.1676941625713; Mon, 20 Feb 2023 17:07:05 -0800 (PST) Received: from 127.0.0.1localhost (94.196.95.64.threembb.co.uk. [94.196.95.64]) by smtp.gmail.com with ESMTPSA id k17-20020a7bc411000000b003dfee43863fsm2092469wmi.26.2023.02.20.17.07.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Feb 2023 17:07:05 -0800 (PST) From: Pavel Begunkov To: io-uring@vger.kernel.org Cc: Jens Axboe , asml.silence@gmail.com Subject: [PATCH liburing 7/7] tests/send: sends with offsets Date: Tue, 21 Feb 2023 01:05:58 +0000 Message-Id: X-Mailer: git-send-email 2.39.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: io-uring@vger.kernel.org Apart from arbitrary shifting buffers before registration so they're not page aligned, also add offsets to send requests. Signed-off-by: Pavel Begunkov --- test/send-zerocopy.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/send-zerocopy.c b/test/send-zerocopy.c index 8ddec39..57894aa 100644 --- a/test/send-zerocopy.c +++ b/test/send-zerocopy.c @@ -833,6 +833,15 @@ int main(int argc, char *argv[]) return T_EXIT_FAIL; } + if (buffers_iov[BUF_T_HUGETLB].iov_base) { + buffers_iov[BUF_T_HUGETLB].iov_base += 13; + buffers_iov[BUF_T_HUGETLB].iov_len -= 26; + } + if (buffers_iov[BUF_T_LARGE].iov_base) { + buffers_iov[BUF_T_LARGE].iov_base += 13; + buffers_iov[BUF_T_LARGE].iov_len -= 26; + } + ret = test_inet_send(&ring); if (ret) { fprintf(stderr, "test_inet_send() failed\n");