Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp4286185pxf; Tue, 16 Mar 2021 09:43:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJztenKWmljAFx1GUMiQWud9qS3H8B19V4j9daKZ0PWhz0pFo1Yxavag2JCEEYbLj5ryi7UI X-Received: by 2002:a17:906:f8d5:: with SMTP id lh21mr30636761ejb.64.1615913036889; Tue, 16 Mar 2021 09:43:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615913036; cv=none; d=google.com; s=arc-20160816; b=ZVE81HL3ZI7EZj2BptO8a9y6nqMzAAI3Ha0pXFw17KO13RkACYoaci95lfKKTKO0z0 s3+tTFM7atT6R04A1smaELTrHmZGsLEk+280om9EIlv58j9g+ns98GjLFac2W7z6sGJr Cbzwvj1r/EP+vHHGVd8oMqy5EXb8AcbZkYFkBxlehQy3wl1VUvI/1MDzjhrQIIlAxtBN bpC6T5xtwuOnAIW4OMz9CmjPL6JqlK5nI7vOWdryQysptlexWMIfs6HhPmVTSjBcD29z OLIoAuhOYCuNRl0pPT7gKAOtUEelQLxEqCXnF+0PTYwv14e5Zz+weWpKlEEYZBIk84bw dhXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=OGmqb8bd2k4uQAcmFJO02M/bVFEk0pVsLjKNZFO7H8U=; b=Z0MrHTyk4F/9qZ6JowAvDp37LS+hXbmXWZ91aZASoj/9ZkgIXsEwgX2BNLaZ1MtOUM WBejjbtMGKn66GAbCpA3kQJX5gtvl7JJNDP2SZUz5WW0FBrmZNfOuJzd8mcST/tZWn85 ices5f3b+LI2SHgvcszD6mVqXsmpbBdK2EhCqtLE9ZDJ5XRS/G+bDupi0rn1wKkL0Wt+ DUs/fCraPIshQnknlwJkGqts3LXGzGknvWcPIZt5kxoQzhueA7zJqBzSbkHvdZ0ZZ2vt YDfrm/v2XCJdLWn6Jxm4T2uFUvHT1X0pAdgf3WWAQfPVWXObhAuX+y5n6OfhTsBIN8IV bWwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=IP5DJMbo; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r12si15123300ejz.5.2021.03.16.09.43.34; Tue, 16 Mar 2021 09:43:56 -0700 (PDT) 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=@infradead.org header.s=desiato.20200630 header.b=IP5DJMbo; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236711AbhCPP2e (ORCPT + 99 others); Tue, 16 Mar 2021 11:28:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35748 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236708AbhCPP2K (ORCPT ); Tue, 16 Mar 2021 11:28:10 -0400 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D28DC06174A for ; Tue, 16 Mar 2021 08:28:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; 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; bh=OGmqb8bd2k4uQAcmFJO02M/bVFEk0pVsLjKNZFO7H8U=; b=IP5DJMboAeWlisUPED4xpD5Z5q 2P9jG+CMq9zMK0w2Q+WA0G626LU+QfN+sVTHotGTeyOMmSbuOGtJ5Ple9biZxPpaRllEEo52Nk/1q d67GOHEC1ZEXX1p9fNdgcmf2KQZ3T3/5Uhedee19TEabjyPUl/louoUqsc41RvOhOilWOpRBXHBx6 rCKgwTTH+qjP0dQB6scKYet0SZ4hW++rqgqOpJeSWJzvNmh5AV85BheowDVycisAh6rwFcQ+77FRX An8Sf/PsJOhZ7lSlbPklxN5rAKwCiTDPjwbmtHEFePVXG0+USkcXRBc/Zm1llJJKuSPFj6k2oiDkh HOIrQ+eQ==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.94 #2 (Red Hat Linux)) id 1lMBby-00144d-4y; Tue, 16 Mar 2021 15:27:58 +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 1822F3012DF; Tue, 16 Mar 2021 16:27:57 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 067BA23E8EF8D; Tue, 16 Mar 2021 16:27:57 +0100 (CET) Date: Tue, 16 Mar 2021 16:27:56 +0100 From: Peter Zijlstra To: Frederic Weisbecker Cc: Thomas Gleixner , LKML , "Rafael J . Wysocki" , Ti Zhou , Yunfeng Ye , "Paul E . McKenney" , Marcelo Tosatti , Ingo Molnar Subject: Re: [PATCH 06/10] timer: Report ignored local enqueue in nohz mode Message-ID: References: <20210311123708.23501-1-frederic@kernel.org> <20210311123708.23501-7-frederic@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210311123708.23501-7-frederic@kernel.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 11, 2021 at 01:37:04PM +0100, Frederic Weisbecker wrote: > 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. > > Reviewed-by: Rafael J. Wysocki > Signed-off-by: Frederic Weisbecker > Cc: Peter Zijlstra > Cc: Thomas Gleixner > Cc: Ingo Molnar > Cc: Paul E. McKenney > --- > kernel/sched/core.c | 20 +++++++++++++++++++- > 1 file changed, 19 insertions(+), 1 deletion(-) > > diff --git a/kernel/sched/core.c b/kernel/sched/core.c > index ca2bb629595f..24552911f92b 100644 > --- a/kernel/sched/core.c > +++ b/kernel/sched/core.c > @@ -674,6 +674,22 @@ int get_nohz_timer_target(void) > return cpu; > } > > +/* Make sure the timer won't be ignored in dynticks-idle case */ > +static void wake_idle_assert_possible(void) > +{ > +#ifdef CONFIG_SCHED_DEBUG > + /* > + * Timers are re-evaluated after idle IRQs. In case of softirq, > + * we assume 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. > + */ > + WARN_ONCE(in_task(), > + "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 +704,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); I'm not entirely sure I understand this one. What's the callchain that leads to this?