From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=90.155.50.34 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796116750; b=gRTgeXNYPl75BbD931JOfSm255YGV6QEystbRe/fxIcmLLAp1YURwpt+AQbGuVVGMAjq qJ+O1gX3j4ES6FlwktTGOxTo6gXlh1OSahkBM3G2ogmE7GfVH614LAjf583qzEGIoOWb3 ukR2tyEx9+PKJwWcSUJcH+0u+NeSryMuG+CMgkz6+j3ED6Bf6fXq0oDxTnVrescqHgr4x zPB2ZeQct/Nqg2YAlOSVEBWmR8WRy7XT2ffxryQTVVRWLAIfMV57BL5pWOEhweDZymGof PxCsTVFmCWJevjRGAgQ5NqSK9fcjz3GB8QUGwAYM1VnpCdDqrbGPS01K2Z3enALVbTA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796116750; h=DMARC-Filter:DKIM-Signature:Received:Received:Date:From:To:Cc: Subject:Message-ID:References:MIME-Version:Content-Type: Content-Disposition:Content-Transfer-Encoding:In-Reply-To; bh=IcdOxnmdILPPaYheJ+1RYGeBo3VhUYTGARyOjeBYo/A=; b=O+nrkKddespbrVPUQkXiWdu6zSIquEY3Ms/W4rykavHegWu8qOLzsXUmO3v8UjRZ433E hPTmFOgp5CjgGflAz63xWVxcG7dEI4Op8An3vJXiIMQ68C+uT1zEib45PLois+IJ8tOIB 2S5bfhjnMWp9lWBE9s2StHwtfw1Ka4X9p3R2P/KCLvKsPuWxVTdsHZXNkypGpmL0GPcx8 B4UsanDc69JkNla+pDY4UDR7F8L/XLz/zduZZ43rQwDw3Eo1GFQ3yUqRbd4JclNRCc82u L+xf6lD0Q95EiwBxiZ+84V7CtCy8hDRWIX2/gsiu0kUNdEhEFjohscIkJKYXI+rQ9kg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=infradead.org; spf=pass smtp.mailfrom=infradead.org; dkim=pass header.d=infradead.org header.i=@infradead.org header.a=rsa-sha256 header.s=casper.20170209 header.b=FX2JfSEx; arc=none smtp.remote-ip=90.155.50.34 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9E4C6606A320; Tue, 1 Dec 2026 09:19:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 9E4C6606A320 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.a=rsa-sha256 header.s=casper.20170209 header.b=FX2JfSEx DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Transfer-Encoding: Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Sender:Reply-To:Content-ID:Content-Description; bh=IcdOxnmdILPPaYheJ+1RYGeBo3VhUYTGARyOjeBYo/A=; b=FX2JfSExc60sk9XtH/UYXVqeJf fpF09xitAAVHkuWat71H8FnLJtVm2V7P57eVSctqBz3aS0B8ZELnmsZ1vwNdUHnK/DCTES55NRweq SeHG3KAOlResjP1psIjWWgRw26DuoZBCkFwtStGOPOqlTPwekPPwi16PXb06Mxn4u5bNtuNuiHbEn ChHe02dgK+NrE1SPr3/FTVLIS8vOq4hcCKDVBe/u9XvhKywDJ1CKqjOP9M50YF3VB0dICXEIMKh2D zkT3YbeAp31ljFZS7HO3mdQ8qkpbe5ZpaqVr7x04IAW7maqDbL2dhcuXJycsZE2DbC6uEPv5IeDW4 6/UGfutA==; Received: from 77-249-17-252.cable.dynamic.v4.ziggo.nl ([77.249.17.252] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.100.1 #2 (Red Hat Linux)) id 1xYK0t-00000000vDc-3tvn; Tue, 01 Dec 2026 09:19:04 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id 2F6EA300AAD; Tue, 01 Dec 2026 10:18:58 +0100 (CET) Date: Tue, 1 Dec 2026 10:18:58 +0100 From: Peter Zijlstra To: Ian Rogers Cc: Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Adrian Hunter , James Clark , Andi Kleen , Dapeng Mi , Kan Liang , Thomas Falcon , Stephane Eranian , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 1/2] perf/core: Add PERF_EVENT_STATE_ON to fix filtered event enabled time Message-ID: <20261201091858.GE2883950@noisy.programming.kicks-ass.net> References: <80d983c5713537f5743b69e9b35ced1177e4732e.1795589380.git.irogers@google.com> <20261125123712.GP1813469@noisy.programming.kicks-ass.net> <20261125130233.GO2669272@noisy.programming.kicks-ass.net> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Mon, Nov 30, 2026 at 10:42:55AM -0800, Ian Rogers wrote: > On Wed, Nov 25, 2026 at 5:02 AM Peter Zijlstra wrote: > > > > On Wed, Nov 25, 2026 at 01:37:12PM +0100, Peter Zijlstra wrote: > > > On Tue, Nov 24, 2026 at 10:52:28PM -0800, Ian Rogers wrote: > > > > @@ -4134,6 +4154,21 @@ struct merge_sched_data { > > > > enum event_type_t event_type; > > > > }; > > > > > > > > +static void group_set_inactive(struct perf_event *group_event) > > > > +{ > > > > + struct perf_event *sibling; > > > > + > > > > + perf_event_set_state(group_event, PERF_EVENT_STATE_INACTIVE); > > > > + > > > > + for_each_sibling_event(sibling, group_event) { > > > > + if (sibling->state == PERF_EVENT_STATE_ON) > > > > + perf_event_set_state(sibling, PERF_EVENT_STATE_INACTIVE); > > > > + } > > > > + > > > > + list_add_tail(&group_event->active_list, > > > > + &group_event->pmu_ctx->flexible_inactive); > > > > +} > > > > This whole thing looks dodgy as well. This feels like > > __perf_effective_state() needs an update or something. > > > Thanks for the review, Peter! I've sent v4 addressing all of these: > https://lore.kernel.org/linux-perf-users/8b61be11e09ae7f663253cde769eff5456ebc263.1796063587.git.irogers@google.com/ > > - Took your state diagram and comment cleanup in perf_event.h. > - Updated __perf_effective_state() and perf_event_set_state() so enabled > (ON) siblings inherit INACTIVE from their group leader, removing > group_set_inactive() (while promoting ON siblings to INACTIVE on > flexible_inactive if an INACTIVE leader is detached). > - De-duplicated the pending_disable path in event_sched_out(). > - Updated merge_sched_in() to branch directly on group_can_go_on() and > group_sched_in() rather than testing event->state == ON. In > event_sched_in(), reverting the speculative ACTIVE back to ON keeps > siblings in ON and matches group_error: rollback so merge_sched_in() > remains the single place transitioning ON -> {ERROR, INACTIVE}. > I've got to ask; are you vibing this? There seem to be random changes in the patch not listed above that make review harder than it wants to be. Eg. there is now a shortcut in group_sched_out() that avoids iterating the siblings when !active. This then leads to other weirdness.