Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp5899140rwb; Mon, 5 Dec 2022 05:41:45 -0800 (PST) X-Google-Smtp-Source: AA0mqf7x6KgM6Z5XSCJPQFEDMJc3gqnnZdsyMzY6T4QUiwLrlF7klGQCUFBdhlo1CoaGgxw+nJ/P X-Received: by 2002:a05:6402:43cc:b0:46c:d5e8:30e7 with SMTP id p12-20020a05640243cc00b0046cd5e830e7mr2608332edc.268.1670247704772; Mon, 05 Dec 2022 05:41:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670247704; cv=none; d=google.com; s=arc-20160816; b=v1o7BhlYtyaCrDL1Ar57wp5BJaRD9YsjSjw6ja5PRATvesP4okjZ9o9t986jZrLK8T lpdJj42hKw4vOJzbPF5Lp8uN/fBPtw86c/yzQzYxhedBlVF0EpmU6LkJLdcqKofx8lUl Ehwp27kAkBN20PXsa6/BCP2D3Wz0wrmcB0oXsUDJ/BBVHjH4mEFXMNaSm2028F69u3pe 5dmiYbj+xy+pgBKzqQl5M94k6M+jqblBtr4Z8/4r/zSW7maLFuiDT+jWhyIXELxb8SU9 aSFggryGivhY0YdmhxXBZ+aHuDKZOH5TfWlORtxOfjpCZSj78o0eb3tECLhYle9zo5Bz Nb0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=1Xa4Zz0CyaNRyIgdkESfhvgnmZzxnvIUFWllvOuHTvc=; b=V6LDaROv0dd5xcMsiy8Ano4oCV3y4NwrOgT2JMwjP3yC4dCWLrQMuH2sGFsCK8tYL9 qOgW7GDhwY0ynr6tV2Y5OGcXEQs4jMOXeoOjA6PmlB0N3m5RQvDgjLFwoz0aWzLvIf+5 7wSNFUJcByyGGNjythrXLRhBhMkVnqLwZ6Bi09nNHxO8DrCK2aFRaqQ4AGghLTmH5PRG lvbF6rhDcqwE6tndxBHellmg3bTHATIVoIsxaNm3X4r1B9p+fmLcXITDRbT/ohMBXLor 9cM7+8i02bsQcFp/TpUOly/zgAklnXV2NuztCVn56wxPABIf7KYIrj3+F37MS1QaEvxP pJig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=RCqwmmzX; 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 mp14-20020a1709071b0e00b007707ab4be28si12527431ejc.972.2022.12.05.05.41.11; Mon, 05 Dec 2022 05:41:44 -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=@kernel.org header.s=k20201202 header.b=RCqwmmzX; 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 S232132AbiLENRI (ORCPT + 82 others); Mon, 5 Dec 2022 08:17:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232140AbiLENQr (ORCPT ); Mon, 5 Dec 2022 08:16:47 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 38E321A232; Mon, 5 Dec 2022 05:16:45 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id DEC98B80F79; Mon, 5 Dec 2022 13:16:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5391DC433D6; Mon, 5 Dec 2022 13:16:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1670246202; bh=K0wO0fZAcT1JLDcHrwAPZK7snFfOuqbvKkHzWu3AJU8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=RCqwmmzX61WuTJJBKaNCTHN2J51bck6n44krFWPJiMsF6IFUjQBAi2xdHmkPQ9bK6 xmnAujeTegnRHNUFA5k3drmvPgOB1GZxQzE1oVi4VXkg/Ghtt63K6BhgETRvlBS9nG VSVCKkLzQtwaRyN1rKmRlZRvObPrQeKg9LSeE1F8NMkIBYCJzKWCBFEcmt2RZ3ssTp tNvD0CKYDL1z1Os37IuirZyiWCXpwcsoe8ApCD8+0bvhLZ2QU6ZvxypDNvSvYpebVC lrnSYpAtfJDJi9qUtMH6oHgS5fnrOH6Mtc83CmLnaI6s1r/tv8SMKqroWgrKSI0fFU BvHitvMciDSww== Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id EAE9740404; Mon, 5 Dec 2022 10:16:39 -0300 (-03) Date: Mon, 5 Dec 2022 10:16:39 -0300 From: Arnaldo Carvalho de Melo To: Namhyung Kim Cc: Ian Rogers , 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 Subject: Re: [PATCH v2 2/4] perf util: Add host_is_bigendian to util.h Message-ID: References: <20221130062935.2219247-1-irogers@google.com> <20221130062935.2219247-3-irogers@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Url: http://acmel.wordpress.com X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 Em Wed, Nov 30, 2022 at 10:52:35AM -0800, Namhyung Kim escreveu: > On Tue, Nov 29, 2022 at 10:30 PM Ian Rogers wrote: > > > > Avoid libtraceevent dependency for tep_is_bigendian or trace-event.h > > dependency for bigendian. Add a new host_is_bigendian to util.h, using > > the compiler defined __BYTE_ORDER__ when available. > > > > Signed-off-by: Ian Rogers > > Acked-by: Namhyung Kim > > A nit below... > > > --- > [SNIP] > > diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h > > index 63cdab0e5314..87d418cb6792 100644 > > --- a/tools/perf/util/util.h > > +++ b/tools/perf/util/util.h > > @@ -94,4 +94,23 @@ int do_realloc_array_as_needed(void **arr, size_t *arr_sz, size_t x, > > 0; \ > > }) > > > > +static inline bool host_is_bigendian(void) > > +{ > > +#ifdef __BYTE_ORDER__ > > +#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ > > + return false; > > +#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ > > + return true; > > +#else > > +#error "Unrecognized __BYTE_ORDER__" > > +#endif > > +#else > > It'd be nice if we could have a comment at least there's a nested > ifdef condition. Like below? > > #else /* !__BYTE_ORDER__ */ Reasonable, added it and applied the first two patches in this series, with your Acked-by, thanks. - Arnaldo diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h index 87d418cb67929576..a06c54ab85ee4506 100644 --- a/tools/perf/util/util.h +++ b/tools/perf/util/util.h @@ -104,7 +104,7 @@ static inline bool host_is_bigendian(void) #else #error "Unrecognized __BYTE_ORDER__" #endif -#else +#else /* !__BYTE_ORDER__ */ unsigned char str[] = { 0x1, 0x2, 0x3, 0x4, 0x0, 0x0, 0x0, 0x0}; unsigned int *ptr;