Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp8922756rwl; Tue, 10 Jan 2023 22:10:02 -0800 (PST) X-Google-Smtp-Source: AMrXdXu/XKXt4UDdbpQEDzY/HZGZUv60l/YSFm75ecrcLMkKklxkgS7Kj4pgQbU97i9vQWZLoZH1 X-Received: by 2002:a05:6a20:b2a9:b0:9d:efbe:2065 with SMTP id ei41-20020a056a20b2a900b0009defbe2065mr1317339pzb.27.1673417402413; Tue, 10 Jan 2023 22:10:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673417402; cv=none; d=google.com; s=arc-20160816; b=lY8j1Xb0TJlLRiwnuRpHxxGpyiPB+N9Knqbo3/ifew5AAq3IzrVwZ+n34UVapU3JGG UpBEb0PU6K+GHic5yg/A5fgYIXsgphtbjReb6uWVQ51toK3k4SKI1Kj1688EIVmPYNYx TWB0sxT+ZX2ueRFDyLUkEZg167vLobpAEhrQuDAvEfV8qlygnew47yzpl0xsBDGZnMlc mKDDVxqvdcw5SHOsE6vt78mud/UVKMaU4Xd+g0SsqEiOBiy9xFjImVRtNrEMKWWgrl9n SFCeDCtNZbl91NKJKFsIUzchFZ0mcU8WsZUe67Fc8GK5oubenG6JEE/juZ6sGtUa2P3s VSBQ== 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=Vljd4jpGI8JGO7YYKmUkcae95jo5r0whgkmYDkRel+o=; b=YmD6RZ/rJ2OfSt8nLGZLbKLC01WlBxkvLCRfJw5c4/8Uv0b7ok4kHD7tK0G8Dt5J9F W2lomeGULx1QDgooBgBfVQdRz0/u9aRbLG7LjwpB4pCJkUmgp3Skk6FUa/hty4rQKDTV GeO+qVrHc33kIFXIlleuTaeTsYLDP4clCaw2QLqp/QrNNdmiqWL5+Q8B1xwh6TPjeTTM RQ3idUBr1F1J+ZPBcL53BLGSa8weNx+gFpPZ3uH4XvbBHuh09przGjw7yEkg3Dbryln2 hhi6zd53j5zyDvHNgtEKI/WkVtoPZdNg3wZ8lqYnugAueBYf0uQEgjEIFObMeMD/dnxN wqug== 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 c13-20020a056a00008d00b005831f272de9si14035657pfj.235.2023.01.10.22.09.56; Tue, 10 Jan 2023 22:10:02 -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 S231332AbjAKF5o (ORCPT + 53 others); Wed, 11 Jan 2023 00:57:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55514 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235813AbjAKF5b (ORCPT ); Wed, 11 Jan 2023 00:57:31 -0500 Received: from mail-io1-f53.google.com (mail-io1-f53.google.com [209.85.166.53]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 99403B7EB; Tue, 10 Jan 2023 21:57:30 -0800 (PST) Received: by mail-io1-f53.google.com with SMTP id r72so7218012iod.5; Tue, 10 Jan 2023 21:57:30 -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=Vljd4jpGI8JGO7YYKmUkcae95jo5r0whgkmYDkRel+o=; b=XEaUXfV2oMGEfoypFAMmtWFPwKiL02COlAUi+zyE1R5hvjWA+r40dXGGMJtUt1X1Wx WOcJFZmrcXe0X4trudv9T6LrBU7GLFUPUYhRiYOXuYbMADxaKsPQAS2YtO+CxaQOHAIj kw+77Wsrwd8+c9TUSv8AwvUcOzghWmKq/G/suoeIRLwjvlY4+bDxxGyYf7zQFb9BuUs9 AFyfbhOfAJNDVO18+zvAeVNdLDEaMWiLOuJE84OvzWpceU/C/CNB26S9zoO1/H9IgK+0 c7pJQVgLBVBbVOYM2ke7ftOIGQgm2p5SD4JSgGByCJYO0G0R0vkre8R9O8QZX4wBIbnl zPzw== X-Gm-Message-State: AFqh2kqB7BrIkjG/Dol61VZDuRBFc5WcAUmyoBgp3merohMoAYX8YLRz 3zkZCOb2yFcP9qatPEA68jAef0WfNKh6Uf9t2YQ= X-Received: by 2002:a6b:a16:0:b0:6e3:28c5:e8ee with SMTP id z22-20020a6b0a16000000b006e328c5e8eemr6765804ioi.140.1673416649854; Tue, 10 Jan 2023 21:57:29 -0800 (PST) MIME-Version: 1.0 References: <20230109223110.1201541-1-irogers@google.com> In-Reply-To: From: Namhyung Kim Date: Tue, 10 Jan 2023 21:57:17 -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 Tue, Jan 10, 2023 at 11:55 AM Ian Rogers wrote: > > On Tue, Jan 10, 2023 at 11:09 AM Namhyung Kim wrote: > > > > 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 > > Sounds good. Should the change be part of this one or a follow up > patch? A follow up patch seems cleanest, I can add it to v2. Sounds good. Thanks, Namhyung