linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Fubo Chen <fubo.chen@gmail.com>
To: peterz@infradead.org
Cc: jpoimboe@redhat.com, Ingo Molnar <mingo@kernel.org>,
	bhole_prashant_q7@lab.ntt.co.jp,
	Linux Kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] perf/x86/intel: Fix unwind errors from PEBS entries (mk-II)
Date: Mon, 6 Aug 2018 14:28:18 -0700	[thread overview]
Message-ID: <CAJAFBLA2WigOMxuWXxZvHVwuGtvYr3_b4gpNbdGzry-=AVxjqA@mail.gmail.com> (raw)
In-Reply-To: <20180806180423.GC2476@hirez.programming.kicks-ass.net>

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.

  reply	other threads:[~2018-08-06 21:28 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-19  4:33 BUG: KASAN: stack-out-of-bounds in unwind_next_frame Prashant Bhole
2018-07-19 15:33 ` Josh Poimboeuf
2018-07-19 17:43   ` Peter Zijlstra
2018-07-19 21:19     ` [PATCH] perf/x86/intel: Fix unwind errors from PEBS entries (mk-II) Peter Zijlstra
2018-07-19 22:45       ` kbuild test robot
2018-07-19 23:54       ` kbuild test robot
2018-07-23 13:30       ` Josh Poimboeuf
2018-07-23 14:14         ` Peter Zijlstra
2018-07-24 16:35           ` Josh Poimboeuf
2018-08-06 15:35       ` Fubo Chen
2018-08-06 15:42         ` Peter Zijlstra
2018-08-06 16:54           ` Fubo Chen
2018-08-06 18:04             ` Peter Zijlstra
2018-08-06 21:28               ` Fubo Chen [this message]
2018-08-06 22:30                 ` Peter Zijlstra
2018-08-06 23:04                   ` Fubo Chen
2018-08-07  9:05                     ` Peter Zijlstra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAJAFBLA2WigOMxuWXxZvHVwuGtvYr3_b4gpNbdGzry-=AVxjqA@mail.gmail.com' \
    --to=fubo.chen@gmail.com \
    --cc=bhole_prashant_q7@lab.ntt.co.jp \
    --cc=jpoimboe@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).