Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp2338107rwl; Thu, 13 Apr 2023 05:17:14 -0700 (PDT) X-Google-Smtp-Source: AKy350bQBoMtk0EkmgTXCYYbDiU0Ex6ba+x1aoqS4Yvhaad2DdwTskwkYQJlC1/Zu9Mg1lMuvJY3 X-Received: by 2002:a05:6870:390a:b0:184:6a2b:ff34 with SMTP id b10-20020a056870390a00b001846a2bff34mr1642634oap.27.1681388234394; Thu, 13 Apr 2023 05:17:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681388234; cv=none; d=google.com; s=arc-20160816; b=COLRnagTR8dGEWKc6xgQaD6Yt/NSqVcFYPFAEU8/z56xMwI/+wAeX5NC7FHd1vluEu d3zuMkQZm0GGVNMaW6NFqgi0WoBcokPauS5dLpVf3nLWKjX28HIRvwLGrIaont9tg5/e YYJq47LSW7OtnJY9nGJ21MoNRRsYZKi2wqX9ZOeNf89TL1oE27JT6rssF8Fn231P3BnG YZPqwRBxFcTPrjBO13szA+sRYl0qZxWCc+AAnzuPWPe47bFZkwCwYFYmZlOUkeCKxwMq nNfGYgNHV6NTWM4sE1MSvUsEYyV3Pktn9zzXuEft9fQLsjgKz9HXW99tNJ9kWqF3W8/5 PJMQ== 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=bVHo1AXvNk+0J2p7GN3q6H/IIXVoMsR7G7c5lAwQvBU=; b=eNNueXVStbbBLsmZJbHxcpdXxHoCl4+ZKVF61tVMzEhmZgbka9f7K3uKae2w7KxcF1 Cdyj87ONULQVClHymN1g8rBHJduXVTQvJqEcn5frEkqAqc3gARKdcE+a4NQCm7ffMjPy Spc6IRA2GeD7OmNBrDcfAuS/bU6OMamT0N8oVq2FM5hEN3YSQT9QUAOd23VHmqCHgmsE RGY9ZfLhsYGdkcRtTOOLelynES8QjVIoCqTrptAUr0RiHXi2O9wHWzEDM5tfP6Ri5Yxd 3uIPWrB00sSstD0HdROL9qdi0SffKktnQjWj3VtrAPMjLCJ+sxXGk9QAhtqeGscleW5l 212Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=HaJy1zlP; 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 y18-20020a056830109200b0069f9bc047a4si1753231oto.148.2023.04.13.05.17.01; Thu, 13 Apr 2023 05:17:14 -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=HaJy1zlP; 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 S229791AbjDMMKs (ORCPT + 99 others); Thu, 13 Apr 2023 08:10:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229749AbjDMMKq (ORCPT ); Thu, 13 Apr 2023 08:10:46 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 478E54EFD; Thu, 13 Apr 2023 05:10:45 -0700 (PDT) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id E697321870; Thu, 13 Apr 2023 12:10:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1681387843; 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=bVHo1AXvNk+0J2p7GN3q6H/IIXVoMsR7G7c5lAwQvBU=; b=HaJy1zlPz/tNt7qW8EQurlRkj6zMsHLxlojZiP//cBWXlSwvxA/9Yt9fVGAlgmgwdpyZlM f59uzjPxfPkSp45d7VkT76gPiKn6IuNhKxzknWGURkgawwA7BYZOB141pPpJ0SRI6we18N xM24LBgMca98+CFZA9PXAYQb0c2rYbE= Received: from suse.cz (pmladek.udp.ovpn2.prg.suse.de [10.100.201.202]) (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 508042C143; Thu, 13 Apr 2023 12:10:43 +0000 (UTC) Date: Thu, 13 Apr 2023 14:10:39 +0200 From: Petr Mladek To: John Ogness Cc: Sergey Senozhatsky , Steven Rostedt , Thomas Gleixner , linux-kernel@vger.kernel.org, "Paul E. McKenney" , Frederic Weisbecker , Neeraj Upadhyay , Josh Triplett , Mathieu Desnoyers , Lai Jiangshan , Joel Fernandes , rcu@vger.kernel.org Subject: Re: [PATCH printk v1 17/18] rcu: Add atomic write enforcement for rcu stalls Message-ID: References: <20230302195618.156940-1-john.ogness@linutronix.de> <20230302195618.156940-18-john.ogness@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230302195618.156940-18-john.ogness@linutronix.de> 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,URIBL_BLOCKED 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 Thu 2023-03-02 21:02:17, John Ogness wrote: > Invoke the atomic write enforcement functions for rcu stalls to > ensure that the information gets out to the consoles. "ensure" is too strong. It is still just the best effort. It might fail when the current console user does not pass the lock. I would say that it will increase the chance to see the messages on NOBKL consoles by printing the messages directly instead of waiting for the printk thread. > It is important to note that if there are any legacy consoles > registered, they will be attempting to directly print from the > printk-caller context, which may jeopardize the reliability of the > atomic consoles. Optimally there should be no legacy consoles > registered. The above paragraph is a bit vague. It is not clear how exactly the legacy consoles affect the reliability, Does it mean that they might cause a deadlock because they are not atomic? But there is nothing specific about rcu stalls and priority of NOBKL consoles. This is a generic problem with legacy consoles. > --- a/kernel/rcu/tree_stall.h > +++ b/kernel/rcu/tree_stall.h > @@ -566,6 +568,8 @@ static void print_other_cpu_stall(unsigned long gp_seq, unsigned long gps) > if (rcu_stall_is_suppressed()) > return; > > + prev_prio = cons_atomic_enter(CONS_PRIO_EMERGENCY); Thinking loudly: This would set the EMERGENCY priority on this CPU. But the following function: + rcu_dump_cpu_stacks() + dump_cpu_task() + trigger_single_cpu_backtrace() might send IPI and the backtrace will be printed from another CPU. As a result that backtraces won't be printed with EMERGENCY priority. One solution would be to have also global EMERGENCY priority. Another possibility would be to use EMERGENCY priority also in nmi_cpu_backtrace() which is the callback called by the IPI. I would probably go for the global flag. printk() called in EMERGENCY priority has to flush also messages added by other CPUs. So that messages added by other CPUs are printed "directly" anyway. Also setting the EMERGENCY priority in nmi_cpu_backtrace() is an ad-hoc solution. The backtrace is usually called as part of another global emergency report. > + > /* > * OK, time to rat on our buddy... > * See Documentation/RCU/stallwarn.rst for info on how to debug Best Regards, Petr