From nobody Tue Apr 7 04:21:21 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 8E3BD38E124; Mon, 16 Mar 2026 09:50:33 +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=1773654634; cv=none; b=tYd7q1Xb0EmHEwoZyf9izB5EvO9BHc4AADG/p9HloMwo7NJ59ke6F31zkspqESzxCRRlwNnHg8xGW09vGGD4nJUZRqBeANoCVYxV2jzXxF1vrlsnuR5PZqeAoHdi51aaSvXjM8ooiOA/OQMZv583P78buNrHMhCyFnQsEhRbG/4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773654634; c=relaxed/simple; bh=gVz6v5mVoAh1D8q4WIUjEI74TxhjcPyfJAEs3kUj6HU=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=IEA5qfKdmZfnkzMNANwbVZAgInNc8GSQp+twG2f/FegCfxVoB1eW0M2sZZJBNRL2pFFFVg19OyfqjJnxTxdT8UMAbj6krTQJfXu4LruZKSHtFdOmhwGo7fgnXNKvYlTvbIVo9ImCHFOfPdp6//iA49/s2btrslR9s31Akr5cPPM= 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=xNdII11q; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=XSNQ9VoX; 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="xNdII11q"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="XSNQ9VoX" Date: Mon, 16 Mar 2026 09:50:30 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1773654632; 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=Cpvye5KqtujhKUhG1iFghd3lSTMpCl0XAy5hybLtVMs=; b=xNdII11qzETT90yHl7U6p4A8m8CyZb/4V6CElIF0Qi+v0EN3pzmEuDgfkbRT8sl7e4tX8Q htdoYn44JNtmAJUvrSjln/jgHt30ISaJ1ox0M2eFucX0qhj0aKVYZ6Mks9ajh1jlqmVKBq JnOFwq35Y986kcven+2eXqwUjpF64GON2ikFRHUF6HJlFOJcDy6p1Gn688f3LFijPCMgbA BXytLBgTacjJMgED575K6v7Ell9k6Lv2Usab5ZcPe03He57OjUNLpmX8xZrvKXxyYPWCrO L6rC6FV+JyJHUo2NHptbecjzfn33rXz2iBDL9wdW89DX/Bg3bJb5VtQc3eeZbw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1773654632; 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=Cpvye5KqtujhKUhG1iFghd3lSTMpCl0XAy5hybLtVMs=; b=XSNQ9VoX8m0hWMQJ0kGfA2mNbJYyiWXrjtJPWtti1URF407ITv4lIs5hknJCJIO2dzwfIJ 5ueoC3Kzf1tKx3AA== From: "tip-bot2 for Peter Zijlstra" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: perf/urgent] x86/perf: Make sure to program the counter value for stopped events on migration Cc: Dapeng Mi , Ian Rogers , "Peter Zijlstra (Intel)" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20260311204035.GX606826@noisy.programming.kicks-ass.net> References: <20260311204035.GX606826@noisy.programming.kicks-ass.net> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <177365463087.1647592.14762972919507059547.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 perf/urgent branch of tip: Commit-ID: f1cac6ac62d28a9a57b17f51ac5795bf250c12d3 Gitweb: https://git.kernel.org/tip/f1cac6ac62d28a9a57b17f51ac5795bf2= 50c12d3 Author: Peter Zijlstra AuthorDate: Wed, 11 Mar 2026 21:29:14 +01:00 Committer: Peter Zijlstra CommitterDate: Thu, 12 Mar 2026 11:29:15 +01:00 x86/perf: Make sure to program the counter value for stopped events on migr= ation Both Mi Dapeng and Ian Rogers noted that not everything that sets HES_STOPP= ED is required to EF_UPDATE. Specifically the 'step 1' loop of rescheduling explicitly does EF_UPDATE to ensure the counter value is read. However, then 'step 2' simply leaves the new counter uninitialized when HES_STOPPED, even though, as noted above, the thing that stopped them might= not be aware it needs to EF_RELOAD -- since it didn't EF_UPDATE on stop. One such location that is affected is throttling, throttle does pmu->stop(,= 0); and unthrottle does pmu->start(, 0); possibly restarting an uninitialized c= ounter. Fixes: a4eaf7f14675 ("perf: Rework the PMU methods") Reported-by: Dapeng Mi Reported-by: Ian Rogers Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Dapeng Mi Link: https://patch.msgid.link/20260311204035.GX606826@noisy.programming.ki= cks-ass.net --- arch/x86/events/core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c index 54b4c31..810ab21 100644 --- a/arch/x86/events/core.c +++ b/arch/x86/events/core.c @@ -1374,8 +1374,10 @@ static void x86_pmu_enable(struct pmu *pmu) =20 cpuc->events[hwc->idx] =3D event; =20 - if (hwc->state & PERF_HES_ARCH) + if (hwc->state & PERF_HES_ARCH) { + static_call(x86_pmu_set_period)(event); continue; + } =20 /* * if cpuc->enabled =3D 0, then no wrmsr as