Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1967359imm; Fri, 7 Sep 2018 08:49:43 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYFLLEH/7wxS2ielmFY5nkhAYzI9zIuMJ8o8Mi5bYVVh5CA0laeQSNToH7rcB5KPmaDnMWA X-Received: by 2002:a17:902:2f43:: with SMTP id s61-v6mr8468203plb.176.1536335383226; Fri, 07 Sep 2018 08:49:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536335383; cv=none; d=google.com; s=arc-20160816; b=v6OungztCGKFfOntM98a7+37BmJlvOlCYs4z0RtD/m/mXBqpAHRktrWmi1wet8URwe cRJrzQ8az2RGKXCjs4dLFS0/TL3hbyFs0wxpPAs22DZYshOJBYeiHLj354Is8EsLBDIf DKuE0E3E4IKNN6PLNmFFwnDT+jSCelTQL22YEwSWh2ek3SLDXfTuRmHEmPEJLTwk1cek r0oPh9RurDUlZpcfFid5JbtdkJRsEXYKk+R3mgbOCh7MkGfKr69AmlNHP9M0f+3eMG1n btgVg5r3O4d/1CLETdWUhnbsELUlUTduh2zBIwEz69SlmpDrTDRY+y/22HRPsg/5ZIxd PAOA== 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=eoVD+e/iiDjmhTM8IEbTtRUmVZx/mTb5jewjouqlMaA=; b=TO4OC8DjJFYd6R8JtZRJCzy3656bWuh0MaSgxZFjJURRVXhp7VFfsjilEFMCgcwkEF /aGXECv7LvP9nyX1tL45pOYz4m1ayIm9UfJPTCdKdDvaSvzdDHtOcjtn3F2zpvT1FdDG NNumTn2lxP26lnsoN42t8mjL4buocKyJUov2yz9mBvwY8Cpr+D4PfRCoR1z0N7Gch53o qV/h5atzFEyRHgp0AxR+0D53zods3FWxUitbLylB24AMcyk/fm31ssLtV7npBzm/Qxig L5+pSSGBQ+cITaIsBdPa+ZDONCncJIQzsDGOOdNlys9buibBavVGd7L3Yd50+OBkyFal 320Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=NdPR2FJK; 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 c72-v6si9156630pfb.178.2018.09.07.08.49.28; Fri, 07 Sep 2018 08:49: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=NdPR2FJK; 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 S1729584AbeIGTFK (ORCPT + 99 others); Fri, 7 Sep 2018 15:05:10 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:59308 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726295AbeIGTFK (ORCPT ); Fri, 7 Sep 2018 15:05:10 -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=eoVD+e/iiDjmhTM8IEbTtRUmVZx/mTb5jewjouqlMaA=; b=NdPR2FJKz0hUTsFaPOorWxAEn enQuBJMHFBTKT3k8nE7kIB6rYL3SYv7XBQFbgUNQ2jstA6ihm58TXcHVeH0eENPDar4n6a/gCFRFs 3epzJgkUGY7kNe1n4PlmvsyUGYtuQy4Q//xMhTXG1ceDWnP/4TUb7wPfJCTjtm+oOUqScaF3FHRRl z36OG3RrG1jzrQR0+rbGm1n+uw2+B1Ur46DA8kYU2CmTzu3Cg3yY26MiI/+A5G5dfxhP6qRT7eoGc ZbzyvfV7Is7zJ2xhZiQV9LuEY/y8nNpDG4oXkxB7IrB/8vZVZk2CvPAWGpsHcAuNaadZUMix77qMw Kh0qXn1mA==; 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 1fyHfu-0001ga-PO; Fri, 07 Sep 2018 14:23:54 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 21C0C2024E442; Fri, 7 Sep 2018 16:23:53 +0200 (CEST) Date: Fri, 7 Sep 2018 16:23:53 +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, linux-sparse@vger.kernel.org Subject: Re: [PATCH] perf: enum overflow in uapi/linux/perf_event.h Message-ID: <20180907142353.GI24106@hirez.programming.kicks-ass.net> References: <20180907134246.GC24106@hirez.programming.kicks-ass.net> <20180907135817.GF24106@hirez.programming.kicks-ass.net> <7a086a56-a896-9513-7315-9d0d21b61a44@c-s.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7a086a56-a896-9513-7315-9d0d21b61a44@c-s.fr> 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 04:15:33PM +0200, Christophe LEROY wrote: > Ah yes, it seems that GCC is happy. So sparse should be fixed instead ? Ideally, yes. > Anyway, is it really correct to put this constant inside that enum, after > PERF_SAMPLE_MAX ? It is a bit of a hack, agreed. What we do is use the top bit of that word (u64) for some internal state. By placing it there (after MAX) we ensure it is not available for userspace (trying to set it will return in -EINVAL) and by keeping it in the enum we know that bit is unavailable for future use. I have a patch queued that puts a little comment on that: https://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git/commit/?h=perf/urgent&id=34cad593c9ea350a1811ab718e64b36e5cde870c (url is not stable, as I regenerate that git tree from quilt every so often, but it should probably last the day).