Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1220223 > unrolled thread
| Started by | Adrian Hunter <adrian.hunter@intel.com> |
|---|---|
| First post | 2015-09-07 16:40 +0200 |
| Last post | 2015-09-08 16:40 +0200 |
| Articles | 5 — 3 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH V2 07/14] perf tools: Add evsel->own_cpus Adrian Hunter <adrian.hunter@intel.com> - 2015-09-07 16:40 +0200
Re: [PATCH V2 07/14] perf tools: Add evsel->own_cpus Jiri Olsa <jolsa@redhat.com> - 2015-09-08 08:50 +0200
Re: [PATCH V2 07/14] perf tools: Add evsel->own_cpus Adrian Hunter <adrian.hunter@intel.com> - 2015-09-08 09:20 +0200
Re: [PATCH V2 07/14] perf tools: Add evsel->own_cpus Jiri Olsa <jolsa@redhat.com> - 2015-09-08 09:40 +0200
Re: [PATCH V2 07/14] perf tools: Add evsel->own_cpus Arnaldo Carvalho de Melo <acme@redhat.com> - 2015-09-08 16:40 +0200
| From | Adrian Hunter <adrian.hunter@intel.com> |
|---|---|
| Date | 2015-09-07 16:40 +0200 |
| Subject | [PATCH V2 07/14] perf tools: Add evsel->own_cpus |
| Message-ID | <q65Kq-8kq-25@gated-at.bofh.it> |
perf_evlist__propagate_maps() cannot easily tell if an evsel
has its own cpu map. To make that simpler, keep a copy of
the PMU cpu map and adjust the propagation logic accordingly.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
tools/perf/util/evlist.c | 5 ++++-
tools/perf/util/evsel.c | 1 +
tools/perf/util/evsel.h | 1 +
tools/perf/util/parse-events.c | 4 ++--
4 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index c959c42080e3..6764e0eff849 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -1111,9 +1111,12 @@ static void perf_evlist__propagate_maps(struct perf_evlist *evlist)
* We already have cpus for evsel (via PMU sysfs) so
* keep it, if there's no target cpu list defined.
*/
- if (!evsel->cpus || evlist->has_user_cpus) {
+ if (!evsel->own_cpus || evlist->has_user_cpus) {
cpu_map__put(evsel->cpus);
evsel->cpus = cpu_map__get(evlist->cpus);
+ } else if (evsel->cpus != evsel->own_cpus) {
+ cpu_map__put(evsel->cpus);
+ evsel->cpus = cpu_map__get(evsel->own_cpus);
}
thread_map__put(evsel->threads);
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index c53f79123b37..5410483d5219 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -1033,6 +1033,7 @@ void perf_evsel__exit(struct perf_evsel *evsel)
perf_evsel__free_config_terms(evsel);
close_cgroup(evsel->cgrp);
cpu_map__put(evsel->cpus);
+ cpu_map__put(evsel->own_cpus);
thread_map__put(evsel->threads);
zfree(&evsel->group_name);
zfree(&evsel->name);
diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h
index 298e6bbca200..ef8925f7211a 100644
--- a/tools/perf/util/evsel.h
+++ b/tools/perf/util/evsel.h
@@ -98,6 +98,7 @@ struct perf_evsel {
struct cgroup_sel *cgrp;
void *handler;
struct cpu_map *cpus;
+ struct cpu_map *own_cpus;
struct thread_map *threads;
unsigned int sample_size;
int id_pos;
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index 7e8ae21906e2..21ed6ee63da9 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -287,8 +287,8 @@ __add_event(struct list_head *list, int *idx,
if (!evsel)
return NULL;
- if (cpus)
- evsel->cpus = cpu_map__get(cpus);
+ evsel->cpus = cpu_map__get(cpus);
+ evsel->own_cpus = cpu_map__get(cpus);
if (name)
evsel->name = strdup(name);
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Jiri Olsa <jolsa@redhat.com> |
|---|---|
| Date | 2015-09-08 08:50 +0200 |
| Message-ID | <q6kT8-4Ul-11@gated-at.bofh.it> |
| In reply to | #1220223 |
On Mon, Sep 07, 2015 at 05:27:49PM +0300, Adrian Hunter wrote:
> perf_evlist__propagate_maps() cannot easily tell if an evsel
> has its own cpu map. To make that simpler, keep a copy of
> the PMU cpu map and adjust the propagation logic accordingly.
>
> Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
> ---
> tools/perf/util/evlist.c | 5 ++++-
> tools/perf/util/evsel.c | 1 +
> tools/perf/util/evsel.h | 1 +
> tools/perf/util/parse-events.c | 4 ++--
> 4 files changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
> index c959c42080e3..6764e0eff849 100644
> --- a/tools/perf/util/evlist.c
> +++ b/tools/perf/util/evlist.c
> @@ -1111,9 +1111,12 @@ static void perf_evlist__propagate_maps(struct perf_evlist *evlist)
> * We already have cpus for evsel (via PMU sysfs) so
> * keep it, if there's no target cpu list defined.
> */
> - if (!evsel->cpus || evlist->has_user_cpus) {
> + if (!evsel->own_cpus || evlist->has_user_cpus) {
> cpu_map__put(evsel->cpus);
> evsel->cpus = cpu_map__get(evlist->cpus);
> + } else if (evsel->cpus != evsel->own_cpus) {
> + cpu_map__put(evsel->cpus);
> + evsel->cpus = cpu_map__get(evsel->own_cpus);
hum, so (evsel->cpus != evsel->own_cpus) could happen only when:
- evsel->own_cpus != NULL
- we overloaded evsel->cpus with evlist->cpus via perf_evlist__propagate_maps
- we changed evlist->has_user_cpus = false
- we recall perf_evlist__propagate_maps
I'm missing usecase for that, or something else ;-)
thanks,
jirka
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Adrian Hunter <adrian.hunter@intel.com> |
|---|---|
| Date | 2015-09-08 09:20 +0200 |
| Message-ID | <q6lma-5Hp-9@gated-at.bofh.it> |
| In reply to | #1220522 |
On 08/09/15 09:45, Jiri Olsa wrote:
> On Mon, Sep 07, 2015 at 05:27:49PM +0300, Adrian Hunter wrote:
>> perf_evlist__propagate_maps() cannot easily tell if an evsel
>> has its own cpu map. To make that simpler, keep a copy of
>> the PMU cpu map and adjust the propagation logic accordingly.
>>
>> Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
>> ---
>> tools/perf/util/evlist.c | 5 ++++-
>> tools/perf/util/evsel.c | 1 +
>> tools/perf/util/evsel.h | 1 +
>> tools/perf/util/parse-events.c | 4 ++--
>> 4 files changed, 8 insertions(+), 3 deletions(-)
>>
>> diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
>> index c959c42080e3..6764e0eff849 100644
>> --- a/tools/perf/util/evlist.c
>> +++ b/tools/perf/util/evlist.c
>> @@ -1111,9 +1111,12 @@ static void perf_evlist__propagate_maps(struct perf_evlist *evlist)
>> * We already have cpus for evsel (via PMU sysfs) so
>> * keep it, if there's no target cpu list defined.
>> */
>> - if (!evsel->cpus || evlist->has_user_cpus) {
>> + if (!evsel->own_cpus || evlist->has_user_cpus) {
>> cpu_map__put(evsel->cpus);
>> evsel->cpus = cpu_map__get(evlist->cpus);
>> + } else if (evsel->cpus != evsel->own_cpus) {
>> + cpu_map__put(evsel->cpus);
>> + evsel->cpus = cpu_map__get(evsel->own_cpus);
>
> hum, so (evsel->cpus != evsel->own_cpus) could happen only when:
> - evsel->own_cpus != NULL
> - we overloaded evsel->cpus with evlist->cpus via perf_evlist__propagate_maps
> - we changed evlist->has_user_cpus = false
> - we recall perf_evlist__propagate_maps
>
> I'm missing usecase for that, or something else ;-)
That's true but the idea is to establish rules (invariants) that are always
true. Like an evsel either has its own cpu map or the same as the evlist.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Jiri Olsa <jolsa@redhat.com> |
|---|---|
| Date | 2015-09-08 09:40 +0200 |
| Message-ID | <q6lFw-63O-27@gated-at.bofh.it> |
| In reply to | #1220536 |
On Tue, Sep 08, 2015 at 10:09:10AM +0300, Adrian Hunter wrote:
> On 08/09/15 09:45, Jiri Olsa wrote:
> > On Mon, Sep 07, 2015 at 05:27:49PM +0300, Adrian Hunter wrote:
> >> perf_evlist__propagate_maps() cannot easily tell if an evsel
> >> has its own cpu map. To make that simpler, keep a copy of
> >> the PMU cpu map and adjust the propagation logic accordingly.
> >>
> >> Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
> >> ---
> >> tools/perf/util/evlist.c | 5 ++++-
> >> tools/perf/util/evsel.c | 1 +
> >> tools/perf/util/evsel.h | 1 +
> >> tools/perf/util/parse-events.c | 4 ++--
> >> 4 files changed, 8 insertions(+), 3 deletions(-)
> >>
> >> diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
> >> index c959c42080e3..6764e0eff849 100644
> >> --- a/tools/perf/util/evlist.c
> >> +++ b/tools/perf/util/evlist.c
> >> @@ -1111,9 +1111,12 @@ static void perf_evlist__propagate_maps(struct perf_evlist *evlist)
> >> * We already have cpus for evsel (via PMU sysfs) so
> >> * keep it, if there's no target cpu list defined.
> >> */
> >> - if (!evsel->cpus || evlist->has_user_cpus) {
> >> + if (!evsel->own_cpus || evlist->has_user_cpus) {
> >> cpu_map__put(evsel->cpus);
> >> evsel->cpus = cpu_map__get(evlist->cpus);
> >> + } else if (evsel->cpus != evsel->own_cpus) {
> >> + cpu_map__put(evsel->cpus);
> >> + evsel->cpus = cpu_map__get(evsel->own_cpus);
> >
> > hum, so (evsel->cpus != evsel->own_cpus) could happen only when:
> > - evsel->own_cpus != NULL
> > - we overloaded evsel->cpus with evlist->cpus via perf_evlist__propagate_maps
> > - we changed evlist->has_user_cpus = false
> > - we recall perf_evlist__propagate_maps
> >
> > I'm missing usecase for that, or something else ;-)
>
> That's true but the idea is to establish rules (invariants) that are always
> true. Like an evsel either has its own cpu map or the same as the evlist.
ook, jirka
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Arnaldo Carvalho de Melo <acme@redhat.com> |
|---|---|
| Date | 2015-09-08 16:40 +0200 |
| Message-ID | <q6sdZ-71F-33@gated-at.bofh.it> |
| In reply to | #1220553 |
Em Tue, Sep 08, 2015 at 09:38:54AM +0200, Jiri Olsa escreveu:
> On Tue, Sep 08, 2015 at 10:09:10AM +0300, Adrian Hunter wrote:
> > On 08/09/15 09:45, Jiri Olsa wrote:
> > > On Mon, Sep 07, 2015 at 05:27:49PM +0300, Adrian Hunter wrote:
> > >> +++ b/tools/perf/util/evlist.c
> > >> @@ -1111,9 +1111,12 @@ static void perf_evlist__propagate_maps(struct perf_evlist *evlist)
> > >> * We already have cpus for evsel (via PMU sysfs) so
> > >> * keep it, if there's no target cpu list defined.
> > >> */
> > >> - if (!evsel->cpus || evlist->has_user_cpus) {
> > >> + if (!evsel->own_cpus || evlist->has_user_cpus) {
> > >> cpu_map__put(evsel->cpus);
> > >> evsel->cpus = cpu_map__get(evlist->cpus);
> > >> + } else if (evsel->cpus != evsel->own_cpus) {
> > >> + cpu_map__put(evsel->cpus);
> > >> + evsel->cpus = cpu_map__get(evsel->own_cpus);
> > >
> > > hum, so (evsel->cpus != evsel->own_cpus) could happen only when:
> > > - evsel->own_cpus != NULL
> > > - we overloaded evsel->cpus with evlist->cpus via perf_evlist__propagate_maps
> > > - we changed evlist->has_user_cpus = false
> > > - we recall perf_evlist__propagate_maps
> > > I'm missing usecase for that, or something else ;-)
> > That's true but the idea is to establish rules (invariants) that are always
> > true. Like an evsel either has its own cpu map or the same as the evlist.
> ook, jirka
Yup, I haven't even looked at the code that much, but at least Adrian's
explanation matches my expectations 8-)
- Arnaldo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web