public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Richard Weinberger <richard@nod.at>
To: "Jörg Krause" <joerg.krause@embedded.rocks>,
	linux-mtd@lists.infradead.org
Subject: Re: ubi_wl_get_peb: Unable to get a free PEB from user WL pool
Date: Thu, 6 Aug 2015 09:30:44 +0200	[thread overview]
Message-ID: <55C30D24.1010504@nod.at> (raw)
In-Reply-To: <1438813074.6328.35.camel@embedded.rocks>

[-- Attachment #1: Type: text/plain, Size: 1691 bytes --]

Jörg,

Am 06.08.2015 um 00:17 schrieb Jörg Krause:
>>>> Then just disable it. :)
>>>
>>> I did :) I thought fastmap is used automatically by the UBI driver?
>>
>> It will *use* fastmap automatically but not convert non-fastmap UBI 
>> images
>> to fastmap.
>> You can enable ubi.fm_autoconvert to do so.
> 
> Sorry for asking, but how do I create an UBI image with fastmap
> support? I've never read something about this.

You have to use the ubi.fm_autoconvert parameter. The UBI will automatically
write down a fastmap if needed.

Currently it is not possible to create a fastmap-enabled UBI image
using ubinize.
The reason is that fastmap stores the LEB->PEB mappings to allow
a fast attach. ubinize cannot know which PEBs are bad.
So, we'd need a tool which creates the fastmap while flashing to the nand.

>>>> Meanwhile I'll find out what exactly is going on.
>>>
>>> Many thanks!
>>
>> Can you please apply the attached debug patch?
>> I wonder why exactly the auto resize function is failing.
> 
> autoresize: cannot auto-resize volume 0: -28

I have good and bad news.
The good news is that I know what is going on, the bad one
is that I don't have an good solution for it.

UBI is requesting a new PEB but your system is still busy with
erasing them. With fastmap disabled UBI can use produce_free_peb()
and wait for a new erased PEB.
But fastmap cannot use this helper as it releases ->wl_lock
and would lead to a inconsistent fastmap state.
Kernels < 4.1 did so and faced interesting fastmap corruptions.
I hoped using the current retry logic the issue you're facing cannot
happen. But as it seems I was wrong.

Can you please give the attached patch a try?

Thanks,
//richard

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: dirty_hack.diff --]
[-- Type: text/x-patch; name="dirty_hack.diff", Size: 509 bytes --]

diff --git a/drivers/mtd/ubi/fastmap-wl.c b/drivers/mtd/ubi/fastmap-wl.c
index b2a6653..e47974d 100644
--- a/drivers/mtd/ubi/fastmap-wl.c
+++ b/drivers/mtd/ubi/fastmap-wl.c
@@ -206,12 +206,12 @@ again:
 
 	if (pool->used == pool->size) {
 		spin_unlock(&ubi->wl_lock);
-		if (retried) {
+		if (retried > 5) {
 			ubi_err(ubi, "Unable to get a free PEB from user WL pool");
 			ret = -ENOSPC;
 			goto out;
 		}
-		retried = 1;
+		retried++;
 		up_read(&ubi->fm_eba_sem);
 		goto again;
 	}

  reply	other threads:[~2015-08-06  7:31 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-05 21:22 ubi_wl_get_peb: Unable to get a free PEB from user WL pool Jörg Krause
2015-08-05 21:30 ` Richard Weinberger
2015-08-05 21:38   ` Jörg Krause
2015-08-05 21:45     ` Richard Weinberger
2015-08-05 21:53       ` Jörg Krause
2015-08-05 22:01         ` Richard Weinberger
2015-08-05 22:17           ` Jörg Krause
2015-08-06  7:30             ` Richard Weinberger [this message]
2015-08-06  8:10               ` Jörg Krause
2015-08-06  8:12                 ` Richard Weinberger
2015-08-06 18:16                 ` Richard Weinberger
2015-08-06 18:43                   ` Jörg Krause

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=55C30D24.1010504@nod.at \
    --to=richard@nod.at \
    --cc=joerg.krause@embedded.rocks \
    --cc=linux-mtd@lists.infradead.org \
    /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