Re: [PATCH] drm/mgag200: Fix calling drm_fb_helper_fini() twice
From: Ingo Molnar
Date: Sat Oct 03 2015 - 06:56:21 EST
* Archit Taneja <architt@xxxxxxxxxxxxxx> wrote:
>
>
> On 9/17/2015 2:04 PM, Ingo Molnar wrote:
> >
> >
> >* Ingo Molnar <mingo@xxxxxxxxxx> wrote:
> >
> >
> >
> >>So this patch was whitespace damaged - I applied it by hand and made the commit
> >
> >>below. This has solved the crash, thanks Archit!
> >
> >
> >
> >Spoke too soon - the attached (allyesconfig-ish) config still crashes, first there
> >
> >are a handful of kobject debug warnings, then:
>
> The error handling in the driver is bad. The main problem is that the
> driver_load op calls mgag200_driver_unload if anything fails, which doesn't
> work well if driver_load fails mid way.
>
> I'll post out patches to fix this. But you'll need to undo the patch
> I'd sent previously.
Thanks, with Linus's latest kernel that has your fixes included I can no longer
reproduce the crash.
The MGAG200 driver still generates the following kobject warnings:
[ 269.353392] calling mgag200_init+0x0/0x3b @ 1
[ 269.358702] bus: 'pci': add driver mgag200
[ 269.363760] bus: 'pci': driver_probe_device: matched device 0000:0b:00.0 with driver mgag200
[ 269.373748] bus: 'pci': really_probe: probing driver mgag200 with device 0000:0b:00.0
[ 269.383073] mgag200 0000:0b:00.0: no default pinctrl state
[ 269.389590] devices_kset: Moving 0000:0b:00.0 to end of list
[ 269.399437] device: 'controlD64': device_add
[ 269.404901] PM: Adding info for No Bus:controlD64
[ 269.410986] device: 'card0': device_add
[ 269.415877] PM: Adding info for No Bus:card0
[ 269.431210] ------------[ cut here ]------------
[ 269.436655] WARNING: CPU: 0 PID: 230 at lib/kobject.c:582 kobject_get+0x33/0x6a()
[ 269.445503] kobject: 'ttm' (ffffffff86c288b0): is not initialized, yet kobject_get() is being called.
[ 269.456290] Modules linked in:
[ 269.460057] CPU: 0 PID: 230 Comm: kworker/0:1 Tainted: G W L 4.3.0-rc3-02057-g77880ef-dirty #183
[ 269.471428] Hardware name: Intel Corporation S2600GZ/S2600GZ, BIOS SE5C600.86B.02.02.0002.122320131210 12/23/2013
[ 269.483389] Workqueue: events work_for_cpu_fn
[ 269.488612] 0000000000000000 ffff88041fabf9a8 ffffffff81892127 ffff88041fabf9f0
[ 269.497809] ffff88041fabf9e0 ffffffff81145b0f ffffffff8189405f ffffffff86c288b0
[ 269.506882] 0000000000000000 ffffffff86c288b0 0000000000ff0000 ffff88041fabfa40
[ 269.515943] Call Trace:
[ 269.518951] [<ffffffff81892127>] dump_stack+0x4b/0x64
[ 269.524975] [<ffffffff81145b0f>] warn_slowpath_common+0x9f/0xb8
[ 269.531970] [<ffffffff8189405f>] ? kobject_get+0x33/0x6a
[ 269.538271] [<ffffffff81145b74>] warn_slowpath_fmt+0x4c/0x4e
[ 269.544976] [<ffffffff8118a84a>] ? lock_is_held+0x55/0x66
[ 269.551382] [<ffffffff8189405f>] kobject_get+0x33/0x6a
[ 269.557500] [<ffffffff81894723>] kobject_add_internal+0x58/0x2c4
[ 269.564589] [<ffffffff81894a02>] kobject_init_and_add+0x73/0x7e
[ 269.571586] [<ffffffff81b9ba3f>] ttm_mem_global_init+0xc6/0x2cd
[ 269.578583] [<ffffffff812916f1>] ? kasan_poison_shadow+0x2f/0x31
[ 269.585674] [<ffffffff81291f09>] ? kasan_unpoison_shadow+0x14/0x35
[ 269.592958] [<ffffffff812916f1>] ? kasan_poison_shadow+0x2f/0x31
[ 269.600044] [<ffffffff81291f75>] ? kasan_kmalloc+0x4b/0x50
[ 269.606544] [<ffffffff8128ebc4>] ? __kmalloc+0x13e/0x180
[ 269.612856] [<ffffffff812916f1>] ? kasan_poison_shadow+0x2f/0x31
[ 269.619945] [<ffffffff81b9496c>] ? drm_global_item_ref+0x67/0xad
[ 269.627056] [<ffffffff81cbf3c2>] mgag200_ttm_mem_global_init+0x12/0x14
[ 269.634725] [<ffffffff81b94983>] drm_global_item_ref+0x7e/0xad
[ 269.641619] [<ffffffff81cbf489>] mgag200_mm_init+0x50/0x199
[ 269.648223] [<ffffffff81cba964>] mgag200_driver_load+0x34a/0x4c7
[ 269.655316] [<ffffffff81b838ad>] drm_dev_register+0x6f/0xb0
[ 269.661923] [<ffffffff81b860d5>] drm_get_pci_dev+0xff/0x1c2
[ 269.668526] [<ffffffff81cbe709>] mga_pci_probe+0xa6/0xad
[ 269.674840] [<ffffffff81911f27>] local_pci_probe+0x3d/0x82
[ 269.685976] [<ffffffff811599c1>] work_for_cpu_fn+0x14/0x1b
[ 269.692622] [<ffffffff8115d50b>] process_one_work+0x28e/0x4ef
[ 269.699424] [<ffffffff8115d3ed>] ? process_one_work+0x170/0x4ef
[ 269.706438] [<ffffffff8115d78d>] process_scheduled_works+0x21/0x2f
[ 269.713728] [<ffffffff8115dc06>] worker_thread+0x1fb/0x2bd
[ 269.720238] [<ffffffff8115da0b>] ? cancel_delayed_work_sync+0x15/0x15
[ 269.727815] [<ffffffff8115da0b>] ? cancel_delayed_work_sync+0x15/0x15
[ 269.735395] [<ffffffff81162dcb>] kthread+0xc5/0xcd
[ 269.741118] [<ffffffff81162d06>] ? kthread_parkme+0x24/0x24
[ 269.747727] [<ffffffff83d556ef>] ret_from_fork+0x3f/0x70
[ 269.754041] [<ffffffff81162d06>] ? kthread_parkme+0x24/0x24
[ 269.760641] ---[ end trace 0609b8147f0ef5df ]---
[ 269.766074] ------------[ cut here ]------------
[ 269.771499] WARNING: CPU: 0 PID: 230 at include/linux/kref.h:47 kobject_get+0x5d/0x6a()
[ 269.780921] Modules linked in:
[ 269.784691] CPU: 0 PID: 230 Comm: kworker/0:1 Tainted: G W L 4.3.0-rc3-02057-g77880ef-dirty #183
[ 269.796062] Hardware name: Intel Corporation S2600GZ/S2600GZ, BIOS SE5C600.86B.02.02.0002.122320131210 12/23/2013
[ 269.808019] Workqueue: events work_for_cpu_fn
[ 269.813274] 0000000000000000 ffff88041fabf9f8 ffffffff81892127 0000000000000000
[ 269.822347] ffff88041fabfa30 ffffffff81145b0f ffffffff81894089 ffffffff86c288b0
[ 269.831405] 0000000000000000 ffffffff86c288b0 0000000000ff0000 ffff88041fabfa40
[ 269.840455] Call Trace:
[ 269.843459] [<ffffffff81892127>] dump_stack+0x4b/0x64
[ 269.849477] [<ffffffff81145b0f>] warn_slowpath_common+0x9f/0xb8
[ 269.856468] [<ffffffff81894089>] ? kobject_get+0x5d/0x6a
[ 269.862783] [<ffffffff81145bd6>] warn_slowpath_null+0x1a/0x1c
[ 269.869571] [<ffffffff81894089>] kobject_get+0x5d/0x6a
[ 269.875690] [<ffffffff81894723>] kobject_add_internal+0x58/0x2c4
[ 269.882784] [<ffffffff81894a02>] kobject_init_and_add+0x73/0x7e
[ 269.889778] [<ffffffff81b9ba3f>] ttm_mem_global_init+0xc6/0x2cd
[ 269.896770] [<ffffffff812916f1>] ? kasan_poison_shadow+0x2f/0x31
[ 269.903865] [<ffffffff81291f09>] ? kasan_unpoison_shadow+0x14/0x35
[ 269.911147] [<ffffffff812916f1>] ? kasan_poison_shadow+0x2f/0x31
[ 269.918228] [<ffffffff81291f75>] ? kasan_kmalloc+0x4b/0x50
[ 269.924731] [<ffffffff8128ebc4>] ? __kmalloc+0x13e/0x180
[ 269.931046] [<ffffffff812916f1>] ? kasan_poison_shadow+0x2f/0x31
[ 269.938136] [<ffffffff81b9496c>] ? drm_global_item_ref+0x67/0xad
[ 269.945226] [<ffffffff81cbf3c2>] mgag200_ttm_mem_global_init+0x12/0x14
[ 269.952903] [<ffffffff81b94983>] drm_global_item_ref+0x7e/0xad
[ 269.959797] [<ffffffff81cbf489>] mgag200_mm_init+0x50/0x199
[ 269.966400] [<ffffffff81cba964>] mgag200_driver_load+0x34a/0x4c7
[ 269.973489] [<ffffffff81b838ad>] drm_dev_register+0x6f/0xb0
[ 269.980091] [<ffffffff81b860d5>] drm_get_pci_dev+0xff/0x1c2
[ 269.986698] [<ffffffff81cbe709>] mga_pci_probe+0xa6/0xad
[ 269.993013] [<ffffffff81911f27>] local_pci_probe+0x3d/0x82
[ 269.999519] [<ffffffff811599c1>] work_for_cpu_fn+0x14/0x1b
[ 270.006025] [<ffffffff8115d50b>] process_one_work+0x28e/0x4ef
[ 270.012826] [<ffffffff8115d3ed>] ? process_one_work+0x170/0x4ef
[ 270.019818] [<ffffffff8115d78d>] process_scheduled_works+0x21/0x2f
[ 270.027100] [<ffffffff8115dc06>] worker_thread+0x1fb/0x2bd
[ 270.033606] [<ffffffff8115da0b>] ? cancel_delayed_work_sync+0x15/0x15
[ 270.041182] [<ffffffff8115da0b>] ? cancel_delayed_work_sync+0x15/0x15
[ 270.048758] [<ffffffff81162dcb>] kthread+0xc5/0xcd
[ 270.054491] [<ffffffff81162d06>] ? kthread_parkme+0x24/0x24
[ 270.061096] [<ffffffff83d556ef>] ret_from_fork+0x3f/0x70
[ 270.067409] [<ffffffff81162d06>] ? kthread_parkme+0x24/0x24
[ 270.074012] ---[ end trace 0609b8147f0ef5e0 ]---
[ 270.079448] ------------[ cut here ]------------
[ 270.084882] WARNING: CPU: 0 PID: 230 at lib/kobject.c:674 kobject_put+0x33/0x47()
[ 270.093723] kobject: 'ttm' (ffffffff86c288b0): is not initialized, yet kobject_put() is being called.
[ 270.104503] Modules linked in:
[ 270.108272] CPU: 0 PID: 230 Comm: kworker/0:1 Tainted: G W L 4.3.0-rc3-02057-g77880ef-dirty #183
[ 270.119648] Hardware name: Intel Corporation S2600GZ/S2600GZ, BIOS SE5C600.86B.02.02.0002.122320131210 12/23/2013
[ 270.131604] Workqueue: events work_for_cpu_fn
[ 270.136828] 0000000000000000 ffff88041fabf9a8 ffffffff81892127 ffff88041fabf9f0
[ 270.145900] ffff88041fabf9e0 ffffffff81145b0f ffffffff818940c9 ffffffff86c288b0
[ 270.154971] ffffffff86c288b0 00000000fffffffe 0000000000ff0000 ffff88041fabfa40
[ 270.164021] Call Trace:
[ 270.167026] [<ffffffff81892127>] dump_stack+0x4b/0x64
[ 270.173045] [<ffffffff81145b0f>] warn_slowpath_common+0x9f/0xb8
[ 270.180036] [<ffffffff818940c9>] ? kobject_put+0x33/0x47
[ 270.186349] [<ffffffff81145b74>] warn_slowpath_fmt+0x4c/0x4e
[ 270.193099] [<ffffffff818940c9>] kobject_put+0x33/0x47
[ 270.199217] [<ffffffff81894966>] kobject_add_internal+0x29b/0x2c4
[ 270.206405] [<ffffffff81894a02>] kobject_init_and_add+0x73/0x7e
[ 270.213401] [<ffffffff81b9ba3f>] ttm_mem_global_init+0xc6/0x2cd
[ 270.220385] [<ffffffff812916f1>] ? kasan_poison_shadow+0x2f/0x31
[ 270.227473] [<ffffffff81291f09>] ? kasan_unpoison_shadow+0x14/0x35
[ 270.234755] [<ffffffff812916f1>] ? kasan_poison_shadow+0x2f/0x31
[ 270.241844] [<ffffffff81291f75>] ? kasan_kmalloc+0x4b/0x50
[ 270.248347] [<ffffffff8128ebc4>] ? __kmalloc+0x13e/0x180
[ 270.254678] [<ffffffff812916f1>] ? kasan_poison_shadow+0x2f/0x31
[ 270.261769] [<ffffffff81b9496c>] ? drm_global_item_ref+0x67/0xad
[ 270.268857] [<ffffffff81cbf3c2>] mgag200_ttm_mem_global_init+0x12/0x14
[ 270.276519] [<ffffffff81b94983>] drm_global_item_ref+0x7e/0xad
[ 270.283416] [<ffffffff81cbf489>] mgag200_mm_init+0x50/0x199
[ 270.290020] [<ffffffff81cba964>] mgag200_driver_load+0x34a/0x4c7
[ 270.297109] [<ffffffff81b838ad>] drm_dev_register+0x6f/0xb0
[ 270.303712] [<ffffffff81b860d5>] drm_get_pci_dev+0xff/0x1c2
[ 270.310317] [<ffffffff81cbe709>] mga_pci_probe+0xa6/0xad
[ 270.316642] [<ffffffff81911f27>] local_pci_probe+0x3d/0x82
[ 270.323151] [<ffffffff811599c1>] work_for_cpu_fn+0x14/0x1b
[ 270.329655] [<ffffffff8115d50b>] process_one_work+0x28e/0x4ef
[ 270.336455] [<ffffffff8115d3ed>] ? process_one_work+0x170/0x4ef
[ 270.343449] [<ffffffff8115d78d>] process_scheduled_works+0x21/0x2f
[ 270.350735] [<ffffffff8115dc06>] worker_thread+0x1fb/0x2bd
[ 270.357242] [<ffffffff8115da0b>] ? cancel_delayed_work_sync+0x15/0x15
[ 270.364821] [<ffffffff8115da0b>] ? cancel_delayed_work_sync+0x15/0x15
[ 270.372398] [<ffffffff81162dcb>] kthread+0xc5/0xcd
[ 270.378125] [<ffffffff81162d06>] ? kthread_parkme+0x24/0x24
[ 270.384733] [<ffffffff83d556ef>] ret_from_fork+0x3f/0x70
[ 270.391045] [<ffffffff81162d06>] ? kthread_parkme+0x24/0x24
[ 270.397646] ---[ end trace 0609b8147f0ef5e1 ]---
[ 270.403093] ------------[ cut here ]------------
[ 270.408531] WARNING: CPU: 0 PID: 230 at lib/kobject.c:244 kobject_add_internal+0x281/0x2c4()
[ 270.418444] kobject_add_internal failed for memory_accounting (error: -2 parent: kkkkkkk\xffffffa5\xffffffbb\xffffffbb\xffffffbb\xffffffbb\xffffffbb\xffffffbb\xffffffbb\xffffffbb`R\xffffffb0\xffffff88\xffffffff\xffffffffsD\xffffff89\xffffff81\xffffffff\xffffffff\xffffffff\xffffffff>\xffffffe3(\xffffff81\xffffffff\xffffffff\xffffffff\xffffffffJ)\xffffff81\xffffffff\xffffffff\xffffffff\xffffffff\xffffffaf\xfffffff6\xffffff89\xffffff81\xffffffff\xffffffff\xffffffff\xffffffffsD\xffffff89\xffffff81\xffffffff\xffffffff\xffffffff\xffffffff\xffffff9c&Ü\xffffffff\xffffffff\xffffffff\xffffffffÖR\xffffff87\xffffffff\xffffffff\xffffffff\xffffffff\xffffff88!)
[ 270.435559] Modules linked in:
[ 270.439326] CPU: 0 PID: 230 Comm: kworker/0:1 Tainted: G W L 4.3.0-rc3-02057-g77880ef-dirty #183
[ 270.450700] Hardware name: Intel Corporation S2600GZ/S2600GZ, BIOS SE5C600.86B.02.02.0002.122320131210 12/23/2013
[ 270.462657] Workqueue: events work_for_cpu_fn
[ 270.467875] 0000000000000000 ffff88041fabf9c0 ffffffff81892127 ffff88041fabfa08
[ 270.476941] ffff88041fabf9f8 ffffffff81145b0f ffffffff8189494c ffff88041fe5e270
[ 270.486017] ffffffff86c288b0 00000000fffffffe 0000000000ff0000 ffff88041fabfa58
[ 270.495088] Call Trace:
[ 270.498094] [<ffffffff81892127>] dump_stack+0x4b/0x64
[ 270.504118] [<ffffffff81145b0f>] warn_slowpath_common+0x9f/0xb8
[ 270.511113] [<ffffffff8189494c>] ? kobject_add_internal+0x281/0x2c4
[ 270.518496] [<ffffffff81145b74>] warn_slowpath_fmt+0x4c/0x4e
[ 270.525197] [<ffffffff8189494c>] kobject_add_internal+0x281/0x2c4
[ 270.532387] [<ffffffff81894a02>] kobject_init_and_add+0x73/0x7e
[ 270.539380] [<ffffffff81b9ba3f>] ttm_mem_global_init+0xc6/0x2cd
[ 270.546372] [<ffffffff812916f1>] ? kasan_poison_shadow+0x2f/0x31
[ 270.553460] [<ffffffff81291f09>] ? kasan_unpoison_shadow+0x14/0x35
[ 270.560744] [<ffffffff812916f1>] ? kasan_poison_shadow+0x2f/0x31
[ 270.567844] [<ffffffff81291f75>] ? kasan_kmalloc+0x4b/0x50
[ 270.574350] [<ffffffff8128ebc4>] ? __kmalloc+0x13e/0x180
[ 270.580665] [<ffffffff812916f1>] ? kasan_poison_shadow+0x2f/0x31
[ 270.587757] [<ffffffff81b9496c>] ? drm_global_item_ref+0x67/0xad
[ 270.594847] [<ffffffff81cbf3c2>] mgag200_ttm_mem_global_init+0x12/0x14
[ 270.602522] [<ffffffff81b94983>] drm_global_item_ref+0x7e/0xad
[ 270.609423] [<ffffffff81cbf489>] mgag200_mm_init+0x50/0x199
[ 270.616027] [<ffffffff81cba964>] mgag200_driver_load+0x34a/0x4c7
[ 270.623118] [<ffffffff81b838ad>] drm_dev_register+0x6f/0xb0
[ 270.629722] [<ffffffff81b860d5>] drm_get_pci_dev+0xff/0x1c2
[ 270.636327] [<ffffffff81cbe709>] mga_pci_probe+0xa6/0xad
[ 270.642642] [<ffffffff81911f27>] local_pci_probe+0x3d/0x82
[ 270.649154] [<ffffffff811599c1>] work_for_cpu_fn+0x14/0x1b
[ 270.655664] [<ffffffff8115d50b>] process_one_work+0x28e/0x4ef
[ 270.662465] [<ffffffff8115d3ed>] ? process_one_work+0x170/0x4ef
[ 270.669459] [<ffffffff8115d78d>] process_scheduled_works+0x21/0x2f
[ 270.676747] [<ffffffff8115dc06>] worker_thread+0x1fb/0x2bd
[ 270.683259] [<ffffffff8115da0b>] ? cancel_delayed_work_sync+0x15/0x15
[ 270.690836] [<ffffffff8115da0b>] ? cancel_delayed_work_sync+0x15/0x15
[ 270.698414] [<ffffffff81162dcb>] kthread+0xc5/0xcd
[ 270.704143] [<ffffffff81162d06>] ? kthread_parkme+0x24/0x24
[ 270.710742] [<ffffffff83d556ef>] ret_from_fork+0x3f/0x70
[ 270.717055] [<ffffffff81162d06>] ? kthread_parkme+0x24/0x24
[ 270.723658] ---[ end trace 0609b8147f0ef5e2 ]---
[ 270.729111] [drm:mgag200_mm_init] *ERROR* Failed setting up TTM memory accounting subsystem.
[ 270.739731] PM: Removing info for No Bus:card0
[ 270.746079] PM: Removing info for No Bus:controlD64
[ 270.755395] mgag200: probe of 0000:0b:00.0 failed with error -2
[ 270.763040] initcall mgag200_init+0x0/0x3b returned 0 after 1371312 usecs
[ 270.873569] calling cirrus_init+0x0/0x3b @ 1
and fails - but does not crash.
Similar config to what I sent you earlier in this thread.
Thanks,
Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/