All of lore.kernel.org
 help / color / mirror / Atom feed
* perf: export struct perf_branch_entry to userspace
@ 2013-07-08 19:25 Vince Weaver
  2013-08-23 19:51 ` [patch, resend] " Vince Weaver
  0 siblings, 1 reply; 5+ messages in thread
From: Vince Weaver @ 2013-07-08 19:25 UTC (permalink / raw)
  To: linux-kernel
  Cc: Peter Zijlstra, Ingo Molnar, Paul Mackerras,
	Arnaldo Carvalho de Melo


In include/uapi/linux/perf_event.h we describe the 
PERF_SAMPLE_BRANCH_STACK fields in the PERF_RECORD_SAMPLE
to be of type struct perf_branch_entry, but that structure
is not exported to the user.

Should we not export that structure, something like the following?

Signed-off-by: Vince Weaver <vincent.weaver@maine.edu>

diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 8873f82..65b2553 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -64,30 +64,6 @@ struct perf_raw_record {
 };
 
 /*
- * single taken branch record layout:
- *
- *      from: source instruction (may not always be a branch insn)
- *        to: branch target
- *   mispred: branch target was mispredicted
- * predicted: branch target was predicted
- *
- * support for mispred, predicted is optional. In case it
- * is not supported mispred = predicted = 0.
- *
- *     in_tx: running in a hardware transaction
- *     abort: aborting a hardware transaction
- */
-struct perf_branch_entry {
-	__u64	from;
-	__u64	to;
-	__u64	mispred:1,  /* target mispredicted */
-		predicted:1,/* target predicted */
-		in_tx:1,    /* in transaction */
-		abort:1,    /* transaction abort */
-		reserved:60;
-};
-
-/*
  * branch stack layout:
  *  nr: number of taken branches stored in entries[]
  *
diff --git a/include/uapi/linux/perf_event.h b/include/uapi/linux/perf_event.h
index 0b1df41..c6e2f76 100644
--- a/include/uapi/linux/perf_event.h
+++ b/include/uapi/linux/perf_event.h
@@ -685,4 +685,28 @@ union perf_mem_data_src {
 #define PERF_MEM_S(a, s) \
 	(((u64)PERF_MEM_##a##_##s) << PERF_MEM_##a##_SHIFT)
 
+/*
+ * single taken branch record layout:
+ *
+ *      from: source instruction (may not always be a branch insn)
+ *        to: branch target
+ *   mispred: branch target was mispredicted
+ * predicted: branch target was predicted
+ *
+ * support for mispred, predicted is optional. In case it
+ * is not supported mispred = predicted = 0.
+ *
+ *     in_tx: running in a hardware transaction
+ *     abort: aborting a hardware transaction
+ */
+struct perf_branch_entry {
+	__u64	from;
+	__u64	to;
+	__u64	mispred:1,  /* target mispredicted */
+		predicted:1,/* target predicted */
+		in_tx:1,    /* in transaction */
+		abort:1,    /* transaction abort */
+		reserved:60;
+};
+
 #endif /* _UAPI_LINUX_PERF_EVENT_H */

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [patch, resend] perf: export struct perf_branch_entry to userspace
  2013-07-08 19:25 perf: export struct perf_branch_entry to userspace Vince Weaver
@ 2013-08-23 19:51 ` Vince Weaver
  2013-08-26  9:31   ` Stephane Eranian
  2013-09-02  7:42   ` [tip:perf/core] perf: Export " tip-bot for Vince Weaver
  0 siblings, 2 replies; 5+ messages in thread
From: Vince Weaver @ 2013-08-23 19:51 UTC (permalink / raw)
  To: linux-kernel
  Cc: Peter Zijlstra, Ingo Molnar, Paul Mackerras,
	Arnaldo Carvalho de Melo, Stephane Eranian

On Mon, 8 Jul 2013, Vince Weaver wrote:

If PERF_SAMPLE_BRANCH_STACK is enabled then samples are returned
with the format { u64 from, to, flags } but the flags layout
is not specified.

This field has the type struct perf_branch_entry; move this
definition into include/uapi/linux/perf_event.h so users can
access these fields.

This is similar to the existing inclusion of perf_mem_data_src in
the include/uapi/linux/perf_event.h file.

Signed-off-by: Vince Weaver <vincent.weaver@maine.edu>

diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 8873f82..65b2553 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -64,30 +64,6 @@ struct perf_raw_record {
 };
 
 /*
- * single taken branch record layout:
- *
- *      from: source instruction (may not always be a branch insn)
- *        to: branch target
- *   mispred: branch target was mispredicted
- * predicted: branch target was predicted
- *
- * support for mispred, predicted is optional. In case it
- * is not supported mispred = predicted = 0.
- *
- *     in_tx: running in a hardware transaction
- *     abort: aborting a hardware transaction
- */
-struct perf_branch_entry {
-	__u64	from;
-	__u64	to;
-	__u64	mispred:1,  /* target mispredicted */
-		predicted:1,/* target predicted */
-		in_tx:1,    /* in transaction */
-		abort:1,    /* transaction abort */
-		reserved:60;
-};
-
-/*
  * branch stack layout:
  *  nr: number of taken branches stored in entries[]
  *
diff --git a/include/uapi/linux/perf_event.h b/include/uapi/linux/perf_event.h
index 0b1df41..c6e2f76 100644
--- a/include/uapi/linux/perf_event.h
+++ b/include/uapi/linux/perf_event.h
@@ -685,4 +685,28 @@ union perf_mem_data_src {
 #define PERF_MEM_S(a, s) \
 	(((u64)PERF_MEM_##a##_##s) << PERF_MEM_##a##_SHIFT)
 
+/*
+ * single taken branch record layout:
+ *
+ *      from: source instruction (may not always be a branch insn)
+ *        to: branch target
+ *   mispred: branch target was mispredicted
+ * predicted: branch target was predicted
+ *
+ * support for mispred, predicted is optional. In case it
+ * is not supported mispred = predicted = 0.
+ *
+ *     in_tx: running in a hardware transaction
+ *     abort: aborting a hardware transaction
+ */
+struct perf_branch_entry {
+	__u64	from;
+	__u64	to;
+	__u64	mispred:1,  /* target mispredicted */
+		predicted:1,/* target predicted */
+		in_tx:1,    /* in transaction */
+		abort:1,    /* transaction abort */
+		reserved:60;
+};
+
 #endif /* _UAPI_LINUX_PERF_EVENT_H */

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [patch, resend] perf: export struct perf_branch_entry to userspace
  2013-08-23 19:51 ` [patch, resend] " Vince Weaver
@ 2013-08-26  9:31   ` Stephane Eranian
  2013-08-26 12:12     ` Peter Zijlstra
  2013-09-02  7:42   ` [tip:perf/core] perf: Export " tip-bot for Vince Weaver
  1 sibling, 1 reply; 5+ messages in thread
From: Stephane Eranian @ 2013-08-26  9:31 UTC (permalink / raw)
  To: Vince Weaver
  Cc: LKML, Peter Zijlstra, Ingo Molnar, Paul Mackerras,
	Arnaldo Carvalho de Melo

On Fri, Aug 23, 2013 at 9:51 PM, Vince Weaver <vincent.weaver@maine.edu> wrote:
>
> On Mon, 8 Jul 2013, Vince Weaver wrote:
>
> If PERF_SAMPLE_BRANCH_STACK is enabled then samples are returned
> with the format { u64 from, to, flags } but the flags layout
> is not specified.
>
> This field has the type struct perf_branch_entry; move this
> definition into include/uapi/linux/perf_event.h so users can
> access these fields.
>
> This is similar to the existing inclusion of perf_mem_data_src in
> the include/uapi/linux/perf_event.h file.
>
> Signed-off-by: Vince Weaver <vincent.weaver@maine.edu>
>
This makes sense.
Acked-by: Stephane Eranian <eranian@google.com>

>
> diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
> index 8873f82..65b2553 100644
> --- a/include/linux/perf_event.h
> +++ b/include/linux/perf_event.h
> @@ -64,30 +64,6 @@ struct perf_raw_record {
>  };
>
>  /*
> - * single taken branch record layout:
> - *
> - *      from: source instruction (may not always be a branch insn)
> - *        to: branch target
> - *   mispred: branch target was mispredicted
> - * predicted: branch target was predicted
> - *
> - * support for mispred, predicted is optional. In case it
> - * is not supported mispred = predicted = 0.
> - *
> - *     in_tx: running in a hardware transaction
> - *     abort: aborting a hardware transaction
> - */
> -struct perf_branch_entry {
> -       __u64   from;
> -       __u64   to;
> -       __u64   mispred:1,  /* target mispredicted */
> -               predicted:1,/* target predicted */
> -               in_tx:1,    /* in transaction */
> -               abort:1,    /* transaction abort */
> -               reserved:60;
> -};
> -
> -/*
>   * branch stack layout:
>   *  nr: number of taken branches stored in entries[]
>   *
> diff --git a/include/uapi/linux/perf_event.h b/include/uapi/linux/perf_event.h
> index 0b1df41..c6e2f76 100644
> --- a/include/uapi/linux/perf_event.h
> +++ b/include/uapi/linux/perf_event.h
> @@ -685,4 +685,28 @@ union perf_mem_data_src {
>  #define PERF_MEM_S(a, s) \
>         (((u64)PERF_MEM_##a##_##s) << PERF_MEM_##a##_SHIFT)
>
> +/*
> + * single taken branch record layout:
> + *
> + *      from: source instruction (may not always be a branch insn)
> + *        to: branch target
> + *   mispred: branch target was mispredicted
> + * predicted: branch target was predicted
> + *
> + * support for mispred, predicted is optional. In case it
> + * is not supported mispred = predicted = 0.
> + *
> + *     in_tx: running in a hardware transaction
> + *     abort: aborting a hardware transaction
> + */
> +struct perf_branch_entry {
> +       __u64   from;
> +       __u64   to;
> +       __u64   mispred:1,  /* target mispredicted */
> +               predicted:1,/* target predicted */
> +               in_tx:1,    /* in transaction */
> +               abort:1,    /* transaction abort */
> +               reserved:60;
> +};
> +
>  #endif /* _UAPI_LINUX_PERF_EVENT_H */

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [patch, resend] perf: export struct perf_branch_entry to userspace
  2013-08-26  9:31   ` Stephane Eranian
@ 2013-08-26 12:12     ` Peter Zijlstra
  0 siblings, 0 replies; 5+ messages in thread
From: Peter Zijlstra @ 2013-08-26 12:12 UTC (permalink / raw)
  To: eranian
  Cc: Vince Weaver, LKML, Ingo Molnar, Paul Mackerras,
	Arnaldo Carvalho de Melo

On Mon, Aug 26, 2013 at 11:31:11AM +0200, Stephane Eranian wrote:
> On Fri, Aug 23, 2013 at 9:51 PM, Vince Weaver <vincent.weaver@maine.edu> wrote:
> >
> > On Mon, 8 Jul 2013, Vince Weaver wrote:
> >
> > If PERF_SAMPLE_BRANCH_STACK is enabled then samples are returned
> > with the format { u64 from, to, flags } but the flags layout
> > is not specified.
> >
> > This field has the type struct perf_branch_entry; move this
> > definition into include/uapi/linux/perf_event.h so users can
> > access these fields.
> >
> > This is similar to the existing inclusion of perf_mem_data_src in
> > the include/uapi/linux/perf_event.h file.
> >
> > Signed-off-by: Vince Weaver <vincent.weaver@maine.edu>
> >
> This makes sense.
> Acked-by: Stephane Eranian <eranian@google.com>

Thanks!

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [tip:perf/core] perf: Export struct perf_branch_entry to userspace
  2013-08-23 19:51 ` [patch, resend] " Vince Weaver
  2013-08-26  9:31   ` Stephane Eranian
@ 2013-09-02  7:42   ` tip-bot for Vince Weaver
  1 sibling, 0 replies; 5+ messages in thread
From: tip-bot for Vince Weaver @ 2013-09-02  7:42 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, hpa, mingo, vincent.weaver, peterz, tglx

Commit-ID:  274481de6cb69abdb49403ff32abb63c23743413
Gitweb:     http://git.kernel.org/tip/274481de6cb69abdb49403ff32abb63c23743413
Author:     Vince Weaver <vincent.weaver@maine.edu>
AuthorDate: Fri, 23 Aug 2013 15:51:03 -0400
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Mon, 2 Sep 2013 08:42:48 +0200

perf: Export struct perf_branch_entry to userspace

If PERF_SAMPLE_BRANCH_STACK is enabled then samples are returned
with the format { u64 from, to, flags } but the flags layout
is not specified.

This field has the type struct perf_branch_entry; move this
definition into include/uapi/linux/perf_event.h so users can
access these fields.

This is similar to the existing inclusion of perf_mem_data_src in
the include/uapi/linux/perf_event.h file.

Signed-off-by: Vince Weaver <vincent.weaver@maine.edu>
Acked-by: Stephane Eranian <eranian@google.com>
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/alpine.DEB.2.10.1308231544420.1889@vincent-weaver-1.um.maine.edu
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 include/linux/perf_event.h      | 24 ------------------------
 include/uapi/linux/perf_event.h | 24 ++++++++++++++++++++++++
 2 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index c43f6ea..4019d82 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -64,30 +64,6 @@ struct perf_raw_record {
 };
 
 /*
- * single taken branch record layout:
- *
- *      from: source instruction (may not always be a branch insn)
- *        to: branch target
- *   mispred: branch target was mispredicted
- * predicted: branch target was predicted
- *
- * support for mispred, predicted is optional. In case it
- * is not supported mispred = predicted = 0.
- *
- *     in_tx: running in a hardware transaction
- *     abort: aborting a hardware transaction
- */
-struct perf_branch_entry {
-	__u64	from;
-	__u64	to;
-	__u64	mispred:1,  /* target mispredicted */
-		predicted:1,/* target predicted */
-		in_tx:1,    /* in transaction */
-		abort:1,    /* transaction abort */
-		reserved:60;
-};
-
-/*
  * branch stack layout:
  *  nr: number of taken branches stored in entries[]
  *
diff --git a/include/uapi/linux/perf_event.h b/include/uapi/linux/perf_event.h
index a77f43a..408b8c7 100644
--- a/include/uapi/linux/perf_event.h
+++ b/include/uapi/linux/perf_event.h
@@ -757,4 +757,28 @@ union perf_mem_data_src {
 #define PERF_MEM_S(a, s) \
 	(((u64)PERF_MEM_##a##_##s) << PERF_MEM_##a##_SHIFT)
 
+/*
+ * single taken branch record layout:
+ *
+ *      from: source instruction (may not always be a branch insn)
+ *        to: branch target
+ *   mispred: branch target was mispredicted
+ * predicted: branch target was predicted
+ *
+ * support for mispred, predicted is optional. In case it
+ * is not supported mispred = predicted = 0.
+ *
+ *     in_tx: running in a hardware transaction
+ *     abort: aborting a hardware transaction
+ */
+struct perf_branch_entry {
+	__u64	from;
+	__u64	to;
+	__u64	mispred:1,  /* target mispredicted */
+		predicted:1,/* target predicted */
+		in_tx:1,    /* in transaction */
+		abort:1,    /* transaction abort */
+		reserved:60;
+};
+
 #endif /* _UAPI_LINUX_PERF_EVENT_H */

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-09-02  7:42 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-08 19:25 perf: export struct perf_branch_entry to userspace Vince Weaver
2013-08-23 19:51 ` [patch, resend] " Vince Weaver
2013-08-26  9:31   ` Stephane Eranian
2013-08-26 12:12     ` Peter Zijlstra
2013-09-02  7:42   ` [tip:perf/core] perf: Export " tip-bot for Vince Weaver

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.