[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1244549599.5847.381.camel@localhost.localdomain>
Date: Tue, 09 Jun 2009 15:13:19 +0300
From: Artem Bityutskiy <dedekind@...radead.org>
To: Kevin Cernekee <kpc.mtd@...il.com>
Cc: dwmw2@...radead.org, linux-mtd@...ts.infradead.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] MTD: Add UBI reboot notifier
On Mon, 2009-06-08 at 22:14 -0700, Kevin Cernekee wrote:
> ubifs_sync_fs() may queue up a new UBI erase transaction, which is
> processed in the background:
>
> bash# sync
> ubifs_sync_fs: enter
> schedule_erase: enter
> schedule_erase: exit
> ubi_sync: enter
> ubi_sync: exit
> ubifs_sync_fs: exit
> cfi_amdstd_erase_varsize: enter
> bash# cfi_amdstd_erase_varsize: exit
>
> Normally this is not a big deal. However, during the final sync before
> rebooting, it initiates an erase operation that is potentially still
> active when Linux restarts the machine:
>
> bash# reboot -f
> ubifs_sync_fs: enter
> schedule_erase: enter
> schedule_erase: exit
> ubi_sync: enter
> ubi_sync: exit
> ubifs_sync_fs: exit
> cfi_amdstd_erase_varsize: enter
> Restarting system.
> <Flash is stuck in FL_ERASE mode - system hangs>
>
> This is easiest to observe on a NOR flash. One factor is the long erase
> time. The other reason is because getting a NOR flash stuck in FL_ERASE
> mode will prevent the bootloader from running, unless the board provides
> a way for the processor to automatically reset the flash. In my
> experience, many boards do not.
>
> My proposal is to add a reboot notifier to let the UBI background thread
> terminate gracefully. The new ordering looks like this:
>
> bash# reboot -f
> ubifs_sync_fs: enter
> schedule_erase: enter
> schedule_erase: exit
> ubifs_sync_fs: exit
> cfi_amdstd_erase_varsize: enter
> ubi_reboot_notifier: enter
> cfi_amdstd_erase_varsize: exit
> ubi_reboot_notifier: exit
> cfi_amdstd_reboot: enter
> cfi_amdstd_reboot: exit
>
> cfi_amdstd_reboot doesn't really exist, but I added a dummy notifier to
> make sure that the ordering would be correct when using drivers that do
> have this feature.
The idea looks OK. So you basically make sure that if UBI bgt thread
started an erase operation, it finishes it (and only it) before we
reboot. Do I read the patch correctly?
--
Best regards,
Artem Bityutskiy (Битюцкий Артём)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists