public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH V2 0/2] perf kvm: fix sample_type manipulation
@ 2013-09-06 19:40 Adrian Hunter
  2013-09-06 19:40 ` [PATCH V2 1/2] perf tools: fix id pos in perf_evlist__open() Adrian Hunter
  2013-09-06 19:40 ` [PATCH V2 2/2] perf kvm: fix sample_type manipulation Adrian Hunter
  0 siblings, 2 replies; 8+ messages in thread
From: Adrian Hunter @ 2013-09-06 19:40 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Peter Zijlstra, linux-kernel, David Ahern, Frederic Weisbecker,
	Jiri Olsa, Mike Galbraith, Namhyung Kim, Paul Mackerras,
	Stephane Eranian

Hi

Here is the sample identifier fix (version 2).


Changes in V2:
	perf tools: fix id pos in perf_evlist__open()
		New patch
	perf kvm: fix sample_type manipulation
		Remove setting of id_pos


Adrian Hunter (2):
      perf tools: fix id pos in perf_evlist__open()
      perf kvm: fix sample_type manipulation

 tools/perf/builtin-kvm.c | 18 +++++++++---------
 tools/perf/util/evlist.c | 12 ++++++++++++
 2 files changed, 21 insertions(+), 9 deletions(-)


Regards
Adrian


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

* [PATCH V2 1/2] perf tools: fix id pos in perf_evlist__open()
  2013-09-06 19:40 [PATCH V2 0/2] perf kvm: fix sample_type manipulation Adrian Hunter
@ 2013-09-06 19:40 ` Adrian Hunter
  2013-09-07 14:20   ` David Ahern
  2013-09-12 11:10   ` [tip:perf/urgent] perf evlist: Fix " tip-bot for Adrian Hunter
  2013-09-06 19:40 ` [PATCH V2 2/2] perf kvm: fix sample_type manipulation Adrian Hunter
  1 sibling, 2 replies; 8+ messages in thread
From: Adrian Hunter @ 2013-09-06 19:40 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Peter Zijlstra, linux-kernel, David Ahern, Frederic Weisbecker,
	Jiri Olsa, Mike Galbraith, Namhyung Kim, Paul Mackerras,
	Stephane Eranian

Ensure the id_pos is correct when perf_evlist__open()
is used.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
 tools/perf/util/evlist.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index b8727ae..005c0eb 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -64,6 +64,16 @@ void perf_evlist__set_id_pos(struct perf_evlist *evlist)
 	evlist->is_pos = first->is_pos;
 }
 
+static void perf_evlist__update_id_pos(struct perf_evlist *evlist)
+{
+	struct perf_evsel *evsel;
+
+	list_for_each_entry(evsel, &evlist->entries, node)
+		perf_evsel__calc_id_pos(evsel);
+
+	perf_evlist__set_id_pos(evlist);
+}
+
 static void perf_evlist__purge(struct perf_evlist *evlist)
 {
 	struct perf_evsel *pos, *n;
@@ -915,6 +925,8 @@ int perf_evlist__open(struct perf_evlist *evlist)
 	struct perf_evsel *evsel;
 	int err;
 
+	perf_evlist__update_id_pos(evlist);
+
 	list_for_each_entry(evsel, &evlist->entries, node) {
 		err = perf_evsel__open(evsel, evlist->cpus, evlist->threads);
 		if (err < 0)
-- 
1.7.11.7


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

* [PATCH V2 2/2] perf kvm: fix sample_type manipulation
  2013-09-06 19:40 [PATCH V2 0/2] perf kvm: fix sample_type manipulation Adrian Hunter
  2013-09-06 19:40 ` [PATCH V2 1/2] perf tools: fix id pos in perf_evlist__open() Adrian Hunter
@ 2013-09-06 19:40 ` Adrian Hunter
  2013-09-07 14:20   ` David Ahern
  2013-09-12 11:10   ` [tip:perf/urgent] perf kvm: Fix " tip-bot for Adrian Hunter
  1 sibling, 2 replies; 8+ messages in thread
From: Adrian Hunter @ 2013-09-06 19:40 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Peter Zijlstra, linux-kernel, David Ahern, Frederic Weisbecker,
	Jiri Olsa, Mike Galbraith, Namhyung Kim, Paul Mackerras,
	Stephane Eranian

Manipulating the sample_type of an evsel requires
the use of:
	perf_evsel__set_sample_bit()
and	perf_evsel__reset_sample_bit()

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
 tools/perf/builtin-kvm.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c
index 47b3540..935d522 100644
--- a/tools/perf/builtin-kvm.c
+++ b/tools/perf/builtin-kvm.c
@@ -1165,16 +1165,16 @@ static int kvm_live_open_events(struct perf_kvm_stat *kvm)
 		struct perf_event_attr *attr = &pos->attr;
 
 		/* make sure these *are* set */
-		attr->sample_type |= PERF_SAMPLE_TID;
-		attr->sample_type |= PERF_SAMPLE_TIME;
-		attr->sample_type |= PERF_SAMPLE_CPU;
-		attr->sample_type |= PERF_SAMPLE_RAW;
+		perf_evsel__set_sample_bit(pos, TID);
+		perf_evsel__set_sample_bit(pos, TIME);
+		perf_evsel__set_sample_bit(pos, CPU);
+		perf_evsel__set_sample_bit(pos, RAW);
 		/* make sure these are *not*; want as small a sample as possible */
-		attr->sample_type &= ~PERF_SAMPLE_PERIOD;
-		attr->sample_type &= ~PERF_SAMPLE_IP;
-		attr->sample_type &= ~PERF_SAMPLE_CALLCHAIN;
-		attr->sample_type &= ~PERF_SAMPLE_ADDR;
-		attr->sample_type &= ~PERF_SAMPLE_READ;
+		perf_evsel__reset_sample_bit(pos, PERIOD);
+		perf_evsel__reset_sample_bit(pos, IP);
+		perf_evsel__reset_sample_bit(pos, CALLCHAIN);
+		perf_evsel__reset_sample_bit(pos, ADDR);
+		perf_evsel__reset_sample_bit(pos, READ);
 		attr->mmap = 0;
 		attr->comm = 0;
 		attr->task = 0;
-- 
1.7.11.7


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

* Re: [PATCH V2 1/2] perf tools: fix id pos in perf_evlist__open()
  2013-09-06 19:40 ` [PATCH V2 1/2] perf tools: fix id pos in perf_evlist__open() Adrian Hunter
@ 2013-09-07 14:20   ` David Ahern
  2013-09-09 18:54     ` Arnaldo Carvalho de Melo
  2013-09-12 11:10   ` [tip:perf/urgent] perf evlist: Fix " tip-bot for Adrian Hunter
  1 sibling, 1 reply; 8+ messages in thread
From: David Ahern @ 2013-09-07 14:20 UTC (permalink / raw)
  To: Adrian Hunter
  Cc: Arnaldo Carvalho de Melo, Peter Zijlstra, linux-kernel,
	Frederic Weisbecker, Jiri Olsa, Mike Galbraith, Namhyung Kim,
	Paul Mackerras, Stephane Eranian

On 9/6/13 1:40 PM, Adrian Hunter wrote:
> Ensure the id_pos is correct when perf_evlist__open()
> is used.

The commit log should reference 7556257 and breakage of 'kvm stat live'; 
helps identify patches when backporting.

Other than that this patch fixes the problem.

Tested-by and Acked-by David Ahern <dsahern@gmail.com>

>
> Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
> ---
>   tools/perf/util/evlist.c | 12 ++++++++++++
>   1 file changed, 12 insertions(+)
>
> diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
> index b8727ae..005c0eb 100644
> --- a/tools/perf/util/evlist.c
> +++ b/tools/perf/util/evlist.c
> @@ -64,6 +64,16 @@ void perf_evlist__set_id_pos(struct perf_evlist *evlist)
>   	evlist->is_pos = first->is_pos;
>   }
>
> +static void perf_evlist__update_id_pos(struct perf_evlist *evlist)
> +{
> +	struct perf_evsel *evsel;
> +
> +	list_for_each_entry(evsel, &evlist->entries, node)
> +		perf_evsel__calc_id_pos(evsel);
> +
> +	perf_evlist__set_id_pos(evlist);
> +}
> +
>   static void perf_evlist__purge(struct perf_evlist *evlist)
>   {
>   	struct perf_evsel *pos, *n;
> @@ -915,6 +925,8 @@ int perf_evlist__open(struct perf_evlist *evlist)
>   	struct perf_evsel *evsel;
>   	int err;
>
> +	perf_evlist__update_id_pos(evlist);
> +
>   	list_for_each_entry(evsel, &evlist->entries, node) {
>   		err = perf_evsel__open(evsel, evlist->cpus, evlist->threads);
>   		if (err < 0)
>


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

* Re: [PATCH V2 2/2] perf kvm: fix sample_type manipulation
  2013-09-06 19:40 ` [PATCH V2 2/2] perf kvm: fix sample_type manipulation Adrian Hunter
@ 2013-09-07 14:20   ` David Ahern
  2013-09-12 11:10   ` [tip:perf/urgent] perf kvm: Fix " tip-bot for Adrian Hunter
  1 sibling, 0 replies; 8+ messages in thread
From: David Ahern @ 2013-09-07 14:20 UTC (permalink / raw)
  To: Adrian Hunter
  Cc: Arnaldo Carvalho de Melo, Peter Zijlstra, linux-kernel,
	Frederic Weisbecker, Jiri Olsa, Mike Galbraith, Namhyung Kim,
	Paul Mackerras, Stephane Eranian

On 9/6/13 1:40 PM, Adrian Hunter wrote:
> Manipulating the sample_type of an evsel requires
> the use of:
> 	perf_evsel__set_sample_bit()
> and	perf_evsel__reset_sample_bit()
>
> Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>


Tested-by and Acked-by David Ahern <dsahern@gmail.com>



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

* Re: [PATCH V2 1/2] perf tools: fix id pos in perf_evlist__open()
  2013-09-07 14:20   ` David Ahern
@ 2013-09-09 18:54     ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 8+ messages in thread
From: Arnaldo Carvalho de Melo @ 2013-09-09 18:54 UTC (permalink / raw)
  To: David Ahern
  Cc: Adrian Hunter, Peter Zijlstra, linux-kernel, Frederic Weisbecker,
	Jiri Olsa, Mike Galbraith, Namhyung Kim, Paul Mackerras,
	Stephane Eranian

Em Sat, Sep 07, 2013 at 08:20:10AM -0600, David Ahern escreveu:
> On 9/6/13 1:40 PM, Adrian Hunter wrote:
> >Ensure the id_pos is correct when perf_evlist__open()
> >is used.
> 
> The commit log should reference 7556257 and breakage of 'kvm stat
> live'; helps identify patches when backporting.
> 
> Other than that this patch fixes the problem.

Thanks, I'm ammending the commit message log.
 
> Tested-by and Acked-by David Ahern <dsahern@gmail.com>
> 
> >
> >Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
> >---
> >  tools/perf/util/evlist.c | 12 ++++++++++++
> >  1 file changed, 12 insertions(+)
> >
> >diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
> >index b8727ae..005c0eb 100644
> >--- a/tools/perf/util/evlist.c
> >+++ b/tools/perf/util/evlist.c
> >@@ -64,6 +64,16 @@ void perf_evlist__set_id_pos(struct perf_evlist *evlist)
> >  	evlist->is_pos = first->is_pos;
> >  }
> >
> >+static void perf_evlist__update_id_pos(struct perf_evlist *evlist)
> >+{
> >+	struct perf_evsel *evsel;
> >+
> >+	list_for_each_entry(evsel, &evlist->entries, node)
> >+		perf_evsel__calc_id_pos(evsel);
> >+
> >+	perf_evlist__set_id_pos(evlist);
> >+}
> >+
> >  static void perf_evlist__purge(struct perf_evlist *evlist)
> >  {
> >  	struct perf_evsel *pos, *n;
> >@@ -915,6 +925,8 @@ int perf_evlist__open(struct perf_evlist *evlist)
> >  	struct perf_evsel *evsel;
> >  	int err;
> >
> >+	perf_evlist__update_id_pos(evlist);
> >+
> >  	list_for_each_entry(evsel, &evlist->entries, node) {
> >  		err = perf_evsel__open(evsel, evlist->cpus, evlist->threads);
> >  		if (err < 0)
> >

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

* [tip:perf/urgent] perf evlist: Fix id pos in perf_evlist__open()
  2013-09-06 19:40 ` [PATCH V2 1/2] perf tools: fix id pos in perf_evlist__open() Adrian Hunter
  2013-09-07 14:20   ` David Ahern
@ 2013-09-12 11:10   ` tip-bot for Adrian Hunter
  1 sibling, 0 replies; 8+ messages in thread
From: tip-bot for Adrian Hunter @ 2013-09-12 11:10 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: acme, linux-kernel, eranian, paulus, hpa, mingo, a.p.zijlstra,
	efault, namhyung, jolsa, fweisbec, adrian.hunter, dsahern, tglx

Commit-ID:  733cd2fe197a0c696c54916f7395451c0da9b867
Gitweb:     http://git.kernel.org/tip/733cd2fe197a0c696c54916f7395451c0da9b867
Author:     Adrian Hunter <adrian.hunter@intel.com>
AuthorDate: Fri, 6 Sep 2013 22:40:11 +0300
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 9 Sep 2013 15:51:44 -0300

perf evlist: Fix id pos in perf_evlist__open()

Ensure the id_pos is correct when perf_evlist__open() is used.

This fixes a problem introduced in 7556257 that broke 'perf kvm stat
live' in that this tool wasn't updated to use the sample_type bits
setting helpers.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Tested-by: David Ahern <dsahern@gmail.com>
Acked-by: David Ahern <dsahern@gmail.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1378496412-2424-2-git-send-email-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/evlist.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index 7101283..f9f77be 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -64,6 +64,16 @@ void perf_evlist__set_id_pos(struct perf_evlist *evlist)
 	evlist->is_pos = first->is_pos;
 }
 
+static void perf_evlist__update_id_pos(struct perf_evlist *evlist)
+{
+	struct perf_evsel *evsel;
+
+	list_for_each_entry(evsel, &evlist->entries, node)
+		perf_evsel__calc_id_pos(evsel);
+
+	perf_evlist__set_id_pos(evlist);
+}
+
 static void perf_evlist__purge(struct perf_evlist *evlist)
 {
 	struct perf_evsel *pos, *n;
@@ -920,6 +930,8 @@ int perf_evlist__open(struct perf_evlist *evlist)
 	struct perf_evsel *evsel;
 	int err;
 
+	perf_evlist__update_id_pos(evlist);
+
 	list_for_each_entry(evsel, &evlist->entries, node) {
 		err = perf_evsel__open(evsel, evlist->cpus, evlist->threads);
 		if (err < 0)

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

* [tip:perf/urgent] perf kvm: Fix sample_type manipulation
  2013-09-06 19:40 ` [PATCH V2 2/2] perf kvm: fix sample_type manipulation Adrian Hunter
  2013-09-07 14:20   ` David Ahern
@ 2013-09-12 11:10   ` tip-bot for Adrian Hunter
  1 sibling, 0 replies; 8+ messages in thread
From: tip-bot for Adrian Hunter @ 2013-09-12 11:10 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: acme, linux-kernel, eranian, paulus, hpa, mingo, a.p.zijlstra,
	efault, namhyung, jolsa, fweisbec, adrian.hunter, dsahern, tglx

Commit-ID:  e71aa28312b208a14cd87fa61e941ac8c85072f4
Gitweb:     http://git.kernel.org/tip/e71aa28312b208a14cd87fa61e941ac8c85072f4
Author:     Adrian Hunter <adrian.hunter@intel.com>
AuthorDate: Fri, 6 Sep 2013 22:40:12 +0300
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 9 Sep 2013 16:13:11 -0300

perf kvm: Fix sample_type manipulation

Manipulating the sample_type of an evsel requires the use of:

	perf_evsel__set_sample_bit()
and	perf_evsel__reset_sample_bit()

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Tested-by: David Ahern <dsahern@gmail.com>
Acked-by: David Ahern <dsahern@gmail.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1378496412-2424-3-git-send-email-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-kvm.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c
index 47b3540..935d522 100644
--- a/tools/perf/builtin-kvm.c
+++ b/tools/perf/builtin-kvm.c
@@ -1165,16 +1165,16 @@ static int kvm_live_open_events(struct perf_kvm_stat *kvm)
 		struct perf_event_attr *attr = &pos->attr;
 
 		/* make sure these *are* set */
-		attr->sample_type |= PERF_SAMPLE_TID;
-		attr->sample_type |= PERF_SAMPLE_TIME;
-		attr->sample_type |= PERF_SAMPLE_CPU;
-		attr->sample_type |= PERF_SAMPLE_RAW;
+		perf_evsel__set_sample_bit(pos, TID);
+		perf_evsel__set_sample_bit(pos, TIME);
+		perf_evsel__set_sample_bit(pos, CPU);
+		perf_evsel__set_sample_bit(pos, RAW);
 		/* make sure these are *not*; want as small a sample as possible */
-		attr->sample_type &= ~PERF_SAMPLE_PERIOD;
-		attr->sample_type &= ~PERF_SAMPLE_IP;
-		attr->sample_type &= ~PERF_SAMPLE_CALLCHAIN;
-		attr->sample_type &= ~PERF_SAMPLE_ADDR;
-		attr->sample_type &= ~PERF_SAMPLE_READ;
+		perf_evsel__reset_sample_bit(pos, PERIOD);
+		perf_evsel__reset_sample_bit(pos, IP);
+		perf_evsel__reset_sample_bit(pos, CALLCHAIN);
+		perf_evsel__reset_sample_bit(pos, ADDR);
+		perf_evsel__reset_sample_bit(pos, READ);
 		attr->mmap = 0;
 		attr->comm = 0;
 		attr->task = 0;

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

end of thread, other threads:[~2013-09-12 11:11 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-06 19:40 [PATCH V2 0/2] perf kvm: fix sample_type manipulation Adrian Hunter
2013-09-06 19:40 ` [PATCH V2 1/2] perf tools: fix id pos in perf_evlist__open() Adrian Hunter
2013-09-07 14:20   ` David Ahern
2013-09-09 18:54     ` Arnaldo Carvalho de Melo
2013-09-12 11:10   ` [tip:perf/urgent] perf evlist: Fix " tip-bot for Adrian Hunter
2013-09-06 19:40 ` [PATCH V2 2/2] perf kvm: fix sample_type manipulation Adrian Hunter
2013-09-07 14:20   ` David Ahern
2013-09-12 11:10   ` [tip:perf/urgent] perf kvm: Fix " tip-bot for Adrian Hunter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox