From patchwork Sun Nov 8 12:26:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zorro Lang X-Patchwork-Id: 11889533 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 EA7351130 for ; Sun, 8 Nov 2020 12:26:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CC505206F4 for ; Sun, 8 Nov 2020 12:26:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Bne5OUTp" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727348AbgKHM0k (ORCPT ); Sun, 8 Nov 2020 07:26:40 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:30330 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726210AbgKHM0k (ORCPT ); Sun, 8 Nov 2020 07:26:40 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1604838398; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=b1hwf1JxJoAI9E+A6q57cvY5ODrs5/Txh3u3tM7Co3c=; b=Bne5OUTpOHlXh7aN10eofcZITU/k+QuS3YCh0JtQzNL945ncewHXOtCrEF6WS+/svyS44v CvA0Hih9gmimqYks328DHUAFuXbUCXOsXnYb6hRkHKUhMjYto6C4jngRtK3jQP/QSaSRpb 0p2XvlJdLTYHilh1EvaJVhdR2YgNsVQ= 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-471-CQ3sECxnMcuYx_5zKBG4Hg-1; Sun, 08 Nov 2020 07:26:36 -0500 X-MC-Unique: CQ3sECxnMcuYx_5zKBG4Hg-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D5BBF56BE3 for ; Sun, 8 Nov 2020 12:26:35 +0000 (UTC) Received: from bogon.redhat.com (ovpn-12-53.pek2.redhat.com [10.72.12.53]) by smtp.corp.redhat.com (Postfix) with ESMTP id E3C835B4B5 for ; Sun, 8 Nov 2020 12:26:34 +0000 (UTC) From: Zorro Lang To: fstests@vger.kernel.org Subject: [PATCH 1/3] src/feature: add IO_URING feature checking Date: Sun, 8 Nov 2020 20:26:21 +0800 Message-Id: <20201108122623.12980-2-zlang@redhat.com> In-Reply-To: <20201108122623.12980-1-zlang@redhat.com> References: <20201108122623.12980-1-zlang@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 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 --- 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 Sun Nov 8 12:26:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zorro Lang X-Patchwork-Id: 11889535 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 F2C1014C0 for ; Sun, 8 Nov 2020 12:26:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D6EDE206F4 for ; Sun, 8 Nov 2020 12:26:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="JHk6XEb7" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727570AbgKHM0m (ORCPT ); Sun, 8 Nov 2020 07:26:42 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:20699 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726210AbgKHM0m (ORCPT ); Sun, 8 Nov 2020 07:26:42 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1604838400; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wvDrZQKGeopbJ3KhJ30MevGVCbWzPenbW3Q+wlPrFjk=; b=JHk6XEb7vfEBVx8CG/LgNuTEwf5Ba2u5gA1wjPJ3Zz7nh54niveKLs3cREZbZg6u3qTZgA 3X3/YQwHFxM7TGmuJy6n5NjPl+d43gaW7kFk/wvfBNQYqIgIjefLcySYnhE7fmTVs4SoyN GMENOnlD3PlyUTrhVGwjH6FaC2/5WOo= 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-301-VNUp1v_4MEeb3d4UG-Zg_A-1; Sun, 08 Nov 2020 07:26:39 -0500 X-MC-Unique: VNUp1v_4MEeb3d4UG-Zg_A-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 473AB1005E65 for ; Sun, 8 Nov 2020 12:26:38 +0000 (UTC) Received: from bogon.redhat.com (ovpn-12-53.pek2.redhat.com [10.72.12.53]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5E4A95B4CB for ; Sun, 8 Nov 2020 12:26:37 +0000 (UTC) From: Zorro Lang To: fstests@vger.kernel.org Subject: [PATCH 2/3] generic: fsx IO_URING soak tests Date: Sun, 8 Nov 2020 20:26:22 +0800 Message-Id: <20201108122623.12980-3-zlang@redhat.com> In-Reply-To: <20201108122623.12980-1-zlang@redhat.com> References: <20201108122623.12980-1-zlang@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 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/613 | 59 +++++++++++++++++++++++++++++++++++++++++++ tests/generic/613.out | 2 ++ tests/generic/group | 1 + 4 files changed, 78 insertions(+) create mode 100755 tests/generic/613 create mode 100644 tests/generic/613.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/613 b/tests/generic/613 new file mode 100755 index 00000000..dc64e67a --- /dev/null +++ b/tests/generic/613 @@ -0,0 +1,59 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2020 Red Hat Inc. All Rights Reserved. +# +# FS QA Test No. 613 +# +# IO_URING soak buffered fsx test, copy from generic/522 but reduce the number +# fsx ops to limit the testing time to be an auto group 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 100 thousand 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/613.out b/tests/generic/613.out new file mode 100644 index 00000000..64524cf1 --- /dev/null +++ b/tests/generic/613.out @@ -0,0 +1,2 @@ +QA output created by 613 +Silence is golden diff --git a/tests/generic/group b/tests/generic/group index aa969bcb..348cc2bd 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 +613 auto rw io_uring From patchwork Sun Nov 8 12:26:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zorro Lang X-Patchwork-Id: 11889537 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 482A51130 for ; Sun, 8 Nov 2020 12:26:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2E675206F4 for ; Sun, 8 Nov 2020 12:26:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="aitXudJs" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727844AbgKHM0o (ORCPT ); Sun, 8 Nov 2020 07:26:44 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:28229 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726210AbgKHM0o (ORCPT ); Sun, 8 Nov 2020 07:26:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1604838403; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ER/NyJGpQwUqZJM97xFSHkujono1u03XWWtdABECXhQ=; b=aitXudJsTua5/Ku5ItLkBKboORCNfKAr2WlDUvyMxMF8Dei968M4N/keKhc4ZfIJdtqEAX NIl7WyehVmx1jtBjrszfzgJpPtyQuMwJZMeqEBQq3fBvje3rv+QDzZFcmp5JH4Skx5SJuq 4bPOgehBIP4qpWFC4RfnL7/nsYSlNCE= 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-589-wFRD_3YZOwOSCDx5H78Ylg-1; Sun, 08 Nov 2020 07:26:41 -0500 X-MC-Unique: wFRD_3YZOwOSCDx5H78Ylg-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id AA4C08014D9 for ; Sun, 8 Nov 2020 12:26:40 +0000 (UTC) Received: from bogon.redhat.com (ovpn-12-53.pek2.redhat.com [10.72.12.53]) by smtp.corp.redhat.com (Postfix) with ESMTP id AE1F75B4B5 for ; Sun, 8 Nov 2020 12:26:39 +0000 (UTC) From: Zorro Lang To: fstests@vger.kernel.org Subject: [PATCH 3/3] generic: fsx IO_URING direct-IO soak tests Date: Sun, 8 Nov 2020 20:26:23 +0800 Message-Id: <20201108122623.12980-4-zlang@redhat.com> In-Reply-To: <20201108122623.12980-1-zlang@redhat.com> References: <20201108122623.12980-1-zlang@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 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 direct-IO test by fsx Signed-off-by: Zorro Lang --- tests/generic/614 | 65 +++++++++++++++++++++++++++++++++++++++++++ tests/generic/614.out | 2 ++ tests/generic/group | 1 + 3 files changed, 68 insertions(+) create mode 100755 tests/generic/614 create mode 100644 tests/generic/614.out diff --git a/tests/generic/614 b/tests/generic/614 new file mode 100755 index 00000000..3f07f204 --- /dev/null +++ b/tests/generic/614 @@ -0,0 +1,65 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2020 Red Hat Inc. All Rights Reserved. +# +# FS QA Test No. 614 +# +# IO_URING soak direct-IO fsx test, copy from generic/521 but reduce the number +# fsx ops to limit the testing time to be an auto group 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_odirect +_require_io_uring + +# Run fsx for 20 thousand ops or more +nr_ops=$((20000 * TIME_FACTOR)) +op_sz=$((128000 * LOAD_FACTOR)) +file_sz=$((600000 * LOAD_FACTOR)) +fsx_file=$TEST_DIR/fsx.$seq +min_dio_sz=$(_min_dio_alignment) + +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) +fsx_args+=(-r $min_dio_sz) +fsx_args+=(-t $min_dio_sz) +fsx_args+=(-w $min_dio_sz) +fsx_args+=(-Z) + +run_fsx "${fsx_args[@]}" | sed -e '/^fsx.*/d' + +# success, all done +echo "Silence is golden" +status=0 +exit diff --git a/tests/generic/614.out b/tests/generic/614.out new file mode 100644 index 00000000..3db70236 --- /dev/null +++ b/tests/generic/614.out @@ -0,0 +1,2 @@ +QA output created by 614 +Silence is golden diff --git a/tests/generic/group b/tests/generic/group index 348cc2bd..79d386ca 100644 --- a/tests/generic/group +++ b/tests/generic/group @@ -612,3 +612,4 @@ 607 auto attr quick dax 608 auto attr quick dax 613 auto rw io_uring +614 auto rw io_uring