Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2644351rwb; Fri, 2 Dec 2022 12:48:53 -0800 (PST) X-Google-Smtp-Source: AA0mqf7HLgBJVcYvAy0uRASTJ6EBx7N8KWmwzBdfbHQReIG1ZC/Y2j6xVVBniKmPwjoWzXl0qhbF X-Received: by 2002:a17:90a:9706:b0:218:7ccd:d487 with SMTP id x6-20020a17090a970600b002187ccdd487mr73706143pjo.18.1670014133605; Fri, 02 Dec 2022 12:48:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670014133; cv=none; d=google.com; s=arc-20160816; b=Tu+WmouJD/L9qxfeG5y02h7ZwxDFoRu+R2kr0TmXwlW2oZVQouwp2eE0gb/qJNzJvr g/+inikcNcBT4ehcLOZoYGu/bA+qSWZWV5zXGy+M8qnCK7qDqmLtY3rChKkiW0AF652M 0lWUkh2k8OCU1/StO+oaVTqYGMaUmSrQewXkG6t6KnC38tV8O0HFfniPC5z7jTky33h0 sRx7YX/bkl+JvjCFhC6lU52orRv1hf3XYvOsJGtwNlLHQmVZz5YXuKF7tDm/by8ekNrN ONy/LPJM0XPeyu0lxDygu1D/FYrptMcIZGWGq6dRXsxOJgfIpO+5ZOSARr8Y/DlNyEny IGvQ== 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:dkim-signature; bh=nbzsLHN287NRmoIH0dYEVu2IEaMjMYmTN1PuYOM7BuY=; b=JnKpahhebMvhnO56cui/FZ+DYhbOj91H916NtxCMHQssc545P8S7geAOpKtYzQlob4 Xkf/miEEj7itXog7TDsDxxZcicJk+MAxXyeAhlWrJGkau08QFXyhyFWi/haJ/kO6xNJO 0LJM2RNgN0++WSzK+DZtXzMGwHl4JsiD3wBULTs5DPlwNnb6Ene2MBFo/dx/QaIBI1Vp EYmB8uGaWoeqS42dtKmcreyqZgH+XxmMXH4Ibh3/K0syf2C8yIYVP25FbLB8+KovqdHC QU++wAkqVF0Qf1U3Z7MwUvNZGPrnFuFhleGwt+DHe0j9X9omXh7dNm8zK9UkXLbufXD7 1aIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=P0xsU1Ia; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g3-20020a635203000000b0043a20d57b46si8106209pgb.826.2022.12.02.12.48.42; Fri, 02 Dec 2022 12:48:53 -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; dkim=pass header.i=@google.com header.s=20210112 header.b=P0xsU1Ia; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234827AbiLBTpl (ORCPT + 83 others); Fri, 2 Dec 2022 14:45:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46316 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234828AbiLBTpj (ORCPT ); Fri, 2 Dec 2022 14:45:39 -0500 Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F16CF4E92 for ; Fri, 2 Dec 2022 11:45:37 -0800 (PST) Received: by mail-wr1-x429.google.com with SMTP id y16so9384180wrm.2 for ; Fri, 02 Dec 2022 11:45:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=nbzsLHN287NRmoIH0dYEVu2IEaMjMYmTN1PuYOM7BuY=; b=P0xsU1IaQIAlZ/k9ksfZJKi/poK1AM9cbxHTrW5Jdls9S08vVA7J6RBU29lS/jSXid PTSg6KsAT1b0xEjqI7fZv5PA5+bzTo0pbnkJU0iCP/Vhe+jA0tVqse99QjU5lB8oSEar VCY2rVFQ+n4emwu12CYcOyKyKbRXjfCxUSCigW3I8lh/wXIK6rlbYu/ZD3z5K7vKhZv9 TE5o1xJjJoFeOyQUmmF4dh1LqLdxixA5asrDT8vV5qARsF+iT8p/z2wJnpnTX5KnVu9S odOFSf7EZ1xKWcvostLn9L9l5VUaNjcCnQAaV4FsLGHHRuqyIKQlW85ysM/W7U0SFWw0 Jgdg== 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=nbzsLHN287NRmoIH0dYEVu2IEaMjMYmTN1PuYOM7BuY=; b=icxKKo9BPx2rf/QIX96XbPgUATdvqnKjOSO5Z+xVmR9DVc/0fFiw+9vxdm+o7eJBqH euzloIB7cY9V9Rfi+Wj/2gIAp9F4g/DqD0o9isQjdZlQ3fzZk/dzldjfCboWJ1rICqAP g+fBUxnMUFZ28e8glNRWs4QbMSagpMm+bs6QU14xf9nqsvUsanG7Q/FhPuvg0rK/nP73 HhWqJwornoa9jgeEoea6lnbKs9uJuTc/+6JneIrYxRBGSrrEU/VSRzNa9+8DY8lN8Y9m 1Bvhly+Jt1q/7CLzY/9Od0srcuQgn150l+ACxsFxTYdKDq8PihvfRSuww/lJepioT4Db 0YJw== X-Gm-Message-State: ANoB5pk5izqE/jje5oOb/XDNhiKzA6Rk1/kZUkgFk+k1OSYwFFE/SaWo xT7ENt16r3hEErMMuN7QXMMIwWjBl9LOARiLHrFlzw== X-Received: by 2002:adf:e2c9:0:b0:241:db86:176d with SMTP id d9-20020adfe2c9000000b00241db86176dmr34644247wrj.40.1670010335669; Fri, 02 Dec 2022 11:45:35 -0800 (PST) MIME-Version: 1.0 References: <20221130062935.2219247-1-irogers@google.com> <20221130062935.2219247-4-irogers@google.com> In-Reply-To: From: Ian Rogers Date: Fri, 2 Dec 2022 11:45:22 -0800 Message-ID: Subject: Re: [PATCH v2 3/4] perf build: Use libtraceevent from the system To: Arnaldo Carvalho de Melo Cc: Namhyung Kim , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Masami Hiramatsu , Steven Rostedt , Adrian Hunter , Leo Yan , Kan Liang , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Stephane Eranian Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham 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 On Fri, Dec 2, 2022 at 10:29 AM Arnaldo Carvalho de Melo wrote: > > Em Fri, Dec 02, 2022 at 10:08:04AM -0800, Namhyung Kim escreveu: > > On Wed, Nov 30, 2022 at 12:13 PM Ian Rogers wrote: > > > > > > On Wed, Nov 30, 2022 at 11:05 AM Namhyung Kim wrote: > > > > > > > > On Tue, Nov 29, 2022 at 10:30 PM Ian Rogers wrote: > > > > > > > > > > Remove the LIBTRACEEVENT_DYNAMIC and LIBTRACEFS_DYNAMIC. If > > > > > libtraceevent isn't installed or NO_LIBTRACEEVENT=1 is passed to the > > > > > build, don't compile in libtraceevent and libtracefs support. This > > > > > also disables CONFIG_TRACE that controls "perf > > > > > trace". CONFIG_TRACEEVENT is used to control enablement in > > > > > Build/Makefiles, HAVE_LIBTRACEEVENT is used in C code. Without > > > > > HAVE_LIBTRACEEVENT tracepoints are disabled and as such the commands > > > > > kmem, kwork, lock, sched and timechart are removed. The majority of > > > > > commands continue to work including "perf test". > > > > > > > > Maybe we can have a different approach. I guess the trace data > > > > access is isolated then we can make dummy interfaces when there's > > > > no libtraceevent. This way we don't need to touch every command > > > > and let it fail when it's asked. > > > > > > Sounds like a worthwhile refactor that can land on top of this change. > > > > > > > The motivation is that we should be able to run the sub-commands > > > > as much as possible. In fact, we could run 'record' part only on the > > > > target machine and pass the data to the host for analysis with a > > > > full-fledged perf. Also some commands like 'perf lock contention' > > > > can run with or without libtraceevent (using BPF only). > > > > > > The issue here is that perf lock contention will use evsel__new_tp and > > > internally that uses libtraceevent. As such it is removed without > > > HAVE_LIBTRACEEVENT. Without the evsel there's not much perf lock > > > contention can do, so rather than litter the code with > > > HAVE_LIBTRACEEVENT and for it to be broken, I made the choice just to > > > remove it from the no libtraceevent build for now. > > > > I don't think it needs evsel__new_tp() when BPF is used. > > The BPF program is attached to the raw tracepoint without > > perf_event and the result is written to the BPF map. > > > > > > > > I think it is worth pursuing these patches in the shape they are in so > > > that we can land the removal of tools/lib/traceevent and ensure the > > > migration away from an out-of-date version of that library. > > > > Yeah, I agree that we should remove the stale libtraceevent but > > I'd like to do it with minimal changes in the perf code base. > > Let me take a look at this. > > Ok, was going to take a look at this patchkit, will wait for you now. > > - Arnaldo So the problematic function is: https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git/tree/tools/perf/util/evsel.c?h=perf/core#n482 struct evsel *evsel__newtp_idx(const char *sys, const char *name, int idx) on success it will always initialize: https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git/tree/tools/perf/util/evsel.c?h=perf/core#n499 evsel->tp_format = trace_event__tp_format(sys, name); tp_format is a libtraceevent type so this patch makes the variable conditional on HAVE_LIBTRACEEVENT. I think this will remain true even with a new evsel__newtp function that isn't dependent on libtraceevent. I also think adding such things is best kept out of this patch which is trying to do the minimal (only 312 lines of addition) to have a build without libtraceevent. Given we expect builds to use libtraceevent and we should build off of this patch, I think we should look to land it for 6.2. Thanks, Ian