From c3c398e0701187716b6fba847fdae192e469b80b Mon Sep 17 00:00:00 2001 From: Shin'ichiro Kawasaki Date: Thu, 21 Mar 2024 12:10:10 +0900 Subject: [PATCH 1/3] iolog: regrow logs in iolog_delay() The commit b85c01f7e9df ("iolog.c: fix inaccurate clat when replay trace") triggered the assertion failure below for the workload which does I/O replay as asynchronous I/O together with log recording options such as write_lat_log. fio: stat.c:3030: get_cur_log: Assertion `iolog->pending->nr_samples < iolog->pending->max_samples' failed. fio: pid=40120, got signal=6 The assertion means that too many logs are recorded in the pending log space which keeps the logs until next log space regrow by reglow_logs() call. However, reglow_logs() is not called, and the pending log space runs out. The trigger commit modified iolog_delay() to call io_u_queued_complete() so that the asynchronous I/Os can be completed during delays between replayed I/Os. Before this commit, replayed I/Os were not completed until all I/O units are consumed. So the free I/O unit list gets empty periodically, then wait_for_completion() and regrow_logs() were called periodically. After this commit, all I/O units are not consumed, so wait_for_completion() and regrow_logs() are no longer called for long duration. Hence the assertion failure. To avoid the assertion, add the check for log regrow and reglow_logs() call in iolog_delay(). Fixes: b85c01f7e9df ("iolog.c: fix inaccurate clat when replay trace") Signed-off-by: Shin'ichiro Kawasaki Link: https://lore.kernel.org/r/20240321031011.4140040-2-shinichiro.kawasaki@wdc.com Signed-off-by: Jens Axboe --- iolog.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/iolog.c b/iolog.c index f52a9a80f7..251e9d7fa2 100644 --- a/iolog.c +++ b/iolog.c @@ -102,6 +102,8 @@ static void iolog_delay(struct thread_data *td, unsigned long delay) ret = io_u_queued_complete(td, 0); if (ret < 0) td_verror(td, -ret, "io_u_queued_complete"); + if (td->flags & TD_F_REGROW_LOGS) + regrow_logs(td); if (utime_since_now(&ts) > delay) break; } From 140c58beeee44a10358a817c7699b66c5c7290f9 Mon Sep 17 00:00:00 2001 From: Shin'ichiro Kawasaki Date: Thu, 21 Mar 2024 12:10:11 +0900 Subject: [PATCH 2/3] test: add the test for regrow logs with asynchronous I/O replay Add t/jobs/t0031-pre.fio and t/jobs/t0031.fio to test that the log space is regrown for the asynchronous I/O replay jobs. This test case confirms the fix by the previous commit titled "iolog: regrow logs in iolog_delay()". Signed-off-by: Shin'ichiro Kawasaki Link: https://lore.kernel.org/r/20240321031011.4140040-3-shinichiro.kawasaki@wdc.com Signed-off-by: Jens Axboe --- t/jobs/t0031-pre.fio | 8 ++++++++ t/jobs/t0031.fio | 7 +++++++ t/run-fio-tests.py | 9 +++++++++ 3 files changed, 24 insertions(+) create mode 100644 t/jobs/t0031-pre.fio create mode 100644 t/jobs/t0031.fio diff --git a/t/jobs/t0031-pre.fio b/t/jobs/t0031-pre.fio new file mode 100644 index 0000000000..ce4ee3b691 --- /dev/null +++ b/t/jobs/t0031-pre.fio @@ -0,0 +1,8 @@ +[job] +rw=write +ioengine=libaio +size=1mb +time_based=1 +runtime=1 +filename=t0030file +write_iolog=iolog diff --git a/t/jobs/t0031.fio b/t/jobs/t0031.fio new file mode 100644 index 0000000000..ae8f74428d --- /dev/null +++ b/t/jobs/t0031.fio @@ -0,0 +1,7 @@ +[job] +rw=read +ioengine=libaio +iodepth=128 +filename=t0030file +read_iolog=iolog +write_lat_log=lat_log diff --git a/t/run-fio-tests.py b/t/run-fio-tests.py index acdbbf8879..1b884d871d 100755 --- a/t/run-fio-tests.py +++ b/t/run-fio-tests.py @@ -869,6 +869,15 @@ def check_result(self): 'parameters': ['--bandwidth-log'], 'requirements': [], }, + { + 'test_id': 31, + 'test_class': FioJobFileTest, + 'job': 't0031.fio', + 'success': SUCCESS_DEFAULT, + 'pre_job': 't0031-pre.fio', + 'pre_success': SUCCESS_DEFAULT, + 'requirements': [], + }, { 'test_id': 1000, 'test_class': FioExeTest, From 20f42c101f7876648705a4fb8a9e2a647dc936ce Mon Sep 17 00:00:00 2001 From: Vincent Fu Date: Thu, 21 Mar 2024 08:36:14 -0400 Subject: [PATCH 3/3] t/run-fio-tests: restrict t0031 to Linux only This test uses libaio. So run it only on Linux when libaio is available. Signed-off-by: Vincent Fu --- t/run-fio-tests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/run-fio-tests.py b/t/run-fio-tests.py index 1b884d871d..225806134e 100755 --- a/t/run-fio-tests.py +++ b/t/run-fio-tests.py @@ -876,7 +876,7 @@ def check_result(self): 'success': SUCCESS_DEFAULT, 'pre_job': 't0031-pre.fio', 'pre_success': SUCCESS_DEFAULT, - 'requirements': [], + 'requirements': [Requirements.linux, Requirements.libaio], }, { 'test_id': 1000,