Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp585151rwe; Thu, 1 Sep 2022 04:51:17 -0700 (PDT) X-Google-Smtp-Source: AA6agR52OM8Wsoj3zv5SN5OocwbttqMYTjtp2d0C+oceggRJ4BZx5Q3qoJFZxcep9Lp0zkUEhCRs X-Received: by 2002:a17:903:28f:b0:175:549a:cd81 with SMTP id j15-20020a170903028f00b00175549acd81mr1314125plr.30.1662033077196; Thu, 01 Sep 2022 04:51:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662033077; cv=none; d=google.com; s=arc-20160816; b=JAkZ102EhxCh6VjDgP6//UTsN36gcZ/07mpAjCSGkTPkb2h73OSU7a1XpfTbcIQaQH vEdXhs5GP8cUiEVxhobZbn/jSm/Stn8v1r4Ty2ftddh4EQZ5DPvmP2W0OZDcAPykutRF 0B1rjaYvfqvSUFrYPj7Ek5UFr5ZsBgPgohdg9k60EX8PCJcRRUBjNTmzibbwOVogFNnw Kf3HGiCiMMno8X6z+HoxR+0A4jkCn0GRhyep010pS7qmlgIEWg3QNTfc4WITTi8ahoY2 0GX2MOTjFyszO8xezkX4JpYzeo8y6VHh8Qaaf37kfNaZcgjSNQbKJN6V+zWbr0UfojUL n/GA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=OG+iIWS5A8fbxQ89HNd8+SKZPeTazSdlBEhzgCR6ffo=; b=fgz9L1BoUUXwGH/QpxqbmN+T0rno56QrtwDxe5HgQCoWRBzEEBCZkDT0sn5s8EDU+p DGErMXdz35Fu8cN3d6hmFDLBx/KVtYCCbcLWbXKPAXcgMa74rqHE3WeGYNtDNVtpkkJS 89F6e5Ejmj1RlpegQaMM8rUCWhpy8rdkONYMFogE9LmQ0pEl/u43KSbkYyBSPR2H8IIw 5zYdIeMr2YgNnlJZ5QfMnqmM+6aZVmQPPe4prhAXBTykpj5zYCrqbojyv/GDL81zQ5FB gHzQ9mUCJVtRTSkcQdaru4yAfi7iOCyQVJR/H4F1zN4zyNHScMFODELBGxBUZvc0LY+1 Gv4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=MSVibIQU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bd32-20020a056a0027a000b00537c5841b19si18091731pfb.310.2022.09.01.04.51.05; Thu, 01 Sep 2022 04:51:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=MSVibIQU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232598AbiIALf1 (ORCPT + 99 others); Thu, 1 Sep 2022 07:35:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39146 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232718AbiIALfN (ORCPT ); Thu, 1 Sep 2022 07:35:13 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B33F82AC60 for ; Thu, 1 Sep 2022 04:35:07 -0700 (PDT) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 5101F1FFA4; Thu, 1 Sep 2022 11:35:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1662032106; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=OG+iIWS5A8fbxQ89HNd8+SKZPeTazSdlBEhzgCR6ffo=; b=MSVibIQUQyiVnv795lwK68fNJx0GQAua9hsV7CqQugm08YmLZCJD1XcFsNH95FsXjP2jzW lD6VaclLpf38k8BJJLTyg147FqMtHxtQ2TcmgiNv8s/QR2LoDROHnbUXtUMPZYRBXlTkgJ xGPuDKDfC+lWgcJEIbC5j44vNfQ8Gcc= Received: from suse.cz (unknown [10.100.208.146]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 3A29C2C141; Thu, 1 Sep 2022 11:35:04 +0000 (UTC) Date: Thu, 1 Sep 2022 13:35:03 +0200 From: Petr Mladek To: Daniel Vetter Cc: LKML , DRI Development , Daniel Vetter , Greg Kroah-Hartman , Jiri Slaby , Ilpo =?iso-8859-1?Q?J=E4rvinen?= , Tetsuo Handa , Xuezhi Zhang , Yangxi Xiang , nick black , Andrew Morton , Luis Chamberlain , "Guilherme G. Piccoli" , Marco Elver , John Ogness , Sebastian Andrzej Siewior , David Gow , tangmeng , Tiezhu Yang , Chris Wilson Subject: Re: [PATCH] kernel/panic: Drop unblank_screen call Message-ID: References: <20220830145004.430545-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220830145004.430545-1-daniel.vetter@ffwll.ch> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue 2022-08-30 16:50:04, Daniel Vetter wrote: > console_unblank() does this too (called in both places right after), > and with a lot more confidence inspiring approach to locking. > > Reconstructing this story is very strange: > > In b61312d353da ("oops handling: ensure that any oops is flushed to > the mtdoops console") it is claimed that a printk(" "); flushed out > the console buffer, which was removed in e3e8a75d2acf ("[PATCH] > Extract and use wake_up_klogd()"). In todays kernels this is done way > earlier in console_flush_on_panic with some really nasty tricks. I > didn't bother to fully reconstruct this all, least because the call to > bust_spinlock(0); gets moved every few years, depending upon how the > wind blows (or well, who screamed loudest about the various issue each > call site caused). > > Before that commit the only calls to console_unblank() where in s390 > arch code. > > The other side here is the console->unblank callback, which was > introduced in 2.1.31 for the vt driver. Which predates the > console_unblank() function by a lot, which was added (without users) > in 2.4.14.3. So pretty much impossible to guess at any motivation > here. Also afaict the vt driver is the only (and always was the only) > console driver implementing the unblank callback, so no idea why a > call to console_unblank() was added for the mtdooops driver - the > action actually flushing out the console buffers is done from > console_unlock() only. My understanding is that mtdoops is not a real console. The commit 4b23aff083649eafa141 ("[MTD] oops and panic message logging to MTD device") suggests that it was just (mis)using the console infrastructure. The commit 2e386e4bac90554887e73d ("mtd: mtdoops: refactor as a kmsg_dumper") converted it to use the new kmsg_dumper API that was created for this use case. So, I would consider all the mtdoops-related changes as a misuse of the console API. > Note that as prep for the s390 users the locking was adjusted in > 2.5.22 (I couldn't figure out how to properly reference the BK commit > from the historical git trees) from a normal semaphore to a trylock. > > Note that a copy of the direct unblank_screen() call was added to > panic() in c7c3f05e341a ("panic: avoid deadlocks in re-entrant console > drivers"), which partially inlined the bust_spinlocks(0); call. > > Long story short, I have no idea why the direct call to unblank_screen > survived for so long (the infrastructure to do it properly existed for > years), nor why it wasn't removed when the console_unblank() call was > finally added. But it makes a ton more sense to finally do that than > not - it's just better encapsulation to go through the console > functions instead of doing a direct call, so let's dare. Plus it > really does not make much sense to call the only unblank > implementation there is twice, once without, and once with appropriate > locking. > > Signed-off-by: Daniel Vetter Nice analyze. The change makes perfect sense from my POV: Reviewed-by: Petr Mladek Best Regards, Petr