From: Mandeep Singh Baines Subject: Re: [PATCH] drm: avoid switching to text console if there is no panic timeout Date: Tue, 18 Oct 2011 11:29:58 -0700 Message-ID: <20111018182958.GS20828@google.com> References: <1318896400-32498-1-git-send-email-msb@chromium.org> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE Return-path: Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org To: Dave Young Cc: Mandeep Singh Baines , linux-kernel@vger.kernel.org, David Airlie , Hugh Dickins , Hugh Dickins , Dave Airlie , Andrew Morton , dri-devel@lists.freedesktop.org, marcheu@chromium.org, rientjes@google.com List-Id: dri-devel@lists.freedesktop.org Dave Young (hidave.darkstar@gmail.com) wrote: > On Tue, Oct 18, 2011 at 10:19 AM, Dave Young wrote: > > On Tue, Oct 18, 2011 at 8:06 AM, Mandeep Singh Baines wrote: > >> From: Hugh Dickins > >> > >> Add a check for panic_timeout in the drm_fb_helper_panic() notifie= r: if > >> we're going to reboot immediately, the user will not be able to se= e the > >> messages anyway, and messing with the video mode may display artif= acts, > >> and certainly get into several layers of complexity (including mut= exes and > >> memory allocations) which we shall be much safer to avoid. > > > > There's one exception is use printk_delay >=20 > OTOH the complexity do exist also when timeout is set, IMHO it is wor= th >=20 Hi Dave, I agree. The complexity is worth it if you want to see the panic trace on the VT. But if you have the panic_timeout negative (i.e. reboot immediately) than you're just add more risk/complexity to panic for no benefit. To avoid losing the panic traces, a reliable panic is critical. In our app, we use panic_timeout=3D-1 and we use ramoops for capturing = panic traces. We want the panic path to be as simple as possible to avoid wedging machines and to avoid losing panic traces. In our test lab, if a machine gets wedged, a human needs to go and power cycle the machi= ne to bring it back online. =46or user devices, we want to panic quickly and get the device back up ASAP. Our reboot time is under 8 seconds so its less than 10 seconds be= fore you're back online and surfing the web. We also want to avoid displayin= g any artifacts or traces to the user when panicking. You bring up a good point about printk_delay. But I'm thinking if you'r= e using prink_delay you'd also want to set panic_timeout >=3D 0. Otherwis= e, you'd reboot immediately after displaying the last line of output. Regards, Mandeep > > > >> > >> Signed-off-by: Hugh Dickins > >> [ Edited commit message and modified to short-circuit panic_timeou= t < 0 > >> =A0instead of testing panic_timeout >=3D 0. =A0-Mandeep ] > >> Signed-off-by: Mandeep Singh Baines > >> Cc: Dave Airlie > >> Cc: Andrew Morton > >> Cc: dri-devel@lists.freedesktop.org > >> --- > >> =A0drivers/gpu/drm/drm_fb_helper.c | =A0 =A07 +++++++ > >> =A01 files changed, 7 insertions(+), 0 deletions(-) > >> > >> diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm= _fb_helper.c > >> index f7c6854..0e62c93 100644 > >> --- a/drivers/gpu/drm/drm_fb_helper.c > >> +++ b/drivers/gpu/drm/drm_fb_helper.c > >> @@ -254,6 +254,13 @@ bool drm_fb_helper_force_kernel_mode(void) > >> =A0int drm_fb_helper_panic(struct notifier_block *n, unsigned long= ununsed, > >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0void *panic_str) > >> =A0{ > >> + =A0 =A0 =A0 /* > >> + =A0 =A0 =A0 =A0* It's a waste of time and effort to switch back = to text console > >> + =A0 =A0 =A0 =A0* if the kernel should reboot before panic messag= es can be seen. > >> + =A0 =A0 =A0 =A0*/ > >> + =A0 =A0 =A0 if (panic_timeout < 0) > >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return 0; > >> + > >> =A0 =A0 =A0 =A0printk(KERN_ERR "panic occurred, switching back to = text console\n"); > >> =A0 =A0 =A0 =A0return drm_fb_helper_force_kernel_mode(); > >> =A0} > >> -- > >> 1.7.3.1 > >> > >> -- > >> To unsubscribe from this list: send the line "unsubscribe linux-ke= rnel" in > >> the body of a message to majordomo@vger.kernel.org > >> More majordomo info at =A0http://vger.kernel.org/majordomo-info.ht= ml > >> Please read the FAQ at =A0http://www.tux.org/lkml/ > >> > > > > > > > > -- > > Regards > > Dave > > >=20 >=20 >=20 > --=20 > Regards > Dave