From patchwork Wed Sep 16 17:14:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zorro Lang X-Patchwork-Id: 11780811 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0C5E71580 for ; Wed, 16 Sep 2020 20:29:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D916B21D43 for ; Wed, 16 Sep 2020 20:29:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="eDER4MN6" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727219AbgIPU3w (ORCPT ); Wed, 16 Sep 2020 16:29:52 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:37239 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726944AbgIPRYC (ORCPT ); Wed, 16 Sep 2020 13:24:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600276990; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Y180oUkejY14cXgK4vjnfdc8RXLi2L7JY7EbjdRpGtM=; b=eDER4MN65YfT3OMwNBFbAnl/dBCADXyjk7jOJ83TDRhfNEuNbvZ5H1FO947H+EkQFJ9s5J 5PXV9/qcgP/QMuvFqq0hCqVBQ5A8ug6v5zeDiPlGdE8ZC1Fr54wX9ubzFtW8NJkZ4y0FUE 10v6vPLLaMY73q2ZVSLPC+zYkzXkS5c= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-559-tK7skm26P3mpbv4V-y9sOA-1; Wed, 16 Sep 2020 13:15:01 -0400 X-MC-Unique: tK7skm26P3mpbv4V-y9sOA-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1B5378B94E5; Wed, 16 Sep 2020 17:14:51 +0000 (UTC) Received: from bogon.redhat.com (ovpn-13-242.pek2.redhat.com [10.72.13.242]) by smtp.corp.redhat.com (Postfix) with ESMTP id D1B9160BFA; Wed, 16 Sep 2020 17:14:49 +0000 (UTC) From: Zorro Lang To: fstests@vger.kernel.org Cc: io-uring@vger.kernel.org Subject: [PATCH 1/3] src/feature: add IO_URING feature checking Date: Thu, 17 Sep 2020 01:14:41 +0800 Message-Id: <20200916171443.29546-2-zlang@redhat.com> In-Reply-To: <20200916171443.29546-1-zlang@redhat.com> References: <20200916171443.29546-1-zlang@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org IO_URING is a new feature for GNU/Linux system, if someone case of xfstests tests this feature, better to check if current system supports it, or need _notrun. Signed-off-by: Zorro Lang Reviewed-by: Brian Foster --- src/Makefile | 4 ++++ src/feature.c | 41 ++++++++++++++++++++++++++++++++++++++--- 2 files changed, 42 insertions(+), 3 deletions(-) diff --git a/src/Makefile b/src/Makefile index 643c1916..f1422c5c 100644 --- a/src/Makefile +++ b/src/Makefile @@ -65,6 +65,10 @@ SUBDIRS += aio-dio-regress LLDLIBS += -laio endif +ifeq ($(HAVE_URING), true) +LLDLIBS += -luring +endif + CFILES = $(TARGETS:=.c) LDIRT = $(TARGETS) fssum diff --git a/src/feature.c b/src/feature.c index a7eb7595..df550cf6 100644 --- a/src/feature.c +++ b/src/feature.c @@ -19,6 +19,7 @@ * * Test for machine features * -A test whether AIO syscalls are available + * -R test whether IO_URING syscalls are available * -o report a number of online cpus * -s report pagesize * -w report bits per long @@ -39,6 +40,10 @@ #include #endif +#ifdef HAVE_LIBURING_H +#include +#endif + #ifndef USRQUOTA #define USRQUOTA 0 #endif @@ -59,7 +64,7 @@ usage(void) fprintf(stderr, "Usage: feature [-v] - \n"); fprintf(stderr, " feature [-v] -c \n"); fprintf(stderr, " feature [-v] -t \n"); - fprintf(stderr, " feature -A | -o | -s | -w\n"); + fprintf(stderr, " feature -A | -R | -o | -s | -w\n"); exit(1); } @@ -215,6 +220,29 @@ check_aio_support(void) #endif } +static int +check_uring_support(void) +{ +#ifdef HAVE_LIBURING_H + struct io_uring ring; + int err; + + err = io_uring_queue_init(1, &ring, 0); + if (err == 0) + return 0; + + if (err == -ENOSYS) /* CONFIG_IO_URING=n */ + return 1; + + fprintf(stderr, "unexpected error from io_uring_queue_init(): %s\n", + strerror(-err)); + return 2; +#else + /* liburing is unavailable, assume IO_URING is unsupported */ + return 1; +#endif +} + int main(int argc, char **argv) @@ -228,6 +256,7 @@ main(int argc, char **argv) int pflag = 0; int Pflag = 0; int qflag = 0; + int Rflag = 0; int sflag = 0; int uflag = 0; int Uflag = 0; @@ -235,7 +264,7 @@ main(int argc, char **argv) int oflag = 0; char *fs = NULL; - while ((c = getopt(argc, argv, "ActgGopPqsuUvw")) != EOF) { + while ((c = getopt(argc, argv, "ActgGopPqRsuUvw")) != EOF) { switch (c) { case 'A': Aflag++; @@ -264,6 +293,9 @@ main(int argc, char **argv) case 'q': qflag++; break; + case 'R': + Rflag++; + break; case 's': sflag++; break; @@ -289,7 +321,7 @@ main(int argc, char **argv) if (optind != argc-1) /* need a device */ usage(); fs = argv[argc-1]; - } else if (Aflag || wflag || sflag || oflag) { + } else if (Aflag || Rflag || wflag || sflag || oflag) { if (optind != argc) usage(); } else @@ -317,6 +349,9 @@ main(int argc, char **argv) if (Aflag) return(check_aio_support()); + if (Rflag) + return(check_uring_support()); + if (sflag) { printf("%d\n", getpagesize()); exit(0); From patchwork Wed Sep 16 17:14:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zorro Lang X-Patchwork-Id: 11780807 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D42C959D for ; Wed, 16 Sep 2020 20:29:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AE00A21D24 for ; Wed, 16 Sep 2020 20:29:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="h83x/N0z" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727115AbgIPU26 (ORCPT ); Wed, 16 Sep 2020 16:28:58 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:38295 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726986AbgIPRYO (ORCPT ); Wed, 16 Sep 2020 13:24:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600276999; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QS+wO1bOb/MZuessqndV980gLlA0r3NSlKNgcyqbDF8=; b=h83x/N0zB2bxF/pwYlovSZvnHgZpeooSdFp5NpzmDzul47fuPErGCoJzdDsH47JeKFO0La 23GfKYhfcAyFsS5YrfE/ZsM6+v/W10KeKk2zSx8BjSGDRGhi2kZjvwaC/5t1ESySgXgbqu PQIiE1wmXoCD2KXy7pJh/c7jiwMa1B4= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-88-S2zDtxUwP0qPfPW2gHSa2Q-1; Wed, 16 Sep 2020 13:15:02 -0400 X-MC-Unique: S2zDtxUwP0qPfPW2gHSa2Q-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D4D7D84E245; Wed, 16 Sep 2020 17:14:53 +0000 (UTC) Received: from bogon.redhat.com (ovpn-13-242.pek2.redhat.com [10.72.13.242]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9809860CC0; Wed, 16 Sep 2020 17:14:52 +0000 (UTC) From: Zorro Lang To: fstests@vger.kernel.org Cc: io-uring@vger.kernel.org Subject: [PATCH 2/3] generic: fsx IO_URING soak tests Date: Thu, 17 Sep 2020 01:14:42 +0800 Message-Id: <20200916171443.29546-3-zlang@redhat.com> In-Reply-To: <20200916171443.29546-1-zlang@redhat.com> References: <20200916171443.29546-1-zlang@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org After fsx supports IO_URING read/write, add a test to do IO_URING soak test of fsx. Signed-off-by: Zorro Lang --- common/rc | 16 ++++++++++++ tests/generic/609 | 58 +++++++++++++++++++++++++++++++++++++++++++ tests/generic/609.out | 2 ++ tests/generic/group | 1 + 4 files changed, 77 insertions(+) create mode 100755 tests/generic/609 create mode 100644 tests/generic/609.out diff --git a/common/rc b/common/rc index aa5a7409..b6b39eba 100644 --- a/common/rc +++ b/common/rc @@ -1984,6 +1984,22 @@ _require_aiodio() _require_odirect } +# this test requires that the kernel supports IO_URING +_require_io_uring() +{ + $here/src/feature -R + case $? in + 0) + ;; + 1) + _notrun "kernel does not support IO_URING" + ;; + *) + _fail "unexpected error testing for IO_URING support" + ;; + esac +} + # this test requires that a test program exists under src/ # $1 - command (require) # diff --git a/tests/generic/609 b/tests/generic/609 new file mode 100755 index 00000000..1d9b6fed --- /dev/null +++ b/tests/generic/609 @@ -0,0 +1,58 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2020 Red Hat Inc. All Rights Reserved. +# +# FS QA Test 609 +# +# IO_URING soak buffered fsx test +# +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -f $tmp.* +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter + +# remove previous $seqres.full before test +rm -f $seqres.full + +# real QA test starts here + +# Modify as appropriate. +_supported_fs generic +_supported_os Linux +_require_test +_require_io_uring + +# Run fsx for a million ops or more +nr_ops=$((100000 * TIME_FACTOR)) +op_sz=$((128000 * LOAD_FACTOR)) +file_sz=$((600000 * LOAD_FACTOR)) +fsx_file=$TEST_DIR/fsx.$seq + +fsx_args=(-S 0) +fsx_args+=(-U) +fsx_args+=(-q) +fsx_args+=(-N $nr_ops) +fsx_args+=(-p $((nr_ops / 100))) +fsx_args+=(-o $op_sz) +fsx_args+=(-l $file_sz) + +run_fsx "${fsx_args[@]}" | sed -e '/^fsx.*/d' + +# success, all done +echo "Silence is golden" +status=0 +exit diff --git a/tests/generic/609.out b/tests/generic/609.out new file mode 100644 index 00000000..0d75b384 --- /dev/null +++ b/tests/generic/609.out @@ -0,0 +1,2 @@ +QA output created by 609 +Silence is golden diff --git a/tests/generic/group b/tests/generic/group index aa969bcb..cf50f4a1 100644 --- a/tests/generic/group +++ b/tests/generic/group @@ -611,3 +611,4 @@ 606 auto attr quick dax 607 auto attr quick dax 608 auto attr quick dax +609 auto rw io_uring From patchwork Wed Sep 16 17:14:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zorro Lang X-Patchwork-Id: 11780805 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8A40E92C for ; Wed, 16 Sep 2020 20:28:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 64D3421973 for ; Wed, 16 Sep 2020 20:28:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="bt4mdDFm" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727009AbgIPU24 (ORCPT ); Wed, 16 Sep 2020 16:28:56 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:38701 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726984AbgIPRYO (ORCPT ); Wed, 16 Sep 2020 13:24:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600276996; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=idfy7Syf4ATJlYyYq2/4nEP2ORzJWyRGssBVYHwWpOI=; b=bt4mdDFmeRQFNDRxC8YhmBHVySHTVhDrYIT0u5NR1sKhXqMwg3JnqvmMcPS/t+GXm87FJL aMoCdxFaj1EDH1N67976yU9WYJ4bM34taPE1gQ11NqZ7GkW356tlWOlyGGYAxPJUZ0CZfv lLe47tFPeTChaPpigBykPjsvDqAQzGU= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-310-o9IeegJIM1-JxV9HfxTM3Q-1; Wed, 16 Sep 2020 13:15:06 -0400 X-MC-Unique: o9IeegJIM1-JxV9HfxTM3Q-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9DD7018C5233; Wed, 16 Sep 2020 17:14:56 +0000 (UTC) Received: from bogon.redhat.com (ovpn-13-242.pek2.redhat.com [10.72.13.242]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5370E60BFA; Wed, 16 Sep 2020 17:14:55 +0000 (UTC) From: Zorro Lang To: fstests@vger.kernel.org Cc: io-uring@vger.kernel.org Subject: [PATCH 3/3] generic: IO_URING direct IO fsx test Date: Thu, 17 Sep 2020 01:14:43 +0800 Message-Id: <20200916171443.29546-4-zlang@redhat.com> In-Reply-To: <20200916171443.29546-1-zlang@redhat.com> References: <20200916171443.29546-1-zlang@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org After fsx supports IO_URING read/write, add IO_URING direct IO fsx test with different read/write size and concurrent buffered IO. Signed-off-by: Zorro Lang --- tests/generic/610 | 52 +++++++++++++++++++++++++++++++++++++++++++ tests/generic/610.out | 7 ++++++ tests/generic/group | 1 + 3 files changed, 60 insertions(+) create mode 100755 tests/generic/610 create mode 100644 tests/generic/610.out diff --git a/tests/generic/610 b/tests/generic/610 new file mode 100755 index 00000000..fc3f4c2a --- /dev/null +++ b/tests/generic/610 @@ -0,0 +1,52 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2020 YOUR NAME HERE. All Rights Reserved. +# +# FS QA Test 610 +# +# IO_URING direct IO fsx test +# +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -f $tmp.* +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter + +# remove previous $seqres.full before test +rm -f $seqres.full + +# real QA test starts here +_supported_fs generic +_supported_os Linux +_require_test +_require_odirect +_require_io_uring + +psize=`$here/src/feature -s` +bsize=`_min_dio_alignment $TEST_DEV` +run_fsx -S 0 -U -N 20000 -l 600000 -r PSIZE -w BSIZE -Z -R -W +run_fsx -S 0 -U -N 20000 -o 8192 -l 600000 -r PSIZE -w BSIZE -Z -R -W +run_fsx -S 0 -U -N 20000 -o 128000 -l 600000 -r PSIZE -w BSIZE -Z -R -W + +# change readbdy/writebdy to double page size +psize=$((psize * 2)) +run_fsx -S 0 -U -N 20000 -l 600000 -r PSIZE -w PSIZE -Z -R -W +run_fsx -S 0 -U -N 20000 -o 256000 -l 600000 -r PSIZE -w PSIZE -Z -R -W +run_fsx -S 0 -U -N 20000 -o 128000 -l 600000 -r PSIZE -w BSIZE -Z -W + +# success, all done +status=0 +exit diff --git a/tests/generic/610.out b/tests/generic/610.out new file mode 100644 index 00000000..97ad41a3 --- /dev/null +++ b/tests/generic/610.out @@ -0,0 +1,7 @@ +QA output created by 610 +fsx -S 0 -U -N 20000 -l 600000 -r PSIZE -w BSIZE -Z -R -W +fsx -S 0 -U -N 20000 -o 8192 -l 600000 -r PSIZE -w BSIZE -Z -R -W +fsx -S 0 -U -N 20000 -o 128000 -l 600000 -r PSIZE -w BSIZE -Z -R -W +fsx -S 0 -U -N 20000 -l 600000 -r PSIZE -w PSIZE -Z -R -W +fsx -S 0 -U -N 20000 -o 256000 -l 600000 -r PSIZE -w PSIZE -Z -R -W +fsx -S 0 -U -N 20000 -o 128000 -l 600000 -r PSIZE -w BSIZE -Z -W diff --git a/tests/generic/group b/tests/generic/group index cf50f4a1..60280dc2 100644 --- a/tests/generic/group +++ b/tests/generic/group @@ -612,3 +612,4 @@ 607 auto attr quick dax 608 auto attr quick dax 609 auto rw io_uring +610 auto rw io_uring