Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp8326040rwl; Tue, 10 Jan 2023 11:57:11 -0800 (PST) X-Google-Smtp-Source: AMrXdXv0kuYWafggK/KeMYVgqL4gkFjVF0RQUi848j2vTQ3c5kjLU+ournCiRTYNOV9IgWSrvOwp X-Received: by 2002:a17:907:c78e:b0:7c5:f0a3:5d71 with SMTP id tz14-20020a170907c78e00b007c5f0a35d71mr60626938ejc.0.1673380630878; Tue, 10 Jan 2023 11:57:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673380630; cv=none; d=google.com; s=arc-20160816; b=pCphViGI1dEGlFxxaW1kEr8N4npGMQl+RBWQPT2xfwmbtMzZYK7gJ/76sed5dcxLuQ OOcMuhXNKoIjbjmiEymri4SJa/h2Itv3kG8/OcxvGHxL8Vf1YhBM7cl541L6IXOAdIC0 6qS8UPEBcWa0yik0Nyg9bEjGvpDsoaSO6rlySQQ5T3qumlfHtKBnSE22PvTTUEgcFzbd YOrsqnvUaw3gEXdeKw11Xj50lMnsBBxCwf9Sshw5Gv96hX5TxlncfaXsI1KgTEWMUXsy xKR9Y31gcL8vGR6awWUerMIvCQ4MdjfO6zZe7+3GFZzuGMChiR6wQ9kChUQgD8Km7z6m BGkw== 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=2m0o8gK2yZq30Jsm83JbSXnacP4P7Zm5m6HyGFlXqoA=; b=w4Vj8W5JkaxBNu6hl0WZYBm8cKVL21lz+GDHrCftdPkackKBt7qzIXVq+PUq5kGG0i m/JcgotW+LHnXFrfJ+HUXTIuIVXJ0BajsRrlhELRbTkjQu8xc99aPm9usdEgcpEGheTS mGBqcyv7w47bh5LjkiyPd7m9V1+EStqo4WtRMhmhHGqOJjt7nAYprUu/tgdzldq4/ycG +LY1iTfZbeeYi0ncp505Ehibn6uNl/LjEcnUhhYCIP116jq806M6SZRnsfdYL71SsblB hBF/Um6d+YR9a7SO8V6K0/BfqgIpdHZTf+X8qwaERyZxe8GBmPT6ygFzPXDHTGZMbyPV KgdQ== 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 k12-20020a50ce4c000000b00458ff6921e6si12831399edj.79.2023.01.10.11.56.58; Tue, 10 Jan 2023 11:57:10 -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 S239761AbjAJTJ4 (ORCPT + 53 others); Tue, 10 Jan 2023 14:09:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51732 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239834AbjAJTJK (ORCPT ); Tue, 10 Jan 2023 14:09:10 -0500 Received: from mail-io1-f45.google.com (mail-io1-f45.google.com [209.85.166.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E9EE710CD; Tue, 10 Jan 2023 11:09:09 -0800 (PST) Received: by mail-io1-f45.google.com with SMTP id 3so6548470iou.12; Tue, 10 Jan 2023 11:09:09 -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=2m0o8gK2yZq30Jsm83JbSXnacP4P7Zm5m6HyGFlXqoA=; b=GbIwcWtqwM5Os3LqwcO+RJn5z6G3zxT2KshwF9RIqbuigGXXxRAFvUqCnCq6p32pGi WimPEefyGSyMJu18J8hvRwagVIqgHZV9GczkJErnagR7vT9TRRrWTwNDdDZTVUL2VNuf b4vocT1U8Yc2iMajvarEn1B8uFtqgKBsEiGGSb80XoXAhNUWUwPYLzM64N/PuDmbDCrA wtY7wvrFQhK7L327/cLqRauWNEFs1af3KwAI5g/G2QS0htQ0dX6gYqy6sVfavNNGVbQx vRH4UZxL7KXdfcA2ruseDb00jcgZ9zSVbji3FVPjZEB61053F3+xfT6neGl3ylPt7ANL KUDA== X-Gm-Message-State: AFqh2krXFLoHZrE3MdcLtSNTRXbrCjSrpksq2vESd9LNxwtdvP9cE+f8 xPihenIUVi9DaQ9vE9DwAj467B7n8gyffmOvdfs= X-Received: by 2002:a02:ccb7:0:b0:38a:cbda:14b7 with SMTP id t23-20020a02ccb7000000b0038acbda14b7mr6467761jap.202.1673377748867; Tue, 10 Jan 2023 11:09:08 -0800 (PST) MIME-Version: 1.0 References: <20230109223110.1201541-1-irogers@google.com> In-Reply-To: From: Namhyung Kim Date: Tue, 10 Jan 2023 11:08:57 -0800 Message-ID: Subject: Re: [PATCH v1 1/2] perf tools: Remove HAVE_LIBTRACEEVENT_TEP_FIELD_IS_RELATIVE To: Ian Rogers 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=-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 On Mon, Jan 9, 2023 at 3:38 PM Ian Rogers wrote: > > 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: > > > 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. I'm not sure how important it is to reveal the intention. I think we wanted to minimize #ifdef-ery in the .c file and moved the conditionals to the header. Maybe we can add a wrapper like this. #if LIBTRACEEVENT_VERSION >= ...(1, 5, 0) static inline bool is_relative_field(field) { return field->flags & TEP_FIELD_IS_RELATIVE; } #else static inline bool is_relative_field(field) { return false; } #endif Thanks, Namhyung