Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp4908540imm; Tue, 9 Oct 2018 07:02:35 -0700 (PDT) X-Google-Smtp-Source: ACcGV62XwEw5jQOv7MCK+Y7qoxOQHEpNvMFg79JOtsxmGr58tYi6RPjz2lPS+ux9jA6q/o3fPkcB X-Received: by 2002:a63:291:: with SMTP id 139-v6mr24841999pgc.365.1539093755043; Tue, 09 Oct 2018 07:02:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539093755; cv=none; d=google.com; s=arc-20160816; b=e83Viy9oG143HHLQnZ1JyjunnVnP5Udk3+57f5K9I1YrKLCw/3ud+Ex7rOAYUUy2/O SGDtg/vVjz0eONtvHVFqWzIMwyk4+KnXaD8ihO4ukiShnoDT3JKS57xm9GHv+C9sKhII hVHs2AJiJUYTqXXdkrXj+Mo0jrAq3kfEfOKQKv/G4ymuICh1ggSRXrXIDLEyCRt7NS1k slOcGk7E+xzwiHP2tJlCBN0WVW5l6WTnT9Mb2rrKq0iNUYW0p1XO/rYLSrlyxp5ad9Cs VaMgQeZckADC4DFG23+TeNC7r3K35kFPWJHMfc2ZHdfmsdmpIW+fqvM1hvPN+qe83rgZ 34IA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=EnYJZX/nvNzLlntgYXsLsIgJ8c+bvqruD//nSu75nqQ=; b=NjR0Z0iozW5MNAx6SyeXyD8EDAJ+I8rhYqgEJI3uxDr/OjTtCrxw5tzdNmemcxXx/p BkE1fKxoDQsL3Yo6aUCCOqMYt0ZuzRwyLsfkIezqyDUK5Hm/IlHWsfS9bdYS3h5aAfj0 kDjtDZA5Dm0MEs2aj+o431tHydUyRHOVFgmZLbeM1R5ow5XiIA6AOIdxqvKrEZq8WVDS H29M5FqpRqcvgtXbblz7La5tr+bpRoo3GqpoA1k4oohmW4wFKOIyIdAu0rtUcInXcxOU k4uKup2v5tzEWVO3BgvowNoo7H8dL2A2TilDOOWHxcXn42Rs1cc+74rk36kzGNFJduJH vTzA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q15-v6si17866749pgg.477.2018.10.09.07.02.19; Tue, 09 Oct 2018 07:02:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726671AbeJIVTC (ORCPT + 99 others); Tue, 9 Oct 2018 17:19:02 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43934 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726445AbeJIVTC (ORCPT ); Tue, 9 Oct 2018 17:19:02 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 82CE53082143; Tue, 9 Oct 2018 14:01:56 +0000 (UTC) Received: from sandy.ghostprotocols.net (ovpn-64-2.rdu2.redhat.com [10.10.64.2]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E0631702EC; Tue, 9 Oct 2018 14:01:55 +0000 (UTC) Received: by sandy.ghostprotocols.net (Postfix, from userid 1000) id 14599109; Tue, 9 Oct 2018 11:01:53 -0300 (BRT) Date: Tue, 9 Oct 2018 11:01:53 -0300 From: Arnaldo Carvalho de Melo To: Alexander Sverdlin Cc: Arnaldo Carvalho de Melo , Ingo Molnar , Clark Williams , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Adrian Hunter , David Ahern , Jiri Olsa , Namhyung Kim , Wang Nan Subject: Re: [PATCH 01/12] tools include: Adopt linux/bits.h Message-ID: <20181009140152.GA2486@redhat.com> References: <20181009005427.6607-1-acme@kernel.org> <20181009005427.6607-2-acme@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 User-Agent: Mutt/1.5.20 (2009-12-10) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Tue, 09 Oct 2018 14:01:56 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Tue, Oct 09, 2018 at 10:47:35AM +0200, Alexander Sverdlin escreveu: > Hello Arnaldo, > > On 09/10/2018 02:54, Arnaldo Carvalho de Melo wrote: > > From: Arnaldo Carvalho de Melo > > > > So that we reduce the difference of tools/include/linux/bitops.h to the > > original kernel file, include/linux/bitops.h, trying to remove the need > > to define BITS_PER_LONG, to avoid clashes with asm/bitsperlong.h. > > thanks for looking into this, but I don't quite get your plan here, > you neither remove redefinition of BITS_PER_LONG in this patch, nor > in any following patch in the series. I tried looking into this, got these patches as preparatory, but then got sidetracked, pushed what I had, have to continue working on it. But I'm busy with other stuff right now, again. - Arnaldo > Have you forgot to include another patch or shall I try to come up with > a patch removing BITS_PER_LONG from bitops.h? > > > And the things removed from tools/include/linux/bitops.h are really in > > linux/bits.h, so that we can have a copy and then > > tools/perf/check_headers.sh will tell us when new stuff gets added to > > linux/bits.h so that we can check if it is useful and if any adjustment > > needs to be done to the tools/{include,arch}/ copies. > > > > Cc: Adrian Hunter > > Cc: Alexander Sverdlin > > Cc: David Ahern > > Cc: Jiri Olsa > > Cc: Namhyung Kim > > Cc: Wang Nan > > Link: https://lkml.kernel.org/n/tip-y1sqyydvfzo0bjjoj4zsl562@git.kernel.org > > Signed-off-by: Arnaldo Carvalho de Melo > > --- > > tools/include/linux/bitops.h | 7 ++----- > > tools/include/linux/bits.h | 26 ++++++++++++++++++++++++++ > > tools/perf/check-headers.sh | 1 + > > 3 files changed, 29 insertions(+), 5 deletions(-) > > create mode 100644 tools/include/linux/bits.h > > > > diff --git a/tools/include/linux/bitops.h b/tools/include/linux/bitops.h > > index acc704bd3998..0b0ef3abc966 100644 > > --- a/tools/include/linux/bitops.h > > +++ b/tools/include/linux/bitops.h > > @@ -3,8 +3,6 @@ > > #define _TOOLS_LINUX_BITOPS_H_ > > > > #include > > -#include > > - > > #ifndef __WORDSIZE > > #define __WORDSIZE (__SIZEOF_LONG__ * 8) > > #endif > > @@ -12,10 +10,9 @@ > > #ifndef BITS_PER_LONG > > # define BITS_PER_LONG __WORDSIZE > > #endif > > +#include > > +#include > > > > -#define BIT_MASK(nr) (1UL << ((nr) % BITS_PER_LONG)) > > -#define BIT_WORD(nr) ((nr) / BITS_PER_LONG) > > -#define BITS_PER_BYTE 8 > > #define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(long)) > > #define BITS_TO_U64(nr) DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(u64)) > > #define BITS_TO_U32(nr) DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(u32)) > > diff --git a/tools/include/linux/bits.h b/tools/include/linux/bits.h > > new file mode 100644 > > index 000000000000..2b7b532c1d51 > > --- /dev/null > > +++ b/tools/include/linux/bits.h > > @@ -0,0 +1,26 @@ > > +/* SPDX-License-Identifier: GPL-2.0 */ > > +#ifndef __LINUX_BITS_H > > +#define __LINUX_BITS_H > > +#include > > + > > +#define BIT(nr) (1UL << (nr)) > > +#define BIT_ULL(nr) (1ULL << (nr)) > > +#define BIT_MASK(nr) (1UL << ((nr) % BITS_PER_LONG)) > > +#define BIT_WORD(nr) ((nr) / BITS_PER_LONG) > > +#define BIT_ULL_MASK(nr) (1ULL << ((nr) % BITS_PER_LONG_LONG)) > > +#define BIT_ULL_WORD(nr) ((nr) / BITS_PER_LONG_LONG) > > +#define BITS_PER_BYTE 8 > > + > > +/* > > + * Create a contiguous bitmask starting at bit position @l and ending at > > + * position @h. For example > > + * GENMASK_ULL(39, 21) gives us the 64bit vector 0x000000ffffe00000. > > + */ > > +#define GENMASK(h, l) \ > > + (((~0UL) - (1UL << (l)) + 1) & (~0UL >> (BITS_PER_LONG - 1 - (h)))) > > + > > +#define GENMASK_ULL(h, l) \ > > + (((~0ULL) - (1ULL << (l)) + 1) & \ > > + (~0ULL >> (BITS_PER_LONG_LONG - 1 - (h)))) > > + > > +#endif /* __LINUX_BITS_H */ > > diff --git a/tools/perf/check-headers.sh b/tools/perf/check-headers.sh > > index 466540ee8ea7..c72cc73a6b09 100755 > > --- a/tools/perf/check-headers.sh > > +++ b/tools/perf/check-headers.sh > > @@ -14,6 +14,7 @@ include/uapi/linux/sched.h > > include/uapi/linux/stat.h > > include/uapi/linux/vhost.h > > include/uapi/sound/asound.h > > +include/linux/bits.h > > include/linux/hash.h > > include/uapi/linux/hw_breakpoint.h > > arch/x86/include/asm/disabled-features.h > > > > -- > Best regards, > Alexander Sverdlin.