Received: by 10.223.176.5 with SMTP id f5csp122713wra; Tue, 6 Feb 2018 18:35:11 -0800 (PST) X-Google-Smtp-Source: AH8x2240y+fJHl2y8m/Ew71S3HgdT0gb+1m2QDbaG9zjveatf8mhZ8rox13W8xnyqU1bPBBE/f3C X-Received: by 10.98.5.129 with SMTP id 123mr4392571pff.75.1517970911620; Tue, 06 Feb 2018 18:35:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517970911; cv=none; d=google.com; s=arc-20160816; b=c/+Ml2vpMl6XfftaAbET2qdZLbDCAciWIKSsTI71okXQ8gbDRs7wZJLKawZEXd4DFV pCwaaQDh+B4P1c4A1reGDCkR6WDk6WUR6CTx92PYxjy7e9uZ9Bh/85NwctMOzeIVP/Sx 6HNwTIJheS0dRFdn8a6bK0QJsfbLg02Zza5jdtwVlGGnCh89n9sccvm8unzqPCvvXqPN sDZvxtAzX3HwjVGIREiL5m3e4H9+ARVqAo+INU7D7H8Eaho2HtZOQm6F3SLiAtAcoHYM 5Ck+UM350mpHRtisElDPcpHMys/RSwt8kYgB9lBVz96rVakJLCqGsVDuRVHrSE0HquTf 0enw== 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=1i7XFBfrJZLUweUSHWaJUNoOwwbLR8yCk2cJoQ0MVUs=; b=FS1xkk8vHlei2uOQYamrKub3r/Ae0GSKilUnGkEBqdk9L+WypJn0h+O1XWeJLC7x29 awmt1AZIsecujHbFNtUhTei74GVUzuoFGQtCNARegWB8sYeTP6aqH3ODnsxs5kNXRKct 8227FcaH+MJtm7cjqANCwC6FVrH1W05nyRnVSMaRzVziFYrI07kp8e4kV9saEy8h/G/r ZDhBWoPuEt2aCQZa+M2I/9hGhkkXCxJiRniptRKkp81yKTl0A0k0/I0B5UQdn7s8GPsN VONnXDZHkQW+zSlc1AMp6wg9FVNzwuyBPaZBXu1C6REwhGKasLg5DoPh4xwT5RCvCrzv hoXA== 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 m11-v6si309605pla.712.2018.02.06.18.34.56; Tue, 06 Feb 2018 18:35:11 -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 S1753335AbeBGCdF (ORCPT + 99 others); Tue, 6 Feb 2018 21:33:05 -0500 Received: from h2.hallyn.com ([78.46.35.8]:39256 "EHLO mail.hallyn.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753081AbeBGCdE (ORCPT ); Tue, 6 Feb 2018 21:33:04 -0500 Received: by mail.hallyn.com (Postfix, from userid 1001) id 176BA1206BA; Tue, 6 Feb 2018 20:33:03 -0600 (CST) Date: Tue, 6 Feb 2018 20:33:03 -0600 From: "Serge E. Hallyn" To: "Paul E. McKenney" Cc: "Serge E. Hallyn" , Tejun Heo , linux-kernel@vger.kernel.org, kernel-team@fb.com Subject: Re: Can RCU stall lead to hard lockups? Message-ID: <20180207023303.GA10583@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> <20180202234430.GA25611@mail.hallyn.com> <20180203205032.GN3617@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180203205032.GN3617@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 On Sat, Feb 03, 2018 at 12:50:32PM -0800, Paul E. McKenney wrote: > On Fri, Feb 02, 2018 at 05:44:30PM -0600, Serge E. Hallyn wrote: > > 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? > > As far as I can tell, slow console lines have been prone to RCU CPU stall > warnings for a very long time. > > Thanx, Paul Ok, thanks Paul. Tejun were you going to push 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; > > > > > >