Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1470167pxb; Thu, 4 Mar 2021 12:09:29 -0800 (PST) X-Google-Smtp-Source: ABdhPJzaReDcJZwqHyCUf9IDhyuAju5x3gHWrk+7DgIrYWhpaHUjvp7mXZeXnM/DvQdfxgxcWqSN X-Received: by 2002:a17:907:c05:: with SMTP id ga5mr6069667ejc.380.1614888569602; Thu, 04 Mar 2021 12:09:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614888569; cv=none; d=google.com; s=arc-20160816; b=kSdcwNVt2XDa8GcAwD8po785nri95MAvE61NwFJVnor+FqoiOCubWpai5497/RVWZv BNgyGViqzHUJY/RXxdn/+8cYXyxk1gcH6X4J2Lh6dAf5b6JEsYgUZLc84UaKJZRczSpJ YBzzv9jmX596I5YqsGCLSe6VtbmVyUT1laitAN7wmLkGnquPBsHMsxKFEFqDkKhMpydp +LB8FDcvlzSj1HPhyS42LBZXhNv3hbw/Xb3Kl7BdeeDCjq/e5G53hdPginnnjvtjjkpV EASO2GehW0XBtkbFCgVMu++Kw773zqGJn0Pmd8T5496erBoFHad+Lg+FBbbR8ld6WNZ3 i/hA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=gBg6cOnvyVEJiB/Wd77T52e5jGptP2Iu7gCWRfdsta4=; b=uK+10+tVOJnHsdswe2nvc6AQ7BRKQ6wejbpaB5SGyoCWZ4bCjZYrFLywbom0J7qDKS 25dkUVabMa1fMIVkN5pAh/yggb1tUxhLrCyAdgBXekuNXJnyWL6vOy4n7MnGPOJ+pMf1 cQOZ5DwhSsOR28r/rzKpNv1DpsljREBECOcox5ZuI6r8sTk3vB55t/SMBQUrFbuGz/mz /yviqXu6YsblpMEGH5hHZoXXNft0kWJSFnez55o8XYWg1diDU7JMfTLneQAFYke6vvpD 9F4MfS744pmKJ4tkmBnceKeFvVXV/K4KYgQJ8j9P6eoEXeLiaxq4imculUCPsrLLpa5y +aJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ESZ1zD1B; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a20si113494ejg.257.2021.03.04.12.09.05; Thu, 04 Mar 2021 12:09:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ESZ1zD1B; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238056AbhCDUHP (ORCPT + 99 others); Thu, 4 Mar 2021 15:07:15 -0500 Received: from mail.kernel.org ([198.145.29.99]:51080 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237970AbhCDUHF (ORCPT ); Thu, 4 Mar 2021 15:07:05 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id BD9D664F70; Thu, 4 Mar 2021 20:06:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1614888384; bh=1E47zo1UX1daMBkM4qjbkmwt7RCf0Z/zmzP302jpzvk=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=ESZ1zD1BDEfhn5vcQuVXG+O8rmO8vwR8D7S60IGkdnckssg0c6zRGrHTAD5mOgJeg HrLj/a7PYOcsipO8oRlm89deUoCaekzKLGn1LUI/YbYiN8B7AVGqPUMC/9Cak+Ez2o +VseoP761bOmvHFRXK+GiaGe4Wj5H/IoDS5bfc/XojrA48r5RWWPWqXjwyL+dF+Hf/ NB/t0EvER4fJcRQHbxGl5mmVZ6sS+aJA37L7MUFxm5iBBymrjgM0plKSfY21gmZgJ9 fnUR5wx1OTmMU9/IIJ5oN0nj6txa18DaPT6tMG2YKZfoTrPOwrnF/IwU2tWEytTsAF RVgAlyP9IOp0g== Received: by paulmck-ThinkPad-P72.home (Postfix, from userid 1000) id 8A38035226C1; Thu, 4 Mar 2021 12:06:24 -0800 (PST) Date: Thu, 4 Mar 2021 12:06:24 -0800 From: "Paul E. McKenney" To: "Rafael J. Wysocki" Cc: rcu@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@fb.com, mingo@kernel.org, jiangshanlai@gmail.com, akpm@linux-foundation.org, mathieu.desnoyers@efficios.com, josh@joshtriplett.org, tglx@linutronix.de, peterz@infradead.org, rostedt@goodmis.org, dhowells@redhat.com, edumazet@google.com, fweisbec@gmail.com, oleg@redhat.com, joel@joelfernandes.org, Frederic Weisbecker Subject: Re: [PATCH tip/core/rcu 02/12] timer: Report ignored local enqueue in nohz mode Message-ID: <20210304200624.GU2696@paulmck-ThinkPad-P72> Reply-To: paulmck@kernel.org References: <20210304002225.GA23492@paulmck-ThinkPad-P72> <20210304002311.23655-2-paulmck@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 04, 2021 at 12:58:54PM +0100, Rafael J. Wysocki wrote: > On 3/4/2021 1:23 AM, paulmck@kernel.org wrote: > > From: Frederic Weisbecker > > > > Enqueuing a local timer after the tick has been stopped will result in > > the timer being ignored until the next random interrupt. > > > > Perform sanity checks to report these situations. > > > > Cc: Peter Zijlstra > > Cc: Thomas Gleixner > > Cc: Ingo Molnar > > Cc: Rafael J. Wysocki > > Signed-off-by: Frederic Weisbecker > > Signed-off-by: Paul E. McKenney > > Reviewed-by: Rafael J. Wysocki Applied, thank you! Thanx, Paul > > --- > > kernel/sched/core.c | 24 +++++++++++++++++++++++- > > 1 file changed, 23 insertions(+), 1 deletion(-) > > > > diff --git a/kernel/sched/core.c b/kernel/sched/core.c > > index ca2bb62..4822371 100644 > > --- a/kernel/sched/core.c > > +++ b/kernel/sched/core.c > > @@ -674,6 +674,26 @@ int get_nohz_timer_target(void) > > return cpu; > > } > > +static void wake_idle_assert_possible(void) > > +{ > > +#ifdef CONFIG_SCHED_DEBUG > > + /* Timers are re-evaluated after idle IRQs */ > > + if (in_hardirq()) > > + return; > > + /* > > + * Same as hardirqs, assuming they are executing > > + * on IRQ tail. Ksoftirqd shouldn't reach here > > + * as the timer base wouldn't be idle. And inline > > + * softirq processing after a call to local_bh_enable() > > + * within idle loop sound too fun to be considered here. > > + */ > > + if (in_serving_softirq()) > > + return; > > + > > + WARN_ON_ONCE("Late timer enqueue may be ignored\n"); > > +#endif > > +} > > + > > /* > > * When add_timer_on() enqueues a timer into the timer wheel of an > > * idle CPU then this timer might expire before the next timer event > > @@ -688,8 +708,10 @@ static void wake_up_idle_cpu(int cpu) > > { > > struct rq *rq = cpu_rq(cpu); > > - if (cpu == smp_processor_id()) > > + if (cpu == smp_processor_id()) { > > + wake_idle_assert_possible(); > > return; > > + } > > if (set_nr_and_not_polling(rq->idle)) > > smp_send_reschedule(cpu); > >