WARN_ON in drivers/gpu/drm/msm/msm_gem.c
diff mbox

Message ID 52195708-75db-936a-ef43-a813f1d47598@xs4all.nl
State New
Headers show

Commit Message

Hans Verkuil July 30, 2017, 12:42 p.m. UTC
Hi all,

While I was testing the upcoming adv7533 CEC support with my Dragonboard c410
I encountered this warning several times during boot:

[    4.408309] WARNING: CPU: 3 PID: 1347 at drivers/gpu/drm/msm/msm_gem.c:312 add_vma+0x78/0x88 [msm]
[    4.412951] Modules linked in: snd_soc_hdmi_codec adv7511 cec qcom_wcnss_pil msm mdt_loader drm_kms_helper msm_rng rng_core drm
[    4.421728] CPU: 3 PID: 1347 Comm: kworker/3:3 Not tainted 4.13.0-rc1-dragonboard #111
[    4.433090] Hardware name: Qualcomm Technologies, Inc. APQ 8016 SBC (DT)
[    4.441081] Workqueue: events deferred_probe_work_func
[    4.447929] task: ffff800031243600 task.stack: ffff800003394000
[    4.453023] PC is at add_vma+0x78/0x88 [msm]
[    4.458823] LR is at _msm_gem_new+0xd4/0x188 [msm]
[    4.463207] pc : [<ffff000000ac01f8>] lr : [<ffff000000ac06b4>] pstate: 40000145
[    4.467811] sp : ffff8000033978a0
[    4.475357] x29: ffff8000033978a0 x28: ffff8000031dea18
[    4.478572] x27: ffff800003933a00 x26: ffff800003b39800
[    4.483953] x25: ffff8000338ff800 x24: 0000000000000001
[    4.489249] x23: 0000000000000000 x22: ffff800003b39800
[    4.494544] x21: ffff8000338ff800 x20: 0000000000000000
[    4.499839] x19: ffff800003932600 x18: 0000000000000001
[    4.505135] x17: 0000ffff8969e9e0 x16: ffff7e00000ce7a0
[    4.510429] x15: ffffffffffffffff x14: ffff8000833977ef
[    4.515724] x13: ffff8000033977f3 x12: 0000000000000038
[    4.521020] x11: 0101010101010101 x10: ffffff7f7fff7f7f
[    4.526315] x9 : 0000000000000000 x8 : ffff800003932800
[    4.531633] x7 : 0000000000000000 x6 : 000000000000003f
[    4.531644] x5 : 0000000000000040 x4 : 0000000000000000
[    4.531650] x3 : ffff800031243600 x2 : 0000000000000000
[    4.531655] x1 : 0000000000000000 x0 : 0000000000000000
[    4.531670] Call trace:
[    4.531676] Exception stack(0xffff8000033976c0 to 0xffff8000033977f0)
[    4.531683] 76c0: ffff800003932600 0001000000000000 ffff8000033978a0 ffff000000ac01f8
[    4.531688] 76e0: 0000000000000140 0000000000000000 ffff800003932550 ffff800003397780
[    4.531694] 7700: ffff800003397730 ffff000008261ce8 0000000000000000 ffff8000031d2f80
[    4.531699] 7720: ffff800003397800 ffff0000081d671c 0000000000000140 0000000000000000
[    4.531705] 7740: ffff000000ac04c0 0000000000004003 ffff800003397908 00000000014080c0
[    4.531710] 7760: 0000000000000000 ffff800003b39800 0000000000000000 0000000000000000
[    4.531716] 7780: 0000000000000000 ffff800031243600 0000000000000000 0000000000000040
[    4.531721] 77a0: 000000000000003f 0000000000000000 ffff800003932800 0000000000000000
[    4.531726] 77c0: ffffff7f7fff7f7f 0101010101010101 0000000000000038 ffff8000033977f3
[    4.531730] 77e0: ffff8000833977ef ffffffffffffffff
[    4.531881] [<ffff000000ac01f8>] add_vma+0x78/0x88 [msm]
[    4.532011] [<ffff000000ac06b4>] _msm_gem_new+0xd4/0x188 [msm]
[    4.532134] [<ffff000000ac1900>] msm_gem_new+0x10/0x18 [msm]
[    4.532260] [<ffff000000acb274>] msm_dsi_host_modeset_init+0x17c/0x268 [msm]
[    4.532384] [<ffff000000ac9024>] msm_dsi_modeset_init+0x34/0x1b8 [msm]
[    4.532504] [<ffff000000ab6168>] modeset_init+0x408/0x488 [msm]
[    4.532623] [<ffff000000ab6c4c>] mdp5_kms_init+0x2b4/0x338 [msm]
[    4.532745] [<ffff000000abeff8>] msm_drm_bind+0x218/0x4e8 [msm]
[    4.532755] [<ffff00000855d744>] try_to_bring_up_master+0x1f4/0x318
[    4.532762] [<ffff00000855d900>] component_add+0x98/0x180
[    4.532887] [<ffff000000ac8da0>] dsi_dev_probe+0x18/0x28 [msm]
[    4.532895] [<ffff000008565fe8>] platform_drv_probe+0x58/0xc0
[    4.532901] [<ffff00000856410c>] driver_probe_device+0x324/0x458
[    4.532907] [<ffff00000856440c>] __device_attach_driver+0xac/0x170
[    4.532913] [<ffff000008561ef4>] bus_for_each_drv+0x4c/0x98
[    4.532918] [<ffff000008563c38>] __device_attach+0xc0/0x160
[    4.532924] [<ffff000008564530>] device_initial_probe+0x10/0x18
[    4.532929] [<ffff000008562f84>] bus_probe_device+0x94/0xa0
[    4.532934] [<ffff0000085635d4>] deferred_probe_work_func+0x8c/0xe8
[    4.532941] [<ffff0000080d79bc>] process_one_work+0x1d4/0x330
[    4.532946] [<ffff0000080d7b60>] worker_thread+0x48/0x468
[    4.532952] [<ffff0000080ddae4>] kthread+0x12c/0x130
[    4.532958] [<ffff000008082f10>] ret_from_fork+0x10/0x40
[    4.532962] ---[ end trace b1ac6888ec40b0bb ]---

After making this hack:


it no longer complains. I have no idea how long the lock should be held here,
but on the off-chance that I am actually right:

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>

Regards,

	Hans

Comments

Rob Clark Aug. 1, 2017, 10:31 a.m. UTC | #1
On Sun, Jul 30, 2017 at 8:42 AM, Hans Verkuil <hverkuil@xs4all.nl> wrote:
> Hi all,
>
> While I was testing the upcoming adv7533 CEC support with my Dragonboard c410
> I encountered this warning several times during boot:
>
> [    4.408309] WARNING: CPU: 3 PID: 1347 at drivers/gpu/drm/msm/msm_gem.c:312 add_vma+0x78/0x88 [msm]
> [    4.412951] Modules linked in: snd_soc_hdmi_codec adv7511 cec qcom_wcnss_pil msm mdt_loader drm_kms_helper msm_rng rng_core drm
> [    4.421728] CPU: 3 PID: 1347 Comm: kworker/3:3 Not tainted 4.13.0-rc1-dragonboard #111
> [    4.433090] Hardware name: Qualcomm Technologies, Inc. APQ 8016 SBC (DT)
> [    4.441081] Workqueue: events deferred_probe_work_func
> [    4.447929] task: ffff800031243600 task.stack: ffff800003394000
> [    4.453023] PC is at add_vma+0x78/0x88 [msm]
> [    4.458823] LR is at _msm_gem_new+0xd4/0x188 [msm]
> [    4.463207] pc : [<ffff000000ac01f8>] lr : [<ffff000000ac06b4>] pstate: 40000145
> [    4.467811] sp : ffff8000033978a0
> [    4.475357] x29: ffff8000033978a0 x28: ffff8000031dea18
> [    4.478572] x27: ffff800003933a00 x26: ffff800003b39800
> [    4.483953] x25: ffff8000338ff800 x24: 0000000000000001
> [    4.489249] x23: 0000000000000000 x22: ffff800003b39800
> [    4.494544] x21: ffff8000338ff800 x20: 0000000000000000
> [    4.499839] x19: ffff800003932600 x18: 0000000000000001
> [    4.505135] x17: 0000ffff8969e9e0 x16: ffff7e00000ce7a0
> [    4.510429] x15: ffffffffffffffff x14: ffff8000833977ef
> [    4.515724] x13: ffff8000033977f3 x12: 0000000000000038
> [    4.521020] x11: 0101010101010101 x10: ffffff7f7fff7f7f
> [    4.526315] x9 : 0000000000000000 x8 : ffff800003932800
> [    4.531633] x7 : 0000000000000000 x6 : 000000000000003f
> [    4.531644] x5 : 0000000000000040 x4 : 0000000000000000
> [    4.531650] x3 : ffff800031243600 x2 : 0000000000000000
> [    4.531655] x1 : 0000000000000000 x0 : 0000000000000000
> [    4.531670] Call trace:
> [    4.531676] Exception stack(0xffff8000033976c0 to 0xffff8000033977f0)
> [    4.531683] 76c0: ffff800003932600 0001000000000000 ffff8000033978a0 ffff000000ac01f8
> [    4.531688] 76e0: 0000000000000140 0000000000000000 ffff800003932550 ffff800003397780
> [    4.531694] 7700: ffff800003397730 ffff000008261ce8 0000000000000000 ffff8000031d2f80
> [    4.531699] 7720: ffff800003397800 ffff0000081d671c 0000000000000140 0000000000000000
> [    4.531705] 7740: ffff000000ac04c0 0000000000004003 ffff800003397908 00000000014080c0
> [    4.531710] 7760: 0000000000000000 ffff800003b39800 0000000000000000 0000000000000000
> [    4.531716] 7780: 0000000000000000 ffff800031243600 0000000000000000 0000000000000040
> [    4.531721] 77a0: 000000000000003f 0000000000000000 ffff800003932800 0000000000000000
> [    4.531726] 77c0: ffffff7f7fff7f7f 0101010101010101 0000000000000038 ffff8000033977f3
> [    4.531730] 77e0: ffff8000833977ef ffffffffffffffff
> [    4.531881] [<ffff000000ac01f8>] add_vma+0x78/0x88 [msm]
> [    4.532011] [<ffff000000ac06b4>] _msm_gem_new+0xd4/0x188 [msm]
> [    4.532134] [<ffff000000ac1900>] msm_gem_new+0x10/0x18 [msm]
> [    4.532260] [<ffff000000acb274>] msm_dsi_host_modeset_init+0x17c/0x268 [msm]
> [    4.532384] [<ffff000000ac9024>] msm_dsi_modeset_init+0x34/0x1b8 [msm]
> [    4.532504] [<ffff000000ab6168>] modeset_init+0x408/0x488 [msm]
> [    4.532623] [<ffff000000ab6c4c>] mdp5_kms_init+0x2b4/0x338 [msm]
> [    4.532745] [<ffff000000abeff8>] msm_drm_bind+0x218/0x4e8 [msm]
> [    4.532755] [<ffff00000855d744>] try_to_bring_up_master+0x1f4/0x318
> [    4.532762] [<ffff00000855d900>] component_add+0x98/0x180
> [    4.532887] [<ffff000000ac8da0>] dsi_dev_probe+0x18/0x28 [msm]
> [    4.532895] [<ffff000008565fe8>] platform_drv_probe+0x58/0xc0
> [    4.532901] [<ffff00000856410c>] driver_probe_device+0x324/0x458
> [    4.532907] [<ffff00000856440c>] __device_attach_driver+0xac/0x170
> [    4.532913] [<ffff000008561ef4>] bus_for_each_drv+0x4c/0x98
> [    4.532918] [<ffff000008563c38>] __device_attach+0xc0/0x160
> [    4.532924] [<ffff000008564530>] device_initial_probe+0x10/0x18
> [    4.532929] [<ffff000008562f84>] bus_probe_device+0x94/0xa0
> [    4.532934] [<ffff0000085635d4>] deferred_probe_work_func+0x8c/0xe8
> [    4.532941] [<ffff0000080d79bc>] process_one_work+0x1d4/0x330
> [    4.532946] [<ffff0000080d7b60>] worker_thread+0x48/0x468
> [    4.532952] [<ffff0000080ddae4>] kthread+0x12c/0x130
> [    4.532958] [<ffff000008082f10>] ret_from_fork+0x10/0x40
> [    4.532962] ---[ end trace b1ac6888ec40b0bb ]---
>
> After making this hack:
>
> diff --git a/drivers/gpu/drm/msm/msm_gem.c b/drivers/gpu/drm/msm/msm_gem.c
> index 65f35544c1ec..29459be6a4b0 100644
> --- a/drivers/gpu/drm/msm/msm_gem.c
> +++ b/drivers/gpu/drm/msm/msm_gem.c
> @@ -928,8 +928,12 @@ static struct drm_gem_object *_msm_gem_new(struct drm_device *dev,
>         if (use_vram) {
>                 struct msm_gem_vma *vma;
>                 struct page **pages;
> +               struct msm_gem_object *msm_obj = to_msm_bo(obj);
> +
> +               mutex_lock(&msm_obj->lock);
>
>                 vma = add_vma(obj, NULL);
> +               mutex_unlock(&msm_obj->lock);
>                 if (IS_ERR(vma)) {
>                         ret = PTR_ERR(vma);
>                         goto fail;
>
> it no longer complains. I have no idea how long the lock should be held here,
> but on the off-chance that I am actually right:

yup, this looks like the correct fix.. more fallout from the
less-tested no-iommu config

BR,
-R


> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
>
> Regards,
>
>         Hans

Patch
diff mbox

diff --git a/drivers/gpu/drm/msm/msm_gem.c b/drivers/gpu/drm/msm/msm_gem.c
index 65f35544c1ec..29459be6a4b0 100644
--- a/drivers/gpu/drm/msm/msm_gem.c
+++ b/drivers/gpu/drm/msm/msm_gem.c
@@ -928,8 +928,12 @@  static struct drm_gem_object *_msm_gem_new(struct drm_device *dev,
 	if (use_vram) {
 		struct msm_gem_vma *vma;
 		struct page **pages;
+		struct msm_gem_object *msm_obj = to_msm_bo(obj);
+
+		mutex_lock(&msm_obj->lock);

 		vma = add_vma(obj, NULL);
+		mutex_unlock(&msm_obj->lock);
 		if (IS_ERR(vma)) {
 			ret = PTR_ERR(vma);
 			goto fail;