Linux Test Project
 help / color / mirror / Atom feed
* [LTP] [PATCH v2] Fix wqueue09 according with 5.17 kernel updates
@ 2022-03-30  9:08 Andrea Cervesato
  2022-03-30 11:58 ` pvorel
  0 siblings, 1 reply; 4+ messages in thread
From: Andrea Cervesato @ 2022-03-30  9:08 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 also the issue of loosing events on big number of iterations
such as -i 1000.

 testcases/kernel/watchqueue/wqueue09.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/testcases/kernel/watchqueue/wqueue09.c b/testcases/kernel/watchqueue/wqueue09.c
index 55d567249..e632be094 100644
--- a/testcases/kernel/watchqueue/wqueue09.c
+++ b/testcases/kernel/watchqueue/wqueue09.c
@@ -11,10 +11,13 @@
 
 #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 void saw_data_loss(struct watch_notification *n,
@@ -29,14 +32,15 @@ static void saw_data_loss(struct watch_notification *n,
 
 static void run(void)
 {
-	int fd;
+	int fd, i, iterations;
 	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);
+
+	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)
-- 
2.35.1


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

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

* Re: [LTP] [PATCH v2] Fix wqueue09 according with 5.17 kernel updates
  2022-03-30  9:08 [LTP] [PATCH v2] Fix wqueue09 according with 5.17 kernel updates Andrea Cervesato
@ 2022-03-30 11:58 ` pvorel
  2022-03-31  6:21   ` Petr Vorel
  0 siblings, 1 reply; 4+ messages in thread
From: pvorel @ 2022-03-30 11:58 UTC (permalink / raw)
  To: Andrea Cervesato; +Cc: ltp

Hi Andrea,

On 2022-03-30 11:08, Andrea Cervesato wrote:

> This patch fixes also the issue of loosing events on big number of 
> iterations
> such as -i 1000.

Unfortunately when testing on machine with older kernel (older 
Tumbleweed with
5.9.1-1-default) it still blocks and then timeout:

wqueue09.c:52: TPASS: Meta loss notification received
common.h:134: TINFO: Reading watch queue events

NOTE: I haven't tested it on 5.17 yet.

Kind regards,
Petr

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

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

* Re: [LTP] [PATCH v2] Fix wqueue09 according with 5.17 kernel updates
  2022-03-30 11:58 ` pvorel
@ 2022-03-31  6:21   ` Petr Vorel
  2022-04-12 12:45     ` Andrea Cervesato via ltp
  0 siblings, 1 reply; 4+ messages in thread
From: Petr Vorel @ 2022-03-31  6:21 UTC (permalink / raw)
  To: pvorel; +Cc: ltp

Hi all,

> Hi Andrea,

> On 2022-03-30 11:08, Andrea Cervesato wrote:

> > This patch fixes also the issue of loosing events on big number of
> > iterations
> > such as -i 1000.

> Unfortunately when testing on machine with older kernel (older Tumbleweed
> with
> 5.9.1-1-default) it still blocks and then timeout:

> wqueue09.c:52: TPASS: Meta loss notification received
> common.h:134: TINFO: Reading watch queue events

FYI on long enough -i (513 in my case)
buf_len = SAFE_READ(0, fd, buffer, sizeof(buffer));

This is regardless kernel version (tested on Tumbleweed 5.17.0-3.g6cba016-default
and SLES 5.14.21) => easily reproducible.

NOTE: keyctl() return value is always 0.

Also not sure why we are not revoking key any more (removed in this patchset).

Kind regards,
Petr

> NOTE: I haven't tested it on 5.17 yet.

> Kind regards,
> Petr

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

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

* Re: [LTP] [PATCH v2] Fix wqueue09 according with 5.17 kernel updates
  2022-03-31  6:21   ` Petr Vorel
@ 2022-04-12 12:45     ` Andrea Cervesato via ltp
  0 siblings, 0 replies; 4+ messages in thread
From: Andrea Cervesato via ltp @ 2022-04-12 12:45 UTC (permalink / raw)
  To: Petr Vorel, pvorel; +Cc: ltp


[-- Attachment #1.1: Type: text/plain, Size: 1349 bytes --]

Hi Petr,

I guess the bug coming out from older versions of the kernel is related 
with kernel patch 3b4c0371928c17af03e8397ac842346624017ce6 and the way 
watch_queue was implemented.

Probably test was finding a kernel bug which is now solved with that 
patch and, with a proper wqueue09 implementation, this bug is not 
showing anymore with high -i values. Please check the latest version of 
the wqueue09 patch that I've sent.

Andrea

On 3/31/22 08:21, Petr Vorel wrote:
> Hi all,
>
>> Hi Andrea,
>> On 2022-03-30 11:08, Andrea Cervesato wrote:
>>> This patch fixes also the issue of loosing events on big number of
>>> iterations
>>> such as -i 1000.
>> Unfortunately when testing on machine with older kernel (older Tumbleweed
>> with
>> 5.9.1-1-default) it still blocks and then timeout:
>> wqueue09.c:52: TPASS: Meta loss notification received
>> common.h:134: TINFO: Reading watch queue events
> FYI on long enough -i (513 in my case)
> buf_len = SAFE_READ(0, fd, buffer, sizeof(buffer));
>
> This is regardless kernel version (tested on Tumbleweed 5.17.0-3.g6cba016-default
> and SLES 5.14.21) => easily reproducible.
>
> NOTE: keyctl() return value is always 0.
>
> Also not sure why we are not revoking key any more (removed in this patchset).
>
> Kind regards,
> Petr
>
>> NOTE: I haven't tested it on 5.17 yet.
>> Kind regards,
>> Petr

[-- Attachment #1.2: Type: text/html, Size: 2890 bytes --]

[-- Attachment #2: Type: text/plain, Size: 60 bytes --]


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

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

end of thread, other threads:[~2022-04-12 12:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-30  9:08 [LTP] [PATCH v2] Fix wqueue09 according with 5.17 kernel updates Andrea Cervesato
2022-03-30 11:58 ` pvorel
2022-03-31  6:21   ` Petr Vorel
2022-04-12 12:45     ` Andrea Cervesato via ltp

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox