From patchwork Tue Aug 21 22:34:31 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 1358241 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork2.kernel.org (Postfix) with ESMTP id 9ECA9DFB34 for ; Tue, 21 Aug 2012 22:35:50 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 659B3A08F1 for ; Tue, 21 Aug 2012 15:35:50 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wi0-f177.google.com (mail-wi0-f177.google.com [209.85.212.177]) by gabe.freedesktop.org (Postfix) with ESMTP id 5588DA088F for ; Tue, 21 Aug 2012 15:34:48 -0700 (PDT) Received: by wibhn17 with SMTP id hn17so233257wib.12 for ; Tue, 21 Aug 2012 15:34:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=y+qPBUHZaevYV/+dZBug+Xul5MXq/Ed56W5Km9WrN0o=; b=QhfinG3KecyHjQNo7mcs9eQ/dmE10U47FelewZheTmClBJ3MzVgcR0WPDiY8xaU0sp tENkVMedGCQEo77PyKJKj4XgLewwKz1hl/UF1SuR5E2wi6eyK2/bmm/b/rm8tRsnHbzz aWccrK+D0axLZ8FilCjp4ncooorfipb99dKx8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=y+qPBUHZaevYV/+dZBug+Xul5MXq/Ed56W5Km9WrN0o=; b=PWYEPCg1Pkfpv2b35TR7VL53dfUOihM6kZMIhMHIPncamduDwSUtNm4MgiHfsmZ4mS gKra4oYH9HqhnpgJMlg2aixkGK30EMcnmYqgbCh3KYuibEK/O/7XbCM3OUNO7I0uXv5V LrBkDinvmGN/nDPOGmBduxXBKdnMHU17pFYJAsb5rkD+aURl8H77Y67rqMlznruPXKAK 97ZnSre2WXdnGaVX3t5p7GzANEUf4QLqsvRvnH23TBBgs7vkTlRtaoFGAEXqgp/3T2CQ QCxxQE2cTtSlBXwAF5dNAfCqMBMIfAce84XiMppgtYASenB8bdGpjx5Pzk0HmczIg3Cs eXdA== Received: by 10.180.81.133 with SMTP id a5mr394018wiy.17.1345588487540; Tue, 21 Aug 2012 15:34:47 -0700 (PDT) Received: from aaron.ffwll.local (178-83-130-250.dynamic.hispeed.ch. [178.83.130.250]) by mx.google.com with ESMTPS id k20sm36045620wiv.11.2012.08.21.15.34.45 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 21 Aug 2012 15:34:46 -0700 (PDT) From: Daniel Vetter To: LKML Subject: [PATCH 1/2] console: use might_sleep in console_lock Date: Wed, 22 Aug 2012 00:34:31 +0200 Message-Id: <1345588472-4055-2-git-send-email-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1345588472-4055-1-git-send-email-daniel.vetter@ffwll.ch> References: <1345588472-4055-1-git-send-email-daniel.vetter@ffwll.ch> X-Gm-Message-State: ALoCoQkI0DwH0KA5d/e6Ziv98FOm41vup9yIJO5KCJWvJ0ell3PcLJk3rHx8Q3fXsjM9QkxUmw9r Cc: linux-fbdev@vger.kernel.org, Daniel Vetter , DRI Development , Thomas Gleixner 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 Instead of BUG_ON(in_interrupt()), since that doesn't check for all the newfangled stuff like preempt. Note that this is valid since the console_sem is essentially used like a real mutex with only two twists: - we allow trylock from hardirq context - across suspend/resume we lock the logical console_lock, but drop the semaphore protecting the locking state. Now that doesn't guarantee that no one is playing tricks in single-thread atomic contexts at suspend/resume/boot time, but - I couldn't find anything suspicious with some grepping, - might_sleep shouldn't die, - and I think the upside of catching more potential issues is worth the risk of getting a might_sleep backtrace that would have been save (and then dealing with that fallout). Cc: Dave Airlie Cc: Thomas Gleixner Signed-off-by: Daniel Vetter --- kernel/printk.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/printk.c b/kernel/printk.c index 66a2ea3..ed9af6a 100644 --- a/kernel/printk.c +++ b/kernel/printk.c @@ -1909,7 +1909,8 @@ static int __cpuinit console_cpu_notify(struct notifier_block *self, */ void console_lock(void) { - BUG_ON(in_interrupt()); + might_sleep(); + down(&console_sem); if (console_suspended) return;