Re: [Intel-gfx] 4.10-rc2 oops in DRM connector code

From: Dave Hansen
Date: Mon Jan 09 2017 - 08:40:14 EST


Well, now I found where the -2 comes from.
intel_dp_register_mst_connector() calls drm_connector_register(), which
fails to add the kobject (warning below). But, it does zero error
checking on the drm_connector_register() call and leaves the
partially-constructed connector in place.

The next time some poor, hapless code goes and tries to do anything with
that kdev, they oops. I'm perplexed by this, though. The
drm_dp_mst_topology_cbs->register_connector just returns void. It seems
a bit goofy that it can't even _return_ failure.

Is there some stable code to go back to here? Or, is there something
about my configuration that's unique? I really wonder why nobody else
is running into this.

There's probably some other race going on here. This warning doesn't
happen on every boot.

> [ 1.396475] ------------[ cut here ]------------
> [ 1.396486] WARNING: CPU: 0 PID: 91 at lib/kobject.c:244 kobject_add_internal+0x108/0x2d0
> [ 1.396492] kobject_add_internal failed for card0-DP-3 (error: -2 parent: card0)
> [ 1.396496] Modules linked in:
> [ 1.396500] CPU: 0 PID: 91 Comm: kworker/0:2 Not tainted 4.10.0-rc2-dirty #58
> [ 1.396503] Hardware name: LENOVO 20F5S7V800/20F5S7V800, BIOS R02ET50W (1.23 ) 09/20/2016
> [ 1.396509] Workqueue: events_long drm_dp_mst_link_probe_work
> [ 1.396511] Call Trace:
> [ 1.396517] dump_stack+0x67/0x99
> [ 1.396521] __warn+0xd1/0xf0
> [ 1.396524] warn_slowpath_fmt+0x4f/0x60
> [ 1.396527] kobject_add_internal+0x108/0x2d0
> [ 1.396531] ? vsnprintf+0x112/0x4b0
> [ 1.396533] kobject_add+0x65/0xb0
> [ 1.396537] ? klist_init+0x31/0x40
> [ 1.396542] device_add+0x102/0x5d0
> [ 1.396546] ? kfree_const+0x22/0x30
> [ 1.396549] device_create_groups_vargs+0xd8/0x100
> [ 1.396553] device_create_with_groups+0x36/0x40
> [ 1.396557] ? drm_fb_helper_add_one_connector+0x57/0xd0
> [ 1.396561] ? kmem_cache_alloc_trace+0x1d2/0x1f0
> [ 1.396566] drm_sysfs_connector_add+0x60/0xe0
> [ 1.396570] drm_connector_register+0x21/0xc0
> [ 1.396575] intel_dp_register_mst_connector+0x41/0x50
> [ 1.396579] drm_dp_add_port+0x350/0x450
> [ 1.396583] ? rcu_early_boot_tests+0x1/0x10
> [ 1.396587] ? schedule_timeout+0x1cd/0x390
> [ 1.396591] ? __might_sleep+0x4a/0x90
> [ 1.396594] ? mutex_lock+0x25/0x50
> [ 1.396597] ? drm_dp_mst_wait_tx_reply+0x118/0x1e0
> [ 1.396600] ? prepare_to_wait_event+0x120/0x120
> [ 1.396603] ? drm_dp_check_mstb_guid+0x3d/0x120
> [ 1.396606] drm_sysfs_connector_add() connector: ffff88040ed3f000 kdev: ffff88040c55dc00
> [ 1.396610] drm_dp_send_link_address+0x185/0x1f0
> [ 1.396614] drm_dp_check_and_send_link_address+0xad/0xc0
> [ 1.396617] drm_dp_mst_link_probe_work+0x57/0xa0
> [ 1.396620] process_one_work+0x14b/0x430
> [ 1.396623] worker_thread+0x12b/0x4a0
> [ 1.396626] kthread+0x10c/0x140
> [ 1.396629] ? process_one_work+0x430/0x430
> [ 1.396632] ? kthread_create_on_node+0x40/0x40
> [ 1.396635] ret_from_fork+0x27/0x40
> [ 1.396639] ---[ end trace dd05bb2cd9ebd900 ]---
> [ 1.396643] drm_sysfs_connector_add() connector: ffff88040c75a000 kdev: fffffffffffffffe
> [ 1.396648] [drm:drm_sysfs_connector_add] *ERROR* failed to register connector device: -2
> [ 1.396651] drm_connector_register(ffff88040ed3f000) connector->registered: 1
> [ 1.396666] drm_sysfs_connector_add() connector: ffff88040ed3f800 kdev: ffff88040c55e400
> [ 1.396700] drm_connector_register(ffff88040ed3f800) connector->registered: 1
> [ 1.396717] drm_sysfs_connector_add() connector: ffff88040ed39800 kdev: ffff88040c55e800
> [ 1.396726] drm_connector_register(ffff88040ed39800) connector->registered: 1
> [ 1.396743] drm_sysfs_connector_add() connector: ffff88040c758000 kdev: ffff88040c55ec00
> [ 1.396769] drm_connector_register(ffff88040c758000) connector->registered: 1
> [ 1.396786] drm_sysfs_connector_add() connector: ffff88040c758800 kdev: ffff88040c55f000
> [ 1.396799] drm_connector_register(ffff88040c758800) connector->registered: 1
> [ 1.396804] drm_connector_register(ffff88040c75a000) connector->registered: 1
> [ 1.398665] ACPI: Video Device [GFX0] (multi-head: yes rom: no post: no)
> [ 1.398893] drm_sysfs_connector_add() connector: ffff88040c75b000 kdev: ffff88040c790400
> [ 1.398907] drm_connector_register(ffff88040c75b000) connector->registered: 1
> [ 1.398930] drm_sysfs_connector_add() connector: ffff88040c75c000 kdev: ffff88040c790800
> [ 1.398939] drm_connector_register(ffff88040c75c000) connector->registered: 1