Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751993AbdHDDUa (ORCPT ); Thu, 3 Aug 2017 23:20:30 -0400 Received: from regular1.263xmail.com ([211.150.99.131]:39062 "EHLO regular1.263xmail.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751845AbdHDDU3 (ORCPT ); Thu, 3 Aug 2017 23:20:29 -0400 X-263anti-spam: KSV:0; X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-KSVirus-check: 0 X-ABS-CHECKED: 4 X-RL-SENDER: hjc@rock-chips.com X-FST-TO: sandy.huang@rock-chips.com X-SENDER-IP: 58.22.7.114 X-LOGIN-NAME: hjc@rock-chips.com X-UNIQUE-TAG: <2f83aaf7e53e458366977f2e276df9b2> X-ATTACHMENT-NUM: 0 X-DNS-TYPE: 0 Subject: Re: [PATCH v1.1] drm/rockchip: fix race with kms hotplug and fbdev To: Mark Yao , David Airlie , Heiko Stuebner Cc: linux-rockchip@lists.infradead.org, linux-arm-kernel@lists.infradead.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org References: <1501494601-7140-1-git-send-email-mark.yao@rock-chips.com> <1501575103-20136-1-git-send-email-mark.yao@rock-chips.com> From: Sandy Huang Message-ID: <3084b854-1b82-5a72-ad51-f7b12e5a57a0@rock-chips.com> Date: Fri, 4 Aug 2017 11:20:25 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <1501575103-20136-1-git-send-email-mark.yao@rock-chips.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1892 Lines: 37 Hi Mark, 在 2017/8/1 16:11, Mark Yao 写道: > According to the kerneldoc[0], should do fbdev setup before calling > drm_kms_helper_poll_init(), otherwise, Kms hotplug event may race > into fbdev helper initial, and fb_helper->dev may be NULL pointer, > that would cause the bug: > [ 0.735411] [00000200] *pgd=00000000f6ffe003, *pud=00000000f6ffe003, *pmd=0000000000000000 > [ 0.736156] Internal error: Oops: 96000005 [#1] PREEMPT SMP > [ 0.736648] Modules linked in: > [ 0.736930] CPU: 2 PID: 20 Comm: kworker/2:0 Not tainted 4.4.41 #20 > [ 0.737480] Hardware name: Rockchip RK3399 Board rev2 (BOX) (DT) > [ 0.738020] Workqueue: events cdn_dp_pd_event_work > [ 0.738447] task: ffffffc0f21f3100 ti: ffffffc0f2218000 task.ti: ffffffc0f2218000 > [ 0.739109] PC is at mutex_lock+0x14/0x44 > [ 0.739469] LR is at drm_fb_helper_hotplug_event+0x30/0x114 > [ 0.756253] [] mutex_lock+0x14/0x44 > [ 0.756260] [] drm_fb_helper_hotplug_event+0x30/0x114 > [ 0.756271] [] rockchip_drm_output_poll_changed+0x18/0x20 > [ 0.756280] [] drm_kms_helper_hotplug_event+0x28/0x34 > [ 0.756286] [] cdn_dp_pd_event_work+0x394/0x3c4 > [ 0.756295] [] process_one_work+0x218/0x3e0 > [ 0.756302] [] worker_thread+0x2e8/0x404 > [ 0.756308] [] kthread+0xe8/0xf0 > [ 0.756316] [] ret_from_fork+0x10/0x40 > > [0]: https://01.org/linuxgraphics/gfx-docs/drm/gpu/drm-kms-helpers.html > > Signed-off-by: Mark Yao > --- > Changes in v1.1: > - According to the kerneldoc, fix the race bug in generic way. > > drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 13 ++++++------- > 1 file changed, 6 insertions(+), 7 deletions(-) > Reviewed-by: Sandy huang