[PATCH] drm/i915/gvt: initialize dmabuf mutex in vgpu_create
Hang Yuan
hang.yuan at linux.intel.com
Fri Jul 27 02:13:12 UTC 2018
Sorry please ignore this patch. It needs more investigation on the cause.
Regards,
Henry
On 07/26/2018 07:04 PM, intel-gvt-dev-bounces at lists.freedesktop.org wrote:
> From: Hang Yuan <hang.yuan at linux.intel.com>
>
> When create one vgpu device and then remove it, oops as below happens.
> It's because dmabuf mutex is not initialized if don't open vgpu device.
> This patch will initialize dmabuf mutex during creating vgpu to avoid
> the oops.
>
> BUG: unable to handle kernel NULL pointer dereference at (null)
> IP: [<ffffffff8dd909fb>] __list_add+0x1b/0xc0
> PGD 0
> Oops: 0000 [#1] SMP
> Workqueue: sysfsd sysfs_schedule_callback_work
> task: ffff8944fdee1040 ti: ffff89405360c000 task.ti: ffff89405360c000
> RIP: 0010:[<ffffffff8dd909fb>] [<ffffffff8dd909fb>] __list_add+0x1b/0xc0
> RSP: 0018:ffff89405360fc88 EFLAGS: 00010246
> RAX: 00000000ffffffff RBX: ffff89405360fcb0 RCX: 0000000000000000
> RDX: ffffab1f4371abb8 RSI: 0000000000000000 RDI: ffff89405360fcb0
> RBP: ffff89405360fca0 R08: 0000000000000000 R09: 000000018040002e
> R10: 0000000051ab3901 R11: ffffe5658e46acc0 R12: ffffab1f4371abb8
> R13: 0000000000000000 R14: 00000000ffffffff R15: ffffab1f4371abb8
> FS: 0000000000000000(0000) GS:ffff8945314c0000(0000) knlGS:0000000000000000
> CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> CR2: 0000000000000000 CR3: 00000001eae0e000 CR4: 00000000003607e0
> DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
> DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
> Call Trace:
> [<ffffffff8e15ecc6>] __mutex_lock_slowpath+0xa6/0x1d0
> [<ffffffff8dbfa6d4>] ? __vunmap+0x94/0x100
> [<ffffffff8e15e0cf>] mutex_lock+0x1f/0x2f
> [<ffffffffc068eb1a>] intel_vgpu_dmabuf_cleanup+0x3a/0xe0 [i915]
> [<ffffffffc06780e4>] intel_gvt_destroy_vgpu+0xa4/0x100 [i915]
> [<ffffffffc03325d0>] intel_vgpu_remove+0x30/0x40 [kvmgt]
> [<ffffffffc0323189>] mdev_device_remove_ops+0x29/0x60 [mdev]
> [<ffffffffc0323886>] mdev_device_remove+0x96/0x130 [mdev]
> [<ffffffffc0323b34>] remove_callback+0x14/0x30 [mdev]
> [<ffffffff8dcc948e>] sysfs_schedule_callback_work+0x1e/0x60
> [<ffffffff8dab88af>] process_one_work+0x17f/0x440
> [<ffffffff8dab9946>] worker_thread+0x126/0x3c0
> [<ffffffff8dab9820>] ? manage_workers.isra.24+0x2a0/0x2a0
> [<ffffffff8dac0a31>] kthread+0xd1/0xe0
> [<ffffffff8dac0960>] ? insert_kthread_work+0x40/0x40
> [<ffffffff8e16cc1d>] ret_from_fork_nospec_begin+0x7/0x21
> [<ffffffff8dac0960>] ? insert_kthread_work+0x40/0x40
> Code: ff ff ff 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 00 55 48 89 e5 41 55 49 89 f5 41 54 49 89 d4 53 4c 8b 42 08 48 89 fb 49 39 f0 75 2a <4d> 8b 45 00 4d 39 c4 75 68 4c 39 e3 74 3e 4c 39 eb 74 39 49 89
> RIP [<ffffffff8dd909fb>] __list_add+0x1b/0xc0
>
> Fixes: e546e281d33d("drm/i915/gvt: Dmabuf support for GVT-g")
> Signed-off-by: Hang Yuan <hang.yuan at linux.intel.com>
> ---
> drivers/gpu/drm/i915/gvt/kvmgt.c | 1 -
> drivers/gpu/drm/i915/gvt/vgpu.c | 1 +
> 2 files changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/gvt/kvmgt.c b/drivers/gpu/drm/i915/gvt/kvmgt.c
> index a22d539..cbdf915e 100644
> --- a/drivers/gpu/drm/i915/gvt/kvmgt.c
> +++ b/drivers/gpu/drm/i915/gvt/kvmgt.c
> @@ -1615,7 +1615,6 @@ static int kvmgt_guest_init(struct mdev_device *mdev)
> kvmgt_protect_table_init(info);
> gvt_cache_init(vgpu);
>
> - mutex_init(&vgpu->dmabuf_lock);
> init_completion(&vgpu->vblank_done);
>
> info->track_node.track_write = kvmgt_page_track_write;
> diff --git a/drivers/gpu/drm/i915/gvt/vgpu.c b/drivers/gpu/drm/i915/gvt/vgpu.c
> index f6fa916..0bc1f1e 100644
> --- a/drivers/gpu/drm/i915/gvt/vgpu.c
> +++ b/drivers/gpu/drm/i915/gvt/vgpu.c
> @@ -361,6 +361,7 @@ static struct intel_vgpu *__intel_gvt_create_vgpu(struct intel_gvt *gvt,
> vgpu->gvt = gvt;
> vgpu->sched_ctl.weight = param->weight;
> mutex_init(&vgpu->vgpu_lock);
> + mutex_init(&vgpu->dmabuf_lock);
> INIT_LIST_HEAD(&vgpu->dmabuf_obj_list_head);
> INIT_RADIX_TREE(&vgpu->page_track_tree, GFP_KERNEL);
> idr_init(&vgpu->object_idr);
>
More information about the intel-gvt-dev
mailing list