[Intel-gfx] [PATCH 1/4] drm/mst: Don't do atomic checks over disabled managers

Lyude Paul lyude at redhat.com
Fri Jan 17 20:21:40 UTC 2020


Reviewed-by: Lyude Paul <lyude at redhat.com>

On Thu, 2020-01-16 at 17:58 -0800, José Roberto de Souza wrote:
> When a main MST port is disconnected drivers should call
> drm_dp_mst_topology_mgr_set_mst() disabling the MST manager, this
> function will set manager mst_primary to NULL and it will cause the
> crash bellow on the next atomic check when trying to access
> mst_primary->port.
> 
> As there is no use in running checks over managers that are not
> active this patch will skip it.
> 
> [  305.616450] [drm:drm_dp_mst_atomic_check] [MST PORT:00000000cc2049e9]
> releases all VCPI slots
> [  305.625085] [drm:drm_dp_mst_atomic_check] [MST PORT:00000000020ab43e]
> releases all VCPI slots
> [  305.633729] [drm:drm_dp_mst_atomic_check] [MST MGR:00000000cdd467d4] mst
> state 00000000b67672eb VCPI avail=63 used=0
> [  305.644405] BUG: kernel NULL pointer dereference, address:
> 0000000000000030
> [  305.651448] #PF: supervisor read access in kernel mode
> [  305.656640] #PF: error_code(0x0000) - not-present page
> [  305.661807] PGD 0 P4D 0
> [  305.664396] Oops: 0000 [#1] PREEMPT SMP NOPTI
> [  305.668789] CPU: 3 PID: 183 Comm: kworker/3:2 Not tainted 5.5.0-rc6+
> #1404
> [  305.675703] Hardware name: Intel Corporation Ice Lake Client
> Platform/IceLake U DDR4 SODIMM PD RVP TLC, BIOS
> ICLSFWR1.R00.3201.A00.1905140358 05/14/2019
> [  305.689425] Workqueue: events drm_dp_delayed_destroy_work
> [  305.694874] RIP: 0010:drm_dp_mst_atomic_check+0x138/0x2c0
> [  305.700306] Code: 00 00 00 41 29 d9 41 89 d8 4c 89 fa 4c 89 f1 48 c7 c6
> b0 b1 34 82 bf 10 00 00 00 45 31 ed e8 3f 99 02 00 4d 8b bf 80 04 00 00 <49>
> 8b 47 30 49 8d 5f 30 4c 8d 60 e8 48 39 c3 74 35 49 8b 7c 24 28
> [  305.719169] RSP: 0018:ffffc90001687b58 EFLAGS: 00010246
> [  305.724434] RAX: 0000000000000000 RBX: 000000000000003f RCX:
> 0000000000000000
> [  305.731611] RDX: 0000000000000000 RSI: ffff88849fba8cb8 RDI:
> 00000000ffffffff
> [  305.738785] RBP: 0000000000000000 R08: 0000000000000000 R09:
> 0000000000000001
> [  305.745962] R10: ffffc900016879a0 R11: ffffc900016879a5 R12:
> 0000000000000000
> [  305.753139] R13: 0000000000000000 R14: ffff8884905c9bc0 R15:
> 0000000000000000
> [  305.760315] FS:  0000000000000000(0000) GS:ffff88849fb80000(0000)
> knlGS:0000000000000000
> [  305.768452] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> [  305.774263] CR2: 0000000000000030 CR3: 0000000005610006 CR4:
> 0000000000760ee0
> [  305.781441] PKRU: 55555554
> [  305.784228] Call Trace:
> [  305.786739]  intel_atomic_check+0xb2e/0x2560 [i915]
> [  305.791678]  ? printk+0x53/0x6a
> [  305.794856]  ? drm_atomic_check_only+0x3e/0x810
> [  305.799417]  ? __drm_dbg+0x82/0x90
> [  305.802848]  drm_atomic_check_only+0x56a/0x810
> [  305.807322]  drm_atomic_commit+0xe/0x50
> [  305.811185]  drm_client_modeset_commit_atomic+0x1e2/0x250
> [  305.816619]  drm_client_modeset_commit_force+0x4d/0x180
> [  305.821921]  drm_fb_helper_restore_fbdev_mode_unlocked+0x46/0xa0
> [  305.827963]  drm_fb_helper_set_par+0x2b/0x40
> [  305.832265]  drm_fb_helper_hotplug_event.part.0+0xb2/0xd0
> [  305.837755]  drm_kms_helper_hotplug_event+0x21/0x30
> [  305.842694]  process_one_work+0x25b/0x5b0
> [  305.846735]  worker_thread+0x4b/0x3b0
> [  305.850439]  kthread+0x100/0x140
> [  305.853690]  ? process_one_work+0x5b0/0x5b0
> [  305.857901]  ? kthread_park+0x80/0x80
> [  305.861588]  ret_from_fork+0x24/0x50
> [  305.865202] Modules linked in: snd_hda_codec_hdmi snd_hda_codec_realtek
> snd_hda_codec_generic i915 btusb btrtl btbcm btintel bluetooth prime_numbers
> snd_hda_intel snd_intel_dspcfg snd_hda_codec e1000e snd_hwdep snd_hda_core
> thunderbolt mei_hdcp mei_me asix cdc_ether x86_pkg_temp_thermal r8152 mei
> coretemp usbnet snd_pcm mii crct10dif_pclmul ptp crc32_pclmul ecdh_generic
> ghash_clmulni_intel pps_core ecc i2c_i801 intel_lpss_pci
> [  305.903096] CR2: 0000000000000030
> [  305.906431] ---[ end trace 70ee364eed801cb0 ]---
> [  305.940816] RIP: 0010:drm_dp_mst_atomic_check+0x138/0x2c0
> [  305.946261] Code: 00 00 00 41 29 d9 41 89 d8 4c 89 fa 4c 89 f1 48 c7 c6
> b0 b1 34 82 bf 10 00 00 00 45 31 ed e8 3f 99 02 00 4d 8b bf 80 04 00 00 <49>
> 8b 47 30 49 8d 5f 30 4c 8d 60 e8 48 39 c3 74 35 49 8b 7c 24 28
> [  305.965125] RSP: 0018:ffffc90001687b58 EFLAGS: 00010246
> [  305.970382] RAX: 0000000000000000 RBX: 000000000000003f RCX:
> 0000000000000000
> [  305.977571] RDX: 0000000000000000 RSI: ffff88849fba8cb8 RDI:
> 00000000ffffffff
> [  305.984747] RBP: 0000000000000000 R08: 0000000000000000 R09:
> 0000000000000001
> [  305.991921] R10: ffffc900016879a0 R11: ffffc900016879a5 R12:
> 0000000000000000
> [  305.999099] R13: 0000000000000000 R14: ffff8884905c9bc0 R15:
> 0000000000000000
> [  306.006271] FS:  0000000000000000(0000) GS:ffff88849fb80000(0000)
> knlGS:0000000000000000
> [  306.014407] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> [  306.020185] CR2: 0000000000000030 CR3: 000000048b3aa003 CR4:
> 0000000000760ee0
> [  306.027404] PKRU: 55555554
> [  306.030127] BUG: sleeping function called from invalid context at
> include/linux/percpu-rwsem.h:38
> [  306.039049] in_atomic(): 0, irqs_disabled(): 1, non_block: 0, pid: 183,
> name: kworker/3:2
> [  306.047272] INFO: lockdep is turned off.
> [  306.051217] irq event stamp: 77505
> [  306.054647] hardirqs last  enabled at (77505): [<ffffffff81a0c147>]
> _raw_spin_unlock_irqrestore+0x47/0x60
> [  306.064270] hardirqs last disabled at (77504): [<ffffffff81a0bedf>]
> _raw_spin_lock_irqsave+0xf/0x50
> [  306.073404] softirqs last  enabled at (77402): [<ffffffff81e00389>]
> __do_softirq+0x389/0x47f
> [  306.081885] softirqs last disabled at (77395): [<ffffffff810b83a9>]
> irq_exit+0xa9/0xc0
> [  306.089859] CPU: 3 PID: 183 Comm: kworker/3:2 Tainted:
> G      D           5.5.0-rc6+ #1404
> [  306.098167] Hardware name: Intel Corporation Ice Lake Client
> Platform/IceLake U DDR4 SODIMM PD RVP TLC, BIOS
> ICLSFWR1.R00.3201.A00.1905140358 05/14/2019
> [  306.111882] Workqueue: events drm_dp_delayed_destroy_work
> [  306.117314] Call Trace:
> [  306.119780]  dump_stack+0x71/0xa0
> [  306.123135]  ___might_sleep.cold+0xf7/0x10b
> [  306.127399]  exit_signals+0x2b/0x360
> [  306.131014]  do_exit+0xa7/0xc70
> [  306.134189]  ? kthread+0x100/0x140
> [  306.137615]  rewind_stack_do_exit+0x17/0x20
> 
> Fixes: cd82d82cbc04 ("drm/dp_mst: Add branch bandwidth validation to MST
> atomic check")
> Cc: Mikita Lipski <mikita.lipski at amd.com>
> Cc: Alex Deucher <alexander.deucher at amd.com>
> Cc: Lyude Paul <lyude at redhat.com>
> Signed-off-by: José Roberto de Souza <jose.souza at intel.com>
> ---
>  drivers/gpu/drm/drm_dp_mst_topology.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c
> b/drivers/gpu/drm/drm_dp_mst_topology.c
> index 4b74193b89ce..38bf111e5f9b 100644
> --- a/drivers/gpu/drm/drm_dp_mst_topology.c
> +++ b/drivers/gpu/drm/drm_dp_mst_topology.c
> @@ -5034,6 +5034,9 @@ int drm_dp_mst_atomic_check(struct drm_atomic_state
> *state)
>  	int i, ret = 0;
>  
>  	for_each_new_mst_mgr_in_state(state, mgr, mst_state, i) {
> +		if (!mgr->mst_state)
> +			continue;
> +
>  		ret = drm_dp_mst_atomic_check_vcpi_alloc_limit(mgr,
> mst_state);
>  		if (ret)
>  			break;
-- 
Cheers,
	Lyude Paul



More information about the Intel-gfx mailing list