Skip to contentSkip to conversation

Recent changes (master)

PATCH Jens Axboe 1 participant 1 message Dec 19, 2025 Kbuild

lore
Share & tools
lore

Jens Axboe

author
#0 lore raw

The following changes since commit 3a4c1dd89241f5aff2835047a166dde19ae796b3:

Merge branch 'fix/prchk-segfault' of https://github.com/calebsander/fio (2025-12-16 13:10:09 -0500)

are available in the Git repository at:

git://git.kernel.dk/fio.git master

for you to fetch changes up to d028bdcb8515a29eb683a23b0a88c398cfe4d687:

test: cleanup test artifacts as we are running (2025-12-18 16:33:42 -0500)

----------------------------------------------------------------
Luis Chamberlain (5):
configure: conditionally add gnutls for libnfs >= 6.0.0
fio: refactor steady state validation check
fio: refactor duplicate code in steadystate_*_mean functions
fio: add latency steady state detection
fio: add mock test framework for isolated unit testing

Vincent Fu (5):
mock-tests: assess per second latency recovery
Merge branch '20251023-steady-state-add-latency' of https://github.com/mcgrof/fio
steadystate: define units for latency measurements
t/run-fio-tests: add cleanup option
test: cleanup test artifacts as we are running

 HOWTO.rst                                 |  10 ++
 Makefile                                  |   5 +
 ci/actions-full-test.sh                   |   2 +-
 client.c                                  |   4 +
 configure                                 |  19 ++-
 example_latency_steadystate.fio           |  47 ++++++
 mock-tests/Makefile                       |  80 +++++++++
 mock-tests/README.md                      | 166 +++++++++++++++++++
 mock-tests/lib/tap.h                      | 103 ++++++++++++
 mock-tests/tests/test_latency_precision.c | 259 ++++++++++++++++++++++++++++++
 options.c                                 |  33 +++-
 server.c                                  |  13 +-
 server.h                                  |   2 +-
 stat.c                                    |  41 ++++-
 stat.h                                    |  10 ++
 steadystate.c                             |  93 +++++++----
 steadystate.h                             |   7 +
 t/fiotestlib.py                           |   3 +
 t/run-fio-tests.py                        |   2 +
 19 files changed, 859 insertions(+), 40 deletions(-)
 create mode 100644 example_latency_steadystate.fio
 create mode 100644 mock-tests/Makefile
 create mode 100644 mock-tests/README.md
 create mode 100644 mock-tests/lib/tap.h
 create mode 100644 mock-tests/tests/test_latency_precision.c

---

Diff of recent changes:

HOWTO.rst +10 -0
index 9f55a73b..3d74cb9f 100644
@@ -4216,6 +4216,16 @@ Steady state
 			Collect bandwidth data and calculate the least squares regression
 			slope. Stop the job if the slope falls below the specified limit.
 
+		**lat**
+			Collect completion latency data and calculate the maximum mean
+			deviation. Stop the job if the deviation falls below the specified
+			limit.
+
+		**lat_slope**
+			Collect completion latency data and calculate the least squares
+			regression slope. Stop the job if the slope falls below the
+			specified limit.
+
 .. option:: steadystate_duration=time, ss_dur=time
 
         A rolling window of this duration will be used to judge whether steady
Makefile +5 -0
index 7393a327..0337e8fe 100644
@@ -643,6 +643,7 @@ clean: FORCE
 	@rm -f .depend $(FIO_OBJS) $(GFIO_OBJS) $(OBJS) $(T_OBJS) $(UT_OBJS) $(PROGS) $(T_PROGS) $(T_TEST_PROGS) core.* core gfio unittests/unittest FIO-VERSION-FILE *.[do] lib/*.d oslib/*.[do] crc/*.d engines/*.[do] engines/*.so profiles/*.[do] t/*.[do] t/*/*.[do] unittests/*.[do] unittests/*/*.[do] config-host.mak config-host.h y.tab.[ch] lex.yy.c exp/*.[do] lexer.h
 	@rm -f t/fio-btrace2fio t/io_uring t/read-to-pipe-async
 	@rm -rf  doc/output
+	@$(MAKE) -C mock-tests clean
 
 distclean: clean FORCE
 	@rm -f cscope.out fio.pdf fio_generate_plots.pdf fio2gnuplot.pdf fiologparser_hist.pdf
@@ -662,6 +663,10 @@ doc: tools/plot/fio2gnuplot.1
 test: fio
 	./fio --minimal --thread --exitall_on_error --runtime=1s --name=nulltest --ioengine=null --rw=randrw --iodepth=2 --norandommap --random_generator=tausworthe64 --size=16T --name=verifyfstest --filename=fiotestfile.tmp --unlink=1 --rw=write --verify=crc32c --verify_state_save=0 --size=16K
 
+
+mock-tests:
+	$(MAKE) -C mock-tests test
+
 fulltest:
 	sudo modprobe null_blk &&				 	\
 	if [ ! -e /usr/include/libzbc/zbc.h ]; then			\
ci/actions-full-test.sh +1 -1
index 6fa9f4ad..5d6d1ca3 100755
@@ -52,7 +52,7 @@ main() {
     fi
 
     echo python3 t/run-fio-tests.py --skip "${skip[@]}" "${args[@]}"
-    python3 t/run-fio-tests.py --skip "${skip[@]}" "${args[@]}"
+    python3 t/run-fio-tests.py -c --skip "${skip[@]}" "${args[@]}"
     make -C doc html
 }
 
client.c +4 -0
index 8c0744b8..374a744a 100644
@@ -1079,6 +1079,7 @@ static void convert_ts(struct thread_stat *dst, struct thread_stat *src)
 		for (i = 0; i < dst->ss_dur; i++ ) {
 			dst->ss_iops_data[i] = le64_to_cpu(src->ss_iops_data[i]);
 			dst->ss_bw_data[i] = le64_to_cpu(src->ss_bw_data[i]);
+			dst->ss_lat_data[i] = le64_to_cpu(src->ss_lat_data[i]);
 		}
 	}
 
@@ -1888,6 +1889,9 @@ int fio_handle_client(struct fio_client *client)
 
 			offset = le64_to_cpu(p->ts.ss_bw_data_offset);
 			p->ts.ss_bw_data = (uint64_t *)((char *)p + offset);
+
+			offset = le64_to_cpu(p->ts.ss_lat_data_offset);
+			p->ts.ss_lat_data = (uint64_t *)((char *)p + offset);
 		}
 
 		convert_ts(&p->ts, &p->ts);
configure +17 -2
index 13450118..64e58b65 100755
@@ -2348,8 +2348,23 @@ print_config "DAOS File System (dfs) Engine" "$dfs"
 if test "$libnfs" != "no" ; then
   if $(pkg-config libnfs > /dev/null 2>&1); then
     libnfs="yes"
-    libnfs_cflags=$(pkg-config --cflags libnfs gnutls)
-    libnfs_libs=$(pkg-config --libs libnfs gnutls)
+    libnfs_cflags=$(pkg-config --cflags libnfs)
+    libnfs_libs=$(pkg-config --libs libnfs)
+
+    # libnfs >= 6.0.0 requires gnutls for TLS support
+    libnfs_version=$(pkg-config --modversion libnfs 2>/dev/null)
+    if test -n "$libnfs_version" ; then
+      libnfs_major=$(echo $libnfs_version | cut -d. -f1)
+      if test "$libnfs_major" -ge 6 ; then
+        if $(pkg-config gnutls > /dev/null 2>&1); then
+          libnfs_cflags="$libnfs_cflags $(pkg-config --cflags gnutls)"
+          libnfs_libs="$libnfs_libs $(pkg-config --libs gnutls)"
+        else
+          feature_not_found "gnutls" "gnutls (required for libnfs >= 6.0.0)"
+          libnfs="no"
+        fi
+      fi
+    fi
   else
     if test "$libnfs" = "yes" ; then
       feature_not_found "libnfs" "libnfs"
example_latency_steadystate.fio new file +47 -0

47 lines not on this page · raw message

mock-tests/Makefile new file +80 -0

80 lines not on this page · raw message

mock-tests/README.md new file +166 -0

166 lines not on this page · raw message

mock-tests/lib/tap.h new file +103 -0

103 lines not on this page · raw message

mock-tests/tests/test_latency_precision.c new file +259 -0

259 lines not on this page · raw message

options.c +31 -2
index 8e3de528..6bd94e13 100644
@@ -1361,6 +1361,13 @@ static int str_random_distribution_cb(void *data, const char *str)
 	return 0;
 }
 
+static bool is_valid_steadystate(unsigned int state)
+{
+	return (state == FIO_SS_IOPS || state == FIO_SS_IOPS_SLOPE ||
+		state == FIO_SS_BW || state == FIO_SS_BW_SLOPE ||
+		state == FIO_SS_LAT || state == FIO_SS_LAT_SLOPE);
+}
+
 static int str_steadystate_cb(void *data, const char *str)
 {
 	struct thread_data *td = cb_data_to_td(data);
@@ -1369,8 +1376,7 @@ static int str_steadystate_cb(void *data, const char *str)
 	char *pct;
 	long long ll;
 
-	if (td->o.ss_state != FIO_SS_IOPS && td->o.ss_state != FIO_SS_IOPS_SLOPE &&
-	    td->o.ss_state != FIO_SS_BW && td->o.ss_state != FIO_SS_BW_SLOPE) {
+	if (!is_valid_steadystate(td->o.ss_state)) {
 		/* should be impossible to get here */
 		log_err("fio: unknown steady state criterion\n");
 		return 1;
@@ -1414,6 +1420,21 @@ static int str_steadystate_cb(void *data, const char *str)
 			return 0;
 
 		td->o.ss_limit.u.f = val;
+        } else if (td->o.ss_state & FIO_SS_LAT) {
+                long long tns;
+                if (check_str_time(nr, &tns, 0)) {
+                        log_err("fio: steadystate latency threshold parsing failed\n");
+                        free(nr);
+                        return 1;
+                }
+
+                dprint(FD_PARSE, "set steady state latency threshold to %lld nsec\n", tns);
+                free(nr);
+                if (parse_dryrun())
+                        return 0;
+
+                td->o.ss_limit.u.f = (double) tns;
+
 	} else {	/* bandwidth criterion */
 		if (str_to_decimal(nr, &ll, 1, td, 0, 0)) {
 			log_err("fio: steadystate BW threshold postfix parsing failed\n");
@@ -5529,6 +5550,14 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
 			    .oval = FIO_SS_BW_SLOPE,
 			    .help = "slope calculated from bandwidth measurements",
 			  },
+                          { .ival = "lat",
+                            .oval = FIO_SS_LAT,
+                            .help = "maximum mean deviation of latency measurements",
+                          },
+                          { .ival = "lat_slope",
+                            .oval = FIO_SS_LAT_SLOPE,
+                            .help = "slope calculated from latency measurements",
+                          },
 		},
 		.category = FIO_OPT_C_GENERAL,
 		.group  = FIO_OPT_G_RUNTIME,
server.c +11 -2
index efb31879..cde7fdf3 100644
@@ -1818,7 +1818,7 @@ void fio_server_send_ts(struct thread_stat *ts, struct group_run_stats *rs)
 
 	dprint(FD_NET, "ts->ss_state = %d\n", ts->ss_state);
 	if (ts->ss_state & FIO_SS_DATA)
-		ss_extra_size = 2 * ts->ss_dur * sizeof(uint64_t);
+		ss_extra_size = 3 * ts->ss_dur * sizeof(uint64_t);
 
 	extended_buf_size += ss_extra_size;
 	if (!extended_buf_size) {
@@ -1863,7 +1863,7 @@ void fio_server_send_ts(struct thread_stat *ts, struct group_run_stats *rs)
 	}
 
 	if (ss_extra_size) {
-		uint64_t *ss_iops, *ss_bw;
+		uint64_t *ss_iops, *ss_bw, *ss_lat;
 		uint64_t offset;
 		struct cmd_ts_pdu *ptr = extended_buf;
 
@@ -1885,6 +1885,15 @@ void fio_server_send_ts(struct thread_stat *ts, struct group_run_stats *rs)
 
 		offset = (char *)extended_buf_wp - (char *)extended_buf;
 		ptr->ts.ss_bw_data_offset = cpu_to_le64(offset);
+		extended_buf_wp = ss_bw + (int) ts->ss_dur;
+
+		/* ss lat */
+		ss_lat = extended_buf_wp;
+		for (i = 0; i < ts->ss_dur; i++)
+			ss_lat[i] = cpu_to_le64(ts->ss_lat_data[i]);
+
+		offset = (char *)extended_buf_wp - (char *)extended_buf;
+		ptr->ts.ss_lat_data_offset = cpu_to_le64(offset);
 	}
 
 	fio_net_queue_cmd(FIO_NET_CMD_TS, extended_buf, extended_buf_size, NULL, SK_F_COPY);
server.h +1 -1
index 139f84b1..a3b163b1 100644
@@ -51,7 +51,7 @@ struct fio_net_cmd_reply {
 };
 
 enum {
-	FIO_SERVER_VER			= 114,
+	FIO_SERVER_VER			= 115,
 
 	FIO_SERVER_MAX_FRAGMENT_PDU	= 1024,
 	FIO_SERVER_MAX_CMD_MB		= 2048,
stat.c +36 -5

84 lines not on this page · raw message

stat.h +10 -0
index f40507e3..84ea8445 100644
@@ -283,6 +283,16 @@ struct thread_stat {
 		uint64_t pad5;
 	};
 
+	union {
+		uint64_t *ss_lat_data;
+		/*
+		 * For FIO_NET_CMD_TS, the pointed to data will temporarily
+		 * be stored at this offset from the start of the payload.
+		 */
+		uint64_t ss_lat_data_offset;
+		uint64_t pad5b;
+	};
+
 	union {
 		struct clat_prio_stat *clat_prio[DDIR_RWDIR_CNT];
 		/*
steadystate.c +66 -27

239 lines not on this page · raw message

steadystate.h +7 -0
index e25fd9d0..aff15211 100644
@@ -9,6 +9,7 @@ extern void steadystate_setup(void);
 extern int td_steadystate_init(struct thread_data *);
 extern uint64_t steadystate_bw_mean(const struct thread_stat *);
 extern uint64_t steadystate_iops_mean(const struct thread_stat *);
+extern uint64_t steadystate_lat_mean(const struct thread_stat *);
 
 extern bool steadystate_enabled;
 extern unsigned int ss_check_interval;
@@ -24,6 +25,7 @@ struct steadystate_data {
 	unsigned int tail;
 	uint64_t *iops_data;
 	uint64_t *bw_data;
+	uint64_t *lat_data;
 
 	double slope;
 	double deviation;
@@ -38,6 +40,8 @@ struct steadystate_data {
 	struct timespec prev_time;
 	uint64_t prev_iops;
 	uint64_t prev_bytes;
+	double prev_lat_sum;
+	uint64_t prev_lat_samples;
 };
 
 enum {
@@ -49,6 +53,7 @@ enum {
 	__FIO_SS_DATA,
 	__FIO_SS_PCT,
 	__FIO_SS_BUFFER_FULL,
+	__FIO_SS_LAT,
 };
 
 enum {
@@ -60,9 +65,11 @@ enum {
 	FIO_SS_DATA		= 1 << __FIO_SS_DATA,
 	FIO_SS_PCT		= 1 << __FIO_SS_PCT,
 	FIO_SS_BUFFER_FULL	= 1 << __FIO_SS_BUFFER_FULL,
+	FIO_SS_LAT		= 1 << __FIO_SS_LAT,
 
 	FIO_SS_IOPS_SLOPE	= FIO_SS_IOPS | FIO_SS_SLOPE,
 	FIO_SS_BW_SLOPE		= FIO_SS_BW | FIO_SS_SLOPE,
+	FIO_SS_LAT_SLOPE	= FIO_SS_LAT | FIO_SS_SLOPE,
 };
 
 #endif
t/fiotestlib.py +3 -0
index 913cb605..2049e41e 100755
@@ -13,6 +13,7 @@ import os
 import sys
 import json
 import locale
+import shutil
 import logging
 import platform
 import traceback
@@ -473,6 +474,8 @@ def run_fio_tests(test_list, test_env, args):
         if test.passed:
             result = "PASSED"
             passed = passed + 1
+            if hasattr(args, 'cleanup') and args.cleanup:
+                shutil.rmtree(test_env['artifact_root'] + f"/{config['test_id']:04d}", ignore_errors=True)
         else:
             result = f"FAILED: {test.failure_reason}"
             failed = failed + 1
t/run-fio-tests.py +2 -0
index 85112878..457d7f8c 100755
@@ -1156,6 +1156,8 @@ def parse_args():
                         help='pass-through an argument to an executable test')
     parser.add_argument('--nvmecdev', action='store', default=None,
                         help='NVMe character device for **DESTRUCTIVE** testing (e.g., /dev/ng0n1)')
+    parser.add_argument('-c', '--cleanup', action='store_true', default=False,
+                        help='Delete artifacts for passing tests')
     args = parser.parse_args()
 
     return args