[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180907142353.GI24106@hirez.programming.kicks-ass.net>
Date: Fri, 7 Sep 2018 16:23:53 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Christophe LEROY <christophe.leroy@....fr>
Cc: Ingo Molnar <mingo@...hat.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Jiri Olsa <jolsa@...hat.com>,
Namhyung Kim <namhyung@...nel.org>,
linux-kernel@...r.kernel.org, linuxppc-dev@...ts.ozlabs.org,
linux-sparse@...r.kernel.org
Subject: Re: [PATCH] perf: enum overflow in uapi/linux/perf_event.h
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).
Powered by blists - more mailing lists