Received: by 2002:ab2:715a:0:b0:1fd:c064:50c with SMTP id l26csp40965lqm; Mon, 10 Jun 2024 12:02:27 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX2WgRMmdolTDttzGHIlGLGDYuQDQB+RbIyq6SSSVNgUphdmQSmlVYuNsoJGbugc9icmBnGI2DdXSuI1ZnE4OWw69zHQCNrGNZ93pZTcg== X-Google-Smtp-Source: AGHT+IHl76XXr2n+RIbFhHKg6lTw4FG8Il/82pPJSGpALIjpap1Rzc4uyFyoMSWbWputD9ZCxdwz X-Received: by 2002:a05:6214:4687:b0:6b0:78b6:e5fd with SMTP id 6a1803df08f44-6b078b6e941mr53525386d6.44.1718046147258; Mon, 10 Jun 2024 12:02:27 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718046147; cv=pass; d=google.com; s=arc-20160816; b=R3+R62lzhSqC5oFN5WByivyI9glGtUqUZB7bEART7/G3nTal9f9C2Je9FcnKb193dS QdXZQ7gFunBxPlAtsU8DaxhDpkheG0eetChHFL6FLICEnjLxDW0J+BqFLtJ8QEgh71VY 7PzqbgdethhMpmtAQeM7DNRws/eKGMldOaU8pavdyRDFlqMTepbN8ySOcddx4SH3TEQm ULgf/xoO22ZzAPs+hDm1MMNzWFCu/D6FlsNFt5EV0E7vJnkeAiItacI+3COmLqMiiEHP j4VFhTSmSWAf6vg0gDRpxteZVAVDNSdACMU1rGZ2LQ5g1Nfyo+eBXk+WEMcTWTCQGIuL pZ/g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=s7Gyb9953r9ixu7af9wBM8hywUzKBl8Kmb/xfyNTRSg=; fh=xJHiY0VWo46aYVNui3CmzdK0I/o4eVA71wuchGM2Bps=; b=kCdA65uoKt9vqPY/qZg1v/KR5yDGpjH5yJE+W37O2GSi9STPoqPfNRzWy16ycTfP+9 2ZWq4LKF02qPGuqlSVevgOJO8G9ZiJH718e8DskZ7c0QrMjhIvibW6r+37k5xkJSxUof MLLANlnURbrNTetqB2Q7GeiaTQxrI8y0XrsKfn8tdIOpQdWF2jBvPxEGDGT+WcdO0sxS 7hBzW4KdsfWYEAbp2md9XV4lQVdKl7KIVTo9hCzSsAXgLvpHQr5eIZA4/nyCWXBDGmHG RQ1ZAJJ1Nm7dgjy4ttpW1ESPehPPAZTRGaIB4INT1dh2zLqfPAsC5qWWyrmMEBIpOosK w4QA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=KBx0Ic5e; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-208770-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-208770-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id 6a1803df08f44-6b075ad2681si46692256d6.94.2024.06.10.12.02.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Jun 2024 12:02:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-208770-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=KBx0Ic5e; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-208770-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-208770-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 012A81C2122D for ; Mon, 10 Jun 2024 19:02:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6F3CC14D2A3; Mon, 10 Jun 2024 19:02:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="KBx0Ic5e" Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 0CEA72E620; Mon, 10 Jun 2024 19:02:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.92.199 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718046138; cv=none; b=mb0zUikBtsWAoR+R/tyld4hu5FR1s34E5deyLKrjfOpOKqC4uvErl1FgNZfdjd05k8f2AlMjiTxshKAEFLS+ZEFb/HIq3ocvKNuZ+MaTIRo7vNel93xdigMZEzcrUOnrRA2lfH2mUu0vjznZCog85vXjeRCgrBPxCfVkMm1BRGU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718046138; c=relaxed/simple; bh=HIxZJDBw8lvC6AgonODjlRnJnG+poyxOoaYJhz1KzqI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=O90EwdyMub7L1HGCLW3PxYHEY+evx/FDc3Aa1FOAW2qNglOKkjyPjjxAkv0+NBMQbw6FOpc3gnjlSSkGm60wp14ikTd+QU1ZH8aSVGMBUMcJnel3F4nbsRoOjXrE9awI+mcBokDKsm14GpYNNS0TuHxDLy92v9GJLa/BomKTE4k= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=KBx0Ic5e; arc=none smtp.client-ip=90.155.92.199 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=s7Gyb9953r9ixu7af9wBM8hywUzKBl8Kmb/xfyNTRSg=; b=KBx0Ic5eGRnV/iKzQO1aiPoOB2 BVinSNWUG8COIh+VgcALGirLNWYTUUJ4SBSUSgbdnL7X9BNTRmt2tIjFFiLAjHViVYHY866EjogIr fucVRg1upRTcTHZAkCXEtviW3XaPQR1Wu0cdtQOM4dRNv8fPSBZ3PxsDOieH4/YUigloV+reuxXP6 bFisFazK7KSbFczNQkeI/c1Q0eCQp3OoKWrN3enEcVmTTozm5wWFeFSOEI/MgFzPtHHgO2jfMUOxQ ywgOf0A9/7Fs3VAGr/P2EvcM2Og8F24rtaK3plNMMun2YyWhRI36qLSl7Zj/iN0sbmt94e33KtB4E ArWrRwTQ==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1sGkGa-00000001cAp-2O4d; Mon, 10 Jun 2024 19:01:23 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id 1B245300439; Mon, 10 Jun 2024 21:01:19 +0200 (CEST) Date: Mon, 10 Jun 2024 21:01:18 +0200 From: Peter Zijlstra To: Ben Gainey Cc: "alexander.shishkin@linux.intel.com" , "linux-perf-users@vger.kernel.org" , Mark Rutland , "acme@kernel.org" , "mingo@redhat.com" , James Clark , "adrian.hunter@intel.com" , "namhyung@kernel.org" , "irogers@google.com" , "jolsa@kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH v7 1/4] perf: Support PERF_SAMPLE_READ with inherit Message-ID: <20240610190118.GV8774@noisy.programming.kicks-ass.net> References: <20240606144059.365633-1-ben.gainey@arm.com> <20240606144059.365633-2-ben.gainey@arm.com> <20240607093254.GN8774@noisy.programming.kicks-ass.net> <451afb8eb03f1519c482a84a6c1cbd1e62222988.camel@arm.com> <20240607110214.GQ8774@noisy.programming.kicks-ass.net> <60ed550e8cb5e5aa4004fb2d3857a605ba1da23e.camel@arm.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: <60ed550e8cb5e5aa4004fb2d3857a605ba1da23e.camel@arm.com> On Fri, Jun 07, 2024 at 02:04:49PM +0000, Ben Gainey wrote: > > IIRC they all originate in a single location around > > perf_output_read(), > > that already has the event and could easily 'correct' the semantic > > meaning by doing the above once or so. > > > > As far as I can tell, you can mix events in a group with inconsistent > values of PERF_SAMPLE_READ which means that doing it at the top level > introduces an inconsistency/confusing behaviour since it makes the > "thread-local-ness" of the read_format values a property of the event > that caused the sample, rather than of the specific event to which the > value belongs. The current implementation makes it a property of the > specific event not the sample event. Specifically, when > perf_output_read_group reads a child event that does not have > PERF_SAMPLE_READ, the sample event must have PERF_SAMPLE_READ, meaning > the child event will give the thread-local value even though it was not > created as inherit+PERF_SAMPLE_READ > > I can either: > > * Keep it so that the perf_output_read_group uses per-event value for > self Having the lot be inconsistent seems bad. > * Rework the deliver_sample_value in session.c to base its decision on > the sample event rather than the specific event The code as it exists seems to use the read_format from the event that actually triggers the sample -- which makes sense. I would expect this new thing to follow that. Mixing inherit between events in a group gets you crap, but that's what you asked for I suppose :-) But otherwise let the sampling event set the format. > * Forbid inconsistent PERF_SAMPLE_READ for events in a group Not possible I think, you can have non-sampling events in a group.