From patchwork Sun Aug 20 04:45:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 803643 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xZkp51kRfz9sN5 for ; Sun, 20 Aug 2017 14:47:41 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="W4NMTGq+"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3xZkp50YGKzDqkY for ; Sun, 20 Aug 2017 14:47:41 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="W4NMTGq+"; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Received: from mail-pf0-x242.google.com (mail-pf0-x242.google.com [IPv6:2607:f8b0:400e:c00::242]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3xZkmN6G5fzDqZw for ; Sun, 20 Aug 2017 14:46:12 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="W4NMTGq+"; dkim-atps=neutral Received: by mail-pf0-x242.google.com with SMTP id r62so1470286pfj.4 for ; Sat, 19 Aug 2017 21:46:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:in-reply-to:references :organization:mime-version:content-transfer-encoding; bh=bYJLrZGs1sMQkGrExqILmuOqxVNgRM+2o7uUOCMpvf8=; b=W4NMTGq+EdyK53HHk9jVT+P9L3IigBMfU1rQBP0PIg7XZB2B1fWUP2oOAtQ984CSzl i4SxZUeZvJRZek3ABSlhUfnD7Gdy8xQXOGvCLtRGk7ZiIJW/EsXnnmn2YhrSkZIjqf7Y iGj497aGZIpjREBjsM5paJumf6GJpBJA19pwEwEI2/xE+qHuLFtsqlzaY7q5OYg7/WfG pVUm9DOkOnZ4Sa5+8jC7PHyFb1mRDY4RFcBK8zT9BtWhddu85c50u2hpeh2hiw9pE28C lGtylXznXUfFt9x06gTtRnzs1S7hYoFprY6Ta2qgLUV9/FPVyBnCApZwuFwUiC3wzBTf i9UA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:organization:mime-version:content-transfer-encoding; bh=bYJLrZGs1sMQkGrExqILmuOqxVNgRM+2o7uUOCMpvf8=; b=ik1Ry0poea8vJhyvUeIGljaTlsE/Tg//8njZki4qAN+JBfQILQONBTPKsI0wIE8bMk caIUNHjWt86SdVixh1PReDn3YcTO0V4R1dprd9d6e0GfFQkL53nhg0tVLeQzqk0yhW0U TsCADkqORPS2zLR4HH80bP21z+s9vDVs+L83GQ2rWtvCcjZFWCD4Y/aeuDr+3+4NV+A3 O540hRVMB5qqv12U+PtVHXTAcQfPUvQiGzwWlSbxv40uy06j8R9WR2FWKkYhVDHuSWSp Rr2nr0VupnbZKwrL3kBk4h0WqHZuPbc1hhUE8h6M3N1mtxhkDjCtHcsNMD5E2SitDg1c xSgA== X-Gm-Message-State: AHYfb5hka5jEeTjH2PNu/7PJxJq8Zlr1/ZYW7KNrFg8g3LDncRI1puwD 2I+5QbPDUVwVGg== X-Received: by 10.101.76.5 with SMTP id u5mr12859194pgq.119.1503204371046; Sat, 19 Aug 2017 21:46:11 -0700 (PDT) Received: from ppc64le (203-219-56-202.tpgi.com.au. [203.219.56.202]) by smtp.gmail.com with ESMTPSA id y25sm18164781pfk.162.2017.08.19.21.46.04 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 19 Aug 2017 21:46:09 -0700 (PDT) Date: Sun, 20 Aug 2017 14:45:53 +1000 From: Nicholas Piggin To: "Paul E. McKenney" Subject: Re: RCU lockup issues when CONFIG_SOFTLOCKUP_DETECTOR=n - any one else seeing this? Message-ID: <20170820144553.2ab2727b@ppc64le> In-Reply-To: <20170816162731.GA22978@linux.vnet.ibm.com> References: <20170728182053.000072aa@huawei.com> <20170728190349.GM3730@linux.vnet.ibm.com> <20170731120847.00003d5c@huawei.com> <20170731150411.GA3730@linux.vnet.ibm.com> <20170731162757.000058ba@huawei.com> <20170801184646.GE3730@linux.vnet.ibm.com> <20170802172555.0000468a@huawei.com> <20170815154743.GK7017@linux.vnet.ibm.com> <87wp63smwn.fsf@concordia.ellerman.id.au> <20170816125617.GY7017@linux.vnet.ibm.com> <20170816162731.GA22978@linux.vnet.ibm.com> Organization: IBM X-Mailer: Claws Mail 3.15.0-dirty (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: dzickus@redhat.com, sfr@canb.auug.org.au, linuxarm@huawei.com, David Miller , abdhalee@linux.vnet.ibm.com, john.stultz@linaro.org, Jonathan Cameron , sparclinux@vger.kernel.org, tglx@linutronix.de, linuxppc-dev@lists.ozlabs.org, akpm@linux-foundation.org, linux-arm-kernel@lists.infradead.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" On Wed, 16 Aug 2017 09:27:31 -0700 "Paul E. McKenney" wrote: > On Wed, Aug 16, 2017 at 05:56:17AM -0700, Paul E. McKenney wrote: > > Thomas, John, am I misinterpreting the timer trace event messages? So I did some digging, and what you find is that rcu_sched seems to do a simple scheudle_timeout(1) and just goes out to lunch for many seconds. The process_timeout timer never fires (when it finally does wake after one of these events, it usually removes the timer with del_timer_sync). So this patch seems to fix it. Testing, comments welcome. Thanks, Nick [PATCH] timers: Fix excessive granularity of new timers after a nohz idle When a timer base is idle, it is forwarded when a new timer is added to ensure that granularity does not become excessive. When not idle, the timer tick is expected to increment the base. However there is a window after a timer is restarted from nohz, when it is marked not-idle, and before the timer tick on this CPU, where a timer may be added on an ancient base that does not get forwarded (beacause the timer appears not-idle). This results in excessive granularity. So much so that a 1 jiffy timeout has blown out to 10s of seconds and triggered the RCU stall warning detector. Fix this by always forwarding the base when adding a new timer if it is more than 1 jiffy behind. Another approach I looked at first was to note if the base was idle but not yet run or forwarded, however this just seemed to add more branches and complexity when it seems we can just cover it with this test. Also add a comment noting a case where we could get an unexpectedly large granularity for a timer. I debugged this problem by adding warnings for such cases, but it seems we can't add them in general due to this corner case. Signed-off-by: Nicholas Piggin --- kernel/time/timer.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/kernel/time/timer.c b/kernel/time/timer.c index 8f5d1bf18854..8f69b3105b8f 100644 --- a/kernel/time/timer.c +++ b/kernel/time/timer.c @@ -859,10 +859,10 @@ static inline void forward_timer_base(struct timer_base *base) unsigned long jnow = READ_ONCE(jiffies); /* - * We only forward the base when it's idle and we have a delta between - * base clock and jiffies. + * We only forward the base when we have a delta between base clock + * and jiffies. In the common case, run_timers will take care of it. */ - if (!base->is_idle || (long) (jnow - base->clk) < 2) + if ((long) (jnow - base->clk) < 2) return; /* @@ -938,6 +938,13 @@ __mod_timer(struct timer_list *timer, unsigned long expires, bool pending_only) * same array bucket then just return: */ if (timer_pending(timer)) { + /* + * The downside of this optimization is that it can result in + * larger granularity than you would get from adding a new + * timer with this expiry. Would a timer flag for networking + * be appropriate, then we can try to keep expiry of general + * timers within ~1/8th of their interval? + */ if (timer->expires == expires) return 1;