[PATCH] lzma: Fix decompression speed regression

Tom Rini trini at konsulko.com
Sat Jul 15 17:03:44 CEST 2023


On Wed, Jul 05, 2023 at 10:34:26AM +0200, Christophe Leroy wrote:

> Uncompressing a 1.7Mbytes FIT image on U-boot 2023.04 takes
> approx 7s on a powerpc 8xx.
> The same on U-boot 2023.07-rc6 takes approx 28s unless watchdog
> is disabled.
> 
> During that decompression, LzmaDec_DecodeReal() calls schedule
> 1.6 million times, that is every 4µs in average.
> 
> In the past it used to be a call to WATCHDOG_RESET() which was
> just calling hw_watchdog_reset().
> 
> But the combination of commit 29caf9305b6 ("cyclic: Use schedule()
> instead of WATCHDOG_RESET()") and commit 26e8ebcd7cb ("watchdog:
> mpc8xxx: Make it generic") results in an heavier processing.
> 
> However, there is absolutely no point in calling schedule() that
> often.
> 
> By moving and keeping only one call to schedule() in the main
> loop the number of calls is reduced to 1.2 million which is still
> too much. So add logic to only call schedule every 1024 times.
> That leads to a call to schedule approx every 6ms which is still
> far enough to entertain the watchdog which has a 1s timeout on
> powerpc 8xx.
> 
> powerpc 8xx being one of the slowest targets we have today in
> U-boot, and most other watchdogs having a timeout of one minutes
> instead of one second like the 8xx, this fix should not have
> negative impact on other targets.
> 
> Fixes: 29caf9305b6 ("cyclic: Use schedule() instead of WATCHDOG_RESET()")
> Signed-off-by: Christophe Leroy <christophe.leroy at csgroup.eu>
> Reviewed-by: Simon Glass <sjg at chromium.org>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20230715/355e1312/attachment.sig>


More information about the U-Boot mailing list