[LTP] [PATCH v2] ltp-aiodio.part4: Run DIT000 with only 1 reader process

Martin Doucha mdoucha@suse.cz
Thu Jan 5 17:29:29 CET 2023


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.

Signed-off-by: Martin Doucha <mdoucha@suse.cz>
---

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(-)

diff --git a/runtest/ltp-aiodio.part4 b/runtest/ltp-aiodio.part4
index d88c27a83..c31bef934 100644
--- a/runtest/ltp-aiodio.part4
+++ b/runtest/ltp-aiodio.part4
@@ -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
diff --git a/testcases/kernel/io/ltp-aiodio/dio_truncate.c b/testcases/kernel/io/ltp-aiodio/dio_truncate.c
index e5c0933e9..de1e3524e 100644
--- a/testcases/kernel/io/ltp-aiodio/dio_truncate.c
+++ b/testcases/kernel/io/ltp-aiodio/dio_truncate.c
@@ -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)
-- 
2.39.0



More information about the ltp mailing list