From: Richard Palethorpe <rpalethorpe@suse.de>
To: Petr Vorel <pvorel@suse.cz>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH 1/1] zram01.sh: Workaround division by 0 on vfat on ppc64le
Date: Mon, 18 Sep 2023 10:38:45 +0100 [thread overview]
Message-ID: <87a5tjhl24.fsf@suse.de> (raw)
In-Reply-To: <Y3s+Czg8sBsGYO+1@pevik>
Hello,
Petr Vorel <pvorel@suse.cz> writes:
> Hi Li,
>
>> Hi Petr,
>
>> On Tue, Nov 8, 2022 at 3:12 AM Petr Vorel <pvorel@suse.cz> wrote:
>
>> > Repeatedly read /sys/block/zram*/mm_stat for 1 sec. This should fix bug
>> > on ppc64le on stable kernels, where mem_used_total is often 0.
>
>> > Signed-off-by: Petr Vorel <pvorel@suse.cz>
>> > ---
>> > .../kernel/device-drivers/zram/zram01.sh | 27 +++++++++++++++++--
>> > 1 file changed, 25 insertions(+), 2 deletions(-)
>
>> > diff --git a/testcases/kernel/device-drivers/zram/zram01.sh
>> > b/testcases/kernel/device-drivers/zram/zram01.sh
>> > index 58d233f91..76a8ccab4 100755
>> > --- a/testcases/kernel/device-drivers/zram/zram01.sh
>> > +++ b/testcases/kernel/device-drivers/zram/zram01.sh
>> > @@ -105,6 +105,26 @@ zram_mount()
>> > tst_res TPASS "mount of zram device(s) succeeded"
>> > }
>
>> > +read_mem_used_total()
>> > +{
>> > + echo $(awk '{print $3}' $1)
>> > +}
>> > +
>> > +# Reads /sys/block/zram*/mm_stat until mem_used_total is not 0.
>> > +loop_read_mem_used_total()
>
>
>> This is not a looping function to check if mem_used_total is equal to zero,
>> the loop part is by means of the TST_RETRY_FUNC macro.
> Thanks for your review!
>
>> So, I'd suggest renaming it to check_read_mem_used_total().
> Agree. Unfortunately even this didn't help on ppc64le system where I was able to
> reproduce it, thus probably not worth to merge.
>
> Unfortunately later I was not able to reproduce the problem any more, I'll try
> it more this week.
I'd like to get this merged and if anyone still see's a failure, then
perhaps there really is a kernel bug or else we have to accept it is
zero sometimes.
Reviewed-by: Richard Palethorpe <rpalethorpe@suse.com>
>
> Kind regards,
> Petr
>
>> Reviewed-by: Li Wang <liwang@redhat.com>
>
>
>
>> > +{
>> > + local file="$1"
>> > + local mem_used_total
>> > +
>> > + tst_res TINFO "$file"
>> > + cat $file >&2
>> > +
>> > + mem_used_total=$(read_mem_used_total $file)
>> > + [ "$mem_used_total" -eq 0 ] && return 1
>> > +
>> > + return 0
>> > +}
>> > +
>> > zram_fill_fs()
>> > {
>> > local mem_used_total
>> > @@ -133,9 +153,12 @@ zram_fill_fs()
>> > continue
>> > fi
>
>> > - mem_used_total=`awk '{print $3}'
>> > "/sys/block/zram$i/mm_stat"`
>> > + TST_RETRY_FUNC "loop_read_mem_used_total
>> > /sys/block/zram$i/mm_stat" 0
>> > + mem_used_total=$(read_mem_used_total
>> > /sys/block/zram$i/mm_stat)
>> > + tst_res TINFO "mem_used_total: $mem_used_total"
>> > +
>> > v=$((100 * 1024 * $b / $mem_used_total))
>> > - r=`echo "scale=2; $v / 100 " | bc`
>> > + r=$(echo "scale=2; $v / 100 " | bc)
>
>> > if [ "$v" -lt 100 ]; then
>> > tst_res TFAIL "compression ratio: $r:1"
>> > --
>> > 2.38.0
>
>
>> > --
>> > Mailing list info: https://lists.linux.it/listinfo/ltp
--
Thank you,
Richard.
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2023-09-18 9:45 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-07 19:11 [PATCH 0/1] Possible bug in zram on ppc64le on vfat Petr Vorel
2022-11-07 19:11 ` [LTP] " Petr Vorel
2022-11-07 19:11 ` [PATCH 1/1] zram01.sh: Workaround division by 0 on vfat on ppc64le Petr Vorel
2022-11-07 19:11 ` [LTP] " Petr Vorel
2022-11-21 7:14 ` Li Wang
2022-11-21 8:59 ` Petr Vorel
2022-11-21 8:59 ` Petr Vorel
2023-09-18 9:38 ` Richard Palethorpe [this message]
2022-11-07 21:25 ` [PATCH 0/1] Possible bug in zram on ppc64le on vfat Minchan Kim
2022-11-07 21:25 ` [LTP] " Minchan Kim
2022-11-07 21:47 ` Petr Vorel
2022-11-07 21:47 ` [LTP] " Petr Vorel
2022-11-07 22:42 ` Petr Vorel
2022-11-07 22:42 ` [LTP] " Petr Vorel
2022-11-08 1:05 ` Sergey Senozhatsky
2022-11-08 1:05 ` [LTP] " Sergey Senozhatsky
2022-11-09 22:08 ` Petr Vorel
2022-11-09 22:08 ` [LTP] " Petr Vorel
2022-11-10 23:04 ` Minchan Kim
2022-11-10 23:04 ` [LTP] " Minchan Kim
2022-11-11 9:29 ` Petr Vorel
2022-11-11 9:29 ` [LTP] " Petr Vorel
2022-11-10 14:29 ` Martin Doucha
2022-11-10 14:29 ` [LTP] " Martin Doucha
2022-11-11 0:48 ` Sergey Senozhatsky
2022-11-11 0:48 ` [LTP] " Sergey Senozhatsky
2022-11-21 9:41 ` Petr Vorel
2022-11-21 9:41 ` [LTP] " Petr Vorel
2022-11-22 14:56 ` Martin Doucha
2022-11-22 14:56 ` [LTP] " Martin Doucha
2022-11-22 15:07 ` Petr Vorel
2022-11-22 15:07 ` [LTP] " Petr Vorel
2022-11-29 4:38 ` Sergey Senozhatsky
2022-11-29 4:38 ` [LTP] " Sergey Senozhatsky
2023-05-02 15:23 ` Martin Doucha
2023-05-02 15:23 ` [LTP] " Martin Doucha
2022-11-11 9:18 ` Petr Vorel
2022-11-11 9:18 ` [LTP] " Petr Vorel
2023-08-04 6:37 ` Ian Wienand
2023-08-04 6:37 ` [LTP] " Ian Wienand
2023-08-07 4:44 ` Ian Wienand
2023-08-07 4:44 ` [LTP] " Ian Wienand
2023-08-07 5:19 ` Sergey Senozhatsky
2023-08-07 5:19 ` [LTP] " Sergey Senozhatsky
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87a5tjhl24.fsf@suse.de \
--to=rpalethorpe@suse.de \
--cc=ltp@lists.linux.it \
--cc=pvorel@suse.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.