From patchwork Mon Feb 26 22:24:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 206953 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp2365382dyb; Mon, 26 Feb 2024 14:24:58 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUzSWqAYjrkpS5VhVA7RrFF7ALm+aS+YUj2r0xWqKkiVeKa/nqUEPl33nFa7vGxiwQw4AL5byzroqhQ9qJBlZxPVCrqSA== X-Google-Smtp-Source: AGHT+IH/xpX+Ro/kXUYBS3rECiuKjFAat0MxnQZtlVYxCZ0V/3a8QRun8qb2k2C5wNQzTAVDqa+W X-Received: by 2002:a05:6214:20a5:b0:68f:a949:77b2 with SMTP id 5-20020a05621420a500b0068fa94977b2mr534344qvd.2.1708986298265; Mon, 26 Feb 2024 14:24:58 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708986298; cv=pass; d=google.com; s=arc-20160816; b=E6MWC3dWFubz+bj0avaMEpiZwxW1Ip5wUOps9x7pDGnMqyIcW5Zo2jydOyAYno41yo zD4iF2J3zuTPfgspTaCHhn/l063xTiK+/RIV+03V1zs25Cr2ugqdv+5/6NbXCMgnm5+7 Ggfvw8StTBpljfM9oGyR15tWS5HysP5fHrOJVXOGWngj1IsaJRi9Vq96wByXEpccykOG irUItSHzNAab1j/m6y/ZF7mSn6wdmm912+IaADR2z8vPZeMsemG9VHj4QMfh00QMvXU9 HLWd6rqtwo+k//Pp3KdXNFmhp8zgQ0i12nmP93CCtqxU6B9iFaoWvbjoXnSevDX38pmn gCUA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:precedence:robot-unsubscribe:robot-id :message-id:mime-version:list-unsubscribe:list-subscribe:list-id :precedence:references:in-reply-to:cc:subject:to:reply-to:sender :from:dkim-signature:dkim-signature:date; bh=MVzKVsJhf5e6bXf2ZcV/iev7ofEWrTQXAf+4O63SiZI=; fh=9Ax9dUTktkw7GUAcxhp/hScrn1H6VeDItxi6qdujZxg=; b=Ehz3Q6k4v/2g2VMMshCQrFaeMWYeaelEKrOFFjwpA4i2jrrCtZvujCuM10731S5pAr no+B7M7mbGuTOuCf7N7TdMtsZ+GmPOov4UZMc311LiScyQezR8y9YGYJGuBd5o3IKhAn AKplomlEGslieCFidiliMIHnltgnkR18WCweika7imfG2EdAQxcyma2OqDBOrcAcNqBl LCJTaTUmRTfNbbhz9z6FQa7sPuXealKX9PwLgaEpwpXfLsI97ud8jPpNXvBw34J/+cyl T56JZCGnvtyxXq3Vv0K2B66TyaLahtTdzSROAna18kjQSw8kBFBCqIh47XwEBaRKnzVl Fsfw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b="Y/zKEXIK"; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-82385-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-82385-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id gm13-20020a056214268d00b0068f467dbcdesi6075930qvb.32.2024.02.26.14.24.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 14:24:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-82385-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b="Y/zKEXIK"; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-82385-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-82385-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id F3CAF1C23162 for ; Mon, 26 Feb 2024 22:24:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B5AB01332A0; Mon, 26 Feb 2024 22:24:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="Y/zKEXIK"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="WH9DlPoT" Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 2C4A3132486; Mon, 26 Feb 2024 22:24:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708986271; cv=none; b=KyFMbHhRQ7OMzu18nxL5k9ex+k+8XKK7odtCuXH4oTRiqgNls7BCR8njUiVCL4YVFM/lnKGEQJcyO20A3Fb+fvNrU1usriQCkqqDUhmfFXZYyTG/XqA5vboWW3sC6U0rMSEa1/EjlxI/JPONVgOVlgQvZdGhqw7cp6AtXHlBn9o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708986271; c=relaxed/simple; bh=TTrlwk/E8iegOt2UjKcQXtlNzMYojq0/n1Iyl0jVdCA=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=ZhmKjEZpM5CrXXwvJryx4obiZwBEv4pL6rsAjxP3MOVjrthgqNdaHlzJWGV94oO8eKBD4lG1tuUX9kFNO0tA1rIWBcLv8HOCD5XlHYoHcrBFkRHWlhO8eolQ1IT528RiZGkDZt5Zc4sxzuPrDcJQH0HNgRni4PnRU61SIIZ/Z24= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=Y/zKEXIK; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=WH9DlPoT; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Date: Mon, 26 Feb 2024 22:24:27 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1708986268; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MVzKVsJhf5e6bXf2ZcV/iev7ofEWrTQXAf+4O63SiZI=; b=Y/zKEXIKagayaKzokOU4zQBlM52gZJ5Y2RXG0HqQ6N70NfgRy6Nfq3wwCpMwWgFj+pY85a AWi29vbZpskrMCN2HNLOBPDCgpePTEKuQjDZx0ef7MSRSwhWco2RDA0mrqHsxp3iJhRlj4 kbKf18NcvO/qZkCnAXx0umqUqzJSN2FF+PgpCP5Re3ULDQsjm7fuTPDsbzdbE7E7Vnrb1R fF29KefOb62gDyc+JiRXibAi+Adbk9MNdeNUQLoEVAv59w2su8/NN8ykRwz2p4bN7S/uBw TMM7vUeqPTfO0+WfaqSaiO0prd7fucCm1D/Lz6otGYuGwJHtMfQboELWg1KRNA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1708986268; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MVzKVsJhf5e6bXf2ZcV/iev7ofEWrTQXAf+4O63SiZI=; b=WH9DlPoT+ufFKFGbncdWJSzJabGFVZ84DZGz0MqxZUafPbvZr2Mah5h1/prR6mY3r2p2tr LP5TpFkWSkll5HAA== From: "tip-bot2 for Frederic Weisbecker" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: timers/core] timers: Assert no next dyntick timer look-up while CPU is offline Cc: Frederic Weisbecker , Thomas Gleixner , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20240225225508.11587-17-frederic@kernel.org> References: <20240225225508.11587-17-frederic@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <170898626753.398.4108841734022309650.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791913553784527599 X-GMAIL-MSGID: 1792002016310319007 The following commit has been merged into the timers/core branch of tip: Commit-ID: 19b344a91ff79f65be377825635bcf5f5bb8df67 Gitweb: https://git.kernel.org/tip/19b344a91ff79f65be377825635bcf5f5bb8df67 Author: Frederic Weisbecker AuthorDate: Sun, 25 Feb 2024 23:55:08 +01:00 Committer: Thomas Gleixner CommitterDate: Mon, 26 Feb 2024 11:37:32 +01:00 timers: Assert no next dyntick timer look-up while CPU is offline The next timer (re-)evaluation, with the purpose of entering/updating the dyntick mode, can happen from 3 sites and none of them are relevant while the CPU is offline: 1) The idle loop: a) From the quick check helping the cpuidle governor to heuristically predict the best C-state. b) While stopping the tick. But if the CPU is offline, the tick has been cancelled and there is consequently no need to further stop the tick. 2) Remote expiry: when a CPU remotely expires global timers on behalf of another CPU, the latter target's next timer is re-evaluated afterwards. However remote expîry doesn't happen on offline CPUs. 3) IRQ exit: on nohz_full mode, the tick is (re-)evaluated on IRQ exit. But full dynticks is disabled on offline CPUs. Therefore it is safe to assume that no next dyntick timer lookup can be performed on offline CPUs. Assert this expectation to report any surprise. Signed-off-by: Frederic Weisbecker Signed-off-by: Thomas Gleixner Link: https://lore.kernel.org/r/20240225225508.11587-17-frederic@kernel.org --- kernel/time/timer.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kernel/time/timer.c b/kernel/time/timer.c index 4f4930d..e69e75d 100644 --- a/kernel/time/timer.c +++ b/kernel/time/timer.c @@ -2233,10 +2233,10 @@ static inline u64 __get_next_timer_interrupt(unsigned long basej, u64 basem, bool idle_is_possible; /* - * Pretend that there is no timer pending if the cpu is offline. - * Possible pending timers will be migrated later to an active cpu. + * When the CPU is offline, the tick is cancelled and nothing is supposed + * to try to stop it. */ - if (cpu_is_offline(smp_processor_id())) { + if (WARN_ON_ONCE(cpu_is_offline(smp_processor_id()))) { if (idle) *idle = true; return tevt.local;