All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH v3] Fix wqueue09 according with 5.17 kernel updates
@ 2022-04-12 12:41 Andrea Cervesato
  2022-04-14 15:44 ` Petr Vorel
  0 siblings, 1 reply; 3+ messages in thread
From: Andrea Cervesato @ 2022-04-12 12:41 UTC (permalink / raw)
  To: 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 <andrea.cervesato@suse.de>
---
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 <unistd.h>
 #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,
 };
-- 
2.35.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [LTP] [PATCH v3] Fix wqueue09 according with 5.17 kernel updates
  2022-04-12 12:41 [LTP] [PATCH v3] Fix wqueue09 according with 5.17 kernel updates Andrea Cervesato
@ 2022-04-14 15:44 ` Petr Vorel
  2022-04-19  5:54   ` Petr Vorel
  0 siblings, 1 reply; 3+ messages in thread
From: Petr Vorel @ 2022-04-14 15:44 UTC (permalink / raw)
  To: Andrea Cervesato; +Cc: ltp

Hi Andrea,

Reviewed-by: Petr Vorel <pvorel@suse.cz>
Tested-by: Petr Vorel <pvorel@suse.cz>

Thanks a lot!

Kind regards,
Petr

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [LTP] [PATCH v3] Fix wqueue09 according with 5.17 kernel updates
  2022-04-14 15:44 ` Petr Vorel
@ 2022-04-19  5:54   ` Petr Vorel
  0 siblings, 0 replies; 3+ messages in thread
From: Petr Vorel @ 2022-04-19  5:54 UTC (permalink / raw)
  To: Andrea Cervesato, ltp

Hi Andrea,

Merged. Thanks!

Kind regards,
Petr

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-04-19  5:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-12 12:41 [LTP] [PATCH v3] Fix wqueue09 according with 5.17 kernel updates Andrea Cervesato
2022-04-14 15:44 ` Petr Vorel
2022-04-19  5:54   ` Petr Vorel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.