From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 948E6296148 for ; Wed, 30 Jul 2025 13:12:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753881138; cv=none; b=oIb2Ag/2aBesGvvWKdEPNjNRncPRhujawhfXgXMcH5RR9IVqvMXVjEXHVMCYVDwuFuXb5Z0l5zJ29WTYHnGrHbzFPKeSwWQtaVzkZw99PQ76R0AhWU8mEMtASgLP8G145ZKIVdPH5RQrmHjxGFLYz4nxIH0zJXQlknubOBMk/WE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753881138; c=relaxed/simple; bh=PAuC7WsD1zBs+mST80zzb6TiYFjZslit6K2f3rxKY44=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Z90BwJrPrX7U1n7+v+v18Y8w2MeUQS6vjjAUnm5wmzV1TTUkJsw7BJVVIb55+mZFJiRhKmVCJTkFePWNe9n4rxYyQWW26ZlMPRYfgjryfWbhQXbOW6T3WiI1Ywxpj3NPH75bh96gh8EUqMqh0c852/xRLLdQAQhjo0bKEU0Zr5s= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=F5nLKzVX; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="F5nLKzVX" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1753881135; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tdFBLnsCWpckgB9HbqcHHM/hdZ93c/I5FsM9wN8QhNI=; b=F5nLKzVX6JSu9zkzpxLFhs83mIXLCe5ERbcbauoyw2nVuyHKqCV64swhZksvAXIWu1QMUW QHil7Z5I4Z3SsAAUpC0HvNgJrKuwqq4P4u/3BQoV4VLdRyC2gBAc0TgPdTg1JanG+umSwC 7CvJGTmuycwNfVyhkY8Dpzv/DNnsJck= Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-128-lDsU7437M0uA6WZMlWc3UQ-1; Wed, 30 Jul 2025 09:12:11 -0400 X-MC-Unique: lDsU7437M0uA6WZMlWc3UQ-1 X-Mimecast-MFC-AGG-ID: lDsU7437M0uA6WZMlWc3UQ_1753881130 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 93ED91956096; Wed, 30 Jul 2025 13:12:10 +0000 (UTC) Received: from gmonaco-thinkpadt14gen3.rmtit.com (unknown [10.44.33.26]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 52CBA19560A2; Wed, 30 Jul 2025 13:12:07 +0000 (UTC) From: Gabriele Monaco To: linux-kernel@vger.kernel.org, Anna-Maria Behnsen , Frederic Weisbecker , Thomas Gleixner , Waiman Long Cc: Gabriele Monaco Subject: [PATCH v9 1/8] timers/migration: Postpone online/offline callbacks registration to late initcall Date: Wed, 30 Jul 2025 15:11:51 +0200 Message-ID: <20250730131158.101668-2-gmonaco@redhat.com> In-Reply-To: <20250730131158.101668-1-gmonaco@redhat.com> References: <20250730131158.101668-1-gmonaco@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 From: Frederic Weisbecker During the early boot process, the default clocksource used for timekeeping is the jiffies. Better clocksources can only be selected once clocksource_done_booting() is called as an fs initcall. NOHZ can only be enabled after that stage, making global timer migration irrelevant up to that point. Therefore, don't bother with trashing the cache within that tree from the SMP bootup until NOHZ even matters. Make the CPUs available to the tree on late initcall, after the right clocksource had a chance to be selected. This will also simplify the handling of domain isolated CPUs on further patches. Signed-off-by: Frederic Weisbecker Signed-off-by: Gabriele Monaco --- kernel/time/timer_migration.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/kernel/time/timer_migration.c b/kernel/time/timer_migration.c index 2f6330831f08..72987f0d101b 100644 --- a/kernel/time/timer_migration.c +++ b/kernel/time/timer_migration.c @@ -1484,6 +1484,16 @@ static int tmigr_cpu_online(unsigned int cpu) return 0; } +/* + * NOHZ can only be enabled after clocksource_done_booting(). Don't + * bother trashing the cache in the tree before. + */ +static int __init tmigr_late_init(void) +{ + return cpuhp_setup_state(CPUHP_AP_TMIGR_ONLINE, "tmigr:online", + tmigr_cpu_online, tmigr_cpu_offline); +} + static void tmigr_init_group(struct tmigr_group *group, unsigned int lvl, int node) { @@ -1846,18 +1856,10 @@ static int __init tmigr_init(void) ret = cpuhp_setup_state(CPUHP_TMIGR_PREPARE, "tmigr:prepare", tmigr_cpu_prepare, NULL); - if (ret) - goto err; - - ret = cpuhp_setup_state(CPUHP_AP_TMIGR_ONLINE, "tmigr:online", - tmigr_cpu_online, tmigr_cpu_offline); - if (ret) - goto err; - - return 0; - err: - pr_err("Timer migration setup failed\n"); + if (ret) + pr_err("Timer migration setup failed\n"); return ret; } early_initcall(tmigr_init); +late_initcall(tmigr_late_init); -- 2.50.1