Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1172451 > unrolled thread

[GIT PULL 0/7] perf/core improvements

Started byArnaldo Carvalho de Melo <acme@kernel.org>
First post2015-06-25 23:20 +0200
Last post2015-06-25 23:20 +0200
Articles 5 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [GIT PULL 0/7] perf/core improvements Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-06-25 23:20 +0200
    [PATCH 6/7] perf evlist: Propagate thread maps through the evlist Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-06-25 23:20 +0200
    [PATCH 5/7] perf evlist: Propagate cpu maps to evsels in an evlist Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-06-25 23:20 +0200
    [PATCH 7/7] perf tools: Make perf_evsel__(nr_)cpus generic Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-06-25 23:20 +0200
    [PATCH 2/7] perf header: Delete an unnecessary check before the calling free_event_desc() Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-06-25 23:20 +0200

#1172451 — [GIT PULL 0/7] perf/core improvements

FromArnaldo Carvalho de Melo <acme@kernel.org>
Date2015-06-25 23:20 +0200
Subject[GIT PULL 0/7] perf/core improvements
Message-ID<pFmIW-3FZ-3@gated-at.bofh.it>
Hi Ingo,

	Please consider pulling,

- Arnaldo


The following changes since commit 27451700dfa01a05cdb4d9d74501536165158034:

  Merge tag 'perf-core-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core (2015-06-25 09:28:42 +0200)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-core-for-mingo

for you to fetch changes up to a22e99cd74a31dee4b5241bd60a256c629c808da:

  perf tools: Make perf_evsel__(nr_)cpus generic (2015-06-25 17:15:39 -0300)

----------------------------------------------------------------
perf/core improvements and refactorings:

Infrastructure:

- Reference count the cpu_map and thread_map classes. (Jiri Olsa)

- Set evsel->{cpus,threads} from the evlist, if not set,
  allowing the generalization of some 'perf stat' functions that
  previously were accessing private static evlist variable. (Jiri Olsa)

- Delete an unnecessary check before the calling
  free_event_desc() (Markus Elfring)

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

----------------------------------------------------------------
Arnaldo Carvalho de Melo (1):
      perf tools: Future-proof thread_map allocation size calculation

Jiri Olsa (5):
      perf tools: Add reference counting for cpu_map object
      perf tools: Add reference counting for thread_map object
      perf evlist: Propagate cpu maps to evsels in an evlist
      perf evlist: Propagate thread maps through the evlist
      perf tools: Make perf_evsel__(nr_)cpus generic

Markus Elfring (1):
      perf header: Delete an unnecessary check before the calling free_event_desc()

 tools/perf/builtin-stat.c                  | 10 ---------
 tools/perf/tests/code-reading.c            |  4 ++--
 tools/perf/tests/keep-tracking.c           |  4 ++--
 tools/perf/tests/mmap-basic.c              |  4 ++--
 tools/perf/tests/mmap-thread-lookup.c      |  2 +-
 tools/perf/tests/openat-syscall-all-cpus.c |  2 +-
 tools/perf/tests/openat-syscall.c          |  2 +-
 tools/perf/tests/switch-tracking.c         |  4 ++--
 tools/perf/util/cpumap.c                   | 26 ++++++++++++++++++++--
 tools/perf/util/cpumap.h                   |  6 ++++-
 tools/perf/util/evlist.c                   | 35 +++++++++++++++++++++++++-----
 tools/perf/util/evsel.c                    |  2 ++
 tools/perf/util/evsel.h                    | 12 ++++++++++
 tools/perf/util/header.c                   |  3 +--
 tools/perf/util/parse-events.c             |  5 ++++-
 tools/perf/util/python.c                   |  4 ++--
 tools/perf/util/record.c                   |  4 ++--
 tools/perf/util/session.c                  |  2 +-
 tools/perf/util/svghelper.c                |  2 +-
 tools/perf/util/thread_map.c               | 32 ++++++++++++++++++++++++---
 tools/perf/util/thread_map.h               |  7 ++++--
 21 files changed, 129 insertions(+), 43 deletions(-)
--
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]


#1172452 — [PATCH 6/7] perf evlist: Propagate thread maps through the evlist

FromArnaldo Carvalho de Melo <acme@kernel.org>
Date2015-06-25 23:20 +0200
Subject[PATCH 6/7] perf evlist: Propagate thread maps through the evlist
Message-ID<pFmIW-3FZ-13@gated-at.bofh.it>
In reply to#1172451
From: Jiri Olsa <jolsa@kernel.org>

Propagate evlist's thread_map object through all the evsel objects.

It'll be handy to access evsel's threads directly in following patches.
The reason is there's no link from evsel to evlist which hold threads
map now and evlist is not always available.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1435012588-9007-7-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/evlist.c | 4 +++-
 tools/perf/util/evsel.c  | 1 +
 tools/perf/util/evsel.h  | 1 +
 3 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index 214affaf1cf6..6cfdee68e763 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -1117,7 +1117,9 @@ static int perf_evlist__propagate_maps(struct perf_evlist *evlist,
 		if (!evsel->cpus || target->cpu_list)
 			evsel->cpus = cpu_map__get(evlist->cpus);
 
-		if (!evsel->cpus)
+		evsel->threads = thread_map__get(evlist->threads);
+
+		if (!evsel->cpus || !evsel->threads)
 			return -ENOMEM;
 	}
 
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 31b0afb68825..1b2f480a3e82 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -886,6 +886,7 @@ void perf_evsel__exit(struct perf_evsel *evsel)
 	perf_evsel__free_id(evsel);
 	close_cgroup(evsel->cgrp);
 	cpu_map__put(evsel->cpus);
+	thread_map__put(evsel->threads);
 	zfree(&evsel->group_name);
 	zfree(&evsel->name);
 	perf_evsel__object.fini(evsel);
diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h
index bb0579e8a10a..9e16a5c4eb01 100644
--- a/tools/perf/util/evsel.h
+++ b/tools/perf/util/evsel.h
@@ -82,6 +82,7 @@ struct perf_evsel {
 	struct cgroup_sel	*cgrp;
 	void			*handler;
 	struct cpu_map		*cpus;
+	struct thread_map	*threads;
 	unsigned int		sample_size;
 	int			id_pos;
 	int			is_pos;
-- 
2.1.0

--
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]


#1172453 — [PATCH 5/7] perf evlist: Propagate cpu maps to evsels in an evlist

FromArnaldo Carvalho de Melo <acme@kernel.org>
Date2015-06-25 23:20 +0200
Subject[PATCH 5/7] perf evlist: Propagate cpu maps to evsels in an evlist
Message-ID<pFmIW-3FZ-17@gated-at.bofh.it>
In reply to#1172451
From: Jiri Olsa <jolsa@kernel.org>

Propagate evlist's cpu_map object through all the evsel objects, while
keeping already configured evsel->cpus.

It'll be handy to access evsel's cpus directly in following patches.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1435012588-9007-6-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/evlist.c | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index a8d18a3d2164..214affaf1cf6 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -1101,6 +1101,29 @@ int perf_evlist__mmap(struct perf_evlist *evlist, unsigned int pages,
 	return perf_evlist__mmap_ex(evlist, pages, overwrite, 0, false);
 }
 
+static int perf_evlist__propagate_maps(struct perf_evlist *evlist,
+				       struct target *target)
+{
+	struct perf_evsel *evsel;
+
+	evlist__for_each(evlist, evsel) {
+		/*
+		 * We already have cpus for evsel (via PMU sysfs) so
+		 * keep it, if there's no target cpu list defined.
+		 */
+		if (evsel->cpus && target->cpu_list)
+			cpu_map__put(evsel->cpus);
+
+		if (!evsel->cpus || target->cpu_list)
+			evsel->cpus = cpu_map__get(evlist->cpus);
+
+		if (!evsel->cpus)
+			return -ENOMEM;
+	}
+
+	return 0;
+}
+
 int perf_evlist__create_maps(struct perf_evlist *evlist, struct target *target)
 {
 	evlist->threads = thread_map__new_str(target->pid, target->tid,
@@ -1117,7 +1140,7 @@ int perf_evlist__create_maps(struct perf_evlist *evlist, struct target *target)
 	if (evlist->cpus == NULL)
 		goto out_delete_threads;
 
-	return 0;
+	return perf_evlist__propagate_maps(evlist, target);
 
 out_delete_threads:
 	thread_map__put(evlist->threads);
-- 
2.1.0

--
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]


#1172455 — [PATCH 7/7] perf tools: Make perf_evsel__(nr_)cpus generic

FromArnaldo Carvalho de Melo <acme@kernel.org>
Date2015-06-25 23:20 +0200
Subject[PATCH 7/7] perf tools: Make perf_evsel__(nr_)cpus generic
Message-ID<pFmIX-3FZ-21@gated-at.bofh.it>
In reply to#1172451
From: Jiri Olsa <jolsa@kernel.org>

Because we now propagate all evlist's cpu_maps and thread_map objects
through all evsels, the perf_evsel__(nr_)cpus no longer need to be
specific to stat object and check evlist and target objects.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1435012588-9007-8-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-stat.c | 10 ----------
 tools/perf/util/evsel.h   | 11 +++++++++++
 2 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index fcf99bdeb19e..3e1636cae76b 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -141,16 +141,6 @@ static inline void diff_timespec(struct timespec *r, struct timespec *a,
 	}
 }
 
-static inline struct cpu_map *perf_evsel__cpus(struct perf_evsel *evsel)
-{
-	return (evsel->cpus && !target.cpu_list) ? evsel->cpus : evsel_list->cpus;
-}
-
-static inline int perf_evsel__nr_cpus(struct perf_evsel *evsel)
-{
-	return perf_evsel__cpus(evsel)->nr;
-}
-
 static void perf_evsel__reset_stat_priv(struct perf_evsel *evsel)
 {
 	int i;
diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h
index 9e16a5c4eb01..4dbf32d94dfb 100644
--- a/tools/perf/util/evsel.h
+++ b/tools/perf/util/evsel.h
@@ -8,6 +8,7 @@
 #include <linux/types.h>
 #include "xyarray.h"
 #include "symbol.h"
+#include "cpumap.h"
 
 struct perf_counts_values {
 	union {
@@ -114,6 +115,16 @@ struct thread_map;
 struct perf_evlist;
 struct record_opts;
 
+static inline struct cpu_map *perf_evsel__cpus(struct perf_evsel *evsel)
+{
+	return evsel->cpus;
+}
+
+static inline int perf_evsel__nr_cpus(struct perf_evsel *evsel)
+{
+	return perf_evsel__cpus(evsel)->nr;
+}
+
 void perf_counts_values__scale(struct perf_counts_values *count,
 			       bool scale, s8 *pscaled);
 
-- 
2.1.0

--
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]


#1172457 — [PATCH 2/7] perf header: Delete an unnecessary check before the calling free_event_desc()

FromArnaldo Carvalho de Melo <acme@kernel.org>
Date2015-06-25 23:20 +0200
Subject[PATCH 2/7] perf header: Delete an unnecessary check before the calling free_event_desc()
Message-ID<pFmIX-3FZ-25@gated-at.bofh.it>
In reply to#1172451
From: Markus Elfring <elfring@users.sourceforge.net>

The free_event_desc() function tests whether its argument is NULL and
then returns immediately. Thus the test around the call is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Cc: Julia Lawall <julia.lawall@lip6.fr>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: kernel-janitors@vger.kernel.org
Link: http://lkml.kernel.org/r/558C2ABA.3000603@users.sourceforge.net
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/header.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
index 21a77e7a171e..03ace57a800c 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -1063,8 +1063,7 @@ out:
 	free(buf);
 	return events;
 error:
-	if (events)
-		free_event_desc(events);
+	free_event_desc(events);
 	events = NULL;
 	goto out;
 }
-- 
2.1.0

--
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