Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp311409ybx; Wed, 6 Nov 2019 00:41:31 -0800 (PST) X-Google-Smtp-Source: APXvYqzJ4QvvfH2oWIGZwB2eP0ktO+C6lIMnGzM6NFMO5t/6x7ppYXcGVil53HSjzdadUz54tekz X-Received: by 2002:a17:906:24d4:: with SMTP id f20mr34305813ejb.182.1573029691344; Wed, 06 Nov 2019 00:41:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573029691; cv=none; d=google.com; s=arc-20160816; b=Kgs4/2YtdIMBB9cXTG3aFgY9yCt/POxvLGpSXSSDQj9gni+XAG3TDZtvSUkUBJZ65V +TtyfKMcZyyVO9Bm7ffrXqfVcomruIGitcVM60mx2Ln9wIvpyGguG7nFns3UsLTrQljS NcR1hWtc35pmGLw+6M+9PmUfH53tBQM4DlZZySxIVN73FEhk9JJVI8Vnu9H3A5Z0Zmc8 CMRtxXjMdO4lVAIg7wO1dOj/MI/XQUhCVGjYTwXpdaqcMcULztdZgqaCT8kp/MUSR3h6 BdrsPslWxg6QVnBFd912IzWCPfl90Y5cZgROZC4Hum7hMfxdSCrgK+Ray/RzQSkp4XSa dcnQ== 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:dkim-signature; bh=MnHRM+LubVd4oXbtR/ESu5wl/pt6GWxUj9mlIliiUuk=; b=fVkx3CXjPyNFPW3Y2INekj1sqv3xxVSIJeHA19PXE3aVnvODuRALSUk2KdIdahSQe3 Xqw/9nobqqAasg2113n8J+y7aIXkC6551At350SuQuDr/8JPL/a0MoiJMhhZfY2IPM1z sIWA1ILPpnpME/KTUpVYAIbyBeb1tXTIJyOfsheyI3ZxCGt0MgM7fX3ZJRC745s2u2Z2 6xtOPrf6E9qISP12W/F62t5Jk6y/1HY87Qh8EVHih84JKr5sC6Cs9vDKAGDC4BlmY2p/ 5PG4FbTrK8xL6bxACDfrjisNt3s8Qc+1xPcmnd7wyD6vgGFqQ9f6Hv4leY9u1FfCFmb7 4YDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=k+cfoYga; 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 i24si14888674ejh.35.2019.11.06.00.41.08; Wed, 06 Nov 2019 00:41:31 -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; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=k+cfoYga; 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 S1731483AbfKFIhy (ORCPT + 99 others); Wed, 6 Nov 2019 03:37:54 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:34564 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731414AbfKFIhx (ORCPT ); Wed, 6 Nov 2019 03:37:53 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=MnHRM+LubVd4oXbtR/ESu5wl/pt6GWxUj9mlIliiUuk=; b=k+cfoYgaNsu/dB9KYFzitP3iR RiIk2BsWLNof9jVorQo+DpHAdtQHt+k5ntQh1koLdTnD5GAObyNQIEcam41po1L6DzTBqI2k1rRhI OE6VW0rgkzLyT8nRjbDbT9j7HF46ejqMFzlByrlPLLrGnazWDH9rHOlfYTrZoZItbJjhFPpqXq12h 3QxGnY+GcBpJ36vlNgXUvxx/dWH1r98NY3q6//xlLlhyazf1AoZLsT+1koxcZo+NXt/EEl8Fcn/KM 4ZEidmpQxUfHKJA7SaReFNEtmQ01X9G75+jR7UMqMNuX+7M+fT/YwPYXEof9fyK3/BRkqT7ayUPkV uMDWUz43g==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1iSGp6-0001WY-9w; Wed, 06 Nov 2019 08:37:52 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id D834B300692; Wed, 6 Nov 2019 09:36:45 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id E1A342020D8FD; Wed, 6 Nov 2019 09:37:49 +0100 (CET) Date: Wed, 6 Nov 2019 09:37:49 +0100 From: Peter Zijlstra To: Scott Wood Cc: Thomas Gleixner , Frederic Weisbecker , Ingo Molnar , LKML Subject: Re: [PATCH] timers/nohz: Update nohz load even if tick already stopped Message-ID: <20191106083749.GJ5671@hirez.programming.kicks-ass.net> References: <20191028150716.22890-1-frederic@kernel.org> <20191029100506.GJ4114@hirez.programming.kicks-ass.net> <52d963553deda810113accd8d69b6dffdb37144f.camel@redhat.com> <20191030133130.GY4097@hirez.programming.kicks-ass.net> <813ed21938aa47b15f35f8834ffd98ad4dd27771.camel@redhat.com> <7b782bc880a29eb7d37f2c2aff73c43e7f7d032f.camel@redhat.com> <20191105124351.GN4131@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191105124351.GN4131@hirez.programming.kicks-ass.net> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 05, 2019 at 01:43:51PM +0100, Peter Zijlstra wrote: > On Tue, Nov 05, 2019 at 01:30:58AM -0600, Scott Wood wrote: > > The warning is due to kernel/sched/idle.c not updating curr->se.exec_start. > > Ah, indeed so. > > > While debugging I noticed an issue with a particular load pattern. The CPU > > goes non-nohz for a brief time at an interval very close to twice > > tick_period. When the tick is started, the timer expiration is more than > > tick_period in the past, so hrtimer_forward() tries to catch up by adding > > 2*tick_period to the expiration. Then the tick is stopped before that new > > expiration, and when the tick is woken up the expiry is again advanced by > > 2*tick_period with the timer never actually running. sched_tick_remote() > > does fire every second, but there are streaks of several seconds where it > > keeps catching the CPU in a non-nohz state, so neither the normal nor remote > > ticks are calling calc_load_nohz_remote(). > > > > Is there a reason to not just remove the hrtimer_forward() from > > tick_nohz_restart(), letting the timer fire if it's in the past, which will > > take care of doing hrtimer_forward()? > > I'll have to look into that. I always get confused by all that nohz code > :/ > > > As for the warning in sched_tick_remote(), it seems like a test for time > > since the last tick on this cpu (remote or otherwise) would be better than > > relying on curr->se.exec_start, in order to detect things like this. > > I don't think we have a timestamp that is shared between the remote and > local tick. Also, there is a reason this warning uses the task time > accounting, there used to be (as in, I can't find it in a hurry) code > that could not deal with >u32 (~4s) clock updates. > > The below should have idle keep the timestamp up-to-date. Keeping > accurate idle->se.sum_exec_runtime doesn't seem too interesting, the > idle code already keeps track of total idle times. > > --- The obvious alternative is something like: if (rq->curr != rq->idle) { s64 delta = rq_clock_task(rq) - curr->se.exec_start; WARN_ON_ONCE(delta > 3ULL * NSEC_PER_SEC); } Which would avoid polluting the idle path with that extra assignment.