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: 1469991 Return-Path: X-Original-To: patchwork-intel-gfx@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 810F4DFFCF for ; Mon, 17 Sep 2012 23:05:09 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 688B99F589 for ; Mon, 17 Sep 2012 16:05:09 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@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 267679E93D for ; Mon, 17 Sep 2012 16:03:53 -0700 (PDT) Received: by wibhn17 with SMTP id hn17so2662743wib.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=R6dQsTo4nrz3j6j+uqzCZT9G8R16fF0zadNEFgLMYRmR4/trx/7ySwxb2a7GGUECmR K7oYSaHY2DA493jXQeVpSFCGqVzIqpxqwVlHi0CNMtOjp5gBXPFLdJIBVKPkAYGOBGZ3 2O+9qYwNai8ajXQx07p6oeCLOafS6PClN9M3sc94hUjqoXnGSEiRG7e8OgMrk6ymIHTd MXER4PUF/IPMJPphl+f7udikwlQ2GqdNz0OIv25aLqoWDHGROOZADlaCWL4v9tM6GPy3 XDX0869Gl4980EyH1ngPbhLYjBESFPCvPDn3284lkjR0IY3tyMYSoCZtsEXg0FZyMSWj A46Q== 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 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: ALoCoQnGFjOROklCiE3qM2G4cX/cziFM3NGfBMa01l+DmfewUuhAcXkhRZvPd0BQsbulqgmGyL6w Cc: Peter Zijlstra , Daniel Vetter , Intel Graphics Development , DRI Development , Thomas Gleixner , Alan Cox Subject: [Intel-gfx] [PATCH 1/2] [RESEND] console: use might_sleep in console_lock X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+patchwork-intel-gfx=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;