public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Richard Weinberger <richard@nod.at>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] mtd, ubi: set free_count to zero before walking through erase list
Date: Mon, 25 Apr 2016 09:06:33 +0200	[thread overview]
Message-ID: <571DC1F9.6090409@nod.at> (raw)
In-Reply-To: <571DAF3D.3000002@denx.de>

Am 25.04.2016 um 07:46 schrieb Heiko Schocher:
> Hello Boris,
> 
> Am 22.04.2016 um 14:21 schrieb Boris Brezillon:
>> On Fri, 22 Apr 2016 13:53:00 +0200
>> Heiko Schocher <hs@denx.de> wrote:
>>
>>>
>>>> An alternative approach would be not executing work
>>>> directly while scheduling it but in produce_free_peb().
>>>> UBI is designed to work with the worker being disabled.
>>>> All UBI work will then happen synchronous and should also work
>>>> in u-boot.
>>>
>>> Sounds good!
>>
>> Not so good actually. I tried that, and ended up with tasks stalled in
>> the work queue because the implementation was never "scheduling" the
>> do_work() loop.
>>
>> Let's keep it simple, in uboot everything is synchronous, and you can't
>> be preempted by another task, so it's safe to assume that "scheduling a
>> work" == "executing it right away". IMHO, the kernel should also assume
>> that "scheduling a work" might involve "the work may have been done
>> before the ubi_schedule_work() function returns": when you schedule a
>> work to be done and wake up the thread responsible for dequeuing UBI
>> works, the scheduler can decide to schedule this thread right away,
>> which means this work can be done before the caller gets back to the
>> instruction just after ubi_schedule_work().
>>
>> Of course, this has to be nuanced for the "attach procedure", because at
>> this time the UBI thread is not launched yet. But even in this
>> specific case, I think it's safer to assume that, maybe one day, the UBI
>> thread might be running when ubi_wl_init() is called, which is why I
>> suggested to also apply this patch to Linux.
> 
> Ok, thanks for this explanation! I posted this patch also on linux-mtd, see:
> 
> https://patchwork.ozlabs.org/patch/613492/

Let's hope that attaching is the only place. :-)
Heiko, it would be cool if you could double check.

Thanks,
//richard

      reply	other threads:[~2016-04-25  7:06 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
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 [this message]

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=571DC1F9.6090409@nod.at \
    --to=richard@nod.at \
    --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