Received: by 2002:a05:6a10:83d0:0:0:0:0 with SMTP id o16csp40921pxh; Thu, 7 Apr 2022 13:21:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw0DdgbKupA6CNAvId8D4PPVEzO2+NqcECQHaeSW186l1tUjQicTwqwCUr7PDdNGuFkXJbr X-Received: by 2002:a05:6a00:ad0:b0:4f7:a357:6899 with SMTP id c16-20020a056a000ad000b004f7a3576899mr15978093pfl.80.1649362891247; Thu, 07 Apr 2022 13:21:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649362891; cv=none; d=google.com; s=arc-20160816; b=FoNybSqrOUFM61+aqi1dJ/wR0ygOzcoA34qhvJr0Zx9pWZWDM/RltTx1/XCGuV+iMk 7attefW6+K9Ebz6qErpLt3J17L3WOG33bAmGOx1mcVl/3oZZ+/DogQUxSWgavoUhvoTJ 8P3K23qPJ/KONAXPsboAQ5F7oCsIr1gG93UgGzNVF8XzVkxPWnXbqoIdwPf/oj+k66/d l1tuKvRTpeocrTZki+cZspnTeAtas17OIbEx5k2K8aqB4K/Cy0iXvqP/snO3AY35PtRN jsd5MsAiIZFWvVpAKcwcJ4xWjLgMqZZVJfSry82LHQlfFyP5muNJhsmPHl6bO2rIOO4V ZBeQ== 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=IlRD7m/alIJncAcf5ZsFIg2sRj4ry7LBP76Q3+m8Fv0=; b=Ld0uBIMhBwIddILAgXeTRosxe9vxq/veayRC44mPCXC5oNb7yYNORx2LGdLdTF6nR2 cYxKIGX1W4G/UYdeZ4Jdv5gjBbqejUDw96qN24lOX9aieFEwUt5gLeyHus9xZ1AJ87Jo /R9L/sPg8yvA1ttWHRnGcV+xCZeclK1CfIaT4Dh4BR6ab3GeDIKpwT+l1RmGUD482XuF Bw76214ZgmGNlEYWGcjXnYl+7uP5rfwKnYBtruy2mdOYf9CmaRKE3hc/2g3Fb/iVGBub WQyF/xwXkNzNBrgu1j1t1IrcCjnbdnO8zH2GlEvNA1YrXkiHi0q7QijIkCHooOUBSvXm c8/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=UKcH9KkS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id q3-20020a170902dac300b00153b2d16653si530830plx.603.2022.04.07.13.21.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Apr 2022 13:21:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=UKcH9KkS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 86AE93381F7; Thu, 7 Apr 2022 12:39:22 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244048AbiDGJ6q (ORCPT + 99 others); Thu, 7 Apr 2022 05:58:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59156 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244051AbiDGJ6o (ORCPT ); Thu, 7 Apr 2022 05:58:44 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BE6E6FEF; Thu, 7 Apr 2022 02:56:23 -0700 (PDT) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 8F167212B7; Thu, 7 Apr 2022 09:56:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1649325381; 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=IlRD7m/alIJncAcf5ZsFIg2sRj4ry7LBP76Q3+m8Fv0=; b=UKcH9KkS3V5pJFKjQTrgHntE36GmrRlMKttleodgavjTOO4sIry5rjlFnvmWUk+RlhxYpD UULtSZJpg0Ou1egwUxOTGJfzoz2l0kn9b21jZF6g7Ixb97QLzQkRiSBe3koCPaQLd63jYl kZKL4+gZ1GU9ZkRrER5szKvrJZF+QoM= Received: from suse.cz (unknown [10.100.216.66]) (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 BAFEFA3B83; Thu, 7 Apr 2022 09:56:19 +0000 (UTC) Date: Thu, 7 Apr 2022 11:56:19 +0200 From: Petr Mladek To: John Ogness Cc: Sergey Senozhatsky , Steven Rostedt , Thomas Gleixner , linux-kernel@vger.kernel.org, Greg Kroah-Hartman , Jiri Slaby , "Paul E. McKenney" , Frederic Weisbecker , Neeraj Upadhyay , Josh Triplett , Mathieu Desnoyers , Lai Jiangshan , Joel Fernandes , Kees Cook , Andrew Morton , Luis Chamberlain , Wei Liu , Xiaoming Ni , Peter Zijlstra , Andy Shevchenko , Helge Deller , Marco Elver , Sebastian Andrzej Siewior , Daniel Lezcano , Shawn Guo , Dmitry Torokhov , Matti Vaittinen , "Eric W. Biederman" , Phil Auld , Juri Lelli , Wang Qing , rcu@vger.kernel.org Subject: Re: [PATCH printk v2 09/12] printk: add functions to prefer direct printing Message-ID: References: <20220405132535.649171-1-john.ogness@linutronix.de> <20220405132535.649171-10-john.ogness@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220405132535.649171-10-john.ogness@linutronix.de> X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=no 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-04-05 15:31:32, John Ogness wrote: > Once kthread printing is available, console printing will no longer > occur in the context of the printk caller. However, there are some > special contexts where it is desirable for the printk caller to > directly print out kernel messages. Using pr_flush() to wait for > threaded printers is only possible if the caller is in a sleepable > context and the kthreads are active. That is not always the case. > > Introduce printk_prefer_direct_enter() and printk_prefer_direct_exit() > functions to explicitly (and globally) activate/deactivate preferred > direct console printing. The term "direct console printing" refers to > printing to all enabled consoles from the context of the printk > caller. The term "prefer" is used because this type of printing is > only best effort. If the console is currently locked or other > printers are already actively printing, the printk caller will need > to rely on the other contexts to handle the printing. > > This preferred direct printing is how all printing is currently > handled (unless explicitly deferred). > > When kthread printing is introduced, there may be some unanticipated > problems due to kthreads being unable to flush important messages. > In order to minimize such risks, preferred direct printing is > activated for the primary important messages when the system > experiences general types of major errors. These are: > > - emergency reboot/shutdown > - cpu and rcu stalls > - hard and soft lockups > - hung tasks > - warn > - sysrq > > Note that since kthread printing does not yet exist, no behavior > changes result from this commit. This is only implementing the > counter and marking the various places where preferred direct > printing is active. > > Signed-off-by: John Ogness Looks good to me. Let's see how it works in practice. It is possible that we will need to add it on more locations. But it is also possible that we will be able to remove it somewhere. Reviewed-by: Petr Mladek Best Regards, Petr