From patchwork Tue Apr 12 12:41:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Cervesato X-Patchwork-Id: 1616252 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=Yo2g0SnK; dkim=fail reason="signature verification failed" header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=pEvLqTxq; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=2001:1418:10:5::2; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Kd52F4PqDz9sBy for ; Tue, 12 Apr 2022 22:41:41 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 4B7B53CA548 for ; Tue, 12 Apr 2022 14:41:38 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-5.smtp.seeweb.it (in-5.smtp.seeweb.it [IPv6:2001:4b78:1:20::5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id EBA273CA49D for ; Tue, 12 Apr 2022 14:41:35 +0200 (CEST) Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by in-5.smtp.seeweb.it (Postfix) with ESMTPS id A61B9600048 for ; Tue, 12 Apr 2022 14:41:34 +0200 (CEST) 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 EAB7E21608; Tue, 12 Apr 2022 12:41:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1649767293; 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=fq4+ZfyZFaPM/R5xXTi9uoCZKYhd4G4U0RDigTpZQMI=; b=Yo2g0SnK/y+eMJCF39tXvzB+r9XCmGSy54+2bARiyte9hly6CPNPsQuLzUxdJcEpm/jDIH Fs0JnxRuRGHzTqbyP4krO+zHl1WrJQsmRopfJmm6H7ZtmSdkQ3uTlbNVvfylGvIF0UZo2B UtEpb2yYFu1wX6cRn8c7+bkTNfcoB0Y= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1649767293; 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=fq4+ZfyZFaPM/R5xXTi9uoCZKYhd4G4U0RDigTpZQMI=; b=pEvLqTxq1p4B8UlQ2+dL1z9R/pkJjWUzEBrdMHadUwufb2Ak9gAcLu75wzp8lVqMkMX0nA hn1i1SiDUD4WnGDw== 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 AB8B213780; Tue, 12 Apr 2022 12:41:33 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 6srYI31zVWJOAQAAMHmgww (envelope-from ); Tue, 12 Apr 2022 12:41:33 +0000 From: Andrea Cervesato To: ltp@lists.linux.it Date: Tue, 12 Apr 2022 14:41:31 +0200 Message-Id: <20220412124131.11655-1-andrea.cervesato@suse.de> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.102.4 at in-5.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on in-5.smtp.seeweb.it Subject: [LTP] [PATCH v3] Fix wqueue09 according with 5.17 kernel updates X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Kernel 5.17 introduced many changes in the watch_queue support. In particular, commit 3b4c0371928c17af03e8397ac842346624017ce6 changes the behaviour of IOC_WATCH_QUEUE_SET_SIZE and ioctl control over watch_queue buffer size: now we need to generate more events than before. In particular, more than the bitmap size to the number of notes. Signed-off-by: Andrea Cervesato Reviewed-by: Petr Vorel Tested-by: Petr Vorel --- This patch fixes the issue of loosing events on big number of iterations such as -i 1000 by introducing also setup/cleanup. testcases/kernel/watchqueue/wqueue09.c | 32 ++++++++++++++++++-------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/testcases/kernel/watchqueue/wqueue09.c b/testcases/kernel/watchqueue/wqueue09.c index 55d567249..9f077b35b 100644 --- a/testcases/kernel/watchqueue/wqueue09.c +++ b/testcases/kernel/watchqueue/wqueue09.c @@ -11,11 +11,16 @@ #define _GNU_SOURCE +#include #include "tst_test.h" #include "lapi/keyctl.h" #include "common.h" +#define WATCH_QUEUE_NOTE_SIZE 128 + static int data_lost; +static key_serial_t key; +static int fd; static void saw_data_loss(struct watch_notification *n, LTP_ATTRIBUTE_UNUSED size_t len, unsigned int wtype) @@ -27,29 +32,38 @@ static void saw_data_loss(struct watch_notification *n, data_lost = 1; } -static void run(void) +static void setup(void) { - int fd; - key_serial_t key; - fd = wqueue_watch(1, &wqueue_filter); - key = wqueue_add_key(fd); - keyctl(KEYCTL_UPDATE, key, "b", 1); - keyctl(KEYCTL_REVOKE, key); +} + +static void run(void) +{ + int i, iterations; + + iterations = (getpagesize() / WATCH_QUEUE_NOTE_SIZE) * 2; + for (i = 0; i < iterations; i++) + keyctl(KEYCTL_UPDATE, key, "b", 1); data_lost = 0; while (!data_lost) wqueue_consumer(fd, saw_data_loss); - SAFE_CLOSE(fd); - if (data_lost) tst_res(TPASS, "Meta loss notification received"); else tst_res(TFAIL, "Event not recognized"); } +static void cleanup(void) +{ + keyctl(KEYCTL_REVOKE, key); + SAFE_CLOSE(fd); +} + static struct tst_test test = { .test_all = run, + .setup = setup, + .cleanup = cleanup, };