public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH] kernel/device-drivers/zram/zram01.sh : add a sync
@ 2023-08-03  1:51 Ian Wienand
  2023-08-03 10:52 ` Cyril Hrubis
  2023-08-08  3:56 ` [LTP] [PATCH v2] kernel/device-drivers/zram/zram01.sh : don't fill from /dev/zero Ian Wienand
  0 siblings, 2 replies; 23+ messages in thread
From: Ian Wienand @ 2023-08-03  1:51 UTC (permalink / raw)
  To: ltp

I have a system (virtualized aarch64, 4.18.0 kernel) that is
consistently failing the zram01.sh test as it tries to divide the
memory stats by zero.  It seems like I'm not the only one, this has
been reported before at [1] without resolution.

This test does a lot of 1k writes into zram devices of size 25, 25,
25, 300 and 25 mb.  On this particular system, I consistently see the
final 25mb testing fail as it examines /sys/block/zramX/mm_stat and
finds the mem_used_total as zero.

For example, I instrumented the test to put a "sync" call in between
examining the mm_stat value if it was zero; before and after it looks
like:

 zram01 7 TINFO: /sys/block/zram34/mm_stat is zero : 10092544        0        0 26214400   196608      154        0        0
 <sync>
 zram01 7 TINFO: /sys/block/zram34/mm_stat is zero (post sync) : 26214400     2841    65536 26214400   196608      399        0        0

This is an otherwise quiet system and nothing else seems out of order
(weird logs, load average, etc.).  I think that given the 300mb worth
of writes from the prior step, the system just needs a little time to
catch up on the compression to make this test more reliable.

I considered checking if the value is zero and arbitrarily just
waiting a few seconds which did work.  I then replaced this with a
sync which also worked.  Rather than worrying about checking for zero
values, it seems more reliable and simpler to just sync after the
writes in all cases.  I could not replicate this issue with the sync
as proposed in this patch.

Additionally this does a check for a zero value to hopefully provide a
more structured message if the test fails in the same way.

[1] https://lists.linux.it/pipermail/ltp/2019-July/013028.html

Signed-off-by: Ian Wienand <iwienand@redhat.com>
---
 testcases/kernel/device-drivers/zram/zram01.sh | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/testcases/kernel/device-drivers/zram/zram01.sh b/testcases/kernel/device-drivers/zram/zram01.sh
index 58d233f91..5f3964f6c 100755
--- a/testcases/kernel/device-drivers/zram/zram01.sh
+++ b/testcases/kernel/device-drivers/zram/zram01.sh
@@ -119,6 +119,9 @@ zram_fill_fs()
 				>/dev/null 2>err.txt || break
 			b=$(($b + 1))
 		done
+                # Give the system time to catch up, otherwise the mm_stat
+                # checking below can give a false negative
+		sync
 		if [ $b -eq 0 ]; then
 			[ -s err.txt ] && tst_res TWARN "dd error: $(cat err.txt)"
 			tst_brk TBROK "cannot fill zram $i"
@@ -134,6 +137,9 @@ zram_fill_fs()
 		fi
 
 		mem_used_total=`awk '{print $3}' "/sys/block/zram$i/mm_stat"`
+		if [ $mem_used_total -eq 0 ]; then
+			test_res FAIL "/sys/block/zram$i/mm_stat reports 0 size : $(cat /sys/block/zram$i/mm_stat)"
+		fi
 		v=$((100 * 1024 * $b / $mem_used_total))
 		r=`echo "scale=2; $v / 100 " | bc`
 
-- 
2.41.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2023-11-22 12:16 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-03  1:51 [LTP] [PATCH] kernel/device-drivers/zram/zram01.sh : add a sync Ian Wienand
2023-08-03 10:52 ` Cyril Hrubis
2023-08-03 10:59   ` Martin Doucha
2023-08-03 11:02     ` Cyril Hrubis
2023-08-03 12:32     ` Ian Wienand
2023-08-08  3:56 ` [LTP] [PATCH v2] kernel/device-drivers/zram/zram01.sh : don't fill from /dev/zero Ian Wienand
2023-08-30  8:20   ` Richard Palethorpe
2023-09-07  6:46     ` Ian Wienand
2023-09-07  8:26       ` Richard Palethorpe
2023-09-08  1:58         ` Ian Wienand
2023-09-07 10:18       ` Martin Doucha
2023-09-07 22:29         ` Ian Wienand
2023-09-08  9:21           ` Martin Doucha
2023-09-12  1:03             ` Ian Wienand
2023-09-13 14:35               ` Richard Palethorpe
2023-09-13 22:21                 ` Ian Wienand
2023-09-14  7:37                   ` Richard Palethorpe
2023-09-14 11:04                     ` Ian Wienand
2023-09-18  8:24                       ` Richard Palethorpe
2023-09-21  1:17                         ` Ian Wienand
2023-09-21  9:34                           ` Richard Palethorpe
2023-09-21  1:12   ` [LTP] [PATCH v3] kernel/device-drivers/zram/zram01.sh : fill with compressible data Ian Wienand
2023-11-22 11:24     ` Richard Palethorpe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox