From owner-svn-src-head@freebsd.org Tue Nov 14 20:39:56 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F2599DDD1D4; Tue, 14 Nov 2017 20:39:56 +0000 (UTC) (envelope-from rpokala@mac.com) Received: from mr11p00im-asmtp004.me.com (mr11p00im-asmtp004.me.com [17.110.69.135]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D5D446E5A9; Tue, 14 Nov 2017 20:39:56 +0000 (UTC) (envelope-from rpokala@mac.com) Received: from process-dkim-sign-daemon.mr11p00im-asmtp004.me.com by mr11p00im-asmtp004.me.com (Oracle Communications Messaging Server 8.0.1.2.20170607 64bit (built Jun 7 2017)) id <0OZF00C00CAKAZ00@mr11p00im-asmtp004.me.com>; Tue, 14 Nov 2017 20:39:56 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mac.com; s=04042017; t=1510691996; bh=bDpjHuB2iCfpfVeI53JxGclimqDtTXRAMZIQ2qt+O+Q=; h=Date:Subject:From:To:Message-id:MIME-version:Content-type; b=vI2IdKYAqdDzFP0GOZRQQc/2dVnwycuuG0FDM/PZBNM8dSCB6g44KTSx2VC1GFlcf vPcvnMCtis0QyR76Ca9nAzQubtnP8Rq4uQZKyihIEhkaJaml/Kn18yyb1lWOSGo8MA rELazxbJkOfcU9LVpy3lM4R9ZhScStybkHeaqP76wIJPz+mxmMauFzdxiKsn3qBR9l EDLPy4++4HuovEgMxLHr/L1RHxvPr7saWKKIzBYmtm2CKUVDatZHRxe1KDD3hDDcCi aH46CJ/HrkKdUBgWezF3ED8/QcGt/Lm2vjXgk03k44sLyJvoBe+eJFuS1Udhp1rjmd FyQhZLhP+2Dzg== Received: from icloud.com ([127.0.0.1]) by mr11p00im-asmtp004.me.com (Oracle Communications Messaging Server 8.0.1.2.20170607 64bit (built Jun 7 2017)) with ESMTPSA id <0OZF00KIMDEGI710@mr11p00im-asmtp004.me.com>; Tue, 14 Nov 2017 20:39:53 +0000 (GMT) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-11-14_10:,, signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 clxscore=1015 suspectscore=2 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1711140274 User-Agent: Microsoft-MacOutlook/f.27.0.171010 Date: Tue, 14 Nov 2017 12:39:52 -0800 Subject: Re: svn commit: r325817 - head/tests/sys/aio From: Ravi Pokala To: Alan Somers , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-id: <77969AC2-58E9-4A00-A173-10C690ACE249@mac.com> Thread-topic: svn commit: r325817 - head/tests/sys/aio References: <201711141746.vAEHkbVb064686@repo.freebsd.org> In-reply-to: <201711141746.vAEHkbVb064686@repo.freebsd.org> MIME-version: 1.0 Content-type: text/plain; charset=UTF-8 Content-transfer-encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Nov 2017 20:39:57 -0000 Hi Alan, This appears to blow up most ARM worlds (and maybe other things too? My `make tinderbox' is still working through the ARMs): _.arm.arm.buildworld: --- all_subdir_tests/sys/aio --- /usr/home/rpokala/freebsd/clean/base/head/tests/sys/aio/lio_kqueue_test.c:123:12: error: format specifies type 'long' but the argument has type 'off_t' (aka 'lo ng long') [-Werror,-Wformat] iocb[k]->aio_offset); ^~~~~~~~~~~~~~~~~~~ /usr/home/rpokala/freebsd/clean/base/head/tests/sys/aio/lio_kqueue_test.c:137:8: error: format specifies type 'long' but the argument has type 'time_t' (aka 'lo ng long') [-Werror,-Wformat] time1, time2, time2-time1, result); ^~~~~ /usr/home/rpokala/freebsd/clean/base/head/tests/sys/aio/lio_kqueue_test.c:137:15: error: format specifies type 'long' but the argument has type 'time_t' (aka 'l ong long') [-Werror,-Wformat] time1, time2, time2-time1, result); ^~~~~ /usr/home/rpokala/freebsd/clean/base/head/tests/sys/aio/lio_kqueue_test.c:137:22: error: format specifies type 'long' but the argument has type 'long long' [-We rror,-Wformat] time1, time2, time2-time1, result); ^~~~~~~~~~~ Thanks, Ravi (rpokala@) -----Original Message----- From: on behalf of Alan Somers Date: 2017-11-14, Tuesday at 09:46 To: , , Subject: svn commit: r325817 - head/tests/sys/aio Author: asomers Date: Tue Nov 14 17:46:37 2017 New Revision: 325817 URL: https://svnweb.freebsd.org/changeset/base/325817 Log: AIO tests: increase limits tests/sys/aio/aio_kqueue_test.c Instead of using a hard-coded queue depth, use vfs.aio.max_aio_queue_per_proc tests/sys/aio/lio_kqueue_test.c The old, small limit on lio_listio's operation count was lifted by change 324941. Raise the operation count as high as possible without exceeding the process's operation limit. MFC after: 3 weeks Sponsored by: Spectra Logic Corp Modified: head/tests/sys/aio/aio_kqueue_test.c head/tests/sys/aio/lio_kqueue_test.c Modified: head/tests/sys/aio/aio_kqueue_test.c ============================================================================== --- head/tests/sys/aio/aio_kqueue_test.c Tue Nov 14 17:16:03 2017 (r325816) +++ head/tests/sys/aio/aio_kqueue_test.c Tue Nov 14 17:46:37 2017 (r325817) @@ -51,28 +51,37 @@ #define PATH_TEMPLATE "aio.XXXXXXXXXX" -#define MAX_IOCBS 128 #define MAX_RUNS 300 /* #define DEBUG */ int main (int argc, char *argv[]) { - struct aiocb *iocb[MAX_IOCBS], *kq_iocb; + struct aiocb **iocb, *kq_iocb; char *file, pathname[sizeof(PATH_TEMPLATE)+1]; struct kevent ke, kq_returned; struct timespec ts; char buffer[32768]; + int max_queue_per_proc; + size_t max_queue_per_proc_size; #ifdef DEBUG int cancel, error; #endif int failed = 0, fd, kq, pending, result, run; int tmp_file = 0; - unsigned i, j; + int i, j; PLAIN_REQUIRE_KERNEL_MODULE("aio", 0); PLAIN_REQUIRE_UNSAFE_AIO(0); + max_queue_per_proc_size = sizeof(max_queue_per_proc); + if (sysctlbyname("vfs.aio.max_aio_queue_per_proc", + &max_queue_per_proc, &max_queue_per_proc_size, NULL, 0) != 0) + err(1, "sysctlbyname"); + iocb = calloc(max_queue_per_proc, sizeof(struct aiocb*)); + if (iocb == NULL) + err(1, "calloc"); + kq = kqueue(); if (kq < 0) { perror("No kqeueue\n"); @@ -95,7 +104,7 @@ main (int argc, char *argv[]) #ifdef DEBUG printf("Run %d\n", run); #endif - for (i = 0; i < nitems(iocb); i++) { + for (i = 0; i < max_queue_per_proc; i++) { iocb[i] = (struct aiocb *)calloc(1, sizeof(struct aiocb)); if (iocb[i] == NULL) @@ -103,7 +112,7 @@ main (int argc, char *argv[]) } pending = 0; - for (i = 0; i < nitems(iocb); i++) { + for (i = 0; i < max_queue_per_proc; i++) { pending++; iocb[i]->aio_nbytes = sizeof(buffer); iocb[i]->aio_buf = buffer; @@ -139,7 +148,7 @@ main (int argc, char *argv[]) } } #ifdef DEBUG - cancel = nitems(iocb) - pending; + cancel = max_queue_per_proc - pending; #endif i = 0; @@ -173,11 +182,11 @@ main (int argc, char *argv[]) break; #ifdef DEBUG printf("Try again left %d out of %lu %d\n", - pending, nitems(iocb), cancel); + pending, max_queue_per_proc, cancel); #endif } - for (j = 0; j < nitems(iocb) && iocb[j] != kq_iocb; + for (j = 0; j < max_queue_per_proc && iocb[j] != kq_iocb; j++) ; #ifdef DEBUG printf("kq_iocb %p\n", kq_iocb); @@ -204,7 +213,7 @@ main (int argc, char *argv[]) i++; } - for (i = 0; i < nitems(iocb); i++) + for (i = 0; i < max_queue_per_proc; i++) free(iocb[i]); } Modified: head/tests/sys/aio/lio_kqueue_test.c ============================================================================== --- head/tests/sys/aio/lio_kqueue_test.c Tue Nov 14 17:16:03 2017 (r325816) +++ head/tests/sys/aio/lio_kqueue_test.c Tue Nov 14 17:46:37 2017 (r325817) @@ -27,14 +27,7 @@ /* * Note: it is a good idea to run this against a physical drive to - * exercise the physio fast path (ie. lio_kqueue /dev/) - * This will ensure op's counting is correct. It is currently broken. - * - * Also note that LIO & kqueue is not implemented in FreeBSD yet, LIO - * is also broken with respect to op's and some paths. - * - * A patch to make this work is at: - * http://www.ambrisko.com/doug/listio_kqueue/listio_kqueue.patch + * exercise the physio fast path (ie. lio_kqueue_test /dev/) */ #include @@ -54,9 +47,10 @@ #define PATH_TEMPLATE "aio.XXXXXXXXXX" +#define DEBUG #define LIO_MAX 5 -#define IOCBS_PER_LIO 16 -#define MAX_IOCBS (LIO_MAX * IOCBS_PER_LIO) +#define MAX_IOCBS_PER_LIO 64 +#define MAX_IOCBS (LIO_MAX * MAX_IOCBS_PER_LIO) #define MAX_RUNS 300 int @@ -65,7 +59,9 @@ main(int argc, char *argv[]) int fd; struct aiocb *iocb[MAX_IOCBS]; struct aiocb **lio[LIO_MAX], **kq_lio; - int i, result, run, error, j, k; + int i, result, run, error, j, k, max_queue_per_proc; + int max_iocbs, iocbs_per_lio; + size_t max_queue_per_proc_size; char buffer[32768]; int kq; struct kevent ke, kq_returned; @@ -78,6 +74,13 @@ main(int argc, char *argv[]) PLAIN_REQUIRE_KERNEL_MODULE("aio", 0); PLAIN_REQUIRE_UNSAFE_AIO(0); + max_queue_per_proc_size = sizeof(max_queue_per_proc); + if (sysctlbyname("vfs.aio.max_aio_queue_per_proc", + &max_queue_per_proc, &max_queue_per_proc_size, NULL, 0) != 0) + err(1, "sysctlbyname"); + iocbs_per_lio = max_queue_per_proc / LIO_MAX; + max_iocbs = LIO_MAX * iocbs_per_lio; + kq = kqueue(); if (kq < 0) err(1, "kqeueue(2) failed"); @@ -104,9 +107,9 @@ main(int argc, char *argv[]) #endif for (j = 0; j < LIO_MAX; j++) { lio[j] = - malloc(sizeof(struct aiocb *) * IOCBS_PER_LIO); - for (i = 0; i < IOCBS_PER_LIO; i++) { - k = (IOCBS_PER_LIO * j) + i; + malloc(sizeof(struct aiocb *) * iocbs_per_lio); + for (i = 0; i < iocbs_per_lio; i++) { + k = (iocbs_per_lio * j) + i; lio[j][i] = iocb[k] = calloc(1, sizeof(struct aiocb)); iocb[k]->aio_nbytes = sizeof(buffer); @@ -126,7 +129,7 @@ main(int argc, char *argv[]) sig.sigev_notify = SIGEV_KEVENT; time(&time1); result = lio_listio(LIO_NOWAIT, lio[j], - IOCBS_PER_LIO, &sig); + iocbs_per_lio, &sig); error = errno; time(&time2); #ifdef DEBUG @@ -202,10 +205,10 @@ main(int argc, char *argv[]) failed++; } else printf("PASS: run %d, operation %d result %d \n", run, LIO_MAX - i -1, result); - for (k = 0; k < MAX_IOCBS / LIO_MAX; k++) { + for (k = 0; k < max_iocbs / LIO_MAX; k++) { result = aio_return(kq_lio[k]); #ifdef DEBUG - printf("Return Resulto for %d %d is %d\n", j, k, result); + printf("Return Result for %d %d is %d\n", j, k, result); #endif if (result != sizeof(buffer)) { printf("FAIL: run %d, operation %d sub-opt %d result %d (errno=%d) should be %zu\n", @@ -219,7 +222,7 @@ main(int argc, char *argv[]) printf("\n"); #endif - for (k = 0; k < MAX_IOCBS / LIO_MAX; k++) + for (k = 0; k < max_iocbs / LIO_MAX; k++) free(lio[j][k]); free(lio[j]); lio[j] = NULL;