Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1966475imm; Fri, 7 Sep 2018 08:48:43 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZq5eYapu0Ofzc0xuu6XUOY0wtZPTourkpHVq3FeOd3ZpK0pHl75nC4/L3Z2BAEOwVMVzol X-Received: by 2002:a63:1204:: with SMTP id h4-v6mr8963444pgl.115.1536335323817; Fri, 07 Sep 2018 08:48:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536335323; cv=none; d=google.com; s=arc-20160816; b=sJlT0kBXkMPvuJSW+9UzE28UvFSxGXEcZMYNNHeis2e16ms0Gmf8O3AAHGPYWcck4r iV76TrJusE2Sr2PLNOxiv/2lXtdjT/GcbA3FjxTSqfNRGlnfhLx9QJATSJEMRjVMI9Ok EZSSwbBch+LiXLKNHdErfDMtDI2VEUCL56Ids6InRGVDccrs0GJdWnBRLfu0ujUiW7AW VO/VTlboC0GX5ICTNqFuFWCrHrU4WaNUne7uA/fI5eya3hkeHnysQHid6RfcpcF18Fpk XfQMHsPjRa6WXdDpkKzWoTrkU1MvPrATA3d96awnp8dz3BapBcz1/vFQtVGFkOpQ4d88 dskQ== 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:dkim-signature; bh=OG7CpCqwDTHhoXbBOHqBcBUWNn3zGgm6Vv7WweSw7So=; b=wxyBonrbkrmZFR3OTQW2HNDCWLl72eiTpt8UH5dlxVdRuSkLR/DVH1c1jvESThKL8x wrVFDYXdpJTF4vbipX7BDR4hA9u2cgJDxEkWeX1kzBM9kW5RW6d2942CDaMGOyw7h2dR KnTdb6MOcAtnv7pKh28j77ZjOgkD4DpkfGJew/70Ijy1dKR7XIeab0prLg4Nds9Xtqy5 wOZhg059Q6PC5ROHvIpF0Fm3GDzA/WHtzPSNENgRUSHCGfsc9XVn54A/1xo1QajuvIqC u71GhV9SPcwr6iF1F28KzP+28SQIBSdWZ5p7QcAVVECQblSX7R/roT4yCQt8KYXINiBf UFLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=hjWO2rPL; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u29-v6si8456186pga.29.2018.09.07.08.48.28; Fri, 07 Sep 2018 08:48:43 -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; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=hjWO2rPL; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729048AbeIGSzM (ORCPT + 99 others); Fri, 7 Sep 2018 14:55:12 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:58486 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727601AbeIGSzL (ORCPT ); Fri, 7 Sep 2018 14:55:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=OG7CpCqwDTHhoXbBOHqBcBUWNn3zGgm6Vv7WweSw7So=; b=hjWO2rPLXO6nzGeWOlf1LlpQh b6JAdQ9U1qo8kbCROD0HuD9nAZYGYMWgCz4ycQcLRxS9q94U0RYATWsMWK6/4XFvQKbFfaR8gagnW 5pSblOX88N+O8RjdHXApbSsvVL6KrT+nmi1iTbPeNvCleX9+IYLhE6fMBa+COuIldw10HjYiCd3ti YhL+JtdyIqBbzPsdT1FNdRn7KAMGpWMk7gaWgUoEZAUBWuOlKxxJC2yQJrlY7YdSS03gfAKqJroFD 2xmEYYYu+cBGaFlqM14WSEgMaAFfa6wPbgblWv0II93NfEqdP4OAdpFboYErR/tfsT7fDQV9dxX6k c4kt6N8vg==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1fyHWC-0006NJ-C2; Fri, 07 Sep 2018 14:13:52 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id BF5FD2024E43D; Fri, 7 Sep 2018 16:13:50 +0200 (CEST) Date: Fri, 7 Sep 2018 16:13:50 +0200 From: Peter Zijlstra To: Christophe Leroy Cc: Ingo Molnar , Arnaldo Carvalho de Melo , Alexander Shishkin , Jiri Olsa , Namhyung Kim , linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: Re: [PATCH] perf: enum overflow in uapi/linux/perf_event.h Message-ID: <20180907141350.GK24142@hirez.programming.kicks-ass.net> References: <20180907134246.GC24106@hirez.programming.kicks-ass.net> <20180907135817.GF24106@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180907135817.GF24106@hirez.programming.kicks-ass.net> User-Agent: Mutt/1.10.0 (2018-05-17) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 07, 2018 at 03:58:17PM +0200, Peter Zijlstra wrote: > On Fri, Sep 07, 2018 at 01:50:18PM +0000, Christophe Leroy wrote: > > > > > > On 09/07/2018 01:42 PM, Peter Zijlstra wrote: > > > On Fri, Sep 07, 2018 at 01:27:19PM +0000, Christophe Leroy wrote: > > > > On PPC32, enums are 32 bits, so __PERF_SAMPLE_CALLCHAIN_EARLY is > > > > out of scope. The following sparse warning is encountered: > > > > > > > > CHECK arch/powerpc/kernel/process.c > > > > ./include/uapi/linux/perf_event.h:147:56: warning: cast truncates bits from constant value (8000000000000000 becomes 0) > > > > > > Urgh... what compiler is that? I've not seen anything like that from the > > > build bots. > > > > > > > [root@pc16082vm linux-powerpc]# sparse --version > > 0.5.2 > > > > [root@pc16082vm linux-powerpc]# ppc-linux-gcc --version > > ppc-linux-gcc (GCC) 5.4.0 > > Ah, that's a sparse warning. But does your GCC agree? The thing is, > sparse uses the C enum spec, but I suspect GCC uses the C++ enum spec > and it all works fine. What does the below proglet print on your PPC32 box? I suspect the output will be: 400000000000 and all is well. --- #include enum ponies { big = 1ULL<<46, }; int main(int argc, char **argv) { unsigned long long val = big; printf("%Lx\n", val); return 0; }