Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp4576009ybg; Mon, 8 Jun 2020 11:17:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxMwTVelHD+TIO/G7jwmbI/c58reA1IEvJZKnSa1qFVN+1GC91PwWhERaRrSeDRrVJVHO+4 X-Received: by 2002:aa7:dc4e:: with SMTP id g14mr22784715edu.346.1591640240440; Mon, 08 Jun 2020 11:17:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591640240; cv=none; d=google.com; s=arc-20160816; b=emMWuq932dAiD9ItV3ulXtTaHJ/kX+ub33Nyk0anxOho8sGBqbCMu2G3RSj3zTZceq Xk5hSgr6CWQPUeX+GvP4lEC5szv8V6q99/adotBfM2XMvGjGdH9LCXyRr06sGSQhkvq2 eiRf/atELSjj2TTM5DG23Fb25ldMROE0PQNRXZObg08SgzrkJYbHObkcegCv5SxKWqfQ rCRRO0r3m4jn4ggsJoFjX6eNjP+dR4/0ssK8Ehl5b9xQEhMA6E6MR9q/syIRhYTZsx7M I4gzZWI0EZxROLf4HUHERjdJPIUt+D3f7ab19YliEXZVxVtZnPkrq1ajVRd5ysV8elVm VmZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:from:cc:to:subject :content-transfer-encoding:mime-version:references:in-reply-to :user-agent:date:dkim-signature; bh=z154RMOSTrXqb2CRDUiw56xx556gz0WSpn0WRRUM9uc=; b=kLH5EN+qa90CrGtLv4MS4Z4t//NpFX/+HE1W6n8AcsozgsfbYDWdJbGBDtnpM1BKhh 5P4YLVTXuRQJyU9jjJrgklpfVvvlQ3bHw3MEnkK3N3Bs7sXrwhl4crwltKie/qDZRGST BLTRf2ARDvzdkmGNuV0u5O2ozlvXVQ4v5amPIi8zVOAXvuzKOYboM6XjoxWwaD6Wtm+I kxmdY18THfz7zJMm+DIbiCMyZUpCTYrUshOxC04oS7dSYqEY4TOyqUKjdykVwBVsTjWy y2NvHOcusA3uJJSEZ2DNBdNUI2F0+Nd52hjZ78l9RS03FWCxZjAvgtsjkRS+4YMwkqn4 rFVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b="hGbti0/L"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p4si8845208ejr.36.2020.06.08.11.16.57; Mon, 08 Jun 2020 11:17:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b="hGbti0/L"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726016AbgFHSMe (ORCPT + 99 others); Mon, 8 Jun 2020 14:12:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48552 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725797AbgFHSMb (ORCPT ); Mon, 8 Jun 2020 14:12:31 -0400 Received: from mail-qk1-x742.google.com (mail-qk1-x742.google.com [IPv6:2607:f8b0:4864:20::742]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B15CC08C5C3; Mon, 8 Jun 2020 11:12:30 -0700 (PDT) Received: by mail-qk1-x742.google.com with SMTP id w1so18209109qkw.5; Mon, 08 Jun 2020 11:12:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:user-agent:in-reply-to:references:mime-version :content-transfer-encoding:subject:to:cc:from:message-id; bh=z154RMOSTrXqb2CRDUiw56xx556gz0WSpn0WRRUM9uc=; b=hGbti0/L5HXU/Ps4jKVXu3Zx4uuYL3OuZ0gXWUlGL+hAIZPW3f0SdkkNzi2pu7S35M 8W8aeo0w4u7CoN9mfBLv4vjKgYxY/VkVy0SqzzsAIG/fg4L7hewJyE7nCY9kXdBXuIX/ N6lGCtklb00LTSHYYuMwIqKSD6oa2DvOZ/I2EtNgvWD1X4R8NSGmAtaPRwmlwgf5zF8N fuQPZ9Azv0h/KFe9pTsJO/na0kUaMDf55+Iopc0v6u7d/hUUA8aKR9+z0ne0CSYmuyyB mHBV1qujGVEINjeqWBV1YiDj0sWpXk7gHNO2LZXeH8nwTPCwf5DIxylH9p2W1J6LoCij go1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:user-agent:in-reply-to:references :mime-version:content-transfer-encoding:subject:to:cc:from :message-id; bh=z154RMOSTrXqb2CRDUiw56xx556gz0WSpn0WRRUM9uc=; b=kk1YNLXgCVPhsJ448uuCxhC8+YDEAX1riVyIBty39GClKcy2w5MRX8pck1Zw3DyDzM OkPE9jz/6d5nehLaI+MJxM9gzZnjubhPD+Y+9K5w4wd4wQQHH3ftkBjXsDMUchCfjlDy pLDQPZQsyGihQkiSXSe9Z47ZrvXIe4aI15smaqjUz52Dy5fMfvKzkyKEKiTAUKPrHfxt t4t23Ga5MtH7MwTwBlQzWGy78MBQGI+l+I05pb33qX1RyNdFkfQtL7V/D9ea6tCb97Mt 42fVYMryZo+5uaFeRpr/9VNPL+zshJ3EpokmogFphMFz04pTKnr398Uj+bmh+kZqpKMU LmhA== X-Gm-Message-State: AOAM532rz/Qrk3kUv7Zd4IS6ez1gxSYzEDoeZzdv13ZeKjkvkIZnJpYN 8kSv6ZZKR5KBKBq8xP7wd94= X-Received: by 2002:a37:a8c4:: with SMTP id r187mr23415214qke.69.1591639949626; Mon, 08 Jun 2020 11:12:29 -0700 (PDT) Received: from [192.168.86.185] ([179.97.37.151]) by smtp.gmail.com with ESMTPSA id m126sm6791923qke.99.2020.06.08.11.12.28 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 08 Jun 2020 11:12:29 -0700 (PDT) Date: Mon, 08 Jun 2020 15:12:03 -0300 User-Agent: K-9 Mail for Android In-Reply-To: References: <20200608161150.GA3073@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: libbpf's hashmap use of __WORDSIZE To: Andrii Nakryiko CC: Peter Zijlstra , Ian Rogers , Namhyung Kim , Pekka Enberg , Jiri Olsa , Irina Tirdea , bpf , Linux Kernel Mailing List From: Arnaldo Carvalho de Melo Message-ID: <1BB90A3B-1372-487E-9E96-193AAAEBC095@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Mi On June 8, 2020 2:32:16 PM GMT-03:00, Andrii Nakryiko wrote: >On Mon, Jun 8, 2020 at 9:11 AM Arnaldo Carvalho de Melo > wrote: >> >> Hi Andrii, >> >> We've got that hashmap=2E[ch] copy from libbpf so that we can >> build perf in systems where libbpf isn't available, and to make it >build >> in all the containers I regularly test build perf I had to add the >patch >> below, I test build with many versions of both gcc and clang and >> multiple libcs=2E >> >> https://gcc=2Egnu=2Eorg/onlinedocs/cpp/Common-Predefined-Macros=2Ehtm= l >> >> The way that tools/include/linux/bitops=2Eh has been doing since 2012 >is >> explained in: >> >> http://git=2Ekernel=2Eorg/torvalds/c/3f34f6c0233ae055b5 >> >> Please take a look and see if you find it acceptable, >> >> Thanks, >> >> - Arnaldo >> >> Warning: Kernel ABI header at 'tools/perf/util/hashmap=2Eh' differs >from latest version at 'tools/lib/bpf/hashmap=2Eh' >> diff -u tools/perf/util/hashmap=2Eh tools/lib/bpf/hashmap=2Eh >> >> $ diff -u tools/lib/bpf/hashmap=2Eh tools/perf/util/hashmap=2Eh >> --- tools/lib/bpf/hashmap=2Eh 2020-06-05 13:25:27=2E822079838 -0300 >> +++ tools/perf/util/hashmap=2Eh 2020-06-05 13:25:27=2E838079794 -0300 >> @@ -10,10 +10,9 @@ >> >> #include >> #include >> -#ifdef __GLIBC__ >> -#include >> -#else >> -#include >> +#include >> +#ifndef __WORDSIZE >> +#define __WORDSIZE (__SIZEOF_LONG__ * 8) >> #endif > >This looks fine, I also build-tested it in Travis CI, so all good=2E >There is actually __SIZEOF_SIZE_T__, which is more directly what >hash_bits work with, but I don't think it matters for any reasonable >system in use :) > >So yeah, > >Acked-by: Andrii Nakryiko > >Are you going to do this change for libbpf's variant, or should I >submit a separate patch? I'll send the patch later, Thanks for checking, - Arnaldo > >> >> static inline size_t hash_bits(size_t h, int bits) --=20 Sent from my Android device with K-9 Mail=2E Please excuse my brevity=2E