From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from stravinsky.debian.org (stravinsky.debian.org [82.195.75.108]) (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 B0EA13AD533; Fri, 13 Mar 2026 13:24:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=82.195.75.108 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773408268; cv=none; b=ZaCvbbYjYxgW8pBMoG+86Ry4ungBn8XHWC313rnNehClL8e0noyD7omjyOC+ToVudrUy7O2ZyXgZxb3ZLnOW+fiYVeoytPDV18xVodeF6xQrJ+YXzrDayLJBb/TK0IcDcslKrpRE4OOhKLEpcUVZkxZtG/k35tixt4/snedUViY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773408268; c=relaxed/simple; bh=WdbifB+Lpy61GxOTmYIJ/0d0Q7fAs/e2+cEJDWNbeeE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=B8J48bN7IrElqdN7hJo5kSB46nPhkk2450VEdPiTMlJ14XuLQgEIQpn1bFTiIJlem0/3/Ugaxuyml803+XY/wPuxFHj+I6A1t8sWIOP9s3A2c5/mVWdLwEM3ELObB1I5NgDRk1XkBX42KmtiP52Bbxpec4GJgkdnvC8+BMlaHF8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=debian.org; spf=none smtp.mailfrom=debian.org; dkim=pass (2048-bit key) header.d=debian.org header.i=@debian.org header.b=mSKEJ6Xx; arc=none smtp.client-ip=82.195.75.108 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=debian.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=debian.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=debian.org header.i=@debian.org header.b="mSKEJ6Xx" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debian.org; s=smtpauto.stravinsky; h=X-Debian-User:In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=X6CzG4WOOG89ao7WBG1kuZfV24i1xtrz3dwp1BQ647U=; b=mSKEJ6XxlogPw/552tbelWc2Zz PdiqU4/kgpDb0b2MGgMZh4POFgho9l/Cw574YBNjVwaSp7VSfLrprJRQ81CBRWIsLg1Df5bjoAJ7h OFEXI7Is0HnzJvVoPXbKCymHJJQYgyie3i3ufKEHUS7nWE1vugAjMSSeCoA+JFreB4IGG3F0/FxX4 eI+njI1x9EdNVkprQDwi4vr+aQzk0I19myY+2vu5XsunIOOYhvbvvUB1RbHXmU5eueYOK7mDvbDeB bqIzi7DGBWj0tYteJAofvUwvUXkO+zr78gUc+Q8Ob3+WA6ljCl35gb5VNXyuPvwaIG1wdJLcTdRth gsivNQgg==; Received: from authenticated user by stravinsky.debian.org with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.94.2) (envelope-from ) id 1w12UV-005LlJ-Qm; Fri, 13 Mar 2026 13:23:48 +0000 Date: Fri, 13 Mar 2026 06:23:41 -0700 From: Breno Leitao To: "Mi, Dapeng" Cc: Peter Zijlstra , Ian Rogers , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Adrian Hunter , James Clark , Thomas Gleixner , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@meta.com, stable@vger.kernel.org Subject: Re: [PATCH v2] perf/x86: Move event pointer setup earlier in x86_pmu_enable() Message-ID: References: <20260310-perf-v2-1-4a3156fce43c@debian.org> <20260311173509.GR606826@noisy.programming.kicks-ass.net> <20260311204035.GX606826@noisy.programming.kicks-ass.net> <9e0e04e9-7421-4dfb-a017-c31741a8d500@linux.intel.com> Precedence: bulk X-Mailing-List: stable@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: <9e0e04e9-7421-4dfb-a017-c31741a8d500@linux.intel.com> X-Debian-User: leitao On Thu, Mar 12, 2026 at 10:53:59AM +0800, Mi, Dapeng wrote: > On 3/12/2026 4:40 AM, Peter Zijlstra wrote: > > Subject: x86/perf: Make sure to program the counter value for stopped events on migration > > From: Peter Zijlstra > > Date: Wed Mar 11 21:29:14 CET 2026 > > > > Both Mi Dapeng and Ian Rogers noted that not everything that sets HES_STOPPED > > 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 counter. > > > > Fixes: a4eaf7f14675 ("perf: Rework the PMU methods") > > Reported-by: Dapeng Mi > > Reported-by: Ian Rogers > > Signed-off-by: Peter Zijlstra (Intel) > > --- > > arch/x86/events/core.c | 4 +++- > > 1 file changed, 3 insertions(+), 1 deletion(-) > > > > --- a/arch/x86/events/core.c > > +++ b/arch/x86/events/core.c > > @@ -1374,8 +1374,10 @@ static void x86_pmu_enable(struct pmu *p > > > > cpuc->events[hwc->idx] = event; > > > > - if (hwc->state & PERF_HES_ARCH) > > + if (hwc->state & PERF_HES_ARCH) { > > + static_call(x86_pmu_set_period)(event); > > continue; > > + } > > > > /* > > * if cpuc->enabled = 0, then no wrmsr as > > LGTM. > > Reviewed-by: Dapeng Mi Thank you for the patch and the discussion. To confirm my understanding: this patch should be applied on top of my v2 series to fully resolve the issue, correct? If so, would you prefer that I include both patches together in a single series, or are you fine with them as-is? Thanks, --breno