【Backport】返合字符串string处理的重要优化#283
Conversation
mainline inclusion from mainline-6.6-rc2 commit 83feeb1 category: feature bugzilla: RVCK-Project#280 -------------------------------- printbuf now needs to know the number of characters that would have been written if the buffer was too small, like snprintf(); this changes string_get_size() to return the the return value of snprintf(). Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> Signed-off-by: Gao Rui <gao.rui@zte.com.cn>
mainline inclusion from mainline-6.8-rc7 commit f0b7f8a category: feature bugzilla: RVCK-Project#280 -------------------------------- The new flags parameter allows controlling - Whether or not the units suffix is separated by a space, for compatibility with sort -h - Whether or not to append a B suffix - we're not always printing bytes. Co-developed-by: Kent Overstreet <kent.overstreet@linux.dev> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Kent Overstreet <kent.overstreet@linux.dev> Link: https://lore.kernel.org/r/20240229205345.93902-1-andriy.shevchenko@linux.intel.com Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: Gao Rui <gao.rui@zte.com.cn>
mainline inclusion from mainline-6.8 commit 29d8568 category: feature bugzilla: RVCK-Project#280 -------------------------------- Convert test_string.c to KUnit so it can be easily run with everything else. Additional text context is retained for failure reporting. For example, when forcing a bad match, we can see the loop counters reported for the memset() tests: [09:21:52] # test_memset64: ASSERTION FAILED at lib/string_kunit.c:93 [09:21:52] Expected v == 0xa2a1a1a1a1a1a1a1ULL, but [09:21:52] v == -6799976246779207263 (0xa1a1a1a1a1a1a1a1) [09:21:52] 0xa2a1a1a1a1a1a1a1ULL == -6727918652741279327 (0xa2a1a1a1a1a1a1a1) [09:21:52] i:0 j:0 k:0 [09:21:52] [FAILED] test_memset64 Currently passes without problems: $ ./tools/testing/kunit/kunit.py run string ... [09:37:40] Starting KUnit Kernel (1/1)... [09:37:40] ============================================================ [09:37:40] =================== string (6 subtests) ==================== [09:37:40] [PASSED] test_memset16 [09:37:40] [PASSED] test_memset32 [09:37:40] [PASSED] test_memset64 [09:37:40] [PASSED] test_strchr [09:37:40] [PASSED] test_strnchr [09:37:40] [PASSED] test_strspn [09:37:40] ===================== [PASSED] string ====================== [09:37:40] ============================================================ [09:37:40] Testing complete. Ran 6 tests: passed: 6 [09:37:40] Elapsed time: 6.730s total, 0.001s configuring, 6.562s building, 0.131s running Link: https://lore.kernel.org/r/20240301202732.2688342-1-keescook@chromium.org Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: Gao Rui <gao.rui@zte.com.cn>
mainline inclusion from mainline-6.8 commit fb57550 category: feature bugzilla: RVCK-Project#280 -------------------------------- Convert test-string_helpers.c to KUnit so it can be easily run with everything else. Failure reporting doesn't need to be open-coded in most places, for example, forcing a failure in the expected output for upper/lower testing looks like this: [12:18:43] # test_upper_lower: EXPECTATION FAILED at lib/string_helpers_kunit.c:579 [12:18:43] Expected dst == strings_upper[i].out, but [12:18:43] dst == "ABCDEFGH1234567890TEST" [12:18:43] strings_upper[i].out == "ABCDEFGH1234567890TeST" [12:18:43] [FAILED] test_upper_lower Currently passes without problems: $ ./tools/testing/kunit/kunit.py run string_helpers ... [12:23:55] Starting KUnit Kernel (1/1)... [12:23:55] ============================================================ [12:23:55] =============== string_helpers (3 subtests) ================ [12:23:55] [PASSED] test_get_size [12:23:55] [PASSED] test_upper_lower [12:23:55] [PASSED] test_unescape [12:23:55] ================= [PASSED] string_helpers ================== [12:23:55] ============================================================ [12:23:55] Testing complete. Ran 3 tests: passed: 3 [12:23:55] Elapsed time: 6.709s total, 0.001s configuring, 6.591s building, 0.066s running Link: https://lore.kernel.org/r/20240301202732.2688342-2-keescook@chromium.org Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: Gao Rui <gao.rui@zte.com.cn>
mainline inclusion from mainline-6.9-rc3 commit 9259a47 category: feature bugzilla: RVCK-Project#280 -------------------------------- Currently, str*cmp functions (strcmp, strncmp, strcasecmp and strncasecmp) are not covered with tests. Extend the `string_kunit.c` test by adding the test cases for them. This patch adds 8 more test cases: 1) strcmp test 2) strcmp test on long strings (2048 chars) 3) strncmp test 4) strncmp test on long strings (2048 chars) 5) strcasecmp test 6) strcasecmp test on long strings 7) strncasecmp test 8) strncasecmp test on long strings These test cases aim at covering as many edge cases as possible, including the tests on empty strings, situations when the different symbol is placed at the end of one of the strings, etc. Signed-off-by: Ivan Orlov <ivan.orlov0322@gmail.com> Reviewed-by: Andy Shevchenko <andy@kernel.org> Link: https://lore.kernel.org/r/20240417233033.717596-1-ivan.orlov0322@gmail.com Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: Gao Rui <gao.rui@zte.com.cn>
mainline inclusion from mainline-6.9-rc5 commit b03442f category: feature bugzilla: RVCK-Project#280 -------------------------------- In preparation for moving the strscpy_kunit.c tests into string_kunit.c, rename "tc" to "strscpy_check" for better readability. Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Tested-by: Ivan Orlov <ivan.orlov0322@gmail.com> Link: https://lore.kernel.org/r/20240419140155.3028912-1-keescook@chromium.org Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: Gao Rui <gao.rui@zte.com.cn>
mainline inclusion from mainline-6.9-rc5 commit bb8d9b7 category: feature bugzilla: RVCK-Project#280 -------------------------------- Move the strscpy() tests into string_kunit.c. Remove the separate Kconfig and Makefile rule. Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Tested-by: Ivan Orlov <ivan.orlov0322@gmail.com> Link: https://lore.kernel.org/r/20240419140155.3028912-2-keescook@chromium.org Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: Gao Rui <gao.rui@zte.com.cn>
mainline inclusion from mainline-6.9-rc5 commit 6e4ef14 category: feature bugzilla: RVCK-Project#280 -------------------------------- The test naming convention differs between string_kunit.c and strcat_kunit.c. Move "test" to the beginning of the function name. Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Tested-by: Ivan Orlov <ivan.orlov0322@gmail.com> Link: https://lore.kernel.org/r/20240419140155.3028912-3-keescook@chromium.org Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: Gao Rui <gao.rui@zte.com.cn>
mainline inclusion from mainline-6.9-rc5 commit bd678f7 category: feature bugzilla: RVCK-Project#280 -------------------------------- Move the strcat() tests into string_kunit.c. Remove the separate Kconfig and Makefile rule. Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Tested-by: Ivan Orlov <ivan.orlov0322@gmail.com> Link: https://lore.kernel.org/r/20240419140155.3028912-4-keescook@chromium.org Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: Gao Rui <gao.rui@zte.com.cn>
mainline inclusion from mainline-6.9-rc5 commit dde915c category: feature bugzilla: RVCK-Project#280 -------------------------------- The KUnit convention for test names is AREA_test_WHAT. Adjust the string test names to follow this pattern. Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Tested-by: Ivan Orlov <ivan.orlov0322@gmail.com> Link: https://lore.kernel.org/r/20240419140155.3028912-5-keescook@chromium.org Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: Gao Rui <gao.rui@zte.com.cn>
mainline inclusion from mainline-6.9-rc6 commit 0efc599 category: feature bugzilla: RVCK-Project#280 -------------------------------- Another ambiguous use of strncpy() is to copy from strings that may not be NUL-terminated. These cases depend on having the destination buffer be explicitly larger than the source buffer's maximum size, having the size of the copy exactly match the source buffer's maximum size, and for the destination buffer to get explicitly NUL terminated. This usually happens when parsing protocols or hardware character arrays that are not guaranteed to be NUL-terminated. The code pattern is effectively this: char dest[sizeof(src) + 1]; strncpy(dest, src, sizeof(src)); dest[sizeof(dest) - 1] = '\0'; In practice it usually looks like: struct from_hardware { ... char name[HW_NAME_SIZE] __nonstring; ... }; struct from_hardware *p = ...; char name[HW_NAME_SIZE + 1]; strncpy(name, p->name, HW_NAME_SIZE); name[NW_NAME_SIZE] = '\0'; This cannot be replaced with: strscpy(name, p->name, sizeof(name)); because p->name is smaller and not NUL-terminated, so FORTIFY will trigger when strnlen(p->name, sizeof(name)) is used. And it cannot be replaced with: strscpy(name, p->name, sizeof(p->name)); because then "name" may contain a 1 character early truncation of p->name. Provide an unambiguous interface for converting a maybe not-NUL-terminated string to a NUL-terminated string, with compile-time buffer size checking so that it can never fail at runtime: memtostr() and memtostr_pad(). Also add KUnit tests for both. Link: https://lore.kernel.org/r/20240410023155.2100422-1-keescook@chromium.org Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: Gao Rui <gao.rui@zte.com.cn>
mainline inclusion from mainline-6.9-rc6 commit c01c41e category: feature bugzilla: RVCK-Project#280 -------------------------------- It is more logical to have the strtomem() test in string_kunit.c instead of the memcpy() suite. Move it to live with memtostr(). Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: Gao Rui <gao.rui@zte.com.cn>
mainline inclusion from mainline-7.0-rc6 commit ae45f89 category: feature bugzilla: RVCK-Project#280 -------------------------------- Add a KUnit test for strlen() to verify correctness across different string lengths and memory alignments. Use vmalloc() to place the NUL character at the page boundary to ensure over-reads are detected. Suggested-by: Kees Cook <kees@kernel.org> Signed-off-by: Feng Jiang <jiangfeng@kylinos.cn> Reviewed-by: Kees Cook <kees@kernel.org> Link: https://patch.msgid.link/20260130025018.172925-2-jiangfeng@kylinos.cn Signed-off-by: Paul Walmsley <pjw@kernel.org> Signed-off-by: Gao Rui <gao.rui@zte.com.cn>
mainline inclusion from mainline-7.0-rc6 commit 263dca2 category: feature bugzilla: RVCK-Project#280 -------------------------------- Add a KUnit test for strnlen() to verify correctness across different string lengths and memory alignments. Use vmalloc() to place the NUL character at the page boundary to ensure over-reads are detected. Suggested-by: Andy Shevchenko <andy@kernel.org> Suggested-by: Kees Cook <kees@kernel.org> Signed-off-by: Feng Jiang <jiangfeng@kylinos.cn> Reviewed-by: Kees Cook <kees@kernel.org> Link: https://patch.msgid.link/20260130025018.172925-3-jiangfeng@kylinos.cn Signed-off-by: Paul Walmsley <pjw@kernel.org> Signed-off-by: Gao Rui <gao.rui@zte.com.cn>
mainline inclusion from mainline-7.0-rc6 commit 27b2810 category: feature bugzilla: RVCK-Project#280 -------------------------------- Add a KUnit test for strrchr() to verify correctness across different string lengths and memory alignments. Use vmalloc() to place the NUL character at the page boundary to ensure over-reads are detected. Suggested-by: Kees Cook <kees@kernel.org> Signed-off-by: Feng Jiang <jiangfeng@kylinos.cn> Reviewed-by: Kees Cook <kees@kernel.org> Link: https://patch.msgid.link/20260130025018.172925-4-jiangfeng@kylinos.cn Signed-off-by: Paul Walmsley <pjw@kernel.org> Signed-off-by: Gao Rui <gao.rui@zte.com.cn>
mainline inclusion from mainline-7.0-rc6 commit 0020240 category: feature bugzilla: RVCK-Project#280 -------------------------------- Introduce a benchmarking framework to the string_kunit test suite to measure the execution efficiency of string functions. The implementation is inspired by crc_benchmark(), measuring throughput (MB/s) and latency (ns/call) across a range of string lengths. It includes a warm-up phase, disables preemption during measurement, and uses a fixed seed for reproducible results. This framework allows for comparing different implementations (e.g., generic C vs. architecture-optimized assembly) within the KUnit environment. Initially, provide a benchmark for strlen(). Suggested-by: Andy Shevchenko <andy@kernel.org> Suggested-by: Eric Biggers <ebiggers@kernel.org> Signed-off-by: Feng Jiang <jiangfeng@kylinos.cn> Reviewed-by: Kees Cook <kees@kernel.org> Link: https://patch.msgid.link/20260130025018.172925-5-jiangfeng@kylinos.cn [pjw@kernel.org: fixed a checkpatch issue] Signed-off-by: Paul Walmsley <pjw@kernel.org> Signed-off-by: Gao Rui <gao.rui@zte.com.cn>
mainline inclusion from mainline-7.0-rc6 commit e73bcb3 category: feature bugzilla: RVCK-Project#280 -------------------------------- Extend the string benchmarking suite to include strnlen(), strchr(), and strrchr(). For character search functions strchr() and strrchr(), the benchmark targets the NUL character. This ensures the entire string is scanned, providing a consistent measure of full-length processing efficiency comparable to strlen(). Suggested-by: Andy Shevchenko <andy@kernel.org> Suggested-by: Eric Biggers <ebiggers@kernel.org> Signed-off-by: Feng Jiang <jiangfeng@kylinos.cn> Acked-by: Andy Shevchenko <andy@kernel.org> Reviewed-by: Kees Cook <kees@kernel.org> Link: https://patch.msgid.link/20260130025018.172925-6-jiangfeng@kylinos.cn Signed-off-by: Paul Walmsley <pjw@kernel.org> Signed-off-by: Gao Rui <gao.rui@zte.com.cn>
mainline inclusion from mainline-7.0-rc6 commit 5ba15d4 category: feature bugzilla: RVCK-Project#280 -------------------------------- Add an optimized strnlen() implementation for RISC-V. This version includes a generic optimization and a Zbb-powered optimization using the 'orc.b' instruction, derived from the strlen() implementation. Benchmark results (QEMU TCG, rv64): Length | Original (MB/s) | Optimized (MB/s) | Improvement -------|-----------------|------------------|------------ 16 B | 179 | 309 | +72.6% 512 B | 347 | 1562 | +350.1% 4096 B | 356 | 1878 | +427.5% Suggested-by: Qingfang Deng <dqfext@gmail.com> Signed-off-by: Feng Jiang <jiangfeng@kylinos.cn> Link: https://patch.msgid.link/20260130025018.172925-7-jiangfeng@kylinos.cn Signed-off-by: Paul Walmsley <pjw@kernel.org> Signed-off-by: Gao Rui <gao.rui@zte.com.cn>
mainline inclusion from mainline-7.0-rc6 commit adf5421 category: feature bugzilla: RVCK-Project#280 -------------------------------- Add an assembly implementation of strchr() for RISC-V. By eliminating stack frame management (prologue/epilogue) and optimizing the function entries, the assembly version provides significant relative gains for short strings where the fixed overhead of the C function is most prominent. As string length increases, performance converges with the generic C implementation. Benchmark results (QEMU TCG, rv64): Length | Original (MB/s) | Optimized (MB/s) | Improvement -------|-----------------|------------------|------------ 1 B | 21 | 22 | +4.8% 7 B | 113 | 121 | +7.1% 16 B | 195 | 202 | +3.6% 512 B | 376 | 389 | +3.5% 4096 B | 394 | 393 | -0.3% Signed-off-by: Feng Jiang <jiangfeng@kylinos.cn> Tested-by: Joel Stanley <joel@jms.id.au> Link: https://patch.msgid.link/20260130025018.172925-8-jiangfeng@kylinos.cn Signed-off-by: Paul Walmsley <pjw@kernel.org> Signed-off-by: Gao Rui <gao.rui@zte.com.cn>
mainline inclusion from mainline-7.0-rc6 commit bef64bc category: feature bugzilla: RVCK-Project#280 -------------------------------- Add an assembly implementation of strrchr() for RISC-V. This implementation minimizes instruction count and avoids unnecessary memory access to the stack. The performance benefits are most visible on small workloads (1-16 bytes) where the architectural savings in function overhead outweigh the execution time of the scan loop. Benchmark results (QEMU TCG, rv64): Length | Original (MB/s) | Optimized (MB/s) | Improvement -------|-----------------|------------------|------------ 1 B | 20 | 21 | +5.0% 7 B | 111 | 120 | +8.1% 16 B | 189 | 199 | +5.3% 512 B | 361 | 382 | +5.8% 4096 B | 388 | 391 | +0.8% Signed-off-by: Feng Jiang <jiangfeng@kylinos.cn> Tested-by: Joel Stanley <joel@jms.id.au> Link: https://patch.msgid.link/20260130025018.172925-9-jiangfeng@kylinos.cn Signed-off-by: Paul Walmsley <pjw@kernel.org> Signed-off-by: Gao Rui <gao.rui@zte.com.cn>
|
开始测试 log: https://github.com/RVCK-Project/rvck/actions/runs/26272884576 参数解析结果
测试完成 详细结果:
Kunit Test Result[06:51:44] Testing complete. Ran 482 tests: passed: 466, skipped: 16
Kernel Build Result
Check Patch Result
LAVA Check (qemu)
result: Lava check done!
LAVA Checklava 执行失败.LAVA Checklava 执行失败.LAVA Checklava 执行失败.测试完成 详细结果:
Kunit Test Result[06:51:44] Testing complete. Ran 482 tests: passed: 466, skipped: 16
Kernel Build Result
Check Patch Result
LAVA Check (qemu)
result: Lava check done!
LAVA Checklava 执行失败.LAVA Checklava 执行失败.LAVA Checklava 执行失败.测试完成 详细结果:
Kunit Test Result[06:51:44] Testing complete. Ran 482 tests: passed: 466, skipped: 16
Kernel Build Result
Check Patch Result
LAVA Check (qemu)
result: Lava check done!
LAVA Checklava 执行失败.LAVA Checklava 执行失败.LAVA Checklava 执行失败. |
|
该PR已经完成,测试通过,请老师评审 |
|
开始测试 log: https://github.com/RVCK-Project/rvck/actions/runs/26272884576 参数解析结果
测试完成 详细结果:
Kunit Test Result[03:26:42] Testing complete. Ran 482 tests: passed: 466, skipped: 16
Kernel Build Result
Check Patch Result
LAVA Check (qemu)
result: Lava check fail!
LAVA Check (sg2042)
result: Lava check fail!
LAVA Check (spacemit-k1-bananapi-f3)
result: Lava check fail!
LAVA Check (lpi4a)
result: Lava check fail!
测试完成 详细结果:
Kunit Test Result[03:26:42] Testing complete. Ran 482 tests: passed: 466, skipped: 16
Kernel Build Result
Check Patch Result
LAVA Check (qemu)
result: Lava check fail!
LAVA Check (sg2042)
result: Lava check fail!
LAVA Check (spacemit-k1-bananapi-f3)
result: Lava check fail!
LAVA Check (lpi4a)
result: Lava check fail!
|
|
临近rebase滚动窗口,如果要争取本月合并,请务必确保CI测试通过,因pr较多,目前的审阅策略是优先审通过CI测试的。 |
|
开始测试 log: https://github.com/RVCK-Project/rvck/actions/runs/26272884576 参数解析结果
测试完成 详细结果:
Kunit Test Result[01:45:42] Testing complete. Ran 482 tests: passed: 466, skipped: 16
Kernel Build Result
Check Patch Result
LAVA Check (qemu)
result: Lava check fail!
LAVA Check (sg2042)
result: Lava check done!
LAVA Check (spacemit-k1-bananapi-f3)
result: Lava check fail!
LAVA Check (lpi4a)
result: Lava check fail!
测试完成 详细结果:
Kunit Test Result[01:45:42] Testing complete. Ran 482 tests: passed: 466, skipped: 16
Kernel Build Result
Check Patch Result
LAVA Check (qemu)
result: Lava check fail!
LAVA Check (sg2042)
result: Lava check done!
LAVA Check (spacemit-k1-bananapi-f3)
result: Lava check fail!
LAVA Check (lpi4a)
result: Lava check fail!
|
|
/check 开始测试 log: https://github.com/RVCK-Project/rvck/actions/runs/26635543220 参数解析结果
测试完成 详细结果:
Kunit Test Result[11:53:14] Testing complete. Ran 482 tests: passed: 466, skipped: 16
Kernel Build Result
Check Patch Result
|
|
很多pr卡在lavaci的build阶段,疑似故障,我本地在oe2403上编译和boot都正常,待问题澄清后如果是补丁的问题,在6月修复吧。 |
58b2553
into
RVCK-Project:rvck-6.6


issues: #280
本系列补丁为 RISC-V 架构提供了 strnlen()、strchr() 和 strrchr() 的优化实现。其中 strnlen() 的实现基于现有已优化的 strlen()。对于 strchr() 和 strrchr(),当前版本采用简单的逐字节汇编逻辑,这将作为未来基于 Zbb 扩展优化的基准。
使用kunit进行测试,测试通过,且string处理性能有较大提升,结果如下:
[ 3.480812] KTAP version 1
[ 3.481021] 1..2
[ 3.482462] KTAP version 1
[ 3.482713] # Subtest: string
[ 3.483016] # module: string_kunit
[ 3.483191] 1..27
[ 4.568666] ok 1 string_test_memset16
[ 5.692374] ok 2 string_test_memset32
[ 6.730313] ok 3 string_test_memset64
[ 6.740274] ok 4 string_test_strlen
[ 6.750874] ok 5 string_test_strnlen
[ 6.757060] ok 6 string_test_strchr
[ 6.762492] ok 7 string_test_strnchr
[ 6.774306] ok 8 string_test_strrchr
[ 6.779985] ok 9 string_test_strspn
[ 6.784372] ok 10 string_test_strcmp
[ 6.789093] ok 11 string_test_strcmp_long_strings
[ 6.793500] ok 12 string_test_strncmp
[ 6.798039] ok 13 string_test_strncmp_long_strings
[ 6.802991] ok 14 string_test_strcasecmp
[ 6.808636] ok 15 string_test_strcasecmp_long_strings
[ 6.813535] ok 16 string_test_strncasecmp
[ 6.819012] ok 17 string_test_strncasecmp_long_strings
[ 6.826514] ok 18 string_test_strscpy
[ 6.831165] ok 19 string_test_strcat
[ 6.837131] ok 20 string_test_strncat
[ 6.842307] ok 21 string_test_strlcat
[ 6.847176] ok 22 string_test_strtomem
[ 6.852960] ok 23 string_test_memtostr
[ 7.077318] # string_bench_strlen: len=0: 0 MB/s (198 ns/call)
[ 7.292520] # string_bench_strlen: len=1: 5 MB/s (189 ns/call)
[ 7.323342] # string_bench_strlen: len=7: 37 MB/s (185 ns/call)
[ 7.346878] # string_bench_strlen: len=8: 47 MB/s (169 ns/call)
[ 7.357557] # string_bench_strlen: len=16: 109 MB/s (146 ns/call)
[ 7.368195] # string_bench_strlen: len=31: 112 MB/s (275 ns/call)
[ 7.374508] # string_bench_strlen: len=64: 202 MB/s (315 ns/call)
[ 7.377349] # string_bench_strlen: len=127: 619 MB/s (205 ns/call)
[ 7.378883] # string_bench_strlen: len=512: 1095 MB/s (467 ns/call)
[ 7.380356] # string_bench_strlen: len=1024: 1285 MB/s (796 ns/call)
[ 7.381720] # string_bench_strlen: len=3173: 1518 MB/s (2088 ns/call)
[ 7.383026] # string_bench_strlen: len=4096: 1544 MB/s (2651 ns/call)
[ 7.385637] ok 24 string_bench_strlen
[ 7.574261] # string_bench_strnlen: len=0: 0 MB/s (164 ns/call)
[ 7.754507] # string_bench_strnlen: len=1: 6 MB/s (161 ns/call)
[ 7.787583] # string_bench_strnlen: len=7: 33 MB/s (208 ns/call)
[ 7.816028] # string_bench_strnlen: len=8: 39 MB/s (200 ns/call)
[ 7.829455] # string_bench_strnlen: len=16: 85 MB/s (186 ns/call)
[ 7.840271] # string_bench_strnlen: len=31: 111 MB/s (278 ns/call)
[ 7.844931] # string_bench_strnlen: len=64: 278 MB/s (230 ns/call)
[ 7.848220] # string_bench_strnlen: len=127: 405 MB/s (313 ns/call)
[ 7.850569] # string_bench_strnlen: len=512: 629 MB/s (813 ns/call)
[ 7.852761] # string_bench_strnlen: len=1024: 666 MB/s (1535 ns/call)
[ 7.854673] # string_bench_strnlen: len=3173: 864 MB/s (3672 ns/call)
[ 7.857759] # string_bench_strnlen: len=4096: 495 MB/s (8269 ns/call)
[ 7.861166] ok 25 string_bench_strnlen
[ 7.989179] # string_bench_strchr: len=0: 0 MB/s (114 ns/call)
[ 8.161600] # string_bench_strchr: len=1: 6 MB/s (163 ns/call)
[ 8.193632] # string_bench_strchr: len=7: 34 MB/s (201 ns/call)
[ 8.232729] # string_bench_strchr: len=8: 27 MB/s (290 ns/call)
[ 8.263111] # string_bench_strchr: len=16: 37 MB/s (421 ns/call)
[ 8.288908] # string_bench_strchr: len=31: 44 MB/s (698 ns/call)
[ 8.305724] # string_bench_strchr: len=64: 67 MB/s (941 ns/call)
[ 8.325444] # string_bench_strchr: len=127: 56 MB/s (2248 ns/call)
[ 8.342152] # string_bench_strchr: len=512: 67 MB/s (7601 ns/call)
[ 8.356506] # string_bench_strchr: len=1024: 81 MB/s (12567 ns/call)
[ 8.373986] # string_bench_strchr: len=3173: 73 MB/s (43243 ns/call)
[ 8.389670] # string_bench_strchr: len=4096: 79 MB/s (51768 ns/call)
[ 8.392996] ok 26 string_bench_strchr
[ 8.607214] # string_bench_strrchr: len=0: 0 MB/s (190 ns/call)
[ 8.821612] # string_bench_strrchr: len=1: 5 MB/s (191 ns/call)
[ 8.861514] # string_bench_strrchr: len=7: 28 MB/s (244 ns/call)
[ 8.905892] # string_bench_strrchr: len=8: 24 MB/s (323 ns/call)
[ 8.937241] # string_bench_strrchr: len=16: 36 MB/s (441 ns/call)
[ 8.962895] # string_bench_strrchr: len=31: 43 MB/s (715 ns/call)
[ 8.984561] # string_bench_strrchr: len=64: 53 MB/s (1197 ns/call)
[ 9.004759] # string_bench_strrchr: len=127: 54 MB/s (2310 ns/call)
[ 9.019346] # string_bench_strrchr: len=512: 79 MB/s (6476 ns/call)
[ 9.036685] # string_bench_strrchr: len=1024: 67 MB/s (15253 ns/call)
[ 9.051305] # string_bench_strrchr: len=3173: 83 MB/s (37876 ns/call)
[ 9.063689] # string_bench_strrchr: len=4096: 103 MB/s (39677 ns/call)
[ 9.066499] ok 27 string_bench_strrchr
[ 9.066814] # string: pass:27 fail:0 skip:0 total:27
[ 9.067939] # Totals: pass:27 fail:0 skip:0 total:27
[ 9.069126] ok 1 string
[ 9.070309] KTAP version 1
[ 9.070750] # Subtest: string_helpers
[ 9.071313] # module: string_helpers_kunit
[ 9.071379] 1..3
[ 9.080711] ok 1 test_get_size
[ 9.085374] ok 2 test_upper_lower
[ 9.174833] ok 3 test_unescape
[ 9.175997] # string_helpers: pass:3 fail:0 skip:0 total:3
[ 9.176725] # Totals: pass:3 fail:0 skip:0 total:3
[ 9.177459] ok 2 string_helpers