Received: by 10.223.176.5 with SMTP id f5csp24522wra; Fri, 2 Feb 2018 15:47:50 -0800 (PST) X-Google-Smtp-Source: AH8x225lLLbxWmBlE2k5ulAIt1/S6xWzLYgkPY0dhqPmWK1FUlgF0u9pVETxdx2Npfy+AT68llvJ X-Received: by 2002:a17:902:ab85:: with SMTP id f5-v6mr37069562plr.199.1517615269996; Fri, 02 Feb 2018 15:47:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517615269; cv=none; d=google.com; s=arc-20160816; b=Q6LVrCWiluR2kWRNIXpvMVan1Sa48FmFnPFUbF0sOBLSK5aVsnCcFQCrlFDfP3wqER 5nBB6r6Tt2eNYzOh9oAJEkm2xKPuiZPwHD94CobsHFMLr6KjntICLGnkcboZT7zzgSGO m/4xrBEF7eFo9AKA47+695GsgIfMUhmCpuZ8BauRsuql4rJ8WH0IIfqvF51J3LQut+H8 n5NJmn2magYngPs3k0aVxZ8T0tI839ocCWrkF7+CARQHPguMOuMLFs7E0hgG1EJ8T8Mw fPdw9GuV1LABRZh6BHAxa1oZOAX4tAMbL651mezymfNwUcRpqyE3peEny+jv1BRWPnth oacQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=xdIMXOsmZ/80ivmP8c3FE4E8KwOVYnDTYRJoe4nZXzo=; b=KXHk34wh1nwx+pG6TQJI/2ZifFVMs6pzoaW4mB9EO7qH3GgUOHrAQsQzP6res+/t3V 6ZETasRprJcuEZdB4XOoo6ZdHHZXmBg6qRoB4tfMLSN49y+5G3OgET0A6/Et/u9z6aVH D9x9QEn4bsAsyPlGkGOlgM/omjPf5dEppNSXwROS2zVeTxTq9E2Hre18ryKWPkv75hkO V0PEge/mq6KXDGP/cKO/4WX8Y+sukBp3voassUrzMccxVZsytyI1RNW01zIprEIn2dZh OH0Q+FuELQE2UdifUDO8/6qLTwWO08duSvAMNfClwwPHb+YrcNJfc7/OgpkkZJZnlA9p a1SA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e6-v6si2655009plo.702.2018.02.02.15.47.35; Fri, 02 Feb 2018 15:47:49 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752641AbeBBXoi (ORCPT + 99 others); Fri, 2 Feb 2018 18:44:38 -0500 Received: from h2.hallyn.com ([78.46.35.8]:33642 "EHLO h2.hallyn.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751669AbeBBXob (ORCPT ); Fri, 2 Feb 2018 18:44:31 -0500 Received: by h2.hallyn.com (Postfix, from userid 1001) id 9766A1205C8; Fri, 2 Feb 2018 17:44:30 -0600 (CST) Date: Fri, 2 Feb 2018 17:44:30 -0600 From: "Serge E. Hallyn" To: "Paul E. McKenney" Cc: Tejun Heo , linux-kernel@vger.kernel.org, kernel-team@fb.com Subject: Re: Can RCU stall lead to hard lockups? Message-ID: <20180202234430.GA25611@mail.hallyn.com> References: <20180109035207.GD3668920@devbig577.frc2.facebook.com> <20180109042425.GS9671@linux.vnet.ibm.com> <20180109141114.GF3668920@devbig577.frc2.facebook.com> <20180109152234.GU9671@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180109152234.GU9671@linux.vnet.ibm.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Quoting Paul E. McKenney (paulmck@linux.vnet.ibm.com): > On Tue, Jan 09, 2018 at 06:11:14AM -0800, Tejun Heo wrote: > > Hello, Paul. > > > > On Mon, Jan 08, 2018 at 08:24:25PM -0800, Paul E. McKenney wrote: > > > > I don't know the RCU code at all but it *looks* like the first CPU is > > > > taking a sweet while flushing printk buffer while holding a lock (the > > > > console is IPMI serial console, which faithfully emulates 115200 baud > > > > rate), and everyone else seems stuck waiting for that spinlock in > > > > rcu_check_callbacks(). > > > > > > > > Does this sound possible? > > > > > > 115200 baud? Ouch!!! That -will- result in trouble from console > > > printing, and often also in RCU CPU stall warnings. > > > > It could even be slower than 115200, and we occassionally see RCU > > stall warnings caused by printk storms, for example, while the kernel > > is trying to dump a lot of info after an OOM. That's an issue we > > probably want to improve from printk side; however, they don't usually > > lead to NMI hard lockup detector kicking in and crashing the machine, > > which is the peculiarity here. > > > > Hmmm... show_state_filter(), the function which dumps all task > > backtraces, share a similar problem and it avoids it by explicitly > > calling touch_nmi_watchdog(). Maybe we can do something like the > > following from RCU too? > > If this fixes things for you, I would welcome such a patch. Hi - would this also be relevant to 4.9-stable and 4.4-stable, or has something elsewhere changed after 4.9 that actually triggers this? thanks, -serge > Thanx, Paul > > > diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h > > index db85ca3..3c4c4d3 100644 > > --- a/kernel/rcu/tree_plugin.h > > +++ b/kernel/rcu/tree_plugin.h > > @@ -561,8 +561,14 @@ static void rcu_print_detail_task_stall_rnp(struct rcu_node *rnp) > > } > > t = list_entry(rnp->gp_tasks->prev, > > struct task_struct, rcu_node_entry); > > - list_for_each_entry_continue(t, &rnp->blkd_tasks, rcu_node_entry) > > + list_for_each_entry_continue(t, &rnp->blkd_tasks, rcu_node_entry) { > > + touch_nmi_watchdog(); > > + /* > > + * We could be printing a lot of these messages while > > + * holding a spinlock. Avoid triggering hard lockup. > > + */ > > sched_show_task(t); > > + } > > raw_spin_unlock_irqrestore_rcu_node(rnp, flags); > > } > > > > @@ -1678,6 +1684,12 @@ static void print_cpu_stall_info(struct rcu_state *rsp, int cpu) > > char *ticks_title; > > unsigned long ticks_value; > > > > + /* > > + * We could be printing a lot of these messages while holding a > > + * spinlock. Avoid triggering hard lockup. > > + */ > > + touch_nmi_watchdog(); > > + > > if (rsp->gpnum == rdp->gpnum) { > > ticks_title = "ticks this GP"; > > ticks_value = rdp->ticks_this_gp; > >