Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1379231rwb; Fri, 18 Nov 2022 17:54:49 -0800 (PST) X-Google-Smtp-Source: AA0mqf6ZQzIORXMAb//Jsci2HrUH7Kh9RCgn9yZy1tOFTjOUFLJaSto/vTi8SIsk80WNz1BIaU7K X-Received: by 2002:a17:90b:3d90:b0:200:7cf7:3d79 with SMTP id pq16-20020a17090b3d9000b002007cf73d79mr15822051pjb.206.1668822889485; Fri, 18 Nov 2022 17:54:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668822889; cv=none; d=google.com; s=arc-20160816; b=GhVzHeOLywmY9PXQAgx54diz2xU8leuYsQNM4AmeZ3g424DNJnyHHNfR/UzKSCsUfE 8T83YJHBP+HyRW06Y7LNEzIiectF67+/Rp90BWHlwI14BOF5nzdVRcPuzGCcqVjQ4mUv 2+XLWlUMZnincgQEMV+fLtK1WST10qN2zruUxF43Eq9O1DNADxIh0r0MMwM7lc72RLUw i1tISmXefvEGjjpX4cLFV+4j4x70USIf2BVRGhf2ta1ToHfCd6BBTF+jhf6SSS+yhoFg nSUV3yj1SyHaTop8dBEJIw4OLCb4J4IrQk0SU3WS8r35uyzq/pg2b5U0NnUb+MQwLcp3 b0uQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=ad8ss5RArgJrnDOHAbd/xNyjFS/cmNN++MlpW3Otizs=; b=K1U0PpBV0wOA3lJR8k4/7j4HN6XVu6Kz7GlkhPnMbRC+mIWe0OjsmmtrYflUUe7VU+ 0o/rGUho4S3amobTZow6pHN4qtnYGOKr2jAopavywFhYpU9wUjJbP1qXMmAOHDcRVGxU EXJ2xZ3zpO8iIT12Z1nRqY2SM19RNxbx/4dIQ2ZwYim/5/Y75tLfSNa0d/bh1NDLccFD RJJKz6IsPIOqgh+42vj5+9eE39odJ+0fttW7gmYx10gq8gBony99LqokA/pENZ7yakG/ ZZpWsUpyklE0eIUkHxPS848Cf6jEiUS5xebp4kGQVal+mhVA0x2qGq4IvOsCg4ueOtQ5 w9+A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t37-20020a056a0013a500b005623e8c0abcsi5567544pfg.151.2022.11.18.17.54.38; Fri, 18 Nov 2022 17:54:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232316AbiKSBcx (ORCPT + 90 others); Fri, 18 Nov 2022 20:32:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36848 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232326AbiKSBcc (ORCPT ); Fri, 18 Nov 2022 20:32:32 -0500 Received: from mail-io1-f50.google.com (mail-io1-f50.google.com [209.85.166.50]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E7F01165B5; Fri, 18 Nov 2022 16:37:27 -0800 (PST) Received: by mail-io1-f50.google.com with SMTP id c7so5026217iof.13; Fri, 18 Nov 2022 16:37:27 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=ad8ss5RArgJrnDOHAbd/xNyjFS/cmNN++MlpW3Otizs=; b=7psNjB2s1KkgYyAIO9wTHYEYwbs/Ey1udOKj1qWdf61TANw6vqLQVsbOThtrEPyuXb yyDvec79M2HgrQIptIa9qnJ7HJ7w7ags796GyLV31iusvxbmC1IPHCuBm0zT3iLG7DoC BVhFfgngOa5P6dSlHIKyeFOyRYXMGwhRW4wPvS/uOhWEJj7qL5DEO0XbR9uMuS8xbhv0 6Lje8X82/OhZdvqU0oQO1z/peI2GwAmOKnphuo26thIddT/Q5Ww6TIF7BQegFJCmU35/ sx1KNjvoZR+wECcDcW7XfKI1/2OUtNrUoAK/Hf7tSnajwWjXOh28yfaaPzc3UGE5f6Nh moFA== X-Gm-Message-State: ANoB5pkvPE7bE+ttF8RXWG1csogfNfD8CdHfDfPf18D/ce7+jGYfAsR1 t2yutYqP59M6xCY8GRSd5bDKPo6RwAaCqoKVM1c= X-Received: by 2002:a02:a399:0:b0:363:a2f8:5223 with SMTP id y25-20020a02a399000000b00363a2f85223mr4001619jak.282.1668818246166; Fri, 18 Nov 2022 16:37:26 -0800 (PST) MIME-Version: 1.0 References: <20221117224952.358639-1-irogers@google.com> <20221117224952.358639-2-irogers@google.com> <20221118103302.7ea12016@gandalf.local.home> In-Reply-To: From: Namhyung Kim Date: Fri, 18 Nov 2022 16:37:12 -0800 Message-ID: Subject: Re: [PATCH v1 1/2] perf build: Require libtraceevent from the system To: Arnaldo Carvalho de Melo Cc: Steven Rostedt , Peter Zijlstra , Ian Rogers , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Masami Hiramatsu , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Steven Rostedt , Adrian Hunter , Linux Trace Devel , Stephane Eranian Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On Fri, Nov 18, 2022 at 8:34 AM Arnaldo Carvalho de Melo wrote: > > Em Fri, Nov 18, 2022 at 10:33:02AM -0500, Steven Rostedt escreveu: > > On Fri, 18 Nov 2022 12:02:38 -0300 Arnaldo Carvalho de Melo wrote: > > > > yeah, this probably should work like with other libraries, don't stop > > > the build, just don't build features that depend on libtraceevent, > > > warning the user that features foo, bar and baz won't be available. > > > > For people working with just hardware, software, cache events, no > > > problem. > > > How are software events parsed? > > Not parsed, fixed: I believe Steve meant tracepoints :) > > root@roc-rk3399-pc:~# perf list sw > > List of pre-defined events (to be used in -e or -M): > > alignment-faults [Software event] > bpf-output [Software event] > cgroup-switches [Software event] > context-switches OR cs [Software event] > cpu-clock [Software event] > cpu-migrations OR migrations [Software event] > dummy [Software event] > emulation-faults [Software event] > major-faults [Software event] > minor-faults [Software event] > page-faults OR faults [Software event] > task-clock [Software event] > > duration_time [Tool event] > user_time [Tool event] > system_time [Tool event] > > root@roc-rk3399-pc:~# > > > In addition to: > > root@roc-rk3399-pc:~# perf list hw > > List of pre-defined events (to be used in -e or -M): > > branch-instructions OR branches [Hardware event] > branch-misses [Hardware event] > bus-cycles [Hardware event] > cache-misses [Hardware event] > cache-references [Hardware event] > cpu-cycles OR cycles [Hardware event] > instructions [Hardware event] > > root@roc-rk3399-pc:~# > > And: > > root@roc-rk3399-pc:~# perf list cache > > List of pre-defined events (to be used in -e or -M): > > L1-dcache-load-misses [Hardware cache event] > L1-dcache-loads [Hardware cache event] > L1-dcache-prefetch-misses [Hardware cache event] > L1-dcache-store-misses [Hardware cache event] > L1-dcache-stores [Hardware cache event] > L1-icache-load-misses [Hardware cache event] > L1-icache-loads [Hardware cache event] > branch-load-misses [Hardware cache event] > branch-loads [Hardware cache event] > dTLB-load-misses [Hardware cache event] > dTLB-store-misses [Hardware cache event] > iTLB-load-misses [Hardware cache event] > node-loads [Hardware cache event] > node-stores [Hardware cache event] > > root@roc-rk3399-pc:~# > > Without something like libtraceevent 'perf probe', 'perf trace' wouldn't > work as of now, as it currently use libtraceevent to parse whats in > tracefs. Right, many other tools would be impacted like 'perf lock', 'perf sched', ... > > So for some people, just interested in profiling the above hw, sw and > cache events, libtraceevent isn't strictly required and may even be > desirable to reduce the number of library dependencies. > > So its a valid feature to allow perf to be built without libtraceevent, > i.e. not something needed for the above scenarios. Right, we could remove unsupported commands from the build or refuse to run them with a warning. Thanks, Namhyung > > With libbpf and BTF tracefs isn't also strictly needed, as we already > have to link with it and things like 'perf trace' want to use libbpf's > btf pretty printing stuff, we can use BTF to enumerate events, iterate > thru its fields, offsets, types, etc: > > root@roc-rk3399-pc:~# pahole --sizes | grep trace_event_raw_sched > trace_event_raw_sched_kthread_stop 28 0 > trace_event_raw_sched_kthread_stop_ret 12 0 > trace_event_raw_sched_kthread_work_queue_work 32 0 > trace_event_raw_sched_kthread_work_execute_start 24 0 > trace_event_raw_sched_kthread_work_execute_end 24 0 > trace_event_raw_sched_wakeup_template 36 0 > trace_event_raw_sched_switch 64 0 > trace_event_raw_sched_migrate_task 40 0 > trace_event_raw_sched_process_template 32 0 > trace_event_raw_sched_process_wait 32 0 > trace_event_raw_sched_process_fork 48 0 > trace_event_raw_sched_process_exec 20 0 > trace_event_raw_sched_stat_runtime 48 1 > trace_event_raw_sched_pi_setprio 36 0 > trace_event_raw_sched_move_numa 36 0 > trace_event_raw_sched_numa_pair_template 48 0 > trace_event_raw_sched_wake_idle_without_ipi 12 0 > root@roc-rk3399-pc:~# > > root@roc-rk3399-pc:~# pahole trace_event_raw_sched_switch > struct trace_event_raw_sched_switch { > struct trace_entry ent; /* 0 8 */ > char prev_comm[16]; /* 8 16 */ > pid_t prev_pid; /* 24 4 */ > int prev_prio; /* 28 4 */ > long int prev_state; /* 32 8 */ > char next_comm[16]; /* 40 16 */ > pid_t next_pid; /* 56 4 */ > int next_prio; /* 60 4 */ > /* --- cacheline 1 boundary (64 bytes) --- */ > char __data[]; /* 64 0 */ > > /* size: 64, cachelines: 1, members: 9 */ > }; > root@roc-rk3399-pc:~# > > - Arnaldo