From patchwork Thu Apr 20 18:57:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gabriel Krisman Bertazi X-Patchwork-Id: 13219129 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 52F96C77B72 for ; Thu, 20 Apr 2023 18:57:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231786AbjDTS5o (ORCPT ); Thu, 20 Apr 2023 14:57:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33556 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232030AbjDTS5l (ORCPT ); Thu, 20 Apr 2023 14:57:41 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA9FF18D for ; Thu, 20 Apr 2023 11:57:40 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 84E0221986; Thu, 20 Apr 2023 18:57:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1682017059; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=fOJ4B7lJuAuRSMaDvfK8itejVRzdh6oeWmoacpZvDCM=; b=mJDD92DOTZ5fm64T2uZO8JYKxvUq81+SV9pqI2pSlqAn39rWKds2KXZsYMN56Hkqx1lAtc +uPLDRBccD08HtEbM8t8Pw7b7rDSkc/lPQli0RLD/bTEIgBA5dvVNNb6hJXDN742yrP32A KF+gBO7f+U9FTD2U+aTY68e6cDBj8eI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1682017059; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=fOJ4B7lJuAuRSMaDvfK8itejVRzdh6oeWmoacpZvDCM=; b=n0r/6I0bH+ELuyQ7cfgE3U7NqHrmZaH4tSd7jRFqClngxcpGoQF74vk9Hjxg6ePiwoDCxR gAaPtQICuvMhcyAQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 4CC9713584; Thu, 20 Apr 2023 18:57:39 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id FAkwDSOLQWRmQAAAMHmgww (envelope-from ); Thu, 20 Apr 2023 18:57:39 +0000 From: Gabriel Krisman Bertazi To: axboe@kernel.dk Cc: io-uring@vger.kernel.org, Gabriel Krisman Bertazi Subject: [PATCH] test/file-verify.t: Don't run over mlock limit when run as non-root Date: Thu, 20 Apr 2023 14:57:28 -0400 Message-Id: <20230420185728.4104-1-krisman@suse.de> X-Mailer: git-send-email 2.40.0 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: io-uring@vger.kernel.org test/file-verify tries to get 2MB of pinned memory at once, which is higher than the default allowed for non-root users in older kernels (64kb before v5.16, nowadays 8mb). Skip the test for non-root users if the registration fails instead of failing the test. Signed-off-by: Gabriel Krisman Bertazi --- test/file-verify.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/test/file-verify.c b/test/file-verify.c index f33b24a..89cbb02 100644 --- a/test/file-verify.c +++ b/test/file-verify.c @@ -381,9 +381,12 @@ static int test(struct io_uring *ring, const char *fname, int buffered, v[i].iov_base = buf[i]; v[i].iov_len = CHUNK_SIZE; } - ret = io_uring_register_buffers(ring, v, READ_BATCH); + ret = t_register_buffers(ring, v, READ_BATCH); if (ret) { - fprintf(stderr, "Error buffer reg %d\n", ret); + if (ret == T_SETUP_SKIP) { + ret = 0; + goto free_bufs; + } goto err; } } @@ -477,6 +480,7 @@ static int test(struct io_uring *ring, const char *fname, int buffered, done: if (registered) io_uring_unregister_buffers(ring); +free_bufs: if (vectored) { for (j = 0; j < READ_BATCH; j++) for (i = 0; i < nr_vecs; i++)