Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp6964049rwl; Mon, 9 Jan 2023 15:51:40 -0800 (PST) X-Google-Smtp-Source: AMrXdXssL1xhVxQ6Vwb4zDlcIErvsiV69EapVaYOK87lqVrBC/QcblbpmFWN6AOhqRDLpkRFU0/r X-Received: by 2002:a05:6a00:3247:b0:576:65f5:c60a with SMTP id bn7-20020a056a00324700b0057665f5c60amr57664631pfb.27.1673308300281; Mon, 09 Jan 2023 15:51:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673308300; cv=none; d=google.com; s=arc-20160816; b=1Ly01G2S1bWoAo+YRxVLknd2RcPenfXb2Af2HEV4xVF5nl6vCZzWmSsKJaOiPeD+iU x4ejEXtYyvxQA04fVLokEi96hVdTkQ4Q1rch2d8BmHMHSH4LZS6kmqHj2DBg7aNPhExV CDrtbAQKbB3Oon+JHVSxMSuHyJi34Sp/HPqrd8TlYbtbsY8X1aV0c69vJaW9a3R+BKsX R5qarQ/TYe3VGR5GpleJgBw43Txvql/yJhZXt9siEOSEkWvVW5GH6/35+rfHTTrTyfe0 tcSjHU+X9noH9AzVKloWnRjiS8F7YzVuefPhgs+hh1C2hWEtPtW0WaMKF7AzB+drpz3K 2h9w== 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=9V4h5//Bd9UpMKrMG2+TjtK29kWm5ULzWzIMWRNryEM=; b=Evkv0rtZxPOfkdP/RGXWF6MvslV636CFDf7GbC7JV+P3VrsWCqpnu/lrnUngyWxE75 K0+R34nXqDzKGyLCWXafq5NqJ0TMEnkn2wMUoMAn/WKlfCBcSeMW9zZkcwifhCvZTc8f Bpr63JQBSCxiAgSV4H3ujc/uJ/W7TdYgUMHAOV9WUZmuFly4M4/HYKKiF85uZgrfD3Gz eJJcIDw3cg1HVMDVw2oAj9SSn5OSDNF7VXoAAyY9Q/zl2mu3ZLHyz0xX7RuPmvtlqOZ3 grJk2BJWvAFvMLIRhX+qAPTO7u4KhFNeaeic7gaS1Pf2PD0hwmLNJR3uOjbOHimgI5ik OSrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=QXQzAUzt; 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 t1-20020a056a00138100b0058095546a38si10517188pfg.361.2023.01.09.15.51.33; Mon, 09 Jan 2023 15:51:40 -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=QXQzAUzt; 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 S237458AbjAIXie (ORCPT + 55 others); Mon, 9 Jan 2023 18:38:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60698 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235189AbjAIXi1 (ORCPT ); Mon, 9 Jan 2023 18:38:27 -0500 Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B54838FF3 for ; Mon, 9 Jan 2023 15:38:25 -0800 (PST) Received: by mail-wm1-x332.google.com with SMTP id g19-20020a05600c4ed300b003d9eb1dbc0aso5580600wmq.3 for ; Mon, 09 Jan 2023 15:38:25 -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=9V4h5//Bd9UpMKrMG2+TjtK29kWm5ULzWzIMWRNryEM=; b=QXQzAUztRHQsHzELRUaK0C7il3idvJDISn5A+Y3vP4hCHLaWKxZ6ZOD0sjYVetESac lhDZsPkeQlU5pkEMj2MPPb4CIQLqKJENYtscyqBP6kFSNTT5/rzYbNpu5oWxgZO7MYKp LOmq/85+nwxingZIcC/l0N3bPCusicuKqPIOWugVVwRcLa9ufdtQfty4U9RRMUTwY9TU +cvi0VxKnp28OO4E1Uk40Mj8AEa5l9DjcfjPfI1HQQmzFlzulUBVGZ5nkmpu23H2PcBt 3YwP5KU7qVDNT+wmV+QvxK4OyuAPdlI4peVLA/qprUE/8rpvx4bKpXOWNbPUx+YQfzax f8Sw== 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=9V4h5//Bd9UpMKrMG2+TjtK29kWm5ULzWzIMWRNryEM=; b=nMkXqEoTsFduqKhygvWOAtlJAgktNHECPvTGaGGLXB1DxmSAx+LAlK4yd6G3b6OVk7 VlAHv0sVdttOGdKf64FXlXfEscb5FEdRskOoReKikUu4yx7nzQBXBV/ih7NlGjk4TyKE 8voDROWXdgaQMRBgczS40mlAYaYC4qkOTcphs0xnDS/ZU/1hWDnQ44yP71zLX8L3047h NTNmN4bIfz3tVXH25BPnYiP5uiB7oSdsz46T7aPJNgsvLwbZ0n+dZOOuDXHwIw1C4mYA lqSq6QP/SvnXAKReREAv/7ZRsG4d81neaJHuT4Y91kxqQ2mbgf1NygNSEOmYAlrVXHG7 Ptfw== X-Gm-Message-State: AFqh2kpBqvIENq3wX+aOH6CYXMwkWyGm0BkosuuJu81AixhixbxW2EoN UC6Yu6ncKNxgjgRjkFm6HWi8GDW6Qe9G2qCdh5uohA== X-Received: by 2002:a05:600c:5d5:b0:3cf:6a4c:af8b with SMTP id p21-20020a05600c05d500b003cf6a4caf8bmr4919832wmd.115.1673307504112; Mon, 09 Jan 2023 15:38:24 -0800 (PST) MIME-Version: 1.0 References: <20230109223110.1201541-1-irogers@google.com> In-Reply-To: From: Ian Rogers Date: Mon, 9 Jan 2023 15:38:11 -0800 Message-ID: Subject: Re: [PATCH v1 1/2] perf tools: Remove HAVE_LIBTRACEEVENT_TEP_FIELD_IS_RELATIVE To: Namhyung Kim Cc: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Adrian Hunter , Yang Jihong , Kan Liang , Kim Phillips , German Gomez , Sean Christopherson , Paolo Bonzini , Eelco Chaudron , Leo Yan , Athira Rajeev , Stephane Eranian , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org 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 Mon, Jan 9, 2023 at 2:57 PM Namhyung Kim wrote: > > Hi Ian, > > On Mon, Jan 9, 2023 at 2:31 PM Ian Rogers wrote: > > > > Switch HAVE_LIBTRACEEVENT_TEP_FIELD_IS_RELATIVE to be a version number > > test on libtraceevent being >= to version 1.5.0. This also corrects a > > greater-than test to be greater-than-or-equal. > > > > Discussed here: > > https://lore.kernel.org/lkml/20221205225940.3079667-3-irogers@google.com/ > > > > Fixes: b9a49f8cb02f ("perf tools: Check if libtracevent has TEP_FIELD_IS_RELATIVE") > > Signed-off-by: Ian Rogers > > --- > > tools/perf/Makefile.config | 4 ---- > > tools/perf/builtin-trace.c | 2 +- > > tools/perf/util/data-convert-bt.c | 2 +- > > tools/perf/util/evsel.c | 2 +- > > tools/perf/util/python.c | 2 +- > > tools/perf/util/scripting-engines/trace-event-perl.c | 2 +- > > tools/perf/util/scripting-engines/trace-event-python.c | 2 +- > > tools/perf/util/sort.c | 3 ++- > > tools/perf/util/trace-event.h | 3 +++ > > 9 files changed, 11 insertions(+), 11 deletions(-) > > > > diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config > > index c2504c39bdcb..f67ba8060162 100644 > > --- a/tools/perf/Makefile.config > > +++ b/tools/perf/Makefile.config > > @@ -1204,10 +1204,6 @@ ifneq ($(NO_LIBTRACEEVENT),1) > > LIBTRACEEVENT_VERSION_CPP := $(shell expr $(LIBTRACEEVENT_VERSION_1) \* 255 \* 255 + $(LIBTRACEEVENT_VERSION_2) \* 255 + $(LIBTRACEEVENT_VERSION_3)) > > CFLAGS += -DLIBTRACEEVENT_VERSION=$(LIBTRACEEVENT_VERSION_CPP) > > $(call detected,CONFIG_LIBTRACEEVENT) > > - LIBTRACEEVENT_VERSION_WITH_TEP_FIELD_IS_RELATIVE := $(shell expr 1 \* 255 \* 255 + 5 \* 255 + 0) # 1.5.0 > > - ifeq ($(shell test $(LIBTRACEEVENT_VERSION_CPP) -gt $(LIBTRACEEVENT_VERSION_WITH_TEP_FIELD_IS_RELATIVE); echo $$?),0) > > - CFLAGS += -DHAVE_LIBTRACEEVENT_TEP_FIELD_IS_RELATIVE > > - endif > > else > > dummy := $(warning Warning: libtraceevent is missing limiting functionality, please install libtraceevent-dev/libtraceevent-devel) > > endif > > diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c > > index 86e06f136f40..927622ecc42e 100644 > > --- a/tools/perf/builtin-trace.c > > +++ b/tools/perf/builtin-trace.c > > @@ -2729,7 +2729,7 @@ static size_t trace__fprintf_tp_fields(struct trace *trace, struct evsel *evsel, > > offset = format_field__intval(field, sample, evsel->needs_swap); > > syscall_arg.len = offset >> 16; > > offset &= 0xffff; > > -#ifdef HAVE_LIBTRACEEVENT_TEP_FIELD_IS_RELATIVE > > +#if LIBTRACEEVENT_VERSION >= MAKE_LIBTRACEEVENT_VERSION(1, 5, 0) > > if (field->flags & TEP_FIELD_IS_RELATIVE) > > offset += field->offset + field->size; > > #endif > > diff --git a/tools/perf/util/data-convert-bt.c b/tools/perf/util/data-convert-bt.c > > index b842273458b8..98454f7a820c 100644 > > --- a/tools/perf/util/data-convert-bt.c > > +++ b/tools/perf/util/data-convert-bt.c > > @@ -322,7 +322,7 @@ static int add_tracepoint_field_value(struct ctf_writer *cw, > > offset = tmp_val; > > len = offset >> 16; > > offset &= 0xffff; > > -#ifdef HAVE_LIBTRACEEVENT_TEP_FIELD_IS_RELATIVE > > +#if LIBTRACEEVENT_VERSION >= MAKE_LIBTRACEEVENT_VERSION(1, 5, 0) > > if (flags & TEP_FIELD_IS_RELATIVE) > > offset += fmtf->offset + fmtf->size; > > #endif > > diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c > > index 999dd1700502..296292fa2c04 100644 > > --- a/tools/perf/util/evsel.c > > +++ b/tools/perf/util/evsel.c > > @@ -2784,7 +2784,7 @@ void *evsel__rawptr(struct evsel *evsel, struct perf_sample *sample, const char > > if (field->flags & TEP_FIELD_IS_DYNAMIC) { > > offset = *(int *)(sample->raw_data + field->offset); > > offset &= 0xffff; > > -#ifdef HAVE_LIBTRACEEVENT_TEP_FIELD_IS_RELATIVE > > +#if LIBTRACEEVENT_VERSION >= MAKE_LIBTRACEEVENT_VERSION(1, 5, 0) > > if (field->flags & TEP_FIELD_IS_RELATIVE) > > offset += field->offset + field->size; > > #endif > > diff --git a/tools/perf/util/python.c b/tools/perf/util/python.c > > index 212031b97910..25a276710dfb 100644 > > --- a/tools/perf/util/python.c > > +++ b/tools/perf/util/python.c > > @@ -442,7 +442,7 @@ tracepoint_field(struct pyrf_event *pe, struct tep_format_field *field) > > offset = val; > > len = offset >> 16; > > offset &= 0xffff; > > -#ifdef HAVE_LIBTRACEEVENT_TEP_FIELD_IS_RELATIVE > > +#if LIBTRACEEVENT_VERSION >= MAKE_LIBTRACEEVENT_VERSION(1, 5, 0) > > if (field->flags & TEP_FIELD_IS_RELATIVE) > > offset += field->offset + field->size; > > #endif > > diff --git a/tools/perf/util/scripting-engines/trace-event-perl.c b/tools/perf/util/scripting-engines/trace-event-perl.c > > index c097b7934fd4..5bcec514f697 100644 > > --- a/tools/perf/util/scripting-engines/trace-event-perl.c > > +++ b/tools/perf/util/scripting-engines/trace-event-perl.c > > @@ -393,7 +393,7 @@ static void perl_process_tracepoint(struct perf_sample *sample, > > if (field->flags & TEP_FIELD_IS_DYNAMIC) { > > offset = *(int *)(data + field->offset); > > offset &= 0xffff; > > -#ifdef HAVE_LIBTRACEEVENT_TEP_FIELD_IS_RELATIVE > > +#if LIBTRACEEVENT_VERSION >= MAKE_LIBTRACEEVENT_VERSION(1, 5, 0) > > if (field->flags & TEP_FIELD_IS_RELATIVE) > > offset += field->offset + field->size; > > #endif > > diff --git a/tools/perf/util/scripting-engines/trace-event-python.c b/tools/perf/util/scripting-engines/trace-event-python.c > > index e930f5f1f36d..759ed6eafa3c 100644 > > --- a/tools/perf/util/scripting-engines/trace-event-python.c > > +++ b/tools/perf/util/scripting-engines/trace-event-python.c > > @@ -994,7 +994,7 @@ static void python_process_tracepoint(struct perf_sample *sample, > > offset = val; > > len = offset >> 16; > > offset &= 0xffff; > > -#ifdef HAVE_LIBTRACEEVENT_TEP_FIELD_IS_RELATIVE > > +#if LIBTRACEEVENT_VERSION >= MAKE_LIBTRACEEVENT_VERSION(1, 5, 0) > > if (field->flags & TEP_FIELD_IS_RELATIVE) > > offset += field->offset + field->size; > > #endif > > diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c > > index e188f74698dd..cfcc253239f0 100644 > > --- a/tools/perf/util/sort.c > > +++ b/tools/perf/util/sort.c > > @@ -28,6 +28,7 @@ > > #include "time-utils.h" > > #include "cgroup.h" > > #include "machine.h" > > +#include "trace-event.h" > > #include > > #include > > > > @@ -2667,7 +2668,7 @@ static int64_t __sort__hde_cmp(struct perf_hpp_fmt *fmt, > > tep_read_number_field(field, a->raw_data, &dyn); > > offset = dyn & 0xffff; > > size = (dyn >> 16) & 0xffff; > > -#ifdef HAVE_LIBTRACEEVENT_TEP_FIELD_IS_RELATIVE > > +#if LIBTRACEEVENT_VERSION >= MAKE_LIBTRACEEVENT_VERSION(1, 5, 0) > > if (field->flags & TEP_FIELD_IS_RELATIVE) > > offset += field->offset + field->size; > > Maybe I missed the previous discussion. > > As it's only used in the bit test, can we have something like this > in the header file? > > #if LIBTRACE_EVENT_VERSION < ...(1, 5, 0) > # define TEP_FIELD_IS_RELATIVE 0 > #endif > > Thanks, > Namhyung We could but I think we lose some of the intention revealing-ness that TEP_FIELD_IS_RELATIVE is only present with libtraceevent 1.5.0 or newer. Thanks, Ian > > #endif > > diff --git a/tools/perf/util/trace-event.h b/tools/perf/util/trace-event.h > > index add6c5d9531c..1a1a2e6b24fb 100644 > > --- a/tools/perf/util/trace-event.h > > +++ b/tools/perf/util/trace-event.h > > @@ -20,6 +20,9 @@ struct trace_event { > > struct tep_plugin_list *plugin_list; > > }; > > > > +/* Computes a version number comparable with LIBTRACEEVENT_VERSION from Makefile.config. */ > > +#define MAKE_LIBTRACEEVENT_VERSION(a, b, c) ((a)*255*255+(b)*255+(c)) > > + > > typedef char *(tep_func_resolver_t)(void *priv, > > unsigned long long *addrp, char **modp); > > > > -- > > 2.39.0.314.g84b9a713c41-goog > >