From: Heiko Schocher <hs@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] mtd, ubi: set free_count to zero before walking through erase list
Date: Tue, 2 Feb 2016 13:53:16 +0100 [thread overview]
Message-ID: <56B0A6BC.4010809@denx.de> (raw)
In-Reply-To: <56B09590.2030308@nod.at>
Hello Richard,
Am 02.02.2016 um 12:40 schrieb Richard Weinberger:
> Am 02.02.2016 um 11:54 schrieb Heiko Schocher:
>> Set free_count to zero before walking through ai->erase list
>> in wl_init().
>>
>> As U-Boot has no workqueue/threads, it immediately calls
>> erase_worker(), which increase for each erased block
>> free_count. Without this patch, free_count gets after
>> this initialized to zero in wl_init(), so the free_count
>> variable always has the maybe wrong value 0.
>>
>> Detected this behaviour on the dxr2 board, where the
>> UBI fastmap gets not written when attaching/dettaching
>> on an empty NAND. It drops instead the error message:
>>
>> could not find any anchor PEB
>>
>> With this patch, fastmap gets written on dettach.
>>
>> Signed-off-by: Heiko Schocher <hs@denx.de>
>> ---
>> added Richard to this EMail, as maybe this could be a problem
>> in linux too ... ?
>
> ubi_wl_init() is called by ubi_attach().
Yes, exactly, same for U-Boot.
> So, as soon your UBI image is attached the WL subsystem
> is fully initialized and ready to use.
> If you try to use it before you're in undefined state.
> u-boot must not run the erase_worker() before the attach
> phase is done.
ubi_attach() in drivers/mtd/ubi/attach.c calls
ubi_wl_init() in drivers/mtd/ubi/wl.c. There schedule_erase() is
called, which calls schedule_ubi_work(). same for linux
and U-Boot ...
Now the U-Boot special:
In U-Boot we have no threads, so in U-Boot this "work" is done
immediately...
Which means in this case, that erase_worker() is executed immediately,
so before ubi_attach() finished ... but couldn;t it be that
with schedule_work(), the erase_work() couldn;t be exeucted before
ubi_attach() is finished?
> Do you have more details what exactly happened?
> This needs a deeper investigation.
I came into this errorcase if the nand flash is empty. Hmm... why
is there erase work? I try to find out more.
bye,
Heiko
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
next prev parent reply other threads:[~2016-02-02 12:53 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-02 10:54 [U-Boot] [PATCH] mtd, ubi: set free_count to zero before walking through erase list Heiko Schocher
2016-02-02 11:40 ` Richard Weinberger
2016-02-02 12:53 ` Heiko Schocher [this message]
2016-04-21 8:58 ` Boris Brezillon
2016-04-21 10:09 ` Heiko Schocher
2016-04-21 10:25 ` Boris Brezillon
2016-04-21 10:48 ` Heiko Schocher
2016-04-21 12:14 ` Boris Brezillon
2016-04-22 9:34 ` Richard Weinberger
2016-04-22 10:20 ` Heiko Schocher
2016-04-22 10:48 ` Richard Weinberger
2016-04-22 11:53 ` Heiko Schocher
2016-04-22 12:21 ` Boris Brezillon
2016-04-25 5:46 ` Heiko Schocher
2016-04-25 7:06 ` Richard Weinberger
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=56B0A6BC.4010809@denx.de \
--to=hs@denx.de \
--cc=u-boot@lists.denx.de \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox