* [PATCH] mtd: ubi: Max out default wear-leveling threshold
@ 2019-07-10 11:27 Stefan Riedmueller
2019-07-11 7:01 ` Sascha Hauer
0 siblings, 1 reply; 6+ messages in thread
From: Stefan Riedmueller @ 2019-07-10 11:27 UTC (permalink / raw)
To: barebox
Due to the recursive ubi_thread implementation in the barebox, a large
amount of wear-leveling can lead to a stack overflow.
This was observed during extensive ubi stress tests with the linux
kernel and periodic power cycles. We found that if the wear-leveling
threshold is exceeded and a large amount of erase blocks need
wear-leveling the stack can overflow.
The hardware used to observe this was a phyCORE-i.MX 6 with 1GB NAND flash.
As the kernel is perfectly capable of handling wear-leveling we can
increase the wear-leveling threshold in the barebox to leave it to the
kernel. To minimize the chance of wear-leveling in the barebox max out
the threshold.
Signed-off-by: Stefan Riedmueller <s.riedmueller@phytec.de>
---
drivers/mtd/ubi/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mtd/ubi/Kconfig b/drivers/mtd/ubi/Kconfig
index 9a344082b7bb..509a1f77ddcd 100644
--- a/drivers/mtd/ubi/Kconfig
+++ b/drivers/mtd/ubi/Kconfig
@@ -12,7 +12,7 @@ if MTD_UBI
config MTD_UBI_WL_THRESHOLD
int "UBI wear-leveling threshold"
- default 4096
+ default 65536
range 2 65536
help
This parameter defines the maximum difference between the highest
--
2.7.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] mtd: ubi: Max out default wear-leveling threshold
2019-07-10 11:27 [PATCH] mtd: ubi: Max out default wear-leveling threshold Stefan Riedmueller
@ 2019-07-11 7:01 ` Sascha Hauer
2019-07-11 11:04 ` Stefan Riedmüller
0 siblings, 1 reply; 6+ messages in thread
From: Sascha Hauer @ 2019-07-11 7:01 UTC (permalink / raw)
To: Stefan Riedmueller; +Cc: barebox
On Wed, Jul 10, 2019 at 01:27:30PM +0200, Stefan Riedmueller wrote:
> Due to the recursive ubi_thread implementation in the barebox, a large
> amount of wear-leveling can lead to a stack overflow.
>
> This was observed during extensive ubi stress tests with the linux
> kernel and periodic power cycles. We found that if the wear-leveling
> threshold is exceeded and a large amount of erase blocks need
> wear-leveling the stack can overflow.
>
> The hardware used to observe this was a phyCORE-i.MX 6 with 1GB NAND flash.
>
> As the kernel is perfectly capable of handling wear-leveling we can
> increase the wear-leveling threshold in the barebox to leave it to the
> kernel. To minimize the chance of wear-leveling in the barebox max out
> the threshold.
I can follow the reasoning and it seems indeed better and more safe to
leave the wearleveling to the Kernel. Given that, can't we just disable
wear leveling completely in barebox?
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] mtd: ubi: Max out default wear-leveling threshold
2019-07-11 7:01 ` Sascha Hauer
@ 2019-07-11 11:04 ` Stefan Riedmüller
2019-07-18 8:24 ` Stefan Riedmüller
0 siblings, 1 reply; 6+ messages in thread
From: Stefan Riedmüller @ 2019-07-11 11:04 UTC (permalink / raw)
To: Sascha Hauer; +Cc: barebox
Hi Sascha,
On 11.07.19 09:01, Sascha Hauer wrote:
> On Wed, Jul 10, 2019 at 01:27:30PM +0200, Stefan Riedmueller wrote:
>> Due to the recursive ubi_thread implementation in the barebox, a large
>> amount of wear-leveling can lead to a stack overflow.
>>
>> This was observed during extensive ubi stress tests with the linux
>> kernel and periodic power cycles. We found that if the wear-leveling
>> threshold is exceeded and a large amount of erase blocks need
>> wear-leveling the stack can overflow.
>>
>> The hardware used to observe this was a phyCORE-i.MX 6 with 1GB NAND flash.
>>
>> As the kernel is perfectly capable of handling wear-leveling we can
>> increase the wear-leveling threshold in the barebox to leave it to the
>> kernel. To minimize the chance of wear-leveling in the barebox max out
>> the threshold.
>
> I can follow the reasoning and it seems indeed better and more safe to
> leave the wearleveling to the Kernel. Given that, can't we just disable
> wear leveling completely in barebox?
I think it would be best to disable it or at least improve it. But since
wear-leveling is not an isolated task but involved in more functionalities I
couldn't find an easy way to disable it in a quick way. That is why I went
with the threshold enlargement to have at least a quick fix.
But I agree that at some point in the future the root cause should be
handled and not just the symptom.
Stefan
>
> Sascha
>
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] mtd: ubi: Max out default wear-leveling threshold
2019-07-11 11:04 ` Stefan Riedmüller
@ 2019-07-18 8:24 ` Stefan Riedmüller
2019-07-18 12:19 ` Sascha Hauer
0 siblings, 1 reply; 6+ messages in thread
From: Stefan Riedmüller @ 2019-07-18 8:24 UTC (permalink / raw)
To: Sascha Hauer; +Cc: barebox
Hi Sascha,
do you guys have an idea or proposal how to disable the wear-leveling
properly? I will gladly take another look at it and it would be nice to get
your input as I only started to dive into ubi.
Regards,
Stefan
On 11.07.19 13:04, Stefan Riedmüller wrote:
> Hi Sascha,
>
> On 11.07.19 09:01, Sascha Hauer wrote:
>> On Wed, Jul 10, 2019 at 01:27:30PM +0200, Stefan Riedmueller wrote:
>>> Due to the recursive ubi_thread implementation in the barebox, a large
>>> amount of wear-leveling can lead to a stack overflow.
>>>
>>> This was observed during extensive ubi stress tests with the linux
>>> kernel and periodic power cycles. We found that if the wear-leveling
>>> threshold is exceeded and a large amount of erase blocks need
>>> wear-leveling the stack can overflow.
>>>
>>> The hardware used to observe this was a phyCORE-i.MX 6 with 1GB NAND flash.
>>>
>>> As the kernel is perfectly capable of handling wear-leveling we can
>>> increase the wear-leveling threshold in the barebox to leave it to the
>>> kernel. To minimize the chance of wear-leveling in the barebox max out
>>> the threshold.
>>
>> I can follow the reasoning and it seems indeed better and more safe to
>> leave the wearleveling to the Kernel. Given that, can't we just disable
>> wear leveling completely in barebox?
>
> I think it would be best to disable it or at least improve it. But since
> wear-leveling is not an isolated task but involved in more functionalities I
> couldn't find an easy way to disable it in a quick way. That is why I went
> with the threshold enlargement to have at least a quick fix.
>
> But I agree that at some point in the future the root cause should be
> handled and not just the symptom.
>
> Stefan
>
>>
>> Sascha
>>
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] mtd: ubi: Max out default wear-leveling threshold
2019-07-18 8:24 ` Stefan Riedmüller
@ 2019-07-18 12:19 ` Sascha Hauer
2019-07-18 12:27 ` Stefan Riedmüller
0 siblings, 1 reply; 6+ messages in thread
From: Sascha Hauer @ 2019-07-18 12:19 UTC (permalink / raw)
To: Stefan Riedmüller; +Cc: barebox
On Thu, Jul 18, 2019 at 10:24:52AM +0200, Stefan Riedmüller wrote:
> Hi Sascha,
>
> do you guys have an idea or proposal how to disable the wear-leveling
> properly? I will gladly take another look at it and it would be nice to get
> your input as I only started to dive into ubi.
What I meant was simply something like this:
#define UBI_WL_THRESHOLD INT_MAX
Put a comment above it why it is done and remove the Kconfig entry for
it and be done.
We found out that UBI wear leveling doesn't work reliably in barebox, so
we should make sure that it's disabled completely and not just change
the defaults (which could be changed back by an unwary user)
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] mtd: ubi: Max out default wear-leveling threshold
2019-07-18 12:19 ` Sascha Hauer
@ 2019-07-18 12:27 ` Stefan Riedmüller
0 siblings, 0 replies; 6+ messages in thread
From: Stefan Riedmüller @ 2019-07-18 12:27 UTC (permalink / raw)
To: Sascha Hauer; +Cc: barebox
Hi Sascha,
On 18.07.19 14:19, Sascha Hauer wrote:
> On Thu, Jul 18, 2019 at 10:24:52AM +0200, Stefan Riedmüller wrote:
>> Hi Sascha,
>>
>> do you guys have an idea or proposal how to disable the wear-leveling
>> properly? I will gladly take another look at it and it would be nice to get
>> your input as I only started to dive into ubi.
>
> What I meant was simply something like this:
>
> #define UBI_WL_THRESHOLD INT_MAX
>
> Put a comment above it why it is done and remove the Kconfig entry for
> it and be done.
>
> We found out that UBI wear leveling doesn't work reliably in barebox, so
> we should make sure that it's disabled completely and not just change
> the defaults (which could be changed back by an unwary user)
I understand. I had something different in mind.
I'll change it and send a v2.
Stefan
>
> Sascha
>
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2019-07-18 12:27 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-10 11:27 [PATCH] mtd: ubi: Max out default wear-leveling threshold Stefan Riedmueller
2019-07-11 7:01 ` Sascha Hauer
2019-07-11 11:04 ` Stefan Riedmüller
2019-07-18 8:24 ` Stefan Riedmüller
2019-07-18 12:19 ` Sascha Hauer
2019-07-18 12:27 ` Stefan Riedmüller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox