All of lore.kernel.org
 help / color / mirror / Atom feed
* [GIT PULL 0/4] perf/urgent fixes
@ 2015-07-09 15:45 Arnaldo Carvalho de Melo
  2015-07-09 15:45 ` [PATCH 1/4] perf tools: Fix lockup using 32-bit compat vdso Arnaldo Carvalho de Melo
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-07-09 15:45 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
	Borislav Petkov, David Ahern, Frederic Weisbecker, Jiri Olsa,
	linux-kbuild, Namhyung Kim, Peter Zijlstra, Riku Voipio,
	Stephane Eranian, Vinson Lee, Arnaldo Carvalho de Melo

Hi Ingo,

	Please consider pulling,

- Arnaldo

The following changes since commit ebf2d2689de551d90965090bb991fc640a0c0d41:

  perf/x86: Fix copy_from_user_nmi() return if range is not ok (2015-07-06 14:09:27 +0200)

are available in the git repository at:

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

for you to fetch changes up to 08ae217b8d44986062fe3648c5bb83816d5bc00f:

  perf thread_map: Fix the sizeof() calculation for map entries (2015-07-09 12:28:53 -0300)

----------------------------------------------------------------
perf/urgent fixes:

User visible:

- Fix 'perf top -u username', where not enough memory per thread_map
  entry was being allocated nor was being initialized, causing a
  segfault (Arnaldo Carvalho de Melo)

- Fix locking lockup using 32-bit compat vdso (Adrian Hunter)

Developer stuff:

- Fix shadow declaration of close with older build environments (Jiri Olsa)

- Make the 'clean' target do a better job, removing some more
  temp files (Riku Voipio)

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

----------------------------------------------------------------
Adrian Hunter (1):
      perf tools: Fix lockup using 32-bit compat vdso

Arnaldo Carvalho de Melo (1):
      perf thread_map: Fix the sizeof() calculation for map entries

Jiri Olsa (1):
      perf stat: Fix shadow declaration of close

Riku Voipio (1):
      tools lib: Improve clean target

 tools/lib/api/Makefile        | 2 +-
 tools/lib/traceevent/Makefile | 2 +-
 tools/perf/builtin-stat.c     | 4 ++--
 tools/perf/util/thread_map.c  | 3 +--
 tools/perf/util/vdso.c        | 8 +++-----
 5 files changed, 8 insertions(+), 11 deletions(-)

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

* [PATCH 1/4] perf tools: Fix lockup using 32-bit compat vdso
  2015-07-09 15:45 [GIT PULL 0/4] perf/urgent fixes Arnaldo Carvalho de Melo
@ 2015-07-09 15:45 ` Arnaldo Carvalho de Melo
  2015-07-09 15:45 ` [PATCH 2/4] perf stat: Fix shadow declaration of close Arnaldo Carvalho de Melo
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-07-09 15:45 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Adrian Hunter, David Ahern, Jiri Olsa,
	Namhyung Kim, Arnaldo Carvalho de Melo

From: Adrian Hunter <adrian.hunter@intel.com>

The __machine__findnew_compat() function is called only from
__machine__findnew_vdso_compat() which is called only from
machine__findnew_vdso() which already holds machine->dsos.lock, so
remove locking from __machine__findnew_compat().

This manifests itself tracing 32-bit programs with a 64-bit perf.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: http://lkml.kernel.org/r/1436267618-20521-1-git-send-email-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/vdso.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/tools/perf/util/vdso.c b/tools/perf/util/vdso.c
index 4b89118f158d..44d440da15dc 100644
--- a/tools/perf/util/vdso.c
+++ b/tools/perf/util/vdso.c
@@ -236,18 +236,16 @@ static struct dso *__machine__findnew_compat(struct machine *machine,
 	const char *file_name;
 	struct dso *dso;
 
-	pthread_rwlock_wrlock(&machine->dsos.lock);
 	dso = __dsos__find(&machine->dsos, vdso_file->dso_name, true);
 	if (dso)
-		goto out_unlock;
+		goto out;
 
 	file_name = vdso__get_compat_file(vdso_file);
 	if (!file_name)
-		goto out_unlock;
+		goto out;
 
 	dso = __machine__addnew_vdso(machine, vdso_file->dso_name, file_name);
-out_unlock:
-	pthread_rwlock_unlock(&machine->dsos.lock);
+out:
 	return dso;
 }
 
-- 
2.1.0


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

* [PATCH 2/4] perf stat: Fix shadow declaration of close
  2015-07-09 15:45 [GIT PULL 0/4] perf/urgent fixes Arnaldo Carvalho de Melo
  2015-07-09 15:45 ` [PATCH 1/4] perf tools: Fix lockup using 32-bit compat vdso Arnaldo Carvalho de Melo
@ 2015-07-09 15:45 ` Arnaldo Carvalho de Melo
  2015-07-09 15:45 ` [PATCH 3/4] tools lib: Improve clean target Arnaldo Carvalho de Melo
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-07-09 15:45 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Jiri Olsa, Jiri Olsa, Peter Zijlstra,
	Arnaldo Carvalho de Melo

From: Jiri Olsa <jolsa@redhat.com>

Vinson reported shadow declaration of close introduced
by the following commit:

  106a94a0f8c2 perf stat: Introduce read_counters function

Using close_counters name instead.

Reported-by: Vinson Lee <vlee@twopensource.com>
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Fixes: 106a94a0f8c2 ("perf stat: Introduce read_counters function")
Link: http://lkml.kernel.org/r/20150708111731.GA3512@krava.redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-stat.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 37e301a32f43..d99d850e1444 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -343,7 +343,7 @@ static int read_counter(struct perf_evsel *counter)
 	return 0;
 }
 
-static void read_counters(bool close)
+static void read_counters(bool close_counters)
 {
 	struct perf_evsel *counter;
 
@@ -354,7 +354,7 @@ static void read_counters(bool close)
 		if (process_counter(counter))
 			pr_warning("failed to process counter %s\n", counter->name);
 
-		if (close) {
+		if (close_counters) {
 			perf_evsel__close_fd(counter, perf_evsel__nr_cpus(counter),
 					     thread_map__nr(evsel_list->threads));
 		}
-- 
2.1.0


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

* [PATCH 3/4] tools lib: Improve clean target
  2015-07-09 15:45 [GIT PULL 0/4] perf/urgent fixes Arnaldo Carvalho de Melo
  2015-07-09 15:45 ` [PATCH 1/4] perf tools: Fix lockup using 32-bit compat vdso Arnaldo Carvalho de Melo
  2015-07-09 15:45 ` [PATCH 2/4] perf stat: Fix shadow declaration of close Arnaldo Carvalho de Melo
@ 2015-07-09 15:45 ` Arnaldo Carvalho de Melo
  2015-07-09 15:45 ` [PATCH 4/4] perf thread_map: Fix the sizeof() calculation for map entries Arnaldo Carvalho de Melo
  2015-07-10  8:04 ` [GIT PULL 0/4] perf/urgent fixes Ingo Molnar
  4 siblings, 0 replies; 6+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-07-09 15:45 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Riku Voipio, Peter Zijlstra, linux-kbuild,
	Arnaldo Carvalho de Melo

From: Riku Voipio <riku.voipio@linaro.org>

The clean targets miss some .cmd and .d files.

Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: linux-kbuild@vger.kernel.org
Link: http://lkml.kernel.org/r/1434631938-12681-1-git-send-email-riku.voipio@linaro.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/lib/api/Makefile        | 2 +-
 tools/lib/traceevent/Makefile | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/lib/api/Makefile b/tools/lib/api/Makefile
index 8bd960658463..fe1b02c2c95b 100644
--- a/tools/lib/api/Makefile
+++ b/tools/lib/api/Makefile
@@ -36,7 +36,7 @@ $(LIBFILE): $(API_IN)
 
 clean:
 	$(call QUIET_CLEAN, libapi) $(RM) $(LIBFILE); \
-	find $(if $(OUTPUT),$(OUTPUT),.) -name \*.o | xargs $(RM)
+	find $(if $(OUTPUT),$(OUTPUT),.) -name \*.o -or -name \*.o.cmd -or -name \*.o.d | xargs $(RM)
 
 FORCE:
 
diff --git a/tools/lib/traceevent/Makefile b/tools/lib/traceevent/Makefile
index 6daaff652aff..7851df1490e0 100644
--- a/tools/lib/traceevent/Makefile
+++ b/tools/lib/traceevent/Makefile
@@ -268,7 +268,7 @@ install: install_lib
 
 clean:
 	$(call QUIET_CLEAN, libtraceevent) \
-		$(RM) *.o *~ $(TARGETS) *.a *.so $(VERSION_FILES) .*.d \
+		$(RM) *.o *~ $(TARGETS) *.a *.so $(VERSION_FILES) .*.d .*.cmd \
 		$(RM) TRACEEVENT-CFLAGS tags TAGS
 
 PHONY += force plugins
-- 
2.1.0


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

* [PATCH 4/4] perf thread_map: Fix the sizeof() calculation for map entries
  2015-07-09 15:45 [GIT PULL 0/4] perf/urgent fixes Arnaldo Carvalho de Melo
                   ` (2 preceding siblings ...)
  2015-07-09 15:45 ` [PATCH 3/4] tools lib: Improve clean target Arnaldo Carvalho de Melo
@ 2015-07-09 15:45 ` Arnaldo Carvalho de Melo
  2015-07-10  8:04 ` [GIT PULL 0/4] perf/urgent fixes Ingo Molnar
  4 siblings, 0 replies; 6+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-07-09 15:45 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
	Borislav Petkov, David Ahern, Frederic Weisbecker, Jiri Olsa,
	Namhyung Kim, Stephane Eranian

From: Arnaldo Carvalho de Melo <acme@redhat.com>

When we started adding extra stuff per array entry, growing the size of
those entries to more than sizeof(pid_t), we had to convert those sizeof
operations to the more robust sizeof(map->map[0]) idiom, that is future
proof, i.e. if/when we add more stuff to those entries, that expression
will produce the new per-entry size.

And besides that, we need to zero out those extra fields, that sometimes
may not get filled, like when we couldn't care less about the comms,
since we don't need those, but since we will try freeing it at
thread_map__delete(), we better fix it.

That is why a thread_map__realloc() was provided.

But that method wasn't used in thread_map__new_by_uid(), fix it.

Reported-by: Ingo Molnar <mingo@kernel.org>
Fixes: 792402fd5c0a ("perf thrad_map: Add comm string into array")
Fixes: 9d7e8c3a96e5 ("perf tools: Add thread_map__(alloc|realloc) helpers")
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Borislav Petkov <bp@suse.de>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-6a0swlm6m8lnu3wpjv284hkb@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/thread_map.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/tools/perf/util/thread_map.c b/tools/perf/util/thread_map.c
index da7646d767fe..292ae2c90e06 100644
--- a/tools/perf/util/thread_map.c
+++ b/tools/perf/util/thread_map.c
@@ -136,8 +136,7 @@ struct thread_map *thread_map__new_by_uid(uid_t uid)
 		if (grow) {
 			struct thread_map *tmp;
 
-			tmp = realloc(threads, (sizeof(*threads) +
-						max_threads * sizeof(pid_t)));
+			tmp = thread_map__realloc(threads, max_threads);
 			if (tmp == NULL)
 				goto out_free_namelist;
 
-- 
2.1.0


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

* Re: [GIT PULL 0/4] perf/urgent fixes
  2015-07-09 15:45 [GIT PULL 0/4] perf/urgent fixes Arnaldo Carvalho de Melo
                   ` (3 preceding siblings ...)
  2015-07-09 15:45 ` [PATCH 4/4] perf thread_map: Fix the sizeof() calculation for map entries Arnaldo Carvalho de Melo
@ 2015-07-10  8:04 ` Ingo Molnar
  4 siblings, 0 replies; 6+ messages in thread
From: Ingo Molnar @ 2015-07-10  8:04 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: linux-kernel, Adrian Hunter, Borislav Petkov, David Ahern,
	Frederic Weisbecker, Jiri Olsa, linux-kbuild, Namhyung Kim,
	Peter Zijlstra, Riku Voipio, Stephane Eranian, Vinson Lee,
	Arnaldo Carvalho de Melo


* Arnaldo Carvalho de Melo <acme@kernel.org> wrote:

> Hi Ingo,
> 
> 	Please consider pulling,
> 
> - Arnaldo
> 
> The following changes since commit ebf2d2689de551d90965090bb991fc640a0c0d41:
> 
>   perf/x86: Fix copy_from_user_nmi() return if range is not ok (2015-07-06 14:09:27 +0200)
> 
> are available in the git repository at:
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-urgent-for-mingo
> 
> for you to fetch changes up to 08ae217b8d44986062fe3648c5bb83816d5bc00f:
> 
>   perf thread_map: Fix the sizeof() calculation for map entries (2015-07-09 12:28:53 -0300)
> 
> ----------------------------------------------------------------
> perf/urgent fixes:
> 
> User visible:
> 
> - Fix 'perf top -u username', where not enough memory per thread_map
>   entry was being allocated nor was being initialized, causing a
>   segfault (Arnaldo Carvalho de Melo)
> 
> - Fix locking lockup using 32-bit compat vdso (Adrian Hunter)
> 
> Developer stuff:
> 
> - Fix shadow declaration of close with older build environments (Jiri Olsa)
> 
> - Make the 'clean' target do a better job, removing some more
>   temp files (Riku Voipio)
> 
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> 
> ----------------------------------------------------------------
> Adrian Hunter (1):
>       perf tools: Fix lockup using 32-bit compat vdso
> 
> Arnaldo Carvalho de Melo (1):
>       perf thread_map: Fix the sizeof() calculation for map entries
> 
> Jiri Olsa (1):
>       perf stat: Fix shadow declaration of close
> 
> Riku Voipio (1):
>       tools lib: Improve clean target
> 
>  tools/lib/api/Makefile        | 2 +-
>  tools/lib/traceevent/Makefile | 2 +-
>  tools/perf/builtin-stat.c     | 4 ++--
>  tools/perf/util/thread_map.c  | 3 +--
>  tools/perf/util/vdso.c        | 8 +++-----
>  5 files changed, 8 insertions(+), 11 deletions(-)

Pulled this and the second round of fixes, thanks a lot Arnaldo!

	Ingo

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

end of thread, other threads:[~2015-07-10  8:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-09 15:45 [GIT PULL 0/4] perf/urgent fixes Arnaldo Carvalho de Melo
2015-07-09 15:45 ` [PATCH 1/4] perf tools: Fix lockup using 32-bit compat vdso Arnaldo Carvalho de Melo
2015-07-09 15:45 ` [PATCH 2/4] perf stat: Fix shadow declaration of close Arnaldo Carvalho de Melo
2015-07-09 15:45 ` [PATCH 3/4] tools lib: Improve clean target Arnaldo Carvalho de Melo
2015-07-09 15:45 ` [PATCH 4/4] perf thread_map: Fix the sizeof() calculation for map entries Arnaldo Carvalho de Melo
2015-07-10  8:04 ` [GIT PULL 0/4] perf/urgent fixes Ingo Molnar

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.