From patchwork Mon Sep 17 23:03: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: 1469981 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 207A2DFFCF for ; Mon, 17 Sep 2012 23:04:10 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 02FF39F57F for ; Mon, 17 Sep 2012 16:04:10 -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 225839E7BA for ; Mon, 17 Sep 2012 16:03:53 -0700 (PDT) Received: by wibhn17 with SMTP id hn17so2662742wib.12 for ; Mon, 17 Sep 2012 16:03:53 -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; bh=Re6lRhpPdorxJ/crcn4Mys9ABtEhzcM8di6YTRZoImg=; b=ZkKURrQrxUgNnv5YpLGDuIW4MCJFXGas6he054PQRI2Pq3qcDJgALMAD9nJQsebCce cjJcqnzMNGHxVfQAeW+a0dPyg1ZMh6hzCKIKP3sl0hssxuoCL5cIjhZRAWYpxbi+tEAI LBCjt69f0yjmjje4t4kpqL/OnErw7knn8l3rY= 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:x-gm-message-state; bh=Re6lRhpPdorxJ/crcn4Mys9ABtEhzcM8di6YTRZoImg=; b=hiNBpMKJPqyLcXtzhE6MhdrEzRQsc4AUBFuxyTwNTxADdfuR5y+4qQ+Ud6L6cn4QaG y+sfskYRCfrz45e18ghqLRTUALpE/98mU4NEX8rtiVKpVD7jG0N1zRXQg24bNlASRKAp kiNbk1rfsw+xj6BUZkbPkIGm44L3I0JRH7rS9F/a550ava0cPvqIaGgPR/66g31gcH+K i3CGi3tiFJPe3woYn67Qa1fWyZge2/t6Z9K3khZhuDK5f8vlPzjdUcCl+XdwBYj+j5X2 z0Q4cGpWqTZitaRiQgV9dy3vAaRZZ3jlPLv8A2qICmln0vE/6OBCroavT/0OZA3P/7kZ 1hwg== Received: by 10.216.53.18 with SMTP id f18mr6669959wec.69.1347923033167; Mon, 17 Sep 2012 16:03:53 -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 o2sm28635397wiz.11.2012.09.17.16.03.51 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 17 Sep 2012 16:03:52 -0700 (PDT) From: Daniel Vetter To: LKML Subject: [PATCH 1/2] [RESEND] console: use might_sleep in console_lock Date: Tue, 18 Sep 2012 01:03:31 +0200 Message-Id: <1347923013-4253-1-git-send-email-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 1.7.10.4 X-Gm-Message-State: ALoCoQloUJovu+G1XzT4aFMcmDu+oxte8AvRIYxkL95ErVIiqDI9tw1QgSYjbwtGQTtPLItibADQ Cc: Peter Zijlstra , Daniel Vetter , Intel Graphics Development , 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 Cc: Alan Cox Cc: Peter Zijlstra 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;