lkml.org 
[lkml]   [2018]   [Aug]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Date
SubjectRe: [PATCH] perf/x86/intel: Fix unwind errors from PEBS entries (mk-II)
On Mon, Aug 6, 2018 at 11:04 AM Peter Zijlstra <peterz@infradead.org> wrote:
> On Mon, Aug 06, 2018 at 09:54:23AM -0700, Fubo Chen wrote:
> > On Mon, Aug 6, 2018 at 8:42 AM Peter Zijlstra <peterz@infradead.org> wrote:
> > > On Mon, Aug 06, 2018 at 08:35:07AM -0700, Fubo Chen wrote:
> > > > On Thu, Jul 19, 2018 at 2:21 PM Peter Zijlstra <peterz@infradead.org> wrote:
> > > > > --- a/include/uapi/linux/perf_event.h
> > > > > +++ b/include/uapi/linux/perf_event.h
> > > > > @@ -143,6 +143,8 @@ enum perf_event_sample_format {
> > > > > PERF_SAMPLE_PHYS_ADDR = 1U << 19,
> > > > >
> > > > > PERF_SAMPLE_MAX = 1U << 20, /* non-ABI */
> > > > > +
> > > > > + __PERF_SAMPLE_CALLCHAIN_EARLY = 1UL << 63,
> > > > > };
> > > >
> > > > The above change makes sparse unhappy :-( Sparse reports the following
> > > > complaint about __PERF_SAMPLE_CALLCHAIN_EARLY:
> > >
> > > I thought I changed that to 1ULL before commit.
> >
> > The sparse complaint was reported for code with the "1ULL << 63".
>
> Ah ok.. and I think I see what you mean. The C standard says that enums
> shall be 'int'. However C++ standard says any integer type that fits the
> largest value.
>
> I suppose GCC uses the C++ definition and I suspect many other compilers
> will too.

Do you think the patch below is sufficient to suppress the sparse warning?

---
include/uapi/linux/perf_event.h | 2 +-
tools/include/uapi/linux/perf_event.h | 3 +--
2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/include/uapi/linux/perf_event.h b/include/uapi/linux/perf_event.h
index eeb787b1c53c..0f0f43599b74 100644
--- a/include/uapi/linux/perf_event.h
+++ b/include/uapi/linux/perf_event.h
@@ -144,8 +144,8 @@ enum perf_event_sample_format {

PERF_SAMPLE_MAX = 1U << 20, /* non-ABI */

- __PERF_SAMPLE_CALLCHAIN_EARLY = 1ULL << 63,
};
+#define __PERF_SAMPLE_CALLCHAIN_EARLY (1ULL << 63)

/*
* values to program into branch_sample_type when PERF_SAMPLE_BRANCH is set
diff --git a/tools/include/uapi/linux/perf_event.h
b/tools/include/uapi/linux/perf_event.h
index eeb787b1c53c..3db800bc8d2e 100644
--- a/tools/include/uapi/linux/perf_event.h
+++ b/tools/include/uapi/linux/perf_event.h
@@ -143,9 +143,8 @@ enum perf_event_sample_format {
PERF_SAMPLE_PHYS_ADDR = 1U << 19,

PERF_SAMPLE_MAX = 1U << 20, /* non-ABI */
-
- __PERF_SAMPLE_CALLCHAIN_EARLY = 1ULL << 63,
};
+#define __PERF_SAMPLE_CALLCHAIN_EARLY (1ULL << 63)

/*
* values to program into branch_sample_type when PERF_SAMPLE_BRANCH is set




--
Fubo.

\
 
 \ /
  Last update: 2018-08-06 23:30    [W:0.117 / U:0.900 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site