From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A87013644CA for ; Mon, 10 Aug 2026 06:26:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786343184; cv=none; b=uvUU7Fx3bsOm0oLPOsw3SQI5yu+gnvXqTeDxXSQVaZ8pZoLvhwSmnzwcf9AwXOXplERKBerRrgzm0zKToXzxkW+GDmVz2SUuh9Rt6Acvbqvr7Y/nwOXcCOK4cHZ0cE+bwEEyj0D54U95A+3w7Lmnnp58/lvVoFoluzzaAXGiObg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786343184; c=relaxed/simple; bh=OfL0WTLW/+L+9SOhGAZ+WsKn8S9p1RbiZA2iTbPILpU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=klcyuLPgNPJ0qgWrbbPap7mAFcqWYgYsz2uIBzySMaMYeDoJFBxMAasCI8/gFsOa0u4Vqjw04BSo2/pIxUu+ZmtlJFPrTCGgOPEcl+AhuxlwEZxcLd04yIWc8LG7nYwDTJGWiPNgE3YuZXGhnFVD1Z67BH+cGPNuoZolob5/p7Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b=OSWa+KHo; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b="OSWa+KHo" Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 7B86D14BF; Sun, 9 Aug 2026 23:26:16 -0700 (PDT) Received: from arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 8E8813F632; Sun, 9 Aug 2026 23:26:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1786343180; bh=OfL0WTLW/+L+9SOhGAZ+WsKn8S9p1RbiZA2iTbPILpU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=OSWa+KHo0QF1RysLWpqEJRGXCq3QKskqxkvb8PNtZqzQXvwzMeJkP78ki3VPRcJ0n fn7E5lvb2CMfiU0bgTJK8zFJyjX2SA2KvHtdZAWQmZFMfUEPJk+fnnbIqgE/dHThnB GzdFU3Yu7UrZGa8txrnWxwIXBo3tJ1TZHC5CN6Zs= Date: Mon, 10 Aug 2026 08:26:07 +0200 From: Beata Michalska To: seanwang1 Cc: Catalin Marinas , Will Deacon , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Lifeng Zheng , Greg Kroah-Hartman , Geert Uytterhoeven , Sumit Gupta , Yunhui Cui , Xuewen Yan Subject: Re: [PATCH] arm64: topology: fix arch_cpu_idle_enter() Message-ID: References: <20260807135216.9919-1-seanwang1@lenovo.com> 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=us-ascii Content-Disposition: inline In-Reply-To: <20260807135216.9919-1-seanwang1@lenovo.com> On Fri, Aug 07, 2026 at 09:52:16PM +0800, seanwang1 wrote: > arch_cpu_idle_enter() directly calls amu_scale_freq_tick() to update > arch_freq_scale when CPU enters idle state. This bypasses the sft_data > pointer check that topology_clear_scale_freq_source() relies on. > > As a result, even after calling topology_clear_scale_freq_source() with > SCALE_FREQ_SOURCE_ARCH to disable AMU-based frequency scaling, the > arch_freq_scale value can still be modified by AMU counters when the > CPU goes idle through the arch_cpu_idle_enter() path. > > Fix by replacing the direct amu_scale_freq_tick() call with > topology_scale_freq_tick(), which is the generic interface for updating > frequency scale and properly respects the sft_data pointer state. > > Co-developed-by: Xuewen Yan > Signed-off-by: Sean Wang > Signed-off-by: Xuewen Yan > --- > arch/arm64/kernel/topology.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/arm64/kernel/topology.c b/arch/arm64/kernel/topology.c > index b32f13358fbb..f617ef5c9903 100644 > --- a/arch/arm64/kernel/topology.c > +++ b/arch/arm64/kernel/topology.c > @@ -176,7 +176,7 @@ void arch_cpu_idle_enter(void) > /* Kick in AMU update but only if one has not happened already */ > if (housekeeping_cpu(cpu, HK_TYPE_TICK) && > time_is_before_jiffies(per_cpu(cpu_amu_samples.last_scale_update, cpu))) > - amu_scale_freq_tick(); > + topology_scale_freq_tick(); > } That actually changes semantics here. This path is strictly AMU-oriented and topology_scale_freq_tick is a dispatcher that does not really care about the actual source of the scale info. So it would be best if this could verify whether AMUs are the current source and call a tick only then, bailing out otherwise. --- BR Beata > > #define AMU_SAMPLE_EXP_MS 20 > -- > 2.25.1 >