Patchwork Fail to mount ubifs

login
register
mail settings
Submitter Jon Ringle
Date Jan. 12, 2010, 8:49 p.m.
Message ID <152584231001121249j32f9a03ax415a322f5d4b4195@mail.gmail.com>
Download mbox | patch
Permalink /patch/42769/
State New
Headers show

Comments

Jon Ringle - Jan. 12, 2010, 8:49 p.m.
On Tue, Jan 12, 2010 at 3:23 PM, Jon Ringle <jon@ringle.org> wrote:
> On Mon, Jan 11, 2010 at 11:50 PM, Artem Bityutskiy <dedekind1@gmail.com> wrote:
>> As this entry suggests:
>> http://www.linux-mtd.infradead.org/doc/ubifs.html#L_how_send_bugreport
>>
>> - validate your flash/driver with the MTD tests - looks like you have a
>> problem there.
>
> Trying to run mtd_readtest I get a seg fault:
> [   67.470000] Unable to handle kernel NULL pointer dereference at
> virtual address 00000000
> [   67.480000] pgd = cf978000
> [   67.480000] [00000000] *pgd=0d49e031, *pte=00000000, *ppte=00000000
> [   67.490000] Internal error: Oops: 0 [#1] PREEMPT
> [   67.490000] Modules linked in: mtd_readtest(+) ixp4xx redboot
> [   67.490000] CPU: 0    Not tainted  (2.6.31.11-isc #3)
> [   67.490000] PC is at 0x0
> [   67.490000] LR is at scan_for_bad_eraseblocks+0x88/0x10c [mtd_readtest]

I patched mtd_readtest.c with this:

After this, I ran mtd_readtest and it seemed to complete, but then
hang after it was done:
(initramfs) modprobe mtd_readtest dev=1
[  194.530000]
[  194.530000] =================================================
[  194.540000] mtd_readtest: MTD device: 1
[  194.540000] mtd_readtest: not NAND flash, assume page size is 512 bytes.
[  194.550000] mtd_readtest: MTD device size 32636928, eraseblock size
131072, page size 512, count of eraseblocks 249, pages per eraseblock
131072, OOB size 0
[  194.570000] mtd_readtest: scanning for bad eraseblocks
[  194.570000] mtd_readtest: scanned 249 eraseblocks, 0 are bad
[  194.580000] mtd_readtest: testing page read
[  194.960000] ------------[ cut here ]------------
[  194.960000] WARNING: at kernel/sched.c:5175 do_page_fault+0x16c/0x1ec()
[  194.960000] Modules linked in: mtd_readtest(+)
Jon Ringle - Jan. 12, 2010, 9:23 p.m.
mtd_speedtest results:
(initramfs) modprobe mtd_speedtest dev=1
[   34.930000]
[   34.930000] =================================================
[   34.940000] mtd_speedtest: MTD device: 1
[   34.940000] mtd_speedtest: not NAND flash, assume page size is 512 bytes.
[   34.950000] mtd_speedtest: MTD device size 32636928, eraseblock
size 131072, page size 512, count of eraseblocks 249, pages per
eraseblock 131072, OOB size 0
[   34.970000] mtd_speedtest: scanning for bad eraseblocks
[   34.970000] mtd_speedtest: scanned 249 eraseblocks, 0 are bad
[  247.150000] mtd_speedtest: testing eraseblock write speed
[  280.020000] mtd_speedtest: eraseblock write speed is 969 KiB/s
[  280.030000] mtd_speedtest: testing eraseblock read speed
[  295.500000] mtd_speedtest: eraseblock read speed is 2060 KiB/s
[  508.300000] mtd_speedtest: testing page write speed
[  545.620000] mtd_speedtest: error: write failed at 0x1f20000
[  545.620000] mtd_speedtest: error -22 occurred
[  545.630000] =================================================
FATAL: Error inserting mtd_speedtest
(/lib/modules/2.6.31.11-isc/kernel/drivers/mtd/tests/mtd_speedtest.ko):
Invalid argument

The device size is 32636928 (0x1f20000), so why is the test trying to
write at 0x1f20000? This is one byte past the end of device address
space.

Jon
Artem Bityutskiy - Jan. 12, 2010, 9:38 p.m.
On Tue, 2010-01-12 at 15:49 -0500, Jon Ringle wrote:
> On Tue, Jan 12, 2010 at 3:23 PM, Jon Ringle <jon@ringle.org> wrote:
> > On Mon, Jan 11, 2010 at 11:50 PM, Artem Bityutskiy <dedekind1@gmail.com> wrote:
> >> As this entry suggests:
> >> http://www.linux-mtd.infradead.org/doc/ubifs.html#L_how_send_bugreport
> >>
> >> - validate your flash/driver with the MTD tests - looks like you have a
> >> problem there.
> >
> > Trying to run mtd_readtest I get a seg fault:
> > [   67.470000] Unable to handle kernel NULL pointer dereference at
> > virtual address 00000000
> > [   67.480000] pgd = cf978000
> > [   67.480000] [00000000] *pgd=0d49e031, *pte=00000000, *ppte=00000000
> > [   67.490000] Internal error: Oops: 0 [#1] PREEMPT
> > [   67.490000] Modules linked in: mtd_readtest(+) ixp4xx redboot
> > [   67.490000] CPU: 0    Not tainted  (2.6.31.11-isc #3)
> > [   67.490000] PC is at 0x0
> > [   67.490000] LR is at scan_for_bad_eraseblocks+0x88/0x10c [mtd_readtest]
> 
> I patched mtd_readtest.c with this:
> diff --git a/drivers/mtd/tests/mtd_readtest.c b/drivers/mtd/tests/mtd_readtest.c
> index 79fc453..9edd658 100644
> --- a/drivers/mtd/tests/mtd_readtest.c
> +++ b/drivers/mtd/tests/mtd_readtest.c
> @@ -130,7 +130,7 @@ static int is_block_bad(int ebnum)
>         loff_t addr = ebnum * mtd->erasesize;
>         int ret;
> 
> -       ret = mtd->block_isbad(mtd, addr);
> +       ret = mtd->block_isbad ? mtd->block_isbad(mtd, addr) : 0;
>         if (ret)
>                 printk(PRINT_PREF "block %d is bad\n", ebnum);
>         return ret;
> 
> After this, I ran mtd_readtest and it seemed to complete, but then
> hang after it was done:
> (initramfs) modprobe mtd_readtest dev=1
> [  194.530000]
> [  194.530000] =================================================
> [  194.540000] mtd_readtest: MTD device: 1
> [  194.540000] mtd_readtest: not NAND flash, assume page size is 512 bytes.
> [  194.550000] mtd_readtest: MTD device size 32636928, eraseblock size
> 131072, page size 512, count of eraseblocks 249, pages per eraseblock
> 131072, OOB size 0
> [  194.570000] mtd_readtest: scanning for bad eraseblocks
> [  194.570000] mtd_readtest: scanned 249 eraseblocks, 0 are bad
> [  194.580000] mtd_readtest: testing page read
> [  194.960000] ------------[ cut here ]------------
> [  194.960000] WARNING: at kernel/sched.c:5175 do_page_fault+0x16c/0x1ec()
> [  194.960000] Modules linked in: mtd_readtest(+)

Do you see this on mtdram on your x86 PC?

Patch

diff --git a/drivers/mtd/tests/mtd_readtest.c b/drivers/mtd/tests/mtd_readtest.c
index 79fc453..9edd658 100644
--- a/drivers/mtd/tests/mtd_readtest.c
+++ b/drivers/mtd/tests/mtd_readtest.c
@@ -130,7 +130,7 @@  static int is_block_bad(int ebnum)
        loff_t addr = ebnum * mtd->erasesize;
        int ret;

-       ret = mtd->block_isbad(mtd, addr);
+       ret = mtd->block_isbad ? mtd->block_isbad(mtd, addr) : 0;
        if (ret)
                printk(PRINT_PREF "block %d is bad\n", ebnum);
        return ret;