From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E6FC7C433E0 for ; Tue, 19 May 2020 19:28:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C6C052070A for ; Tue, 19 May 2020 19:28:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="bmQ+Yeug" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726455AbgEST2Z (ORCPT ); Tue, 19 May 2020 15:28:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726059AbgEST2Z (ORCPT ); Tue, 19 May 2020 15:28:25 -0400 Received: from mail-qv1-xf42.google.com (mail-qv1-xf42.google.com [IPv6:2607:f8b0:4864:20::f42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B191C08C5C0; Tue, 19 May 2020 12:28:25 -0700 (PDT) Received: by mail-qv1-xf42.google.com with SMTP id ee19so168723qvb.11; Tue, 19 May 2020 12:28:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:date:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=sJ2WtymJ/44ukH73/nmAxCbRKt4OtZ9J3eO3Z1WCx+s=; b=bmQ+YeugrD0P0y8R1+JB/gALpn6SNySKmGjb+J9kkUSjlI/t+EbizeE4z/gyb8qo4y GqhM/bjwtEUJQU65fTXJ8yCTJnwoz1J6pE0MdL/A2Qjl4Q+AEe7sq6w/wYlAaAL4WjKN FAKYvqSr1P6krmgL/EVrghAdWjfv1GkQ/7Ii65Q16+kwIbrJuTJJXh/p1iwpSPA2IiXs ZXR4rs9p2ZsjPNyc1Pn2dR9ankY5kSbzKIW7CgDj01vXJrbX7W+7GqUEiO7OE+vS58SG +FMRIU5HhTWdwC1RsYrRg2IVOHRm++eAQzJ8XBvBtCYv3pj9x3ovMPvHWIIK7Z1ozem4 QSeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=sJ2WtymJ/44ukH73/nmAxCbRKt4OtZ9J3eO3Z1WCx+s=; b=Vl+I4nNx1DH8P8ZmRa2TnY6tuiDpG/bgAetTNj++Ivr2MqXskxGW7tyVhNlN99bjRd fzdKGq3HP1qbmfuRmk1zRkfdFxcTK+julNWIBI4TTTD9MvAtpO6R9cYJHTkq84ARic9e CyVxb8LKVSUyuzVAsP7txs/7eduOyg3b+LVEr241UIhNqnngUgrTTbq0NwiJa33yuZge 6P+zTEsT+DNpY1I31GW9RQl9qwoWFYxvhCbf8KzyguWQaJlAXFLvrg9ijXvEFE1bgykh IJDpKdKP+CKYxgvWPWMNkBh+Ws440oZ0EbG5WdXaRaMMQ0P7aL8FH2lOTTGc+lFIFOZM jYqQ== X-Gm-Message-State: AOAM531RNwtONji/6WRqzvEEjmnHQBOv4H6PKvWJmM/0K7hZMDY0OYGK /Pkf9cU0t63EB/DpaBUOsp0= X-Google-Smtp-Source: ABdhPJz0uBnKIXEfrTulqlvs6UK2lZUeYHabJFqmgAMRHk9g9NbIOh8l60tueo4Ud8wq6kVNiTiOqQ== X-Received: by 2002:a0c:a993:: with SMTP id a19mr1231250qvb.57.1589916503962; Tue, 19 May 2020 12:28:23 -0700 (PDT) Received: from quaco.ghostprotocols.net ([179.97.37.151]) by smtp.gmail.com with ESMTPSA id u41sm656836qte.28.2020.05.19.12.28.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 May 2020 12:28:22 -0700 (PDT) From: Arnaldo Carvalho de Melo X-Google-Original-From: Arnaldo Carvalho de Melo Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id C333740AFD; Tue, 19 May 2020 16:28:19 -0300 (-03) Date: Tue, 19 May 2020 16:28:19 -0300 To: Ian Rogers Cc: Arnaldo Carvalho de Melo , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Alexei Starovoitov , Daniel Borkmann , Martin KaFai Lau , Song Liu , Yonghong Song , Andrii Nakryiko , John Fastabend , KP Singh , Kajol Jain , Andi Kleen , John Garry , Jin Yao , Kan Liang , Cong Wang , Kim Phillips , Adrian Hunter , Leo Yan , LKML , Networking , bpf , Stephane Eranian Subject: Re: [PATCH v3 7/7] perf expr: Migrate expr ids table to a hashmap Message-ID: <20200519192819.GC28228@kernel.org> References: <20200515221732.44078-1-irogers@google.com> <20200515221732.44078-8-irogers@google.com> <20200518154505.GE24211@kernel.org> <20200518160648.GI24211@kernel.org> <20200518161137.GK24211@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Url: http://acmel.wordpress.com Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Em Mon, May 18, 2020 at 09:29:06AM -0700, Ian Rogers escreveu: > I had some issues here too: > https://lore.kernel.org/lkml/CAEf4BzYxTTND7T7X0dLr2CbkEvUuKtarOeoJYYROefij+qds0w@mail.gmail.com/ > The only reason for the bits/reg.h inclusion is for __WORDSIZE for the > hash_bits operation. As shown below: So, to have perf building in all the systems I have test build containers for I have this in: tools/include/linux/bitops.h #include #include #ifndef __WORDSIZE #define __WORDSIZE (__SIZEOF_LONG__ * 8) #endif With that it works everywhere, Android cross NDK for arm64, older systems, cross compilers to many arches, Musl libc, uclibc, etc. So I'm trying, just to check, that this change will make this build everywhere: commit ef4c968ccbd52d6a02553719ac7e97f70c65ba47 Author: Arnaldo Carvalho de Melo Date: Tue May 19 16:26:14 2020 -0300 WIP Signed-off-by: Arnaldo Carvalho de Melo diff --git a/tools/perf/util/hashmap.h b/tools/perf/util/hashmap.h index e823b35e7371..df59fd4fc95b 100644 --- a/tools/perf/util/hashmap.h +++ b/tools/perf/util/hashmap.h @@ -10,10 +10,9 @@ #include #include -#ifdef __GLIBC__ -#include -#else -#include +#include +#ifndef __WORDSIZE +#define __WORDSIZE (__SIZEOF_LONG__ * 8) #endif static inline size_t hash_bits(size_t h, int bits) > #ifdef __GLIBC__ > #include > #else > #include > #endif > static inline size_t hash_bits(size_t h, int bits) > { > /* shuffle bits and return requested number of upper bits */ > return (h * 11400714819323198485llu) >> (__WORDSIZE - bits); > } > > It'd be possible to change the definition of hash_bits and remove the > #includes by: > > static inline size_t hash_bits(size_t h, int bits) > { > /* shuffle bits and return requested number of upper bits */ > #ifdef __LP64__ > int shift = 64 - bits; > #else > int shift = 32 - bits; > #endif > return (h * 11400714819323198485llu) >> shift; > } > > Others may have a prefered more portable solution. A separate issue > with this same function is undefined behavior getting flagged > (unnecessarily) by sanitizers: > https://lore.kernel.org/lkml/20200508063954.256593-1-irogers@google.com/ > > I was planning to come back to that once we got these changes landed. > > Thanks! > Ian -- - Arnaldo