Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp2239260rdb; Mon, 20 Nov 2023 06:06:16 -0800 (PST) X-Google-Smtp-Source: AGHT+IEpC2LZ1CvyuQ8augTyEUFXbY6QNf20GoGH7N+cPSG85hX6uv1G2p9aJ/LBnsci7+33kOdH X-Received: by 2002:a17:902:db86:b0:1ce:5ca7:1060 with SMTP id m6-20020a170902db8600b001ce5ca71060mr6190110pld.10.1700489175687; Mon, 20 Nov 2023 06:06:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700489175; cv=none; d=google.com; s=arc-20160816; b=PjIfM/YQbtpVAiwpf+SbySwaS8DxJs76c/UIox+X5t3GMq22St8binI53YFEioLiFl sLuBQ8lA+BPlJn0766jw3pUoYnK81XUU/H22hvs3dkd9MubsIHmy7lUSFwjNK1GAGqgv Zgnpq39EHjb8IuOEkN9rLskdHg3quPeaX8lBLnjsVcaLp1zhwfdHoURJILzaj4MzQiVo q39+pQeWtLRr1uN7CTueZVtPgNDSz1ENzapKAhXU8CWa0q/wQUm/9UOxhxsAwEGYJJ/b 9sT6o8xPC52Vp3Qi8ga3S/AJlz+hvpOKPnpTm1CG7KtwbX9lXYRi5vvPHu4n+qUitHl+ WVuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=uc0JwOzjLilE+8LV/PtshmiVin5WqZkelAmOVULsXo8=; fh=FhhhQU6UXsBLddD3lzpScggcFnx91uFnzM9b/GPXE1Y=; b=GIPL7OIgZP7uUS9yh1l0Ta+JDwOda+ApjiCDqf3/cQwfemI4sLzXqiglapB070nn7y HOiCyYfnBZgS4m6I39BXzSNWejjsJsMREZA/EArC1//i0gdAXvCXR6lmAgZ9gScmHvv7 +GN2X/u20EtL88UBBzglIgcgDKeAIlRF2f/TluPXKK1GFf3Lqv8AKgFCLiQVPJPAhcb6 wX6t9KqvaGNnJR5avBQCvh5NUWG8QwpdiJ6nA302Hq8piTXJ52zSrkP7n8359MbRDbcw q/gpbVz7b1qIPiucnnKOT5we4LTR7nSD9hLcuDLVDO+T+3AW410fKOYP13bXCCAvypKy mqZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=bMOpwJOK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id i9-20020a17090332c900b001cf696b19fasi410728plr.232.2023.11.20.06.06.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 06:06:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=bMOpwJOK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 5A624807DED7; Mon, 20 Nov 2023 06:05:22 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233767AbjKTOEo (ORCPT + 99 others); Mon, 20 Nov 2023 09:04:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233532AbjKTOEW (ORCPT ); Mon, 20 Nov 2023 09:04:22 -0500 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6B621170B; Mon, 20 Nov 2023 06:03:48 -0800 (PST) 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=uc0JwOzjLilE+8LV/PtshmiVin5WqZkelAmOVULsXo8=; b=bMOpwJOKHP6MJ+6u4ayDpeHEvk Nicuud2iLkCBvPRrIyD2ZakyHmEVOmc48ewko+sLmU12OUElmhF/jd19NP5jsWqb/P4YhLiBP6SsD oKBdIg5oZjdWkAeLk6Z+fJOb0QRzBLiUL/7RD4yPU5vMELaV3I3eozlPGI6hKjcvQeS8YZFDH1peu nFzyShk+ZibBIJ5xCX2tzekTvbdzlkvwPe7axYOsdty9b6KRlz6v2V2E5W36y1Kk1NfO9NBxam4Vw 9qG4rfr3Zi14+UGbZBnI32cfUQXNvGDX1cHvGrh5ejSQ7oDXEoeRKoTSini6sdT0Rmbl/nkoCINkX f2q5I8vw==; 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.96 #2 (Red Hat Linux)) id 1r54sA-00AzmG-1J; Mon, 20 Nov 2023 14:03:34 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id 12E36300419; Mon, 20 Nov 2023 15:03:34 +0100 (CET) Date: Mon, 20 Nov 2023 15:03:34 +0100 From: Peter Zijlstra To: Namhyung Kim Cc: Josh Poimboeuf , Steven Rostedt , Ingo Molnar , Arnaldo Carvalho de Melo , linux-kernel@vger.kernel.org, x86@kernel.org, Indu Bhagat , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , linux-perf-users@vger.kernel.org, Mark Brown , linux-toolchains@vger.kernel.org Subject: Re: [PATCH RFC 04/10] perf: Introduce deferred user callchains Message-ID: <20231120140334.GW8262@noisy.programming.kicks-ass.net> References: <20231111184908.ym4l6cwzwnkl7e6m@treble> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Mon, 20 Nov 2023 06:05:23 -0800 (PST) On Wed, Nov 15, 2023 at 08:13:31AM -0800, Namhyung Kim wrote: > ---8<--- > diff --git a/include/uapi/linux/perf_event.h b/include/uapi/linux/perf_event.h > index 39c6a250dd1b..a3765ff59798 100644 > --- a/include/uapi/linux/perf_event.h > +++ b/include/uapi/linux/perf_event.h > @@ -456,7 +456,8 @@ struct perf_event_attr { > inherit_thread : 1, /* children only inherit if cloned with CLONE_THREAD */ > remove_on_exec : 1, /* event is removed from task on exec */ > sigtrap : 1, /* send synchronous SIGTRAP on event */ > - __reserved_1 : 26; > + defer_callchain: 1, /* generate DEFERRED_CALLCHAINS records for userspace */ > + __reserved_1 : 25; > > union { > __u32 wakeup_events; /* wakeup every n events */ > @@ -1207,6 +1208,20 @@ enum perf_event_type { > */ > PERF_RECORD_AUX_OUTPUT_HW_ID = 21, > > + /* > + * Deferred user stack callchains (for SFrame). Previous samples would Possibly also useful for ShadowStack based unwinders. And by virtue of it possibly saving work when multiple consecutive samples hit the same kernel section, for everything. > + * have kernel callchains only and they need to be stitched with this > + * to make full callchains. > + * > + * struct { > + * struct perf_event_header header; > + * u64 nr; > + * u64 ips[nr]; > + * struct sample_id sample_id; > + * }; > + */ > + PERF_RECORD_DEFERRED_CALLCHAINS = 22, > + > PERF_RECORD_MAX, /* non-ABI */ > }; > Anyway, yeah, that should do I suppose.