From patchwork Thu Aug 20 20:31:16 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Deucher X-Patchwork-Id: 7047001 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 5B62DC05AC for ; Thu, 20 Aug 2015 20:31:22 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 35E23204EB for ; Thu, 20 Aug 2015 20:31:21 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 2F7D0204E7 for ; Thu, 20 Aug 2015 20:31:20 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C09926E0BF; Thu, 20 Aug 2015 13:31:18 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-yk0-f176.google.com (mail-yk0-f176.google.com [209.85.160.176]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3DBEB6E0BF for ; Thu, 20 Aug 2015 13:31:17 -0700 (PDT) Received: by ykdt205 with SMTP id t205so50687383ykd.1 for ; Thu, 20 Aug 2015 13:31:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=5PPsM7FiE6FekNDW5+H4Mao2dlpTUlvj8otc1HhcURs=; b=NQp45AGhYMRGYbEW/+CLGG6MfNv/y6nAbXZ5of5eHreD4k+aca7h5DNZ9duniXKEbb UOOfSvmDivNkvMeNPWhPiuvazVJNFCENJMeWrwhNGNwxi1phqpCEEV/ph6r8aq9rocKK ZVXkv3SNDeSKEv2O+O0i5qZ1kTICYn44kt82Q5LVkXgxt0MUBgoK6d7s/GvLD6VwAWSE OTSaZCCop/44sogKeVQYMRiJASSrW6ChP3GIy1bsrpt4ZGcz0l2gnK8GBI+e30ed+a9u 3fes0Pn/l0gc/sUEEKRTf4iecnaOBjoYkZmVo/PH677OyZbUbQyLRCTykHNrLnMvpYYz Yj1Q== MIME-Version: 1.0 X-Received: by 10.129.50.208 with SMTP id y199mr6760966ywy.136.1440102676193; Thu, 20 Aug 2015 13:31:16 -0700 (PDT) Received: by 10.37.44.132 with HTTP; Thu, 20 Aug 2015 13:31:16 -0700 (PDT) In-Reply-To: <1440029709-27520-1-git-send-email-airlied@gmail.com> References: <1440029709-27520-1-git-send-email-airlied@gmail.com> Date: Thu, 20 Aug 2015 16:31:16 -0400 Message-ID: Subject: Re: [PATCH] drm/radeon: fix hotplug race at startup From: Alex Deucher To: Dave Airlie Cc: Maling list - DRI developers X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Wed, Aug 19, 2015 at 8:15 PM, Dave Airlie wrote: > From: Dave Airlie > > We apparantly get a hotplug irq before we've initialised > modesetting, > > [drm] Loading R100 Microcode > BUG: unable to handle kernel NULL pointer dereference at (null) > IP: [] __mutex_lock_slowpath+0x23/0x91 > *pde = 00000000 > Oops: 0002 [#1] > Modules linked in: radeon(+) drm_kms_helper ttm drm i2c_algo_bit backlight pcspkr psmouse evdev sr_mod input_leds led_class cdrom sg parport_pc parport floppy intel_agp intel_gtt lpc_ich acpi_cpufreq processor button mfd_core agpgart uhci_hcd ehci_hcd rng_core snd_intel8x0 snd_ac97_codec ac97_bus snd_pcm usbcore usb_common i2c_i801 i2c_core snd_timer snd soundcore thermal_sys > CPU: 0 PID: 15 Comm: kworker/0:1 Not tainted 4.2.0-rc7-00015-gbf67402 #111 > Hardware name: MicroLink /D850MV , BIOS MV85010A.86A.0067.P24.0304081124 04/08/2003 > Workqueue: events radeon_hotplug_work_func [radeon] > task: f6ca5900 ti: f6d3e000 task.ti: f6d3e000 > EIP: 0060:[] EFLAGS: 00010282 CPU: 0 > EIP is at __mutex_lock_slowpath+0x23/0x91 > EAX: 00000000 EBX: f5e900fc ECX: 00000000 EDX: fffffffe > ESI: f6ca5900 EDI: f5e90100 EBP: f5e90000 ESP: f6d3ff0c > DS: 007b ES: 007b FS: 0000 GS: 0000 SS: 0068 > CR0: 8005003b CR2: 00000000 CR3: 36f61000 CR4: 000006d0 > Stack: > f5e90100 00000000 c103c4c1 f6d2a5a0 f5e900fc f6df394c c125f162 f8b0faca > f6d2a5a0 c138ca00 f6df394c f7395600 c1034741 00d40000 00000000 f6d2a5a0 > c138ca00 f6d2a5b8 c138ca10 c1034b58 00000001 f6d40000 f6ca5900 f6d0c940 > Call Trace: > [] ? dequeue_task_fair+0xa4/0xb7 > [] ? mutex_lock+0x9/0xa > [] ? radeon_hotplug_work_func+0x17/0x57 [radeon] > [] ? process_one_work+0xfc/0x194 > [] ? worker_thread+0x18d/0x218 > [] ? rescuer_thread+0x1d5/0x1d5 > [] ? kthread+0x7b/0x80 > [] ? ret_from_kernel_thread+0x20/0x30 > [] ? init_completion+0x18/0x18 > Code: 42 08 e8 8e a6 dd ff c3 57 56 53 83 ec 0c 8b 35 48 f7 37 c1 8b 10 4a 74 1a 89 c3 8d 78 04 8b 40 08 89 63 > > Reported-by: Meelis Roos > Signed-off-by: Dave Airlie Looks good to me. The attached patch ports your fix to amdgpu. I'll pull them in once Meelis confirms the fix. Alex > --- > drivers/gpu/drm/radeon/radeon_irq_kms.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/drivers/gpu/drm/radeon/radeon_irq_kms.c b/drivers/gpu/drm/radeon/radeon_irq_kms.c > index 1162bfa..171d3e4 100644 > --- a/drivers/gpu/drm/radeon/radeon_irq_kms.c > +++ b/drivers/gpu/drm/radeon/radeon_irq_kms.c > @@ -79,6 +79,11 @@ static void radeon_hotplug_work_func(struct work_struct *work) > struct drm_mode_config *mode_config = &dev->mode_config; > struct drm_connector *connector; > > + /* we can race here at startup, some boards seem to trigger > + * hotplug irqs when they shouldn't. */ > + if (!rdev->mode_info.mode_config_initialized) > + return; > + > mutex_lock(&mode_config->mutex); > if (mode_config->num_connector) { > list_for_each_entry(connector, &mode_config->connector_list, head) > -- > 2.4.3 > > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/dri-devel From 82deab5babd939b743662742fde05b01f30ba2d2 Mon Sep 17 00:00:00 2001 From: Alex Deucher Date: Thu, 20 Aug 2015 16:27:42 -0400 Subject: [PATCH] drm/amdgpu: fix a potential hotplug race at startup We apparantly get a hotplug irq before we've initialised modesetting. This is a port of: drm/radeon: fix hotplug race at startup to amdgpu. Signed-off-by: Alex Deucher --- drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c index 0aba8e9..303fc33 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c @@ -59,6 +59,11 @@ static void amdgpu_hotplug_work_func(struct work_struct *work) struct drm_mode_config *mode_config = &dev->mode_config; struct drm_connector *connector; + /* we can race here at startup, some boards seem to trigger + * hotplug irqs when they shouldn't. */ + if (!adev->mode_info.mode_config_initialized) + return; + mutex_lock(&mode_config->mutex); if (mode_config->num_connector) { list_for_each_entry(connector, &mode_config->connector_list, head) -- 1.8.3.1