From patchwork Thu Jun 27 11:38:24 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maarten Lankhorst X-Patchwork-Id: 2791931 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id D2A8E9F3A0 for ; Thu, 27 Jun 2013 11:47:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8B8DF202CE for ; Thu, 27 Jun 2013 11:47:13 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 6A094202B8 for ; Thu, 27 Jun 2013 11:47:12 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6167AE6455 for ; Thu, 27 Jun 2013 04:47:12 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wi0-f174.google.com (mail-wi0-f174.google.com [209.85.212.174]) by gabe.freedesktop.org (Postfix) with ESMTP id ED9B7E6275 for ; Thu, 27 Jun 2013 04:39:19 -0700 (PDT) Received: by mail-wi0-f174.google.com with SMTP id k10so2994630wiv.7 for ; Thu, 27 Jun 2013 04:39:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=NTPXaZouJhvwDAg8NKNhaXethmOjA13ItXKajw/vuTQ=; b=v4+rXWAtU7q3U8yrx3EHcLEs4iP+TltTIdBwtiNWk1UG5BCCs9fWv7krnecu+kQ903 +eC9HxSq/KonhuD6zYb8iWJ11Z5tipMEt75rYyBfOL3DYxSkC/XQbQEvtsaNE+WN+uHy ClJpbkY6HRD7ywmhUahWdFRziHGwGUm2Nz1qlcC8I0NigfxtfJ2ux0IvlTm5eg2bVFr3 rLEARSyubAezmsP8p9u/+HEehizolzchCUH78h9KT973vwwKZBPFKjqajfR3OKp8XIoE 6xTcsG7dJu9PdXdBoRIpoQ/5RFsgW4Z8S3YVp4Z9q6dmPVoMA103A40suf7qxTnImqyG TKqA== X-Received: by 10.180.36.12 with SMTP id m12mr5719068wij.10.1372333158850; Thu, 27 Jun 2013 04:39:18 -0700 (PDT) Received: from localhost (5ED49945.cm-7-5c.dynamic.ziggo.nl. [94.212.153.69]) by mx.google.com with ESMTPSA id fo10sm3011393wib.8.2013.06.27.04.39.13 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 27 Jun 2013 04:39:15 -0700 (PDT) Received: by localhost (sSMTP sendmail emulation); Thu, 27 Jun 2013 13:39:13 +0200 From: Maarten Lankhorst To: Dave Airlie Subject: [PATCH 7/9] drm/cirrus: do not attempt to acquire a reservation while in an interrupt handler Date: Thu, 27 Jun 2013 13:38:24 +0200 Message-Id: <1372333106-28910-7-git-send-email-maarten.lankhorst@canonical.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1372333106-28910-1-git-send-email-maarten.lankhorst@canonical.com> References: <1372333106-28910-1-git-send-email-maarten.lankhorst@canonical.com> Cc: dri-devel@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org X-Spam-Status: No, score=-5.4 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 Mutexes should not be acquired in interrupt context. While the trylock fastpath is arguably safe on all implementations, the slowpath unlock path definitely isn't. This fixes the following lockdep splat: [ 13.044313] ------------[ cut here ]------------ [ 13.044367] WARNING: at /c/kernel-tests/src/tip/kernel/mutex.c:858 mutex_trylock+0x87/0x220() [ 13.044378] DEBUG_LOCKS_WARN_ON(in_interrupt()) [ 13.044378] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 3.10.0-rc4-00296-ga2963dd #20 [ 13.044379] Hardware name: Bochs Bochs, BIOS Bochs 01/01/2007 [ 13.044390] 0000000000000009 ffff88000de039f8 ffffffff81fc86d5 ffff88000de03a38 [ 13.044395] ffffffff810d511b ffff880000000018 ffff88000f33c690 0000000000000001 [ 13.044398] 00000000000003f0 ffff88000f4677c8 0000000000000000 ffff88000de03a98 [ 13.044400] Call Trace: [ 13.044412] [] dump_stack+0x19/0x1b [ 13.044441] [] warn_slowpath_common+0x6b/0x90 [ 13.044445] [] warn_slowpath_fmt+0x46/0x50 [ 13.044448] [] mutex_trylock+0x87/0x220 [ 13.044482] [] cirrus_dirty_update+0x1cd/0x330 [ 13.044486] [] cirrus_imageblit+0x38/0x50 [ 13.044506] [] soft_cursor+0x22e/0x240 [ 13.044510] [] bit_cursor+0x581/0x5b0 [ 13.044525] [] ? vsnprintf+0x124/0x670 [ 13.044529] [] ? get_color.isra.16+0x43/0x130 [ 13.044532] [] fbcon_cursor+0x18a/0x1d0 [ 13.044535] [] ? update_attr.isra.2+0xa0/0xa0 [ 13.044556] [] hide_cursor+0x32/0xa0 [ 13.044565] [] vt_console_print+0x103/0x3b0 [ 13.044569] [] ? print_time+0x9c/0xb0 [ 13.044576] [] ? print_prefix+0xa0/0xc0 [ 13.044580] [] call_console_drivers.constprop.6+0x146/0x1f0 [ 13.044593] [] ? do_raw_spin_unlock+0xc8/0x100 [ 13.044597] [] console_unlock+0x2f7/0x460 [ 13.044600] [] vprintk_emit+0x59a/0x5e0 [ 13.044615] [] printk+0x4d/0x4f [ 13.044650] [] print_local_APIC+0x28/0x41c [ 13.044672] [] generic_smp_call_function_single_interrupt+0x145/0x2b0 [ 13.044688] [] smp_call_function_single_interrupt+0x27/0x40 [ 13.044697] [] call_function_single_interrupt+0x72/0x80 [ 13.044707] [] ? native_safe_halt+0x6/0x10 [ 13.044717] [] ? trace_hardirqs_on+0xd/0x10 [ 13.044738] [] default_idle+0x59/0x120 [ 13.044742] [] arch_cpu_idle+0x18/0x40 [ 13.044754] [] cpu_startup_entry+0x235/0x410 [ 13.044763] [] rest_init+0xd1/0xe0 [ 13.044766] [] ? rest_init+0x5/0xe0 [ 13.044778] [] start_kernel+0x425/0x493 [ 13.044781] [] ? repair_env_string+0x5e/0x5e [ 13.044786] [] x86_64_start_reservations+0x2a/0x2c [ 13.044789] [] x86_64_start_kernel+0xf1/0x100 [ 13.044799] ---[ end trace 113ad28772af4058 ]--- Reported-by: Fengguang Wu Signed-off-by: Maarten Lankhorst --- drivers/gpu/drm/cirrus/cirrus_fbdev.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/cirrus/cirrus_fbdev.c b/drivers/gpu/drm/cirrus/cirrus_fbdev.c index 3541b56..b27e956 100644 --- a/drivers/gpu/drm/cirrus/cirrus_fbdev.c +++ b/drivers/gpu/drm/cirrus/cirrus_fbdev.c @@ -25,7 +25,7 @@ static void cirrus_dirty_update(struct cirrus_fbdev *afbdev, struct cirrus_bo *bo; int src_offset, dst_offset; int bpp = (afbdev->gfb.base.bits_per_pixel + 7)/8; - int ret; + int ret = -EBUSY; bool unmap = false; bool store_for_later = false; int x2, y2; @@ -39,7 +39,8 @@ static void cirrus_dirty_update(struct cirrus_fbdev *afbdev, * then the BO is being moved and we should * store up the damage until later. */ - ret = cirrus_bo_reserve(bo, true); + if (!in_interrupt()) + ret = cirrus_bo_reserve(bo, true); if (ret) { if (ret != -EBUSY) return;