From nobody Mon Jun 8 05:26:40 2026 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 990AE3546F0; Tue, 2 Jun 2026 19:35:56 +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=1780428957; cv=none; b=Pl6Nj8kyk8NjidZLIfOql522ym6jj8OrVcArLrFkqIdaJjXBZaTAxrvEHo/RFDbwUvZI0fpGafnN+xSfhffM2ByyMIhFdEt0mNxCdUw8dTFLHAll3NGPeytyNpULJclkhedrl74QAi7nGLrycif26P7X7l3nRIG+FTZ89ZTw0lQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780428957; c=relaxed/simple; bh=Oqlwphqp03qyqC2hkuj3cmOC/Qj2cjk6z8efOY/02+Q=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=HgAPLGEH+50Cbs9sV24RgxvPxDNSEPDmm7vWc/vUvbDdv7TNswf2OggZ1FmtTrrLH57if05yjMyhLsBUgunza8+03bvq4rRj0TtvtG1TvhIXzJWgioY/wgXJK6gIJVEkTrt2T4NE9VkGQwtrtjrxsOQAqafkQx3lsu+FRHziiHQ= 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=v2sYBmuM; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=P448ltTi; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="v2sYBmuM"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="P448ltTi" Date: Tue, 02 Jun 2026 19:35:53 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1780428954; 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=TocEkLSST88enJn2vqZ8RPenivHu2LXCoeVpVXe9vV0=; b=v2sYBmuM/7X5T9uCMc6aYA1WYlYKE0ojA0BQzR1o4IOue8RaVuNN1lXGwPbRtsBhobpDPA roCvz9oqZUllD1hHvX/VtRsloaAhEuQdH5ATOJoK22alb8lfKGLZapZ0AydJDyZk1AmkBz KdRqRnvSYcLt4tUOn9h81X6Z52/ZPxE7AZAUrdrIx00xuTHx20OiwdQBWaVTlJpmsKboDW 8fpbgOALc/ckH1YDECarVU4mN+42dJ8c1d3NAW7nsN5MMylU4b4fyR9/ZZRECuGLxQ3bxd QQ7ZyYajbJaxsbsiS4cefAupvl/kHjvV5Gi/ndgtp9dOn7u+3xyDJ1twoRTgDQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1780428954; 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=TocEkLSST88enJn2vqZ8RPenivHu2LXCoeVpVXe9vV0=; b=P448ltTiyqM+ll7Wk+1QdzsvMTwl8VNLeToJaLIXpetpYnRV2m35+kalFtJqu1M8aMqP+M 9XfD2GELXuEsL4Bw== 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/migration: Fix hotplug migrator selection target on asymetric capacity machines Cc: Frederic Weisbecker , Thomas Gleixner , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20260519220926.63437-2-frederic@kernel.org> References: <20260519220926.63437-2-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: <178042895350.710.17312754281444205130.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The following commit has been merged into the timers/core branch of tip: Commit-ID: e4a70f5fbd43f55b474028a2cee3d78e4b443dd7 Gitweb: https://git.kernel.org/tip/e4a70f5fbd43f55b474028a2cee3d78e4= b443dd7 Author: Frederic Weisbecker AuthorDate: Wed, 20 May 2026 00:09:25 +02:00 Committer: Thomas Gleixner CommitterDate: Tue, 02 Jun 2026 21:34:03 +02:00 timers/migration: Fix hotplug migrator selection target on asymetric capaci= ty machines When a top-level migrator is deactivated, either at CPU down hotplug time or when a CPU is domain isolated, a new migrator is elected among the available CPUs and woken up to take over the migration duty. However that election must happen at the scope of a given hierarchy and not globally, which the introduction of per-capacity hierarchies failed to handle. As a result a given hierarchy may end up without migrator to handle global timers. Fix it by making sure that the new migrator belongs to the same hierarchy as the outgoing CPU. Fixes: 098cbaad8e57 ("timers/migration: Split per-capacity hierarchies") Signed-off-by: Frederic Weisbecker Signed-off-by: Thomas Gleixner Link: https://patch.msgid.link/20260519220926.63437-2-frederic@kernel.org --- kernel/time/timer_migration.c | 42 +++++++++++++++++++++++++--------- 1 file changed, 32 insertions(+), 10 deletions(-) diff --git a/kernel/time/timer_migration.c b/kernel/time/timer_migration.c index 25e3c56..8032b00 100644 --- a/kernel/time/timer_migration.c +++ b/kernel/time/timer_migration.c @@ -1464,6 +1464,18 @@ static long tmigr_trigger_active(void *unused) return 0; } =20 +static struct tmigr_hierarchy *__tmigr_get_hierarchy(unsigned int capacity) +{ + struct tmigr_hierarchy *iter; + + list_for_each_entry(iter, &tmigr_hierarchy_list, node) { + if (iter->capacity =3D=3D capacity) + return iter; + } + + return NULL; +} + static int tmigr_clear_cpu_available(unsigned int cpu) { struct tmigr_cpu *tmc =3D this_cpu_ptr(&tmigr_cpu); @@ -1488,8 +1500,21 @@ static int tmigr_clear_cpu_available(unsigned int cp= u) } =20 if (firstexp !=3D KTIME_MAX) { - migrator =3D cpumask_any(tmigr_available_cpumask); - work_on_cpu(migrator, tmigr_trigger_active, NULL); + struct tmigr_hierarchy *hier =3D __tmigr_get_hierarchy(arch_scale_cpu_ca= pacity(cpu)); + + if (WARN_ON_ONCE(!hier)) + return -EINVAL; + + migrator =3D cpumask_any_and(tmigr_available_cpumask, hier->cpumask); + if (migrator < nr_cpu_ids) { + work_on_cpu(migrator, tmigr_trigger_active, NULL); + } else { + /* + * If deactivation returned an expiration, it belongs to an available + * nohz CPU in the hierarchy. + */ + WARN_ONCE(1, "Expected available CPU in the hierarchy\n"); + } } =20 return 0; @@ -1915,12 +1940,9 @@ out: =20 static struct tmigr_hierarchy *tmigr_get_hierarchy(unsigned int capacity) { - struct tmigr_hierarchy *hier =3D NULL, *iter; + struct tmigr_hierarchy *hier; =20 - list_for_each_entry(iter, &tmigr_hierarchy_list, node) { - if (iter->capacity =3D=3D capacity) - hier =3D iter; - } + hier =3D __tmigr_get_hierarchy(capacity); =20 if (hier) return hier; @@ -1978,9 +2000,9 @@ static long connect_old_root_work(void *arg) struct tmigr_hierarchy *hier; int cpu =3D smp_processor_id(); =20 - hier =3D tmigr_get_hierarchy(arch_scale_cpu_capacity(cpu)); - if (IS_ERR(hier)) - return PTR_ERR(hier); + hier =3D __tmigr_get_hierarchy(arch_scale_cpu_capacity(cpu)); + if (WARN_ON_ONCE(!hier)) + return -EINVAL; =20 return tmigr_connect_old_root(hier, cpu, old_root, true); }