Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1788426rwb; Thu, 8 Dec 2022 15:33:10 -0800 (PST) X-Google-Smtp-Source: AA0mqf5/OkUKI3OQCFrTOYMNL46tJdxLcWfdQKE+2sWdDbByPKpvzOUM4BO4yhY4Y2uhfMu1MfIH X-Received: by 2002:a17:902:f60f:b0:186:e378:91cf with SMTP id n15-20020a170902f60f00b00186e37891cfmr4348022plg.37.1670542389964; Thu, 08 Dec 2022 15:33:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670542389; cv=none; d=google.com; s=arc-20160816; b=ANZj0w7cRHQXGGZFc/so9gQKgkke+gpD7FnTKFBQCRzGwoDRr/7579BusFt78Y+izQ 9REDmbSDeP8/Wi2AIJtm3qdfXtf/6u96gy0DPGXu0C6VEqiiUYKuQdJhGoxfud8BGz3F cUfkgw9cPAK8LVvAC0yYnhMngr6Y+MTDPovlK7jzXkHkcuoFrKQ2x+dX82s0bnBED4bQ Ihj9M6l2t4hVSIXG7EZCcOGg+DjGSjcZCHLDVjyJdhpsbQKzE/YidrFz23GSd2Er/cUh esuEBz/Rz+uzAFedP0Hsexte8SmklLxL/5qErGWlyzmU/lxDIvNRavDozHUpMhMNly4e 6BFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=eh4bsmmhDV2na+c1cDv3cDUUxd8uJbpto56UNxa7sxs=; b=CASU4V2+GMd60KQneiBSXrLDbe0bA7DgQ7a1ET5Jl+4vplrvEiTNqMugWxOZuhIQwQ So1+hz3m8Z+ovvuX+9eEyIxy18AkGOnN2FS4ROqIpG0OMLGihamq14VWZbvqAUK2iu+k MYVPC5ZiFe3efJWwRdHOlOeXg8AHe4Nnq6B2r/hwQMV8hbgRuZYGrvgZVY6LaVseGd2a FT86LZVdoL7h16VHTqxAc1/KrE83H64Es66yAKRC8l8JRjr+eBzsKY9nL63KtMc92Kf5 xNfUIvE3VgRLVCxicDetxOAVKct9En2erdZeQEdesnlDIaYmrNAbn0vw23CdEQvagW9P JUCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=h0zqJYv7; 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 n12-20020a170903110c00b00188b9b4139asi18331856plh.210.2022.12.08.15.32.59; Thu, 08 Dec 2022 15:33:09 -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=h0zqJYv7; 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 S229763AbiLHXBC (ORCPT + 73 others); Thu, 8 Dec 2022 18:01:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46290 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229908AbiLHXA4 (ORCPT ); Thu, 8 Dec 2022 18:00:56 -0500 Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06D4A92A19 for ; Thu, 8 Dec 2022 15:00:54 -0800 (PST) Received: by mail-wr1-x430.google.com with SMTP id y16so3472801wrm.2 for ; Thu, 08 Dec 2022 15:00:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=eh4bsmmhDV2na+c1cDv3cDUUxd8uJbpto56UNxa7sxs=; b=h0zqJYv790Sm8oD9EZiXdsmgwuqIWnxyzinQSwmgcnt2z1UBuZ4wDsBE2FInDTf2ZF 6Ni+I7BhNsYSaXDpJ4OICWVSmXM0ZQa7vEAvUn/Mu6Rw785VXoioOen7YF2JbZPElwtX 7hVCh6pY7iYmZMYRdc2uMqvpHOcGb11iIBZ9gZSk6VL7vhuiSQYYVvFvJWpuPSsUEdbY XCsTzACU6jG3gvz/5S+Jj3Rjs+/DTIXLFgHEgiDKhDFxxp2VLxIZBD7FZY4XLUx9DAbp Uaxh6pFW+Ir4pXSIk0CMGs/1QaB21SqsyPhMpPBWFppMdfghIOJniuJ5oANsEHg30JpS m0fQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding: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=eh4bsmmhDV2na+c1cDv3cDUUxd8uJbpto56UNxa7sxs=; b=WaJuv36Chieje8R5rmOdHSOb9J7DXjJKx+vCQUjXEUbuRJXMNjKpDMAc/3wHjVe2or M5GHstgIeAyX4dDORG0qkR91At9kCc2e+/4jC2UYZdFJDVlffWRKr60py3XyvgpzQr5/ plSN3g28zE5Tnrfr6jrWbX2DE4knrgOp4fj6QDV51n9/RLpr7MWlzd67UFbt28f1CaYZ 4gZetbz8hdHjSQFpGL/5I8wLItI5QykdJjS7HSYcOsGWADP5iiPHos7BrNNyHcTwPujb UDI+Yfxk9C6ojcdn2bsZwVU67n/cGx0194DgV/tzrmCSeMoyGbJtH9XS6VkZnpdQpdRA 4Nag== X-Gm-Message-State: ANoB5pljgvkKsd67i/0AsjLTXgtCH2UVcP/wY0hfE/AZ/mv3GDwbpZ6b +K/imy2R8EOqcwbXYKPnSx2V4S1HM8wZCtdhZh2lAQ== X-Received: by 2002:a5d:4acb:0:b0:242:78b7:6bf3 with SMTP id y11-20020a5d4acb000000b0024278b76bf3mr5995792wrs.375.1670540452229; Thu, 08 Dec 2022 15:00:52 -0800 (PST) MIME-Version: 1.0 References: <36CD1041-0CAE-41C1-8086-C17854531B3E@linux.vnet.ibm.com> In-Reply-To: From: Ian Rogers Date: Thu, 8 Dec 2022 15:00:39 -0800 Message-ID: Subject: Re: [PATCH 2/3] perf build: Use libtraceevent from the system To: Arnaldo Carvalho de Melo Cc: Athira Rajeev , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Nick Desaulniers , LKML , linux-perf-users@vger.kernel.org, bpf@vger.kernel.org, Stephane Eranian Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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=unavailable 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 Thu, Dec 8, 2022 at 2:32 PM Arnaldo Carvalho de Melo w= rote: > > Em Thu, Dec 08, 2022 at 07:04:52PM -0300, Arnaldo Carvalho de Melo escrev= eu: > > Em Thu, Dec 08, 2022 at 12:21:20PM +0530, Athira Rajeev escreveu: > > > > On 07-Dec-2022, at 10:57 PM, Arnaldo Carvalho de Melo wrote: > > > > Can you try again? tmp.perf/core? That "tmp." part means its a forc= e > > > > pushed branch, so I just force pushed with some arch specific fixes= , now > > > > I'm down to (removing the successful builds and unrelated failures,= now > > > > related to libbpf's F_DUPFD_CLOEXEC kaboom): > > > > > Ok Arnaldo, Sure, I will check with updated branch > > > > > > 5 7.38 fedora:34 : FAIL gcc version 11.3.= 1 20220421 (Red Hat 11.3.1-2) (GCC) > > > > /git/perf-6.1.0-rc6/tools/perf/util/evsel.c: In function =E2=80= =98evsel__rawptr=E2=80=99: > > > > /git/perf-6.1.0-rc6/tools/perf/util/evsel.c:2787:36: error: =E2= =80=98TEP_FIELD_IS_RELATIVE=E2=80=99 undeclared (first use in this function= ); did you mean =E2=80=98TEP_FIELD_IS_FLAG=E2=80=99? > > > > 2787 | if (field->flags & TEP_FIELD_IS_RELATIVE= ) > > > > | ^~~~~~~~~~~~~~~~~~~~~ > > > > | TEP_FIELD_IS_FLAG > > > > > I observed same issue as updated here: > > > https://lore.kernel.org/lkml/10476A85-3F75-4C91-AB5B-E5B136F31297@lin= ux.vnet.ibm.com/ > > > > > Looks like TEP_FIELD_IS_RELATIVE is not defined in header file of the= system installed version. > > > whereas it is there in header file in tools/lib/traceevent > > > > > # grep TEP_FIELD_IS_RELATIVE /usr/include/traceevent/event-parse.h > > > # grep TEP_FIELD_IS_RELATIVE ../lib/traceevent/event-parse.h > > > TEP_FIELD_IS_RELATIVE =3D 256, > > > > Right, I had noticed that as well, so as a prep patch I'm adding the > > patch below, before Ian's. Please check and provide an > > Acked-by/Tested-by/Reviewed-by if possible. > > I ended up with the one below, _after_ Ian's patch as I had some trouble = grafting > it before and had already tested it this way multiple times, I'm pushing > this to tmp/perf.core. > > - Arnaldo > > commit a0ec3ef4590e7e82339b6f318e671a6b69fd94e8 > Author: Arnaldo Carvalho de Melo > Date: Thu Dec 8 19:28:58 2022 -0300 > > perf tools: Add test to check if libtracevent has TEP_FIELD_IS_RELATI= VE > Could HAVE_LIBTRACEEVENT_TEP_FIELD_IS_RELATIVE be a version rather than feature check, something like: #define MAKE_LIBTRACEEVENT_VERSION(maj, mid, min) (maj * 255 *255 + mid * 255 + min) #define HAVE_LIBTRACEEVENT_TEP_FIELD_IS_RELATIVE (LIBTRACEEVENT_VERSION >=3D MAKE_LIBTRACEEVENT_VERSION(1, 5, 0) Note, we have LIBTRACEEVENT_VERSION computed in Makefile.config by way of pkg-config. Thanks, Ian > Some distros have older versions of libtraceevent where > TEP_FIELD_IS_RELATIVE and its associated semantics are not present, s= o > we need to test for its presence and cope when it isn't present when > building with LIBTRACEEVENT_DYNAMIC=3D1. > > Reported-by: Athira Jajeev > Cc: Adrian Hunter > Cc: Alexander Shishkin > Cc: Ian Rogers > Cc: Ingo Molnar > Cc: Jiri Olsa > Cc: Mark Rutland > Cc: Namhyung Kim > Cc: Nick Desaulniers > Cc: Peter Zijlstra , > Cc: Stephane Eranian > Signed-off-by: Arnaldo Carvalho de Melo > > diff --git a/tools/build/Makefile.feature b/tools/build/Makefile.feature > index 38f8851bd7cbdb0e..c6c9b7c7723d4290 100644 > --- a/tools/build/Makefile.feature > +++ b/tools/build/Makefile.feature > @@ -71,7 +71,8 @@ FEATURE_TESTS_BASIC :=3D \ > libzstd \ > disassembler-four-args \ > disassembler-init-styled \ > - file-handle > + file-handle \ > + libtraceevent-tep_field_is_relative > > # FEATURE_TESTS_BASIC + FEATURE_TESTS_EXTRA is the complete list > # of all feature tests > diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile > index 690fe97be1904399..24246df35ac30eeb 100644 > --- a/tools/build/feature/Makefile > +++ b/tools/build/feature/Makefile > @@ -81,7 +81,8 @@ FILES=3D \ > test-libzstd.bin \ > test-clang-bpf-co-re.bin \ > test-file-handle.bin \ > - test-libpfm4.bin > + test-libpfm4.bin \ > + test-libtraceevent-tep_field_is_relative > > FILES :=3D $(addprefix $(OUTPUT),$(FILES)) > > @@ -159,6 +160,9 @@ $(OUTPUT)test-dwarf_getlocations.bin: > $(OUTPUT)test-libelf-getphdrnum.bin: > $(BUILD) -lelf > > +$(OUTPUT)test-libtraceevent-tep_field_is_relative.bin: > + $(BUILD) -ltraceevent > + > $(OUTPUT)test-libelf-gelf_getnote.bin: > $(BUILD) -lelf > > diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config > index 680228e19c1aabdb..e29975664f06bd61 100644 > --- a/tools/perf/Makefile.config > +++ b/tools/perf/Makefile.config > @@ -1197,6 +1197,10 @@ ifneq ($(NO_LIBTRACEEVENT),1) > LIBTRACEEVENT_VERSION_CPP :=3D $(shell expr $(LIBTRACEEVENT_VERSION_= 1) \* 255 \* 255 + $(LIBTRACEEVENT_VERSION_2) \* 255 + $(LIBTRACEEVENT_VERS= ION_3)) > CFLAGS +=3D -DLIBTRACEEVENT_VERSION=3D$(LIBTRACEEVENT_VERSION_CPP) > $(call detected,CONFIG_LIBTRACEEVENT) > + $(call feature_check,libtraceevent-tep_field_is_relative) > + ifeq ($(feature-libtraceevent-tep_field_is_relative), 1) > + CFLAGS +=3D -DHAVE_LIBTRACEEVENT_TEP_FIELD_IS_RELATIVE > + endif > else > dummy :=3D $(warning Warning: libtraceevent is missing limiting func= tionality, please install libtraceevent-dev/libtraceevent-devel) > endif > diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c > index 6909cd9f48d11644..c9802ab549d7782f 100644 > --- a/tools/perf/builtin-trace.c > +++ b/tools/perf/builtin-trace.c > @@ -2729,8 +2729,10 @@ static size_t trace__fprintf_tp_fields(struct trac= e *trace, struct evsel *evsel, > offset =3D format_field__intval(field, sa= mple, evsel->needs_swap); > syscall_arg.len =3D offset >> 16; > offset &=3D 0xffff; > +#ifdef HAVE_LIBTRACEEVENT_TEP_FIELD_IS_RELATIVE > if (field->flags & TEP_FIELD_IS_RELATIVE) > offset +=3D field->offset + field= ->size; > +#endif > } > > val =3D (uintptr_t)(sample->raw_data + offset); > diff --git a/tools/perf/util/data-convert-bt.c b/tools/perf/util/data-con= vert-bt.c > index 8031b586e81384e7..b842273458b862bd 100644 > --- a/tools/perf/util/data-convert-bt.c > +++ b/tools/perf/util/data-convert-bt.c > @@ -322,8 +322,10 @@ static int add_tracepoint_field_value(struct ctf_wri= ter *cw, > offset =3D tmp_val; > len =3D offset >> 16; > offset &=3D 0xffff; > +#ifdef HAVE_LIBTRACEEVENT_TEP_FIELD_IS_RELATIVE > if (flags & TEP_FIELD_IS_RELATIVE) > offset +=3D fmtf->offset + fmtf->size; > +#endif > } > > if (flags & TEP_FIELD_IS_ARRAY) { > diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c > index ca911856c4b1d3c8..77b2cf5a214ec1e4 100644 > --- a/tools/perf/util/evsel.c > +++ b/tools/perf/util/evsel.c > @@ -2784,8 +2784,10 @@ void *evsel__rawptr(struct evsel *evsel, struct pe= rf_sample *sample, const char > if (field->flags & TEP_FIELD_IS_DYNAMIC) { > offset =3D *(int *)(sample->raw_data + field->offset); > offset &=3D 0xffff; > +#ifdef HAVE_LIBTRACEEVENT_TEP_FIELD_IS_RELATIVE > if (field->flags & TEP_FIELD_IS_RELATIVE) > offset +=3D field->offset + field->size; > +#endif > } > > return sample->raw_data + offset; > diff --git a/tools/perf/util/python.c b/tools/perf/util/python.c > index 6fb84b7455b8392d..7320f7f777fe0e56 100644 > --- a/tools/perf/util/python.c > +++ b/tools/perf/util/python.c > @@ -442,8 +442,10 @@ tracepoint_field(struct pyrf_event *pe, struct tep_f= ormat_field *field) > offset =3D val; > len =3D offset >> 16; > offset &=3D 0xffff; > +#ifdef HAVE_LIBTRACEEVENT_TEP_FIELD_IS_RELATIVE > if (field->flags & TEP_FIELD_IS_RELATIVE) > offset +=3D field->offset + field->size; > +#endif > } > if (field->flags & TEP_FIELD_IS_STRING && > is_printable_array(data + offset, len)) { > diff --git a/tools/perf/util/scripting-engines/trace-event-perl.c b/tools= /perf/util/scripting-engines/trace-event-perl.c > index 0bacb49408f84adf..c097b7934fd4ebe9 100644 > --- a/tools/perf/util/scripting-engines/trace-event-perl.c > +++ b/tools/perf/util/scripting-engines/trace-event-perl.c > @@ -393,8 +393,10 @@ static void perl_process_tracepoint(struct perf_samp= le *sample, > if (field->flags & TEP_FIELD_IS_DYNAMIC) { > offset =3D *(int *)(data + field->offset)= ; > offset &=3D 0xffff; > +#ifdef HAVE_LIBTRACEEVENT_TEP_FIELD_IS_RELATIVE > if (field->flags & TEP_FIELD_IS_RELATIVE) > offset +=3D field->offset + field= ->size; > +#endif > } else > offset =3D field->offset; > XPUSHs(sv_2mortal(newSVpv((char *)data + offset, = 0))); > diff --git a/tools/perf/util/scripting-engines/trace-event-python.c b/too= ls/perf/util/scripting-engines/trace-event-python.c > index fabba21919b8fa51..e930f5f1f36d2831 100644 > --- a/tools/perf/util/scripting-engines/trace-event-python.c > +++ b/tools/perf/util/scripting-engines/trace-event-python.c > @@ -994,8 +994,10 @@ static void python_process_tracepoint(struct perf_sa= mple *sample, > offset =3D val; > len =3D offset >> 16; > offset &=3D 0xffff; > +#ifdef HAVE_LIBTRACEEVENT_TEP_FIELD_IS_RELATIVE > if (field->flags & TEP_FIELD_IS_RELATIVE) > offset +=3D field->offset + field= ->size; > +#endif > } > if (field->flags & TEP_FIELD_IS_STRING && > is_printable_array(data + offset, len)) { > diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c > index c7a97b33e13477e1..0ecc2cb137920d2d 100644 > --- a/tools/perf/util/sort.c > +++ b/tools/perf/util/sort.c > @@ -2568,9 +2568,10 @@ static int64_t __sort__hde_cmp(struct perf_hpp_fmt= *fmt, > tep_read_number_field(field, a->raw_data, &dyn); > offset =3D dyn & 0xffff; > size =3D (dyn >> 16) & 0xffff; > +#ifdef HAVE_LIBTRACEEVENT_TEP_FIELD_IS_RELATIVE > if (field->flags & TEP_FIELD_IS_RELATIVE) > offset +=3D field->offset + field->size; > - > +#endif > /* record max width for output */ > if (size > hde->dynamic_len) > hde->dynamic_len =3D size;