Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp2833645rdh; Wed, 27 Sep 2023 14:20:44 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFk4wSw1VF0Yg2vcbAVrO7UtXgKMUh/ldz+7fAz2yBnaFxVC7ZoBAhfNeL722MUKcW2mGjV X-Received: by 2002:a9d:7759:0:b0:6bc:8632:e150 with SMTP id t25-20020a9d7759000000b006bc8632e150mr3404786otl.5.1695849644428; Wed, 27 Sep 2023 14:20:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695849644; cv=none; d=google.com; s=arc-20160816; b=z4iODBczxeckPS9ABICwsKZ/NBLpTIGMcWZue8sa1NVfYcPFMV8d5RiVL+EEqi8IrB pjEnFXVngUjb7yovmeu83j0n06EGwI76DHJ2QJrGCZTx1c2U7e4ADUIFvGj35h2MCZV6 tuBYB0IR4d0WvWzj5m04A1lvQF5VPmaGdaDEskKxZUqXJm8d/+l5ZuoeU0LTMFy/rjF8 nC3qYTASWlp5voW1q5zXNp/TxFf3f5V70zeo5BgODlIVeUlqzHy0JRB+vuhQV08Yna4/ 1dyqzkHYT6EEFGyhvnsjQsVAsGJCVQw91vYa5vcG0s56jzOX/mNabJ3taEu2zHXnRmTe TNAg== 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=ntrsNhAyOOgMXZMp6zh4HTN0Tx78MaxJouIAxQNAnI8=; fh=8yVhKi7zq7E6lX+LKEse+o954cKIk58/mhM+RTwB0oI=; b=hi3PT8BYO5WNwbDI+Zcwoy4qUZb9DC751YZljqEYSwsPy6itPQ9jQrJO7U9ir5VHPD 6crbHXzpnn4ZHPZ7os3On7G6iZ4POKjOUHIhV6ZFK5jAFVFiQiOE+SjmT4h9vjHFH6vm iAoT6r+O66gc3ti1Sz11zCKNxlaTISncoYA1iIJQnBvbY0gVlnDEJpoIndR9sBKIBRcR wy1DQlt9cMUgdLWKrfB4lyUpXYR0Wmruuv3juksEmxVES4cUCf24pV5NqfsAhms6LBkh C04ycb8eoqiKW+UCpfdyGEZNdn5Cabrmg7DNTVzVU5bc+01BIviiqT0YPLPE1DUkrq+8 bd6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=Ti6s3Rfz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id w29-20020a63161d000000b00577d99bd045si16802673pgl.843.2023.09.27.14.20.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 14:20:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=Ti6s3Rfz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 5360D8063023; Wed, 27 Sep 2023 08:00:48 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232271AbjI0PAb (ORCPT + 99 others); Wed, 27 Sep 2023 11:00:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55230 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232067AbjI0PA3 (ORCPT ); Wed, 27 Sep 2023 11:00:29 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB095F4; Wed, 27 Sep 2023 08:00:27 -0700 (PDT) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 3FC1D21871; Wed, 27 Sep 2023 15:00:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1695826826; 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=ntrsNhAyOOgMXZMp6zh4HTN0Tx78MaxJouIAxQNAnI8=; b=Ti6s3RfzLpsWtNcGRLkWU78lEcclV7iQ8fZ8Sk/gHgmoL6gZikY8cEs53gy2XRqaXyBkeR yg+hVf19WoF2a/z52qzb9MDxryiWrtARId2lzxKiHdIQHNziR3jx9Nvnj9SsefNuSGmuHd N6G/151E9e0jDELXUPhczncG47APK6M= 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 DC3842C145; Wed, 27 Sep 2023 15:00:24 +0000 (UTC) Date: Wed, 27 Sep 2023 17:00:24 +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 , Joel Fernandes , Josh Triplett , Boqun Feng , Mathieu Desnoyers , Lai Jiangshan , Zqiang , rcu@vger.kernel.org Subject: Re: [PATCH printk v2 10/11] rcu: Add atomic write enforcement for rcu stalls Message-ID: References: <20230919230856.661435-1-john.ogness@linutronix.de> <20230919230856.661435-11-john.ogness@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230919230856.661435-11-john.ogness@linutronix.de> X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Wed, 27 Sep 2023 08:00:48 -0700 (PDT) On Wed 2023-09-20 01:14:55, John Ogness wrote: > Invoke the atomic write enforcement functions for rcu stalls to > ensure that the information gets out to the consoles. > > 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. > > Signed-off-by: John Ogness > --- > kernel/rcu/tree_stall.h | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/kernel/rcu/tree_stall.h b/kernel/rcu/tree_stall.h > index 6f06dc12904a..0a58f8b233d8 100644 > --- a/kernel/rcu/tree_stall.h > +++ b/kernel/rcu/tree_stall.h > @@ -8,6 +8,7 @@ > */ > > #include > +#include > > ////////////////////////////////////////////////////////////////////////////// > // > @@ -582,6 +583,7 @@ static void rcu_check_gp_kthread_expired_fqs_timer(void) > > static void print_other_cpu_stall(unsigned long gp_seq, unsigned long gps) > { > + enum nbcon_prio prev_prio; > int cpu; > unsigned long flags; > unsigned long gpa; > @@ -597,6 +599,8 @@ static void print_other_cpu_stall(unsigned long gp_seq, unsigned long gps) > if (rcu_stall_is_suppressed()) > return; > > + prev_prio = nbcon_atomic_enter(NBCON_PRIO_EMERGENCY); > + > /* > * OK, time to rat on our buddy... > * See Documentation/RCU/stallwarn.rst for info on how to debug > @@ -651,6 +655,8 @@ static void print_other_cpu_stall(unsigned long gp_seq, unsigned long gps) > panic_on_rcu_stall(); > > rcu_force_quiescent_state(); /* Kick them all. */ > + > + nbcon_atomic_exit(NBCON_PRIO_EMERGENCY, prev_prio); The locations looks reasonable to me. I just hope that we would use another API: nbcon_emergency_enter()/exit() in the end. Note that the new API it would allow to flush the messages in the emergency context immediately from printk(). In that case, we would to handle nmi_trigger_cpumask_backtrace() some special way. This function would be called from the emergency context but the nmi_cpu_backtrace() callbacks would be called on other CPUs in normal context. For this case I would add something like: void nbcon_flush_all_emergency(void) { emum nbcon_prio = nbcon_get_default_prio(); if (nbcon_prio >= NBCON_PRIO_EMERGENCY) nbcon_flush_all(); } , where the POC of nbcon_get_default_prio() and nbcon_flush_all() was in the replay to the 7th patch, see https://lore.kernel.org/all/ZRLBxsXPCym2NC5Q@alley/ Best Regards, Petr