From patchwork Mon Jul 31 09:50:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: yao mark X-Patchwork-Id: 9871385 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id CAE296038F for ; Mon, 31 Jul 2017 09:53:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BC5E728516 for ; Mon, 31 Jul 2017 09:53:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AAEA22852D; Mon, 31 Jul 2017 09:53:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 58A00285A3 for ; Mon, 31 Jul 2017 09:53:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=0b28CfJBvwMmjhRlsEu8cX7Hu8M9TwgdSik0hxbDz9s=; b=K5THPrqdTEFrCFvU6Wvuvrth+E ieP2VdQKL09pslpg+oZF58tKC5hcglxu8hi2V50l3Rjl5NbY0+iIpJ3ON5SgCKeq8XwyyRwhiRvEY CWFexXg8Zx1txO0T65/cWxAp0JotiCyaHiH0aptRoP09IpYRaPBD3H/SHKDS9hntjKBy4bn0JOsIM HhOLlNYkbyENdZ1q1CQg2kCWDd9Q6rIsevtuO/WwjV12xEuEZRfnRJdMna5zh65n9rB192THRww/6 w34/bzZgjQOfUsEc4wmXxLuuf51opwcQrO3SZhdOa7+yT3+rtQMySV8QY7KHfCWHVTpeIlVpv/C8R UWeHeGTg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dc7Nx-0002q4-3P; Mon, 31 Jul 2017 09:53:13 +0000 Received: from regular1.263xmail.com ([211.150.99.135]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dc7LJ-0000Uu-Cl; Mon, 31 Jul 2017 09:50:31 +0000 Received: from mark.yao?rock-chips.com (unknown [192.168.167.232]) by regular1.263xmail.com (Postfix) with ESMTP id E34051DE86; Mon, 31 Jul 2017 17:50:04 +0800 (CST) X-263anti-spam: KSV:0; X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-KSVirus-check: 0 X-ABS-CHECKED: 4 Received: from yaozq-pc.lan (localhost [127.0.0.1]) by smtp.263.net (Postfix) with ESMTPA id E37FC3AA; Mon, 31 Jul 2017 17:50:03 +0800 (CST) X-RL-SENDER: mark.yao@rock-chips.com X-FST-TO: mark.yao@rock-chips.com X-SENDER-IP: 58.22.7.114 X-LOGIN-NAME: mark.yao@rock-chips.com X-UNIQUE-TAG: <5ddb67ae24b45b171782f372a447eea3> X-ATTACHMENT-NUM: 0 X-SENDER: yzq@rock-chips.com X-DNS-TYPE: 0 Received: from yaozq-pc.lan (unknown [58.22.7.114]) by smtp.263.net (Postfix) whith ESMTP id 24966RE0M6I; Mon, 31 Jul 2017 17:50:06 +0800 (CST) From: Mark Yao To: Mark Yao , David Airlie , Heiko Stuebner Subject: [PATCH 6/6] drm/rockchip: fix race with kms hotplug and fbdev Date: Mon, 31 Jul 2017 17:50:00 +0800 Message-Id: <1501494601-7140-1-git-send-email-mark.yao@rock-chips.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1501494569-6825-1-git-send-email-mark.yao@rock-chips.com> References: <1501494569-6825-1-git-send-email-mark.yao@rock-chips.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170731_025029_857625_7CB66484 X-CRM114-Status: UNSURE ( 9.05 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-rockchip@lists.infradead.org, linux-arm-kernel@lists.infradead.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Since fb_helper is not a pointer on rockchip_drm_private, it's no need to check pointer. 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 Signed-off-by: Mark Yao --- drivers/gpu/drm/rockchip/rockchip_drm_fb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_fb.c b/drivers/gpu/drm/rockchip/rockchip_drm_fb.c index 81f9548..e6bd0f4 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_fb.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_fb.c @@ -170,7 +170,7 @@ static void rockchip_drm_output_poll_changed(struct drm_device *dev) struct rockchip_drm_private *private = dev->dev_private; struct drm_fb_helper *fb_helper = &private->fbdev_helper; - if (fb_helper) + if (fb_helper->dev) drm_fb_helper_hotplug_event(fb_helper); }