Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp1672265rdb; Tue, 20 Feb 2024 03:42:07 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUG8Zj9IEzEF6HKbvcVMpxnrZRUZQ48qUZSaNGYJbNFhYRKj1gVMEjsW2wSARn4Ss3KBVVkZNtxT5FfGZ0h2XYKWRp+cr+0eqX2Nd2yug== X-Google-Smtp-Source: AGHT+IHQSBsX9j2L++jYVvrl3jSZb3TH8Jv14ZPDzK2KGIeDYxds4bVbxuAcSUSGvahm0qksyKlM X-Received: by 2002:a9d:628a:0:b0:6e4:598c:3f09 with SMTP id x10-20020a9d628a000000b006e4598c3f09mr3430692otk.10.1708429327208; Tue, 20 Feb 2024 03:42:07 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708429327; cv=pass; d=google.com; s=arc-20160816; b=HWWu/EmTw8XN81sObYhUffPViEG+RVBk+S/LiIsyikCEPC5Yjz0crrnctq1/h4QsMv nmpZMRxZq7bcSCNR1NIoOn5b5dqs2IhDPoF/SCK6M7SAF0lWGlvTF6gr4BNy12BHt1NC 2blVrbtOcancwBrzU0qMiwG7CJoYgeZXkur5/SLRG+1foedSayqLzMHaNFuf5RTS6ph2 OhyIxKrFJ2DB0syUuICYUfbmQdbJkHKxpljgVFrU7PIIk5NBmdFyJ4WT0VgllkQzmPgy 3nEE7yfbnGLwH9enK/MhdFptY6qzVEHE93+6uJ3kwEsqYw7ZFndZBD8oqL1DmiPfG/N6 PcXQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=4oCJjeULl77Qn9NiaxNSYL0OJ37rGgruKD+tkxWE8SQ=; fh=rlwn4pxNjzZxzAe0OFpEm5XldgGOhioyoE/W5GSrSmE=; b=ak2GHse+orlUgrDntENM8ovfWOlmzpm6F8K3vvJ++MODnAftCLW16FL7Uesa9Xvtxu ISKZYye/t7A86lfSQB7KjF8PHJOOXVKt74dX8nQ1p1h5L7J/YT2eOeF4qX3LvpjpIWs4 0i6kWH36INFUOEzpZwP/327R/CnzNkgFpPHga3nPBXduNYLoJUV+jPMnq+/JO1c/o3UV 1tEzn4kbaK3fped0ff1ZS4DeunNhuN4uwEyscYMJ22PJRjPMz/fSloKXNs5+FdHZUDOQ Cf/2Xxp95bgCqnBVvzom+RIeq5zbdcpaAu6Clf7rvCAuzs1h2npF4riGeDr1RvttWsUZ 2F4A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rUjWxzsx; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-72925-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-72925-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id bq3-20020a056a02044300b005dc7fe30f45si6286914pgb.567.2024.02.20.03.42.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Feb 2024 03:42:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-72925-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rUjWxzsx; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-72925-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-72925-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 4BA93285D93 for ; Tue, 20 Feb 2024 11:42:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D60746775E; Tue, 20 Feb 2024 11:42:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="rUjWxzsx" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 10600664CE for ; Tue, 20 Feb 2024 11:41:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708429320; cv=none; b=GWj6TT8bLPU6YJwYb/41XBFknClv75F7o1dy0BBqUdlvtJqbWI9AFfdwV7jE+shpIETG76JjXxX2+TD/gzen/6hoRI989kf09pWaWcmJ9EHOiVa+QG2bZlz92PfDupaW09DqP1a8yLmTtHzx/FHZYkBAOM+mTmFxIe5kUkkB3gg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708429320; c=relaxed/simple; bh=q++Ve8879Npx2wq1JnlALpXBfW43mRaompH7G7hkYn8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=OHxjho22YJHqKGujL5omH3bnmF80vV2c/JaDXNYanp1PKPHu3pW6jdW+9/i6+az+z6KT6OgdauIXrqtgfnoasrPghQa1uZfJhcRZLPx0hgbBs0IgehiCUOlKgxrZ7829GgLIq6dABBJt+rabrzU+arCqGI+2K68NGWX5qwvUpMo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=rUjWxzsx; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 008D9C433A6; Tue, 20 Feb 2024 11:41:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708429319; bh=q++Ve8879Npx2wq1JnlALpXBfW43mRaompH7G7hkYn8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=rUjWxzsxc7b/+LXSnMFEghOioBejkwFTOwX/XcP7a5GLe8qmThsFBC9ENzl2O6M0X pGUvvtRmB+dW1/bamR9c/NQ9mjzbiwxvmDg4joH9rvwYWwhiY1Cax8/XM/cTp3GTyR /NPEm8gFGBigZzbrFCe0PIOf31RI9w+DfHo6Q4yc1oSQxHABGuwYU+gyDUaZwxJGW0 f1RaWdUzl5HQKjtRFFWUlLh9GGdE4yPzByvHzWvu7WifbmtdDQR6jAVm5VMCQ0/FIn lXICU3JuTh4AFEMfgJWJwVtzrC2PipoF3ITA0AMRNEaEK9WnpIPx8ApeMftjsKW2w+ QCrqqsPtKeniw== Date: Tue, 20 Feb 2024 12:41:56 +0100 From: Frederic Weisbecker To: Anna-Maria Behnsen Cc: linux-kernel@vger.kernel.org, Peter Zijlstra , John Stultz , Thomas Gleixner , Eric Dumazet , "Rafael J . Wysocki" , Arjan van de Ven , "Paul E . McKenney" , Rik van Riel , Steven Rostedt , Sebastian Siewior , Giovanni Gherdovich , Lukasz Luba , "Gautham R . Shenoy" , Srinivas Pandruvada , K Prateek Nayak Subject: Re: [PATCH v10a] timers: Move marking timer bases idle into tick_nohz_stop_tick() Message-ID: References: <20240115143743.27827-4-anna-maria@linutronix.de> <20240219085236.10624-1-anna-maria@linutronix.de> <878r3f5s3w.fsf@somnus> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <878r3f5s3w.fsf@somnus> Le Tue, Feb 20, 2024 at 11:48:19AM +0100, Anna-Maria Behnsen a ?crit : > Frederic Weisbecker writes: > diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c > index 01fb50c1b17e..b93f0e6f273f 100644 > --- a/kernel/time/tick-sched.c > +++ b/kernel/time/tick-sched.c > @@ -895,21 +895,6 @@ static void tick_nohz_stop_tick(struct tick_sched *ts, int cpu) > /* Make sure we won't be trying to stop it twice in a row. */ > ts->timer_expires_base = 0; > > - /* > - * If this CPU is the one which updates jiffies, then give up > - * the assignment and let it be taken by the CPU which runs > - * the tick timer next, which might be this CPU as well. If we > - * don't drop this here, the jiffies might be stale and > - * do_timer() never gets invoked. Keep track of the fact that it > - * was the one which had the do_timer() duty last. > - */ > - if (cpu == tick_do_timer_cpu) { > - tick_do_timer_cpu = TICK_DO_TIMER_NONE; > - ts->do_timer_last = 1; > - } else if (tick_do_timer_cpu != TICK_DO_TIMER_NONE) { > - ts->do_timer_last = 0; > - } > - > /* Skip reprogram of event if it's not changed */ > if (ts->tick_stopped && (expires == ts->next_tick)) { > /* Sanity check: make sure clockevent is actually programmed */ That should work but then you lose the optimization that resets ts->do_timer_last even if the next timer hasn't changed. Thanks. > @@ -938,6 +923,21 @@ static void tick_nohz_stop_tick(struct tick_sched *ts, int cpu) > trace_tick_stop(1, TICK_DEP_MASK_NONE); > } > > + /* > + * If this CPU is the one which updates jiffies, then give up > + * the assignment and let it be taken by the CPU which runs > + * the tick timer next, which might be this CPU as well. If we > + * don't drop this here, the jiffies might be stale and > + * do_timer() never gets invoked. Keep track of the fact that it > + * was the one which had the do_timer() duty last. > + */ > + if (cpu == tick_do_timer_cpu) { > + tick_do_timer_cpu = TICK_DO_TIMER_NONE; > + ts->do_timer_last = 1; > + } else if (tick_do_timer_cpu != TICK_DO_TIMER_NONE) { > + ts->do_timer_last = 0; > + } > + > ts->next_tick = expires; > > /*