From: akpm@linux-foundation.org Subject: [patch 2/2] drm: avoid switching to text console if there is no panic timeout Date: Tue, 15 Nov 2011 14:53:15 -0800 Message-ID: <201111152253.pAFMrFYX000847@wpaz1.hot.corp.google.com> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Return-path: Received: from mail-vw0-f73.google.com (mail-vw0-f73.google.com [209.85.212.73]) by gabe.freedesktop.org (Postfix) with ESMTP id AAF6F9F30B for ; Tue, 15 Nov 2011 14:53:18 -0800 (PST) Received: by vws10 with SMTP id 10so145824vws.0 for ; Tue, 15 Nov 2011 14:53:17 -0800 (PST) List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org Errors-To: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org To: airlied@linux.ie Cc: hidave.darkstar@gmail.com, hughd@chromium.org, rientjes@google.com, hughd@google.com, dri-devel@lists.freedesktop.org, marcheu@chromium.org, airlied@redhat.com, akpm@linux-foundation.org List-Id: dri-devel@lists.freedesktop.org From: Hugh Dickins Subject: drm: avoid switching to text console if there is no panic timeout Add a check for panic_timeout in the drm_fb_helper_panic() notifier: if we're going to reboot immediately, the user will not be able to see the messages anyway, and messing with the video mode may display artifacts, and certainly get into several layers of complexity (including mutexes and memory allocations) which we shall be much safer to avoid. [msb@chromium.org: edited commit message and modified to short-circuit pani= c_timeout < 0 instead of testing panic_timeout >=3D 0] Signed-off-by: Hugh Dickins Signed-off-by: Mandeep Singh Baines Cc: Dave Airlie Acked-by: David Rientjes Acked-by: St=E9phane Marchesin Cc: Dave Young Signed-off-by: Andrew Morton --- drivers/gpu/drm/drm_fb_helper.c | 7 +++++++ 1 file changed, 7 insertions(+) diff -puN drivers/gpu/drm/drm_fb_helper.c~drm-avoid-switching-to-text-conso= le-if-there-is-no-panic-timeout drivers/gpu/drm/drm_fb_helper.c --- a/drivers/gpu/drm/drm_fb_helper.c~drm-avoid-switching-to-text-console-i= f-there-is-no-panic-timeout +++ a/drivers/gpu/drm/drm_fb_helper.c @@ -255,6 +255,13 @@ bool drm_fb_helper_force_kernel_mode(voi int drm_fb_helper_panic(struct notifier_block *n, unsigned long ununsed, void *panic_str) { + /* + * It's a waste of time and effort to switch back to text console + * if the kernel should reboot before panic messages can be seen. + */ + if (panic_timeout < 0) + return 0; + printk(KERN_ERR "panic occurred, switching back to text console\n"); return drm_fb_helper_force_kernel_mode(); } _