Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp561823ybx; Tue, 5 Nov 2019 01:54:28 -0800 (PST) X-Google-Smtp-Source: APXvYqy5/uEu7nRWrSqfGXL/P5xXe8PFNQpoxqwf7+CHZ22lo5hOYS7csRhuJrASal2oDjTQ+47d X-Received: by 2002:a50:ff19:: with SMTP id a25mr34366593edu.181.1572947668376; Tue, 05 Nov 2019 01:54:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1572947668; cv=none; d=google.com; s=arc-20160816; b=DuVA6zikikT7COTT6dcs3YcMHBSZ0ie6wtl0+AamBTHy6Eerzdlhu7eWeDBWaB7jKL sxuOAPf3hDbBhogHnJgnzR/3ker0PqnkfjA+/uGquVDJPVUXrq+SHn9/5rTrir4jS3ad 3e2cjhj05Ug7SwHdSyUgqyNOJO8abnnyLRKKe+4aWPSQic8PKWnEe2y1NvKRmrnOemye dq0gaG9yBhL9HXnDJwu2GPLTSVtTlVWSowru9pjx3yLXMCReDUYWyq5WJ5Jz0aaOxTSE JG/clh3tTittIVWZmgmIZYHQlSKCbsVZft9xqzIl18LXiQydWPk0JgDn6wRcmWkU0/nl kzAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date; bh=TYxesS+CweIPD7dsqWPnipj0Z531Jla6D+UNWsSV9rQ=; b=Wx5D78izlUtM/aOCq/TyRR4JHKYx+Z5QJ29Rlnu68/cKTOtLM0KjJdy4x9h/B4eGOu SDOUJd+FJE4cOe78KH0Z8BbmQM0U0w8r5aZcxBSzIk50yMzhReIhrNdjLSsEsC7s4s3G 3aQkUknTe72GyS1b89j6WUTsnqeT5g2/lvI1mZ2G6iscAaxpg5tD2Re0j+cUKeiJVhpM BUOtBX7H7sZXD6BpwROIndNvf8y4BhzV5d/qw4i1TSU1qezEO+Mpo8JuSixYx5Z5JiI2 qhWeFyWl8AiUPZ/KyWmRw+451Qt9NiXn+IpaJPVtRkB7UAw+HX4c4VPTOEKn0sFVbeyB rsTQ== 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 l15si12748735ejp.114.2019.11.05.01.54.05; Tue, 05 Nov 2019 01:54:28 -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 S2388021AbfKEJx1 (ORCPT + 99 others); Tue, 5 Nov 2019 04:53:27 -0500 Received: from Galois.linutronix.de ([193.142.43.55]:40745 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730615AbfKEJx0 (ORCPT ); Tue, 5 Nov 2019 04:53:26 -0500 Received: from [5.158.153.52] (helo=nanos.tec.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1iRvWc-00007n-Cx; Tue, 05 Nov 2019 10:53:22 +0100 Date: Tue, 5 Nov 2019 10:53:21 +0100 (CET) From: Thomas Gleixner To: Scott Wood cc: Peter Zijlstra , Frederic Weisbecker , Ingo Molnar , LKML Subject: Re: [PATCH] timers/nohz: Update nohz load even if tick already stopped In-Reply-To: <7b782bc880a29eb7d37f2c2aff73c43e7f7d032f.camel@redhat.com> Message-ID: 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> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 5 Nov 2019, Scott Wood wrote: > On Tue, 2019-11-05 at 00:43 +0100, Thomas Gleixner wrote: > > As Peter pointed out to me privately we should rather go and analyze the > > real thing instead of just applying duct tape. > > > > /me drops the patch again. > > The warning is due to kernel/sched/idle.c not updating curr->se.exec_start. > > 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()? Well, no. tick_nohz_restart() can be invoked in a situation where the timer is armed for something in the far future (or completelt disabled) due to previously entering an estimated long idle (or user space execution on NOHZ_FULL) period. That means if the timer is not canceled, realigned to the current tick and forwarded to the next due tick, the tick will not fire on time causing another sort of trouble. > 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. Care to give that a shot? Thanks, tglx