From mboxrd@z Thu Jan 1 00:00:00 1970 From: Richard Weinberger Date: Mon, 21 May 2018 16:07:41 +0200 Subject: [U-Boot] UBI: regression since "mtd: ubi: Fix worker handling" In-Reply-To: <0a34e4d0-7563-313f-ec09-e14ef8f27d58@st.com> References: <0a34e4d0-7563-313f-ec09-e14ef8f27d58@st.com> Message-ID: <20114634.YJdGbKEMWP@blindfold> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Patrice, Am Montag, 21. Mai 2018, 15:38:57 CEST schrieb Patrice CHOTARD: > Hi Richard, Heiko > > Since f82290afc847 ("mtd: ubi: Fix worker handling"), > when booting from NAND, on a fresh NAND just after being flashed (and > only in this case), we got the following log: > > ubi0: default fastmap pool size: 200 > ubi0: default fastmap WL pool size: 100 > ubi0: attaching mtd2 > ubi0: scanning is finished > ubi0 error: ubi_update_fastmap: could not find any anchor PEB > ubi0 error: ubi_update_fastmap: could not find any anchor PEB > ubi0 error: ubi_wl_get_peb: Unable to get a free PEB from user WL pool > ubi0 error: autoresize: cannot auto-resize volume 1 > UBI error: cannot attach mtd2UBI error: cannot initialize UBI, error > -28UBI init error 28 > > > After analysis, in ubi_wl_init(), when performing schedule_erase(), > thread_enabled flag is not yet set to 1, which forbids ubi_do_worker() > to execute pending works. > > This has to effect to not populate ubi->free with free physical > eraseblocks. > > As temporary workaround i did the following update on my side which fix > this issue, but i don't consider it neither as a clean patch nor certain > that it is enough : > > > @@ -1560,15 +1560,17 @@ int ubi_wl_init(struct ubi_device *ubi, struct > ubi_attach_info *ai) > goto out_free; > > e->pnum = aeb->pnum; > e->ec = aeb->ec; > ubi->lookuptbl[e->pnum] = e; > + ubi->thread_enabled = 1; This is not correct. At this point the UBI thread is not ready. I know, I know, U-Boot has no threads but some data structures might not be ready. Let me think how to work around this properly. Thanks, //richard