From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=90.155.92.199 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796112887; b=WEIn0MRdut7MeytD6IM4Y1u46wuHBlJIwqi8+95F3UmNgLE6SxVGV/8fMi4+j5E4AoZG C53I4RZq+hbE6Lj2o75J90bRP+xXir0Db17grMuh7QAWcrIxAIVrciuzrqijWLuQ1Aqdy o6KE26Ey8LaiDr4y3+g2Feo4SWoKeIMqSW5Vxd0DHJlPHHvk3bNM+tXUHrOZEINH/Hf7c SMtmaDNZaZXK9XjNDw3Th29Ti32b5Pt7iYTEBaWMu9nX1c9EXI28KhOAK342L/428h3fc zlnQ2mh+47v+MuCTu7GB+zoEgGL7SXKsYdHa1moTSfDgvzGF78j5S5dmPvT8p1/F0Ag== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796112887; h=DMARC-Filter:DKIM-Signature:Received:Received:Date:From:To:Cc: Subject:Message-ID:References:MIME-Version:Content-Type: Content-Disposition:In-Reply-To; bh=h8+LYBqP4CtMDaBHHfzYu0Pw5EB3HGOwqR/dq43ZFTc=; b=i7SINX9GrjT6sV1r4t+XZZda7TFuZC5i9erTWUCfWrl8vCrGiSaRhpJMvbB1UcUYcFmN LjmZLKFyvB808Hi4DMcWSQchMuOhUUz7HfP7BSosSVU4ZkW72LLv4mPp+lkjWo/pQCDU0 a6xAWRCzq4ZvXDDbh1PH3UmothQTnCCBJnIkiYayPPRMArOBnOtcGwi8oS3edBlWGiV8Q bc7gTr5rVcJRqSoYE7IYMgUO4ESUDAIoV7B8kn7ydmrQU1CgPw1p3dx3T1TPcg98Pkk+D rgLwKD95TPQ/koYTbwqIFa+CFzfWt9lrgU8fIgWWr2buNX6//2dI/gu9dVy8sHeH05A== 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=desiato.20200630 header.b=Z4e6RGxF; arc=none smtp.remote-ip=90.155.92.199 Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 900E0606A31A; Tue, 1 Dec 2026 08:14:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 900E0606A31A 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=desiato.20200630 header.b=Z4e6RGxF 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=h8+LYBqP4CtMDaBHHfzYu0Pw5EB3HGOwqR/dq43ZFTc=; b=Z4e6RGxF5m6aZf6S/hCnzTNMF8 0l6vCbpDBklI3GHhOrsPNB5nub32awCHP/Ur7LLOwThehc134H2PkWcQyY+m5iRadW5tkE7VdHoPq T3m7ioQKWXNM5cMhRFNDybFZr0C7SFZRx5A968vBDtlSFU8ndEOiSMZEtDBC3oiNn+c5l5UyjIPnz xNxVIxTH4/DzYPLlY4iJK/FjcoUfysEvxZR7sK5zZcXAv6eSGC3PTSS/oP11MXIHgYhzJmBgBCpJO h6a0ikxlE92o5iyuHhE3IP/LtaGshqCvHUYAuYNnrfhuplTCZHGMBrsVgCgeJgJ9uTfqaOuTXlzJx WOOkJeFw==; Received: from 77-249-17-252.cable.dynamic.v4.ziggo.nl ([77.249.17.252] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.100.1 #2 (Red Hat Linux)) id 1xYJ0X-0000000AmIe-1NX9; Tue, 01 Dec 2026 08:14:37 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id E2E42300673; Tue, 01 Dec 2026 09:14:35 +0100 (CET) Date: Tue, 1 Dec 2026 09:14:35 +0100 From: Peter Zijlstra To: Ian Rogers Cc: Namhyung Kim , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Adrian Hunter , James Clark , Athira Rajeev , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Eduard Zingerman , Song Liu , Yonghong Song , Ihor Solodrai , Leo Yan , Dmitry Vyukov , "Steinar H . Gunderson" , Stephen Brennan , Thomas Falcon , linux-perf-users@vger.kernel.org, bpf@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v4 03/19] perf/uapi: Add BUILD_ID_OFFSET sample types to UAPI Message-ID: <20261201081435.GD2883950@noisy.programming.kicks-ass.net> References: <20261125005108.1020003-1-irogers@google.com> <20261125005108.1020003-4-irogers@google.com> <20261125132512.GB2668804@noisy.programming.kicks-ass.net> <20261130193846.3582553-1-irogers@google.com> 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=us-ascii Content-Disposition: inline In-Reply-To: <20261130193846.3582553-1-irogers@google.com> On Mon, Nov 30, 2026 at 11:38:46AM -0800, Ian Rogers wrote: > On Wed, Nov 25, 2026 at 01:45:32PM -0800, Namhyung Kim wrote: > > On Wed, Nov 25, 2026 at 02:25:12PM +0100, Peter Zijlstra wrote: > > > > 64-bit offsets whose top 8 bits encode the 1-based build ID index (or > > > > 0x00 for unresolved user addresses and 0xff for kernel/context entries). > > > > In common cases where multiple callchain frames belong to the same > > > > binary, each unique build ID is encoded only once. > > > > > > Why ?!? This is insane > > > > This is basically to save space for callchains. When multiple entries > > fall into the same binary, it can have a table of binaries/build-ids > > and use indices instead of repeating full build-id for each entry. > > > > It'd be great if it could have a global (or per-session) table. This is > > a per-sample table. Please let us know if you have a better idea. > > For context on how we arrived here: in v1/v2 each callchain frame was > simply a fixed 32-byte { struct perf_build_id bid; u64 offset; } entry > (4x larger than raw u64 IPs, ~4 KiB for a 127-frame stack). The > per-sample table + 8-bit index in v3/v4 was an attempt to cut that size > overhead while keeping each sample self-contained. > > Fair enough if the bit-packing / per-sample table complexity is too > ugly for UAPI. Before spinning v5, what direction would you prefer? Personally, I would much prefer buildid to cease existing ;-) It is an abomination. > Some alternatives: > > 1. Simple fixed-size entries per frame (no table, no bit-packing): > back to { struct perf_build_id bid; u64 offset; } per entry, trading > extra ring-buffer bytes for a trivial UAPI and kernel path. > > 2. Per-sample table without bit-packing into offsets: e.g. fixed > struct perf_build_id build_ids[nr_build_ids] plus explicit > { u64 offset; u32 bid_idx; u32 reserved; } (or separate u8/u16 > index array) so 64-bit offsets/addresses stay untouched. > > 3. A session/ring-buffer sideband record (e.g. assigning a monotonic > ID per build ID when first encountered, or emitting a build-ID table > record) so samples only carry { id, offset } instead of repeating > 20-byte build IDs across samples. > > Which aspect is the main objection here -- the 8-bit/56-bit packing, > the per-sample deduplication in the kernel, or repeating build IDs per > sample instead of a sideband mapping? Like I just replied; I don't see why we need it at all; we already have buildid in the mmap sideband data. That is sufficient to reconstruct at post processing.