Received: by 2002:a05:6a10:83d0:0:0:0:0 with SMTP id o16csp72098pxh; Thu, 7 Apr 2022 14:20:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw07n+0sc+D/NGfDCa74r3cXHUnV2XtazR6ks9GOU6Nw6vTDJ7F87ABZ/7mF5riU20E4HTA X-Received: by 2002:a17:903:22ca:b0:14c:d9cf:a463 with SMTP id y10-20020a17090322ca00b0014cd9cfa463mr16522481plg.32.1649366402914; Thu, 07 Apr 2022 14:20:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649366402; cv=none; d=google.com; s=arc-20160816; b=UAQLhHBYDCg1QKNz32ELPV+9HYSZblCfCTtAjsSXBmGrGfr2sD3xCROdMb5KyTV+Qq trhbnzyNyPUKPccLkjV/EdQrZns13sejVka4ufxfgX7hsGLXP6hdmzAl4ZBCCxFUZvxT OJijzLY/CKTT7xENS9Bz5BJHhy6MRCyJePq6D2Kt901pYyb7iWzqaSlc0TPCUNPFFom2 ET2SzncUzCdf2RIkyqkha6CZQwUdoiPtp0McCyvURrV58X+HG+N2AZmSxpUoDyBkOj7p 6WrM1QikMFxWRoEFKp1i9v+BGV1Axy+P9CMnUnFUrw0U4M3wC9WZpl4qYKejohO9zWvo HIuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:dkim-signature:dkim-signature:from; bh=oPpZ0m/EoTYA7DrLIFgnk4y1wQaBSP5g0/ujxGiQvG4=; b=ATZsG8yBSojWjDBqTqV03zWarsFYA/Ab2mTv+xzbCze47V55plPQeIlAfEwrirvvSH AKSf/pN6IZuu/EAptbNxKCpH6NUjLTpdwwbks0TsdRb0UeJ/8IAT2iAflmLUvpsWQEXT L+yIdPMqgXaLzVmmPIlPxmb9lDEr0NT9cXvKHKliI4wSyXRCm2AQjikpxaRybBmlnwVY CrxFuC8sti/5EzcWgxoHPmaf1hio8ohwyjTsf4Xk380Ios8/BdP+wgxyAp6GNbWdwnpy I7wOcx2QqLiM6jbDRgrPKseAS7cYbKnuyiyfi6PGX7GhfNb1f3iSABTE4Zqjy49IZ5fK +MnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=JFPSDWgc; dkim=neutral (no key) header.i=@linutronix.de; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id b29-20020a631b5d000000b003816043f106si20146543pgm.763.2022.04.07.14.20.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Apr 2022 14:20:02 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=JFPSDWgc; dkim=neutral (no key) header.i=@linutronix.de; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 3946947CD15; Thu, 7 Apr 2022 13:11:40 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245693AbiDGOi4 (ORCPT + 99 others); Thu, 7 Apr 2022 10:38:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60358 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237013AbiDGOiy (ORCPT ); Thu, 7 Apr 2022 10:38:54 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C9B3213858C; Thu, 7 Apr 2022 07:36:53 -0700 (PDT) From: John Ogness DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1649342157; h=from:from:reply-to:subject:subject: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=oPpZ0m/EoTYA7DrLIFgnk4y1wQaBSP5g0/ujxGiQvG4=; b=JFPSDWgcDH5/nzr9OLV61NtbaX5cpcuOs0hCg8p6nRk238Xbe0DHd2splLnhZ405VuJZu6 xgEvmbSFbT/qtWM9R9GrfswIOAjgDSzfsfV2CB+7/DW5obz6l9CJwCl66hMhg4n6mZ+nsq aNtV9/xHjb0xq6rrikMXHYDKy2ZmNYHRuYTnNi4kjix/MIL0MchiXeuf3Hlmf+ZKuC9dwE ZmaxHiDtf0s1V6eIY211e/y9mKy4SCwts89QsH9DlYpczA64TfX9Tk+P8jw2fHQapThy1V oxxOqPfVyQnyApAm5w5/Lr4rQlnQpgnbvny6d+WM8SuwKit/G68ZhHRtEChmwA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1649342157; h=from:from:reply-to:subject:subject: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=oPpZ0m/EoTYA7DrLIFgnk4y1wQaBSP5g0/ujxGiQvG4=; b=jbnaZA7raEVl7ThYX+0bKwEQFI//kGVTC1fXb4kYxTvQG3olAl4sxy4B0WZmtBbTd/SJsB 2DGlpoopNMzpHwCw== To: Helge Deller , Petr Mladek 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 , 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 In-Reply-To: References: <20220405132535.649171-1-john.ogness@linutronix.de> <20220405132535.649171-10-john.ogness@linutronix.de> Date: Thu, 07 Apr 2022 16:41:55 +0206 Message-ID: <87zgkxnepg.fsf@jogness.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INVALID_DATE_TZ_ABSURD,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 2022-04-07, Helge Deller wrote: >>> - emergency reboot/shutdown >>> - cpu and rcu stalls >>> - hard and soft lockups >>> - hung tasks >>> - warn >>> - sysrq > > I agree that those needs direct printing. > Did you maybe checked how much (e.g. in percentage) of a normal log is > then still left to be printed threadened? Just in case it's not much, > is there still a benefit to introduce threadened printing? A "normal" log can still contain many many messages. There have been reports [0] where the system died because _printk_ killed it. This was not any of the scenarios that we want direct printing for. It was just a lot of messages that some driver wanted to output. Until now the response was always to reduce printk usage or avoid it altogether. printk has a bad reputation because it is so unpredictable and expensive. So we are fixing printk. With threaded printers, we make a dramatic change. printk becomes 100% lockless and consistently quite fast. You can use it to debug or log messages within any code in the kernel and not need to worry about horrible latencies being introduced. For drivers that start dumping tons of messages, there is no concern that the system will die because of the messages. > Or another example, e.g. when running on a slow console (the best > testcase I know of is a 9600 baud serial port), where some printks are > threadened. Then a warn printk() has to be shown, doesn't it mean all > threadened printks have to be flushed (waited for) until the warning > can be shown. Will there then still be a measureable time benefit? Now you are talking about something else, unrelated to the threaded printing. A warn is considered a serious non-normal event. In this case, printk temporarily falls back to the direct, slow, unpredictable, printk-caller-context behavior we know today. If we see that direct printing is being used during normal operation (i.e. developers are performing warns just for fun), then we should not mark warns for direct printing. We will need to get some real-world experience here, but the goal is that systems do not use direct printing unless a real serious emergency is going on. Otherwise, the system risks dying because of the messages rather than the problem being reported. John [0] https://lore.kernel.org/all/20190306171943.12345598@oasis.local.home