lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20220314155955.77400-1-miquel.raynal@bootlin.com>
Date:   Mon, 14 Mar 2022 16:59:55 +0100
From:   Miquel Raynal <miquel.raynal@...tlin.com>
To:     Amit Kumar Mahapatra <amit.kumar-mahapatra@...inx.com>,
        miquel.raynal@...tlin.com, richard@....at, vigneshr@...com,
        david.oberhollenzer@...ma-star.at
Cc:     git@...inx.com, linux-mtd@...ts.infradead.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] mtd: tests: Fix eraseblock read speed miscalculation for lower partition sizes

On Tue, 2022-02-08 at 10:39:05 UTC, Amit Kumar Mahapatra wrote:
> While calculating speed during  mtd_speedtest, the time interval
> (i.e., start - finish) is rounded off to the nearest milliseconds by
> ignoring the fractional part. This leads to miscalculation of speed.
> The miscalculation is more visible while running speed test on small
> partition sizes(i.e., when partition size is equal to eraseblock size or
> twice the eraseblock size) at higher spi frequencies.
> 
> For e.g., while calculating eraseblock read speed for a mtd partition with
> size equal to the eraseblock size(i.e., 64KiB) the eraseblock read time
> interval comes out to be 966490 nanosecond. This is then converted to
> millisecond(i.e., 0.966 msec.). The integer part (i.e., 0 msec) of the
> value is considered and the fractional part (i.e., 0.966) is ignored,for
> calculating the eraseblock read speed. So the reported eraseblock read
> speed is 0 KiB/s, which is incorrect.
> 
> There are two approaches to fix this issue.
> 
> First approach will be to keep the time interval in millisecond. and round
> up the integer value, with this approach the 0.966msec time interval in the
> above example will be rounded up to 1msec and this value is used for
> calculating the speed. Downside of this approach is that the reported speed
> is still not accurate.
> 
> Second approach will be to convert the time interval to microseconds
> instead of milliseconds, with this approach the 966490 nanosecond time
> interval in the above example will be converted t0 966.490usec and this
> value is used for calculating the speed. As compared to the current
> implementation and the suggested First approach, this approach will report
> a more accurate speed. Downside of this approach is that, in future if the
> mtd size is too large then the u64 variable, that holds the number of
> bytes, might overflow.
> 
> In this patch we have gone with the second approach as this reports a more
> accurate speed. With this approach the eraseblock read speed in the above
> example comes out to be 132505 KiB/s when the spi clock is configured at
> 150Mhz.
> 
> Signed-off-by: Amit Kumar Mahapatra <amit.kumar-mahapatra@...inx.com>
> Reviewed-by: Miquel Raynal <miquel.raynal@...tlin.com>

Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git mtd/next, thanks.

Miquel

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ