All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] perf tools: Miscellaneous fix from the previous cycle
@ 2018-02-12 20:32 ` Mathieu Poirier
  0 siblings, 0 replies; 13+ messages in thread
From: Mathieu Poirier @ 2018-02-12 20:32 UTC (permalink / raw)
  To: acme
  Cc: peterz, mingo, alexander.shishkin, namhyung, yao.jin,
	linux-arm-kernel, linux-kernel

Good day Arnaldo,

Here are 3 patches that were sent late in the v4.15 cycle, too late for
you to pick up for the v4.16 cycle.  I don't know if they are on a backlog
of yours somewhere or if you've made a mental note of them - if so kindly
disregard this set.  Otherwise, here they are again, rebased to your latest
perf/core [1].

All 3 patches are required for proper functionning of the CoreSight
trace decoding integration that is in the current cycle.

Regards,
Mathieu

[1]. f13c88d836d8 perf report: Add support to display group output for non group events

Jin Yao (1):
  perf util: Use target->per_thread and target->system_wide flags

Mathieu Poirier (2):
  perf tools: Freeing allocated memory
  perf tools: Fixing uninitialised variable

 tools/perf/arch/arm/util/auxtrace.c |  2 +-
 tools/perf/util/cs-etm.c            |  6 ++++++
 tools/perf/util/evlist.c            | 21 ++++++++++++++++++++-
 tools/perf/util/thread_map.c        |  4 ++--
 tools/perf/util/thread_map.h        |  2 +-
 5 files changed, 30 insertions(+), 5 deletions(-)

-- 
2.7.4

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

* [PATCH 0/3] perf tools: Miscellaneous fix from the previous cycle
@ 2018-02-12 20:32 ` Mathieu Poirier
  0 siblings, 0 replies; 13+ messages in thread
From: Mathieu Poirier @ 2018-02-12 20:32 UTC (permalink / raw)
  To: linux-arm-kernel

Good day Arnaldo,

Here are 3 patches that were sent late in the v4.15 cycle, too late for
you to pick up for the v4.16 cycle.  I don't know if they are on a backlog
of yours somewhere or if you've made a mental note of them - if so kindly
disregard this set.  Otherwise, here they are again, rebased to your latest
perf/core [1].

All 3 patches are required for proper functionning of the CoreSight
trace decoding integration that is in the current cycle.

Regards,
Mathieu

[1]. f13c88d836d8 perf report: Add support to display group output for non group events

Jin Yao (1):
  perf util: Use target->per_thread and target->system_wide flags

Mathieu Poirier (2):
  perf tools: Freeing allocated memory
  perf tools: Fixing uninitialised variable

 tools/perf/arch/arm/util/auxtrace.c |  2 +-
 tools/perf/util/cs-etm.c            |  6 ++++++
 tools/perf/util/evlist.c            | 21 ++++++++++++++++++++-
 tools/perf/util/thread_map.c        |  4 ++--
 tools/perf/util/thread_map.h        |  2 +-
 5 files changed, 30 insertions(+), 5 deletions(-)

-- 
2.7.4

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

* [PATCH 1/3] perf tools: Freeing allocated memory
  2018-02-12 20:32 ` Mathieu Poirier
@ 2018-02-12 20:32   ` Mathieu Poirier
  -1 siblings, 0 replies; 13+ messages in thread
From: Mathieu Poirier @ 2018-02-12 20:32 UTC (permalink / raw)
  To: acme
  Cc: peterz, mingo, alexander.shishkin, namhyung, yao.jin,
	linux-arm-kernel, linux-kernel

This patch frees all the memory allocated in function
cs_etm__alloc_queue().

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
---
 tools/perf/util/cs-etm.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c
index b9f0a53dfa65..f2c98774e665 100644
--- a/tools/perf/util/cs-etm.c
+++ b/tools/perf/util/cs-etm.c
@@ -174,6 +174,12 @@ static void cs_etm__free_queue(void *priv)
 {
 	struct cs_etm_queue *etmq = priv;
 
+	if (!etmq)
+		return;
+
+	thread__zput(etmq->thread);
+	cs_etm_decoder__free(etmq->decoder);
+	zfree(&etmq->event_buf);
 	free(etmq);
 }
 
-- 
2.7.4

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

* [PATCH 1/3] perf tools: Freeing allocated memory
@ 2018-02-12 20:32   ` Mathieu Poirier
  0 siblings, 0 replies; 13+ messages in thread
From: Mathieu Poirier @ 2018-02-12 20:32 UTC (permalink / raw)
  To: linux-arm-kernel

This patch frees all the memory allocated in function
cs_etm__alloc_queue().

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
---
 tools/perf/util/cs-etm.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c
index b9f0a53dfa65..f2c98774e665 100644
--- a/tools/perf/util/cs-etm.c
+++ b/tools/perf/util/cs-etm.c
@@ -174,6 +174,12 @@ static void cs_etm__free_queue(void *priv)
 {
 	struct cs_etm_queue *etmq = priv;
 
+	if (!etmq)
+		return;
+
+	thread__zput(etmq->thread);
+	cs_etm_decoder__free(etmq->decoder);
+	zfree(&etmq->event_buf);
 	free(etmq);
 }
 
-- 
2.7.4

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

* [PATCH 2/3] perf util: Use target->per_thread and target->system_wide flags
  2018-02-12 20:32 ` Mathieu Poirier
@ 2018-02-12 20:32   ` Mathieu Poirier
  -1 siblings, 0 replies; 13+ messages in thread
From: Mathieu Poirier @ 2018-02-12 20:32 UTC (permalink / raw)
  To: acme
  Cc: peterz, mingo, alexander.shishkin, namhyung, yao.jin,
	linux-arm-kernel, linux-kernel

From: Jin Yao <yao.jin@linux.intel.com>

Mathieu Poirier reports issue in commit ("73c0ca1eee3d perf thread_map:
Enumerate all threads from /proc") that it has negative impact on
'perf record --per-thread'. It has the effect of creating a kernel event
for each thread in the system for 'perf record --per-thread'.

Mathieu Poirier's patch ("perf util: Do not reuse target->per_thread flag")
can fix this issue by creating a new target->all_threads flag.

This patch is based on Mathieu Poirier's patch but it doesn't use a new
target->all_threads flag. This patch just uses 'target->per_thread &&
target->system_wide' as a condition to check for all threads case.

Signed-off-by: Jin Yao <yao.jin@linux.intel.com>
[Fixed checkpatch warning about line over 80 characters]
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
---
 tools/perf/util/evlist.c     | 21 ++++++++++++++++++++-
 tools/perf/util/thread_map.c |  4 ++--
 tools/perf/util/thread_map.h |  2 +-
 3 files changed, 23 insertions(+), 4 deletions(-)

diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index e5fc14e53c05..7b7d535396f7 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -1086,11 +1086,30 @@ int perf_evlist__mmap(struct perf_evlist *evlist, unsigned int pages)
 
 int perf_evlist__create_maps(struct perf_evlist *evlist, struct target *target)
 {
+	bool all_threads = (target->per_thread && target->system_wide);
 	struct cpu_map *cpus;
 	struct thread_map *threads;
 
+	/*
+	 * If specify '-a' and '--per-thread' to perf record, perf record
+	 * will override '--per-thread'. target->per_thread = false and
+	 * target->system_wide = true.
+	 *
+	 * If specify '--per-thread' only to perf record,
+	 * target->per_thread = true and target->system_wide = false.
+	 *
+	 * So target->per_thread && target->system_wide is false.
+	 * For perf record, thread_map__new_str doesn't call
+	 * thread_map__new_all_cpus. That will keep perf record's
+	 * current behavior.
+	 *
+	 * For perf stat, it allows the case that target->per_thread and
+	 * target->system_wide are all true. It means to collect system-wide
+	 * per-thread data. thread_map__new_str will call
+	 * thread_map__new_all_cpus to enumerate all threads.
+	 */
 	threads = thread_map__new_str(target->pid, target->tid, target->uid,
-				      target->per_thread);
+				      all_threads);
 
 	if (!threads)
 		return -1;
diff --git a/tools/perf/util/thread_map.c b/tools/perf/util/thread_map.c
index 3e1038f6491c..729dad8f412d 100644
--- a/tools/perf/util/thread_map.c
+++ b/tools/perf/util/thread_map.c
@@ -323,7 +323,7 @@ struct thread_map *thread_map__new_by_tid_str(const char *tid_str)
 }
 
 struct thread_map *thread_map__new_str(const char *pid, const char *tid,
-				       uid_t uid, bool per_thread)
+				       uid_t uid, bool all_threads)
 {
 	if (pid)
 		return thread_map__new_by_pid_str(pid);
@@ -331,7 +331,7 @@ struct thread_map *thread_map__new_str(const char *pid, const char *tid,
 	if (!tid && uid != UINT_MAX)
 		return thread_map__new_by_uid(uid);
 
-	if (per_thread)
+	if (all_threads)
 		return thread_map__new_all_cpus();
 
 	return thread_map__new_by_tid_str(tid);
diff --git a/tools/perf/util/thread_map.h b/tools/perf/util/thread_map.h
index 0a806b99e73c..5ec91cfd1869 100644
--- a/tools/perf/util/thread_map.h
+++ b/tools/perf/util/thread_map.h
@@ -31,7 +31,7 @@ struct thread_map *thread_map__get(struct thread_map *map);
 void thread_map__put(struct thread_map *map);
 
 struct thread_map *thread_map__new_str(const char *pid,
-		const char *tid, uid_t uid, bool per_thread);
+		const char *tid, uid_t uid, bool all_threads);
 
 struct thread_map *thread_map__new_by_tid_str(const char *tid_str);
 
-- 
2.7.4

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

* [PATCH 2/3] perf util: Use target->per_thread and target->system_wide flags
@ 2018-02-12 20:32   ` Mathieu Poirier
  0 siblings, 0 replies; 13+ messages in thread
From: Mathieu Poirier @ 2018-02-12 20:32 UTC (permalink / raw)
  To: linux-arm-kernel

From: Jin Yao <yao.jin@linux.intel.com>

Mathieu Poirier reports issue in commit ("73c0ca1eee3d perf thread_map:
Enumerate all threads from /proc") that it has negative impact on
'perf record --per-thread'. It has the effect of creating a kernel event
for each thread in the system for 'perf record --per-thread'.

Mathieu Poirier's patch ("perf util: Do not reuse target->per_thread flag")
can fix this issue by creating a new target->all_threads flag.

This patch is based on Mathieu Poirier's patch but it doesn't use a new
target->all_threads flag. This patch just uses 'target->per_thread &&
target->system_wide' as a condition to check for all threads case.

Signed-off-by: Jin Yao <yao.jin@linux.intel.com>
[Fixed checkpatch warning about line over 80 characters]
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
---
 tools/perf/util/evlist.c     | 21 ++++++++++++++++++++-
 tools/perf/util/thread_map.c |  4 ++--
 tools/perf/util/thread_map.h |  2 +-
 3 files changed, 23 insertions(+), 4 deletions(-)

diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index e5fc14e53c05..7b7d535396f7 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -1086,11 +1086,30 @@ int perf_evlist__mmap(struct perf_evlist *evlist, unsigned int pages)
 
 int perf_evlist__create_maps(struct perf_evlist *evlist, struct target *target)
 {
+	bool all_threads = (target->per_thread && target->system_wide);
 	struct cpu_map *cpus;
 	struct thread_map *threads;
 
+	/*
+	 * If specify '-a' and '--per-thread' to perf record, perf record
+	 * will override '--per-thread'. target->per_thread = false and
+	 * target->system_wide = true.
+	 *
+	 * If specify '--per-thread' only to perf record,
+	 * target->per_thread = true and target->system_wide = false.
+	 *
+	 * So target->per_thread && target->system_wide is false.
+	 * For perf record, thread_map__new_str doesn't call
+	 * thread_map__new_all_cpus. That will keep perf record's
+	 * current behavior.
+	 *
+	 * For perf stat, it allows the case that target->per_thread and
+	 * target->system_wide are all true. It means to collect system-wide
+	 * per-thread data. thread_map__new_str will call
+	 * thread_map__new_all_cpus to enumerate all threads.
+	 */
 	threads = thread_map__new_str(target->pid, target->tid, target->uid,
-				      target->per_thread);
+				      all_threads);
 
 	if (!threads)
 		return -1;
diff --git a/tools/perf/util/thread_map.c b/tools/perf/util/thread_map.c
index 3e1038f6491c..729dad8f412d 100644
--- a/tools/perf/util/thread_map.c
+++ b/tools/perf/util/thread_map.c
@@ -323,7 +323,7 @@ struct thread_map *thread_map__new_by_tid_str(const char *tid_str)
 }
 
 struct thread_map *thread_map__new_str(const char *pid, const char *tid,
-				       uid_t uid, bool per_thread)
+				       uid_t uid, bool all_threads)
 {
 	if (pid)
 		return thread_map__new_by_pid_str(pid);
@@ -331,7 +331,7 @@ struct thread_map *thread_map__new_str(const char *pid, const char *tid,
 	if (!tid && uid != UINT_MAX)
 		return thread_map__new_by_uid(uid);
 
-	if (per_thread)
+	if (all_threads)
 		return thread_map__new_all_cpus();
 
 	return thread_map__new_by_tid_str(tid);
diff --git a/tools/perf/util/thread_map.h b/tools/perf/util/thread_map.h
index 0a806b99e73c..5ec91cfd1869 100644
--- a/tools/perf/util/thread_map.h
+++ b/tools/perf/util/thread_map.h
@@ -31,7 +31,7 @@ struct thread_map *thread_map__get(struct thread_map *map);
 void thread_map__put(struct thread_map *map);
 
 struct thread_map *thread_map__new_str(const char *pid,
-		const char *tid, uid_t uid, bool per_thread);
+		const char *tid, uid_t uid, bool all_threads);
 
 struct thread_map *thread_map__new_by_tid_str(const char *tid_str);
 
-- 
2.7.4

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

* [PATCH 3/3] perf tools: Fixing uninitialised variable
  2018-02-12 20:32 ` Mathieu Poirier
@ 2018-02-12 20:32   ` Mathieu Poirier
  -1 siblings, 0 replies; 13+ messages in thread
From: Mathieu Poirier @ 2018-02-12 20:32 UTC (permalink / raw)
  To: acme
  Cc: peterz, mingo, alexander.shishkin, namhyung, yao.jin,
	linux-arm-kernel, linux-kernel

When working natively on arm64 the compiler gets pesky and complains
that variable 'i' is uninitialised, something that breaks the
compilation.  Here no further checks are needed since variable 'found_spe'
can only be true if variable 'i' has been initialised as part of the for
loop.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
---
 tools/perf/arch/arm/util/auxtrace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/arch/arm/util/auxtrace.c b/tools/perf/arch/arm/util/auxtrace.c
index 2323581b157d..fa639e3e52ac 100644
--- a/tools/perf/arch/arm/util/auxtrace.c
+++ b/tools/perf/arch/arm/util/auxtrace.c
@@ -68,7 +68,7 @@ struct auxtrace_record
 	bool found_spe = false;
 	static struct perf_pmu **arm_spe_pmus = NULL;
 	static int nr_spes = 0;
-	int i;
+	int i = 0;
 
 	if (!evlist)
 		return NULL;
-- 
2.7.4

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

* [PATCH 3/3] perf tools: Fixing uninitialised variable
@ 2018-02-12 20:32   ` Mathieu Poirier
  0 siblings, 0 replies; 13+ messages in thread
From: Mathieu Poirier @ 2018-02-12 20:32 UTC (permalink / raw)
  To: linux-arm-kernel

When working natively on arm64 the compiler gets pesky and complains
that variable 'i' is uninitialised, something that breaks the
compilation.  Here no further checks are needed since variable 'found_spe'
can only be true if variable 'i' has been initialised as part of the for
loop.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
---
 tools/perf/arch/arm/util/auxtrace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/arch/arm/util/auxtrace.c b/tools/perf/arch/arm/util/auxtrace.c
index 2323581b157d..fa639e3e52ac 100644
--- a/tools/perf/arch/arm/util/auxtrace.c
+++ b/tools/perf/arch/arm/util/auxtrace.c
@@ -68,7 +68,7 @@ struct auxtrace_record
 	bool found_spe = false;
 	static struct perf_pmu **arm_spe_pmus = NULL;
 	static int nr_spes = 0;
-	int i;
+	int i = 0;
 
 	if (!evlist)
 		return NULL;
-- 
2.7.4

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

* Re: [PATCH 0/3] perf tools: Miscellaneous fix from the previous cycle
  2018-02-12 20:32 ` Mathieu Poirier
@ 2018-02-15 14:55   ` Arnaldo Carvalho de Melo
  -1 siblings, 0 replies; 13+ messages in thread
From: Arnaldo Carvalho de Melo @ 2018-02-15 14:55 UTC (permalink / raw)
  To: Mathieu Poirier
  Cc: peterz, mingo, alexander.shishkin, namhyung, yao.jin,
	linux-arm-kernel, linux-kernel

Em Mon, Feb 12, 2018 at 01:32:34PM -0700, Mathieu Poirier escreveu:
> Good day Arnaldo,
> 
> Here are 3 patches that were sent late in the v4.15 cycle, too late for
> you to pick up for the v4.16 cycle.  I don't know if they are on a backlog
> of yours somewhere or if you've made a mental note of them - if so kindly
> disregard this set.  Otherwise, here they are again, rebased to your latest
> perf/core [1].
> 
> All 3 patches are required for proper functionning of the CoreSight
> trace decoding integration that is in the current cycle.

Thanks, applied the 3 patches.

- Arnaldo

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

* [PATCH 0/3] perf tools: Miscellaneous fix from the previous cycle
@ 2018-02-15 14:55   ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 13+ messages in thread
From: Arnaldo Carvalho de Melo @ 2018-02-15 14:55 UTC (permalink / raw)
  To: linux-arm-kernel

Em Mon, Feb 12, 2018 at 01:32:34PM -0700, Mathieu Poirier escreveu:
> Good day Arnaldo,
> 
> Here are 3 patches that were sent late in the v4.15 cycle, too late for
> you to pick up for the v4.16 cycle.  I don't know if they are on a backlog
> of yours somewhere or if you've made a mental note of them - if so kindly
> disregard this set.  Otherwise, here they are again, rebased to your latest
> perf/core [1].
> 
> All 3 patches are required for proper functionning of the CoreSight
> trace decoding integration that is in the current cycle.

Thanks, applied the 3 patches.

- Arnaldo

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

* [tip:perf/core] perf cs-etm: Freeing allocated memory
  2018-02-12 20:32   ` Mathieu Poirier
  (?)
@ 2018-02-17 11:28   ` tip-bot for Mathieu Poirier
  -1 siblings, 0 replies; 13+ messages in thread
From: tip-bot for Mathieu Poirier @ 2018-02-17 11:28 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: peterz, linux-kernel, alexander.shishkin, tglx, hpa, acme,
	yao.jin, mathieu.poirier, namhyung, mingo

Commit-ID:  099c1130998fd2234a200b55d69713ec66d88325
Gitweb:     https://git.kernel.org/tip/099c1130998fd2234a200b55d69713ec66d88325
Author:     Mathieu Poirier <mathieu.poirier@linaro.org>
AuthorDate: Mon, 12 Feb 2018 13:32:35 -0700
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Fri, 16 Feb 2018 14:55:39 -0300

perf cs-etm: Freeing allocated memory

This patch frees all the memory allocated in function
cs_etm__alloc_queue().

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Jin Yao <yao.jin@linux.intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: linux-arm-kernel@lists.infradead.org
Link: http://lkml.kernel.org/r/1518467557-18505-2-git-send-email-mathieu.poirier@linaro.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/cs-etm.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c
index b9f0a53..f2c9877 100644
--- a/tools/perf/util/cs-etm.c
+++ b/tools/perf/util/cs-etm.c
@@ -174,6 +174,12 @@ static void cs_etm__free_queue(void *priv)
 {
 	struct cs_etm_queue *etmq = priv;
 
+	if (!etmq)
+		return;
+
+	thread__zput(etmq->thread);
+	cs_etm_decoder__free(etmq->decoder);
+	zfree(&etmq->event_buf);
 	free(etmq);
 }
 

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

* [tip:perf/core] perf tools: Use target->per_thread and target->system_wide flags
  2018-02-12 20:32   ` Mathieu Poirier
  (?)
@ 2018-02-17 11:29   ` tip-bot for Jin Yao
  -1 siblings, 0 replies; 13+ messages in thread
From: tip-bot for Jin Yao @ 2018-02-17 11:29 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: yao.jin, linux-kernel, namhyung, alexander.shishkin, hpa,
	mathieu.poirier, mingo, tglx, acme, peterz

Commit-ID:  147c508f3004df6e2958f6c8867909531c2a15e2
Gitweb:     https://git.kernel.org/tip/147c508f3004df6e2958f6c8867909531c2a15e2
Author:     Jin Yao <yao.jin@linux.intel.com>
AuthorDate: Mon, 12 Feb 2018 13:32:36 -0700
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Fri, 16 Feb 2018 14:55:40 -0300

perf tools: Use target->per_thread and target->system_wide flags

Mathieu Poirier reports issue in commit ("73c0ca1eee3d perf thread_map:
Enumerate all threads from /proc") that it has negative impact on 'perf
record --per-thread'. It has the effect of creating a kernel event for
each thread in the system for 'perf record --per-thread'.

Mathieu Poirier's patch ("perf util: Do not reuse target->per_thread flag")
can fix this issue by creating a new target->all_threads flag.

This patch is based on Mathieu Poirier's patch but it doesn't use a new
target->all_threads flag. This patch just uses 'target->per_thread &&
target->system_wide' as a condition to check for all threads case.

Signed-off-by: Jin Yao <yao.jin@linux.intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: linux-arm-kernel@lists.infradead.org
Fixes: 73c0ca1eee3d ("perf thread_map: Enumerate all threads from /proc")
Link: http://lkml.kernel.org/r/1518467557-18505-3-git-send-email-mathieu.poirier@linaro.org
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
[Fixed checkpatch warning about line over 80 characters]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/evlist.c     | 21 ++++++++++++++++++++-
 tools/perf/util/thread_map.c |  4 ++--
 tools/perf/util/thread_map.h |  2 +-
 3 files changed, 23 insertions(+), 4 deletions(-)

diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index e5fc14e..7b7d535 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -1086,11 +1086,30 @@ int perf_evlist__mmap(struct perf_evlist *evlist, unsigned int pages)
 
 int perf_evlist__create_maps(struct perf_evlist *evlist, struct target *target)
 {
+	bool all_threads = (target->per_thread && target->system_wide);
 	struct cpu_map *cpus;
 	struct thread_map *threads;
 
+	/*
+	 * If specify '-a' and '--per-thread' to perf record, perf record
+	 * will override '--per-thread'. target->per_thread = false and
+	 * target->system_wide = true.
+	 *
+	 * If specify '--per-thread' only to perf record,
+	 * target->per_thread = true and target->system_wide = false.
+	 *
+	 * So target->per_thread && target->system_wide is false.
+	 * For perf record, thread_map__new_str doesn't call
+	 * thread_map__new_all_cpus. That will keep perf record's
+	 * current behavior.
+	 *
+	 * For perf stat, it allows the case that target->per_thread and
+	 * target->system_wide are all true. It means to collect system-wide
+	 * per-thread data. thread_map__new_str will call
+	 * thread_map__new_all_cpus to enumerate all threads.
+	 */
 	threads = thread_map__new_str(target->pid, target->tid, target->uid,
-				      target->per_thread);
+				      all_threads);
 
 	if (!threads)
 		return -1;
diff --git a/tools/perf/util/thread_map.c b/tools/perf/util/thread_map.c
index 3e1038f..729dad8 100644
--- a/tools/perf/util/thread_map.c
+++ b/tools/perf/util/thread_map.c
@@ -323,7 +323,7 @@ out_free_threads:
 }
 
 struct thread_map *thread_map__new_str(const char *pid, const char *tid,
-				       uid_t uid, bool per_thread)
+				       uid_t uid, bool all_threads)
 {
 	if (pid)
 		return thread_map__new_by_pid_str(pid);
@@ -331,7 +331,7 @@ struct thread_map *thread_map__new_str(const char *pid, const char *tid,
 	if (!tid && uid != UINT_MAX)
 		return thread_map__new_by_uid(uid);
 
-	if (per_thread)
+	if (all_threads)
 		return thread_map__new_all_cpus();
 
 	return thread_map__new_by_tid_str(tid);
diff --git a/tools/perf/util/thread_map.h b/tools/perf/util/thread_map.h
index 0a806b9..5ec91cf 100644
--- a/tools/perf/util/thread_map.h
+++ b/tools/perf/util/thread_map.h
@@ -31,7 +31,7 @@ struct thread_map *thread_map__get(struct thread_map *map);
 void thread_map__put(struct thread_map *map);
 
 struct thread_map *thread_map__new_str(const char *pid,
-		const char *tid, uid_t uid, bool per_thread);
+		const char *tid, uid_t uid, bool all_threads);
 
 struct thread_map *thread_map__new_by_tid_str(const char *tid_str);
 

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

* [tip:perf/core] perf auxtrace arm: Fixing uninitialised variable
  2018-02-12 20:32   ` Mathieu Poirier
  (?)
@ 2018-02-17 11:29   ` tip-bot for Mathieu Poirier
  -1 siblings, 0 replies; 13+ messages in thread
From: tip-bot for Mathieu Poirier @ 2018-02-17 11:29 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: yao.jin, acme, mingo, tglx, linux-kernel, namhyung, hpa,
	mathieu.poirier, alexander.shishkin, peterz

Commit-ID:  d2785de15f1bd42d613d56bbac5a007e7293b874
Gitweb:     https://git.kernel.org/tip/d2785de15f1bd42d613d56bbac5a007e7293b874
Author:     Mathieu Poirier <mathieu.poirier@linaro.org>
AuthorDate: Mon, 12 Feb 2018 13:32:37 -0700
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Fri, 16 Feb 2018 14:55:40 -0300

perf auxtrace arm: Fixing uninitialised variable

When working natively on arm64 the compiler gets pesky and complains
that variable 'i' is uninitialised, something that breaks the
compilation.  Here no further checks are needed since variable
'found_spe' can only be true if variable 'i' has been initialised as
part of the for loop.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Jin Yao <yao.jin@linux.intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: linux-arm-kernel@lists.infradead.org
Link: http://lkml.kernel.org/r/1518467557-18505-4-git-send-email-mathieu.poirier@linaro.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/arch/arm/util/auxtrace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/arch/arm/util/auxtrace.c b/tools/perf/arch/arm/util/auxtrace.c
index 2323581..fa639e3 100644
--- a/tools/perf/arch/arm/util/auxtrace.c
+++ b/tools/perf/arch/arm/util/auxtrace.c
@@ -68,7 +68,7 @@ struct auxtrace_record
 	bool found_spe = false;
 	static struct perf_pmu **arm_spe_pmus = NULL;
 	static int nr_spes = 0;
-	int i;
+	int i = 0;
 
 	if (!evlist)
 		return NULL;

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

end of thread, other threads:[~2018-02-17 11:40 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-12 20:32 [PATCH 0/3] perf tools: Miscellaneous fix from the previous cycle Mathieu Poirier
2018-02-12 20:32 ` Mathieu Poirier
2018-02-12 20:32 ` [PATCH 1/3] perf tools: Freeing allocated memory Mathieu Poirier
2018-02-12 20:32   ` Mathieu Poirier
2018-02-17 11:28   ` [tip:perf/core] perf cs-etm: " tip-bot for Mathieu Poirier
2018-02-12 20:32 ` [PATCH 2/3] perf util: Use target->per_thread and target->system_wide flags Mathieu Poirier
2018-02-12 20:32   ` Mathieu Poirier
2018-02-17 11:29   ` [tip:perf/core] perf tools: " tip-bot for Jin Yao
2018-02-12 20:32 ` [PATCH 3/3] perf tools: Fixing uninitialised variable Mathieu Poirier
2018-02-12 20:32   ` Mathieu Poirier
2018-02-17 11:29   ` [tip:perf/core] perf auxtrace arm: " tip-bot for Mathieu Poirier
2018-02-15 14:55 ` [PATCH 0/3] perf tools: Miscellaneous fix from the previous cycle Arnaldo Carvalho de Melo
2018-02-15 14:55   ` Arnaldo Carvalho de Melo

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.