[#4463] bfin_nand module would be failed if inserted twice

Document created by Aaronwu Employee on Aug 29, 2013
Version 1Show Document
  • View in full screen mode

[#4463] bfin_nand module would be failed if inserted twice

Submitted By: Mingquan Pan

Open Date

2008-10-08 05:58:57     Close Date

2008-12-12 02:16:23

Priority:

Medium     Assignee:

Bryan Wu

Status:

Closed     Fixed In Release:

N/A

Found In Release:

N/A     Release:

Category:

N/A     Board:

N/A

Processor:

N/A     Silicon Revision:

Is this bug repeatable?:

Yes     Resolution:

Fixed

Uboot version or rev.:

    Toolchain version or rev.:

Sep 23

App binary format:

N/A     

Summary: bfin_nand module would be failed if inserted twice

Details:

 

bfin_nand module would be failed if inserted twice on trunk head kernel.

 

root:/> uname -a

Linux blackfin 2.6.26.5-ADI-2009R1-pre-svn5387 #154 Wed Oct 8 18:36:48 MDT 2008 blackfin unknown

root:/>

root:/> insmod /lib/modules/2.6.26.5-ADI-2009R1-pre-svn5384-dirty/kernel/drivers

/mtd/nand/bfin_nand.ko

NAND device: Manufacturer ID: 0x20, Chip ID: 0xf1 (ST Micro NAND 128MiB 3,3V 8-bit)

Scanning device for bad blocks

Bad eraseblock 711 at 0x058e0000

Bad eraseblock 778 at 0x06140000

Creating 2 MTD partitions on "NAND 128MiB 3,3V 8-bit":

0x00000000-0x00400000 : "linux kernel"

0x00400000-0x08000000 : "file system"

root:/>

root:/> lsmod

Module                  Size  Used by

bfin_nand               1640  0

root:/> rmmod bfin_nand

root:/> lsmod

Module                  Size  Used by

root:/> modprobe bfin_nand

modprobe: /etc/modprobe.d: No such file or directory

NAND device: Manufacturer ID: 0x20, Chip ID: 0xf1 (ST Micro NAND 128MiB 3,3V 8-bit)

Scanning device for bad blocks

Bad eraseblock 711 at 0x058e0000

Bad eraseblock 778 at 0x06140000

Creating 2 MTD partitions on "NAND 128MiB 3,3V 8-bit":

0x00000000-0x00400000 : "linux kernel"

kobject_add_internal failed for 31:0 with -EEXIST, don't try to register things with the same name in the same directory.

Hardware Trace:

   0 Target : <0x000040d8> { _dump_stack + 0x0 }

     Source : <0x00093ef6> { _kobject_add_internal + 0xf6 }

   1 Target : <0x00093ef6> { _kobject_add_internal + 0xf6 }

     Source : <0x00093f48> { _kobject_add_internal + 0x148 }

   2 Target : <0x00093f48> { _kobject_add_internal + 0x148 }

     Source : <0x0000e5c6> { _printk + 0x16 }

   3 Target : <0x0000e5c2> { _printk + 0x12 }

     Source : <0x0000ee70> { _vprintk + 0x1bc }

   4 Target : <0x0000ee64> { _vprintk + 0x1b0 }

     Source : <0xffa00c48> { __common_int_entry + 0xd8 }

   5 Target : <0xffa00be6> { __common_int_entry + 0x76 }

     Source : <0xffa00a30> { _return_from_int + 0x58 }

   6 Target : <0xffa00a30> { _return_from_int + 0x58 }

     Source : <0xffa00a06> { _return_from_int + 0x2e }

   7 Target : <0xffa009d8> { _return_from_int + 0x0 }

     Source : <0xffa00be2> { __common_int_entry + 0x72 }

   8 Target : <0xffa00be0> { __common_int_entry + 0x70 }

     Source : <0xffa00338> { _asm_do_IRQ + 0x6c }

   9 Target : <0xffa00330> { _asm_do_IRQ + 0x64 }

     Source : <0x000125de> { __local_bh_enable + 0x3e }

  10 Target : <0x000125a0> { __local_bh_enable + 0x0 }

     Source : <0x000126be> { ___do_softirq + 0x96 }

  11 Target : <0x000126b6> { ___do_softirq + 0x8e }

     Source : <0x00012694> { ___do_softirq + 0x6c }

  12 Target : <0x00012688> { ___do_softirq + 0x60 }

     Source : <0x00015992> { _run_timer_softirq + 0x86 }

  13 Target : <0x00015920> { _run_timer_softirq + 0x14 }

     Source : <0x0002073a> { _run_hrtimer_pending + 0xa2 }

  14 Target : <0x0002072c> { _run_hrtimer_pending + 0x94 }

     Source : <0x000206be> { _run_hrtimer_pending + 0x26 }

  15 Target : <0x00020698> { _run_hrtimer_pending + 0x0 }

     Source : <0x000212fa> { _hrtimer_run_pending + 0x4a }

Stack info:

SP: [0x004bbc74] <0x004bbc74> /* kernel dynamic memory */

FP: (0x004bbd54)

Memory from 0x004bbc70 to 004bc000

004bbc70: 00000000 [004bbc78]<00093efa> 0323ce8c  ffffffef  0323ce8c  00124d4c  004b98a0

004bbc90: 004acc40 <0009423e> 0323ce8c  03218c2c  00189a9c  0323ce00  00000000  00000068

004bbcb0:<00072226> 004bbce4  004bbcd0  004bbcd0 <000aa426> 0323ce00  00188708  00189a9c

004bbcd0: 0323ce8c  03202a60  03202a60 <000aa8b4> 0323ce00  03218c2c  00189a9c  0059bbc0

004bbcf0: 00000000  00000000  00400000  0323ce8c  00000014  00146c59  004bbd50 <000398d4>

004bbd10: 03218c2c  00400000  00000000  00000000  03218b9c  03202a64  00158ab8  03218c2c

004bbd30: 00146c54  004bbd50  004bbd50 <0003994e> 031fd000  00000000  00159324 <0008e534>

004bbd50: 0000001f (00000000)<0008e54a> 00000000  00000000  00400000  0008da8c  0008e2f8

004bbd70: 031fd000 <000b4aba> 031fd000  03202a64 <000b50d0> 004afec0  00189a9c  0015bc74

004bbd90: 00000000 <00119128> 004bbdf8 <000b47d2> 00189ad8  00189a6c  004afec0  004bbdf8

004bbdb0:<00119610><0000e5c2><000b266a> 00189a64  00189918  004afec0  00400000  00000000

004bbdd0: 00400000 <000b3274><000b36da> 004afec0  0323c000  005ba174  00000000  00000000

004bbdf0: 00400000  005ba204  005ba660 <0323c71a> ffa01870  0323c0c4  0323c000  005ba4e0

004bbe10: 00000000  00000012  0000feff  0323c000  0018a034  00000002  005ba4e0 <00029aea>

004bbe30: 0323cba0  0323ca00  031f2968  031f2c05  004bbee4  00000000  00000000  00000000

004bbe50: 00000000  00000000  00000000  00000000  00000000  00000000  00000000  00000000

004bbe70: 00000000  00000000  00000000  00000000  00000000  00000010  031f2b28  031fbc40

004bbe90: 031f2918  031f2878  031f2940  031f2000  00000000  0000001c  0000001c  031f2698

004bbeb0: 031f2600  031f2698  00000000  00000000  00000000  00000000  00000000  00000000

004bbed0: 00000000  00000000  00000000  00000000  00000000  00000000  00268e44 <ffa008a4>

004bbef0: 00029a3c  00000080  0000002a  00000000  ffffe000  0025f168 <0021a312> 004b4ff3

004bbf10: 004ec060  00174078  00000f58 <0021a312> 0025f168  00201dae  00008000  00000000

004bbf30: 00000000  004bc000  00201dae  00201dae <0021c37a><ffa00e0c> 02003004  0338bca9

004bbf50: 0020cf39  0338bca8  0020cf38  00000000  00000000  00000000  00000000  00000000

004bbf70: 00000000  00000000  00000000  00000000  00000000  00000000  00000000  00000000

004bbf90: 00000000  00000000  00000000  004aa12c  00000000  00000000  00000000  004aa134

004bbfb0: 00268e41  00268e38  00268e44  00268f34  00268f2c  0000002a  004b2004  004b3ff4

004bbfd0: 00000080  00255d73  0025de9c  0025f168 <0021a312> 00000f58  0025de9c  00000f58

004bbff0: 004b2004  004b2004  00000080  00000006  c98c2fb9

Return addresses in stack:

    address : <0x00093efa> { _kobject_add_internal + 0xfa }

    address : <0x0009423e> { _kobject_add + 0x26 }

    address : <0x00072226> { _sysfs_addrm_start + 0x3e }

    address : <0x000aa426> { _device_add + 0x6e }

    address : <0x000aa8b4> { _device_create_vargs + 0x70 }

    address : <0x000398d4> { _bdi_register + 0x28 }

    address : <0x0003994e> { _bdi_register_dev + 0x22 }

    address : <0x0008e534> { _add_disk + 0x44 }

   frame  1 : <0x0008e54a> { _add_disk + 0x5a }

    address : <0x000b4aba> { _add_mtd_blktrans_dev + 0x146 }

    address : <0x000b50d0> { _mtdblock_add_mtd + 0x20 }

    address : <0x00119128> { __cond_resched + 0x34 }

    address : <0x000b47d2> { _blktrans_notify_add + 0x26 }

    address : <0x00119610> { _mutex_lock + 0xc }

    address : <0x0000e5c2> { _printk + 0x12 }

    address : <0x000b266a> { _add_mtd_device + 0x86 }

    address : <0x000b3274> { _add_mtd_partitions + 0x40 }

    address : <0x000b36da> { _add_mtd_partitions + 0x4a6 }

    address : <0x0323c71a> { :bfin_nand:_init_module + 0x11a }

    address : <0x00029aea> { _sys_init_module + 0xae }

    address : <0xffa008a4> { _system_call + 0x68 }

    address : <0x0021a312> [ insmod + 0x1a2d2 ]

    address : <0x0021a312> [ insmod + 0x1a2d2 ]

    address : <0x0021c37a> [ insmod + 0x1c33a ]

    address : <0xffa00e0c> { _evt_system_call + 0x64 }

    address : <0x0021a312> [ insmod + 0x1a2d2 ]

Hardware Trace:

   0 Target : <0x000041d0> { _trap_c + 0x0 }

     Source : <0xffa006d8> { _exception_to_level5 + 0x9c }

   1 Target : <0xffa0063c> { _exception_to_level5 + 0x0 }

     Source : <0xffa004c6> { _bfin_return_from_exception + 0xe }

   2 Target : <0xffa004b8> { _bfin_return_from_exception + 0x0 }

     Source : <0xffa00590> { _ex_trap_c + 0x6c }

   3 Target : <0xffa00524> { _ex_trap_c + 0x0 }

     Source : <0xffa003a2> { _ex_workaround_261 + 0x22 }

   4 Target : <0xffa00380> { _ex_workaround_261 + 0x0 }

     Source : <0xffa0076e> { _trap + 0x36 }

   5 Target : <0xffa00754> { _trap + 0x1c }

     Source : <0xffa00750> { _trap + 0x18 }

   6 Target : <0xffa00738> { _trap + 0x0 }

     Source : <0xffa004c6> { _bfin_return_from_exception + 0xe }

   7 Target : <0xffa004b8> { _bfin_return_from_exception + 0x0 }

     Source : <0xffa00392> { _ex_workaround_261 + 0x12 }

   8 Target : <0xffa00380> { _ex_workaround_261 + 0x0 }

     Source : <0xffa0076e> { _trap + 0x36 }

   9 Target : <0xffa00754> { _trap + 0x1c }

     Source : <0xffa00750> { _trap + 0x18 }

  10 Target : <0xffa00738> { _trap + 0x0 }

     Source : <0x00072f48> { _sysfs_create_link + 0x24 }

  11 Target : <0x00072f24> { _sysfs_create_link + 0x0 }

     Source : <0x0008e56a> { _add_disk + 0x7a }

  12 Target : <0x0008e54a> { _add_disk + 0x5a }

     Source : <0x00039952> { _bdi_register_dev + 0x26 }

  13 Target : <0x0003994e> { _bdi_register_dev + 0x22 }

     Source : <0x0003992a> { _bdi_register + 0x7e }

  14 Target : <0x00039922> { _bdi_register + 0x76 }

     Source : <0x000398dc> { _bdi_register + 0x30 }

  15 Target : <0x000398d4> { _bdi_register + 0x28 }

     Source : <0x000aa8ca> { _device_create_vargs + 0x86 }

Stack info:

SP: [0x004bb924] <0x004bb924> /* kernel dynamic memory */

FP: (0x004bba04)

Memory from 0x004bb920 to 004bc000

004bb920: ffffffff [ffffffff] 004bb924  004bb924  00000000  00000010  00000008  ffffffff

004bb940: 00000021  00000002  0000ffff  004bb94c  004bb94c  001831cc <00025ec8> 0017a3a0

004bb960: 00000006  0017490e  00000000  00000000  00000006  004bb9b0 <00015920> 00178fe0

004bb980: 00178da0  0017b5d4  00000000  0000000a  00000001  00000000  037cc568  004ec1e0

004bb9a0:<0021a312><ffa00378> 004bb9a8  004bb9a8  00181f3c <00012688> 00178dec  00178da0

004bb9c0: 0017b5d4  00000000  0000000a <000a8dd6> 001890fc  001831a0  0000001f  00003560

004bb9e0: 00003581  000032be  00147f34  0017490e  000a8d54 <0000e2d0> 0000000a  00000001

004bba00: 00000000 (00000000)<0000e7e8> 001748e6  001831c4  0018319c  00003610 <0000e824>

004bba20: 0000363b  004bbabc <00097fae> 001748dc  00147f5c  0000001f  fffff4fe  001831cc

004bba40:<0000eef4> 001748e6  00147f5c  001748e5  0000000a  001831c8  0000ffff <0000eef4>

004bba60:<0000eef4> ffffffff  00000021  004bbaf8  004bbafc <00008322> ffa00372  00000001

004bba80: 00000000  00000000  00000000  00000001  6fa63001  0061aed1  00000000  00000000

004bbaa0: 00000000  00000000 <00003cc8> 004bba78  004bba08  004bba04  ffa0036e  00000000

004bbac0:<0000e5c2> 004bbac4  004bba08  004bba04  00000000  00003d98  0000006d  004bbb04

004bbae0: 00189a9c  00000000 <00003f1a> 00000000 <004bc000><000040b8><000040b8> 000040b6

004bbb00: 00000001  3078303c  62623430  3e343239  202a2f20  6e72656b  64206c65  6d616e79

004bbb20: 6d206369  726f6d65  2f2a2079  7d203600  30783000  00007d20  fd1ae3ff  00002eed

004bbb40: 00000000  00000000  00000000  03202a60 <00097f3a> 00000000  3f3f3f3f  00000000

004bbb60: 00072f60  00072f60  004bbb9c  004bbb94  004bbb94  7fffffff  00147e94  004bbb90

004bbb80: 004bbb90 <00003d3e> 004bbd58  00000000  00000000  30303030  004bc000  03202a60

004bbba0:<00004414> 004bbc70  001748d0  00189a9c  0000000b  00000027  00000003  00400000

004bbbc0: 202b2064  004bb924  20326432  7830005d  7d203436  0003000b  7d206131  00000000

004bbbe0: 0000ffff  0000ffff  00183178  00000006  004acdcc  037efc6c <0004eed6> 004bbc88

004bbc00: 004acdcc  00000000  0017c068 <00072370> 004acdcc  004bbc48  ffffffef  004acdcc

004bbc20: 004bbcd8 <0007267e> 004bbcd8 <000726a6> 004acdcc  0323ce68  00189a9c  004b98a0

004bbc40: 00000005  004bbcd8 <00004104><ffa006dc> ffa00c4c  ffe02014  00152a6c  0000ffff

004bbc60: 00000000  00000000  0323ce68  004bbc74  00000480  00008030  00060027  00000000

004bbc80: 004bbd4c  00000480  00072f4a <000b4aba> 031fd0b0  02003004  000975a0  ffa0182c

004bbca0: 00097594  ffa0182a  00000000  00000000  00000000  00000000  00000000  00000000

004bbcc0: 00000000  00000000  00000000  00000000  00000000  00000000  00000000  00000000

004bbce0: 00000000  00000000  00000000  00000000  00000000  ffff1bcc  00000000  001740c4

004bbd00: 00268e38  03202a60  031fd000  03202a64  00189a9c  031fd0b0  00000068  004f0540

004bbd20: 00152a6c  004ac458  00000000  00400000  004bbb8c  00152a6c  00000068  031fd0b0

004bbd40: 031fd0b0  004f0540  00000006 <0008e534> 0000001f  00000000 <0008e54a> 00000000

004bbd60: 00000000  00400000  0008da8c <000b4aba> 031fd000  03202a64  00400000  00000000

004bbd80:<000b50d0> 004afec0  00189a9c  0015bc74  00000000 <00119128> 004bbdf8 <000b47d2>

004bbda0: 00189ad8  00189a6c  004afec0  004bbdf8 <00119610><0000e5c2><000b266a> 00189a64

004bbdc0: 00189918  004afec0  00400000  00000000  00400000 <000b3274><000b36da> 004afec0

004bbde0: 0323c000  005ba174  00000000  00000000  00400000  005ba204  005ba660 <0323c71a>

004bbe00: ffa01870  0323c0c4  0323c000  005ba4e0  00000000  00000012  0000feff  0323c000

004bbe20: 0018a034  00000002  005ba4e0 <00029aea> 0323cba0  0323ca00  031f2968  031f2c05

004bbe40: 004bbee4  00000000  00000000  00000000  00000000  00000000  00000000  00000000

004bbe60: 00000000  00000000  00000000  00000000  00000000  00000000  00000000  00000000

004bbe80: 00000000  00000010  031f2b28  031fbc40  031f2918  031f2878  031f2940  031f2000

004bbea0: 00000000  0000001c  0000001c  031f2698  031f2600  031f2698  00000000  00000000

004bbec0: 00000000  00000000  00000000  00000000  00000000  00000000  00000000  00000000

004bbee0: 00000000  00000000  00268e44 <ffa008a4> 00029a3c  00000080  0000002a  00000000

004bbf00: ffffe000  0025f168 <0021a312> 004b4ff3  004ec060  00174078  00000f58 <0021a312>

004bbf20: 0025f168  00201dae  00008000  00000000  00000000  004bc000  00201dae  00201dae

004bbf40:<0021c37a><ffa00e0c> 02003004  0338bca9  0020cf39  0338bca8  0020cf38  00000000

004bbf60: 00000000  00000000  00000000  00000000  00000000  00000000  00000000  00000000

004bbf80: 00000000  00000000  00000000  00000000  00000000  00000000  00000000  004aa12c

004bbfa0: 00000000  00000000  00000000  004aa134  00268e41  00268e38  00268e44  00268f34

004bbfc0: 00268f2c  0000002a  004b2004  004b3ff4  00000080  00255d73  0025de9c  0025f168

004bbfe0:<0021a312> 00000f58  0025de9c  00000f58  004b2004  004b2004  00000080  00000006

004bc000: c98c2fb9

Return addresses in stack:

    address : <0x00025ec8> { _tick_periodic + 0x30 }

    address : <0x00015920> { _run_timer_softirq + 0x14 }

    address : <0x0021a312> [ insmod + 0x1a2d2 ]

    address : <0xffa00378> { _timer_interrupt + 0xc }

    address : <0x00012688> { ___do_softirq + 0x60 }

    address : <0x000a8dd6> { _bfin_serial_console_write + 0x2e }

    address : <0x0000e2d0> { ___call_console_drivers + 0x48 }

   frame  1 : <0x0000e772> { _release_console_sem + 0xd2 }

    address : <0x0000e7e8> { _release_console_sem + 0x148 }

    address : <0x0000e824> { _release_console_sem + 0x184 }

    address : <0x00097fae> { _vscnprintf + 0x16 }

    address : <0x0000eef4> { _vprintk + 0x240 }

    address : <0x0000eef4> { _vprintk + 0x240 }

    address : <0x0000eef4> { _vprintk + 0x240 }

    address : <0x00008322> { _isram_memcpy + 0x22 }

    address : <0x00003cc8> { _get_instruction + 0x130 }

    address : <0x00003d98> { _is_bfin_call + 0x4c }

    address : <0x00003f1a> { _show_stack + 0x156 }

    address : <0x000040b8> { _dump_bfin_trace_buffer + 0xa0 }

    address : <0x00097f3a> { _sprintf + 0x1a }

    address : <0x00003d3e> { _dump_bfin_mem + 0x66 }

    address : <0x00004414> { _trap_c + 0x244 }

    address : <0x0004eed6> { _ilookup5_nowait + 0x2e }

    address : <0x00072370> { _release_sysfs_dirent + 0x38 }

    address : <0x0007267e> { _create_dir + 0x3a }

    address : <0x000726a6> { _create_dir + 0x62 }

    address : <0x00004104> { _dump_stack + 0x2c }

    address : <0xffa006dc> { _exception_to_level5 + 0xa0 }

    address : <0x000b4aba> { _add_mtd_blktrans_dev + 0x146 }

    address : <0x0008e534> { _add_disk + 0x44 }

    address : <0x0008e54a> { _add_disk + 0x5a }

    address : <0x000b4aba> { _add_mtd_blktrans_dev + 0x146 }

    address : <0x000b50d0> { _mtdblock_add_mtd + 0x20 }

    address : <0x00119128> { __cond_resched + 0x34 }

    address : <0x000b47d2> { _blktrans_notify_add + 0x26 }

    address : <0x00119610> { _mutex_lock + 0xc }

    address : <0x0000e5c2> { _printk + 0x12 }

    address : <0x000b266a> { _add_mtd_device + 0x86 }

    address : <0x000b3274> { _add_mtd_partitions + 0x40 }

    address : <0x000b36da> { _add_mtd_partitions + 0x4a6 }

    address : <0x0323c71a> { :bfin_nand:_init_module + 0x11a }

    address : <0x00029aea> { _sys_init_module + 0xae }

    address : <0xffa008a4> { _system_call + 0x68 }

    address : <0x0021a312> [ insmod + 0x1a2d2 ]

    address : <0x0021a312> [ insmod + 0x1a2d2 ]

    address : <0x0021c37a> [ insmod + 0x1c33a ]

    address : <0xffa00e0c> { _evt_system_call + 0x64 }

    address : <0x0021a312> [ insmod + 0x1a2d2 ]

Modules linked in: bfin_nand(+) [last unloaded: bfin_nand]

Kernel panic - not syncing: Kernel exception

 

                                                                                                                                                          

 

Follow-ups

 

--- Bryan Wu                                                 2008-10-16 04:24:57

I also found this bug on BF548 EZKIT. modprobe bf5xx_nand and rmmod it, then

modprobe it again, the bug shows up.

 

After digging into the mtd code, this bug is not related to our driver. It

should be a subtle bug in mtd core code.

 

In add_mtd_partition, for 2 partitions, 2 gendisk structures will be allocated.

But these 2 gendisk->queue will be set to the same request_queue. Then when

unregistering the 1st partition, from the same

request_queue->backing_dev_info, the bdi struct will be set to NULL. So for

the 2nd partition (bdi == NULL), the sysfs dir of 2nd partition will not be

removed. Finally, when modprobe the module again, the 2nd partition won't be

added because the bug reported in this tracker.

 

It will take some time to find a suitable solution for both us and mainline.

 

-Bryan

 

--- Adam Cook                                                2008-11-10 15:47:28

Bryan,

Could you please let me know where specifically in the mtd code you found the

bug? A customer may be interested in fixing this issue themselves and would like

to know what code they need to look at in order to do so.

 

Thanks,

Adam

 

 

 

--- Bryan Wu                                                 2008-11-10 21:47:05

Hi Adam,

 

Actually, after discussing on LKML, this bug is more subtle than what I

thought. So the kernel maintainer is working on it. It should be related to

backing_dev_info (BDI) stuff. And not only MTD but also Floppy system found the

same bug.   lkml.org/lkml/2008/10/28/180

 

I think there is only workaround here no real fixing.

 

-Bryan

 

--- Bryan Wu                                                 2008-12-07 22:00:22

I backport the fixing to our svn. Please test again.

 

Thanks

-Bryan

 

--- Bryan Wu                                                 2008-12-09 04:31:31

I removed the WARN_ON in this patch to kill tons of warning message.

 

-Bryan

 

--- Mingquan Pan                                             2008-12-12 02:16:23

Yes,fixed on bf537 board. Close.

 

 

 

    Files

    Changes

    Commits

    Dependencies

    Duplicates

    Associations

    Tags

 

File Name     File Type     File Size     Posted By

No Files Were Found

Attachments

    Outcomes