Skip to contentSkip to conversation

ltp-aiodio.part4: Run DIT000 with only 1 reader process

PATCH In review Martin Doucha 2 participants 4 messages Jan 5, 2023 – Jan 6, 2023

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 ltp-aiodio.part4: Run DIT000 with only 1 reader process

New changes in real-time kernel patchset give high priority to direct I/O readers and may cause writes to block indefinitely if there are too many reader processes running in parallel. Reduce the number of reader processes in DIT000 to 1 which was the dio_truncate default before rewrite to new API.

Also add warning to dio_truncate if CONFIG_PREEMPT_RT is enabled and the number of reader processes is too high.

---

Change since v1:
- Added warning to dio_trunc

I'll leave up for discussion whether to merge this patch or v1.

 runtest/ltp-aiodio.part4                      | 2 +-
 testcases/kernel/io/ltp-aiodio/dio_truncate.c | 7 +++++++
 2 files changed, 8 insertions(+), 1 deletion(-)
runtest/ltp-aiodio.part4 +1 -1
index d88c27a83..c31bef934 100644
@@ -56,7 +56,7 @@ ADI007 dio_append
 ADI008 dio_append
 ADI009 dio_append
 #Running dio_truncate
-DIT000 dio_truncate
+DIT000 dio_truncate -n 1
 DIT001 dio_truncate
 DIT002 dio_truncate
 #Running dio_read
testcases/kernel/io/ltp-aiodio/dio_truncate.c +7 -0
index e5c0933e9..de1e3524e 100644
@@ -31,6 +31,7 @@
 #include <sys/types.h>
 #include <fcntl.h>
 #include "tst_test.h"
+#include "tst_kconfig.h"
 #include "common.h"
 
 static volatile int *run_child;
@@ -86,6 +87,7 @@ static void dio_read(const char *filename, long long align, size_t bs)
 static void setup(void)
 {
 	struct stat sb;
+	const char *kconf_rt[] = {"CONFIG_PREEMPT_RT", NULL};
 
 	if (tst_parse_int(str_numchildren, &numchildren, 1, INT_MAX))
 		tst_brk(TBROK, "Invalid number of children '%s'", str_numchildren);
@@ -103,6 +105,11 @@ static void setup(void)
 	alignment = sb.st_blksize;
 
 	run_child = SAFE_MMAP(NULL, sizeof(int), PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANONYMOUS, -1, 0);
+
+	if (numchildren > 2 && !tst_kconfig_check(kconf_rt)) {
+		tst_res(TINFO, "Warning: This test may deadlock on RT kernels");
+		tst_res(TINFO, "If it does, reduce number of threads to 2");
+	}
 }
 
 static void cleanup(void)
Signature · 5 lines
2.39.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
Reviewed-by on v2 1/1
#1 lore raw

Hi Martin,

...

Quoted 1 line
testcases/kernel/io/ltp-aiodio/dio_truncate.c +0 -0

...

testcases/kernel/io/ltp-aiodio/dio_truncate.c static void setup(void) · line 110

Quoted 3 lines
testcases/kernel/io/ltp-aiodio/dio_truncate.c +3 -0
+
+	if (numchildren > 2 && !tst_kconfig_check(kconf_rt)) {
+		tst_res(TINFO, "Warning: This test may deadlock on RT kernels");

I hate TWARN exits non-zero, thus we need to have warnings like this (TWARN would be more visible than TINFO, but it'd always mean non-zero for RT).

I'd wish the message was TWARN on error, but because on RT test timeouts, we would have to somehow check remaining time to print the warning before timeout.

Let's not complicate things more. Thank you for your work!

Kind regards,
Petr

Quoted 3 lines
testcases/kernel/io/ltp-aiodio/dio_truncate.c +2 -0
+		tst_res(TINFO, "If it does, reduce number of threads to 2");
+	}
 }
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#2 lore raw
In reply to Martin Doucha

Hi Martin,

testcases/kernel/io/ltp-aiodio/dio_truncate.c static void dio_read(const char *filename, long long align, size_t bs) · line 90

Quoted 1 line
testcases/kernel/io/ltp-aiodio/dio_truncate.c +1 -0
+	const char *kconf_rt[] = {"CONFIG_PREEMPT_RT", NULL};

FYI I'll change it to static const char * const kconf_rt[] before merge to keep checkpatch.pl happy.

Kind regards,
Petr

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#3 lore raw

Hi Martin,

merged. Thanks a lot for your work.

Kind regards,
Petr

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp