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


Groups > linux.kernel > #1289626 > unrolled thread

[GIT PULL 0/9] perf/core improvements and fixes

Started byArnaldo Carvalho de Melo <acme@kernel.org>
First post2015-12-11 15:30 +0100
Last post2015-12-14 09:40 +0100
Articles 5 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [GIT PULL 0/9] perf/core improvements and fixes Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-12-11 15:30 +0100
    [PATCH 9/9] perf tools: Clear struct machine during machine__init() Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-12-11 15:30 +0100
    [PATCH 2/9] perf top: Access hists->lock only if needed Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-12-11 15:30 +0100
    [PATCH 7/9] perf data: Add u32_hex data type Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-12-11 15:30 +0100
    Re: [GIT PULL 0/9] perf/core improvements and fixes Ingo Molnar <mingo@kernel.org> - 2015-12-14 09:40 +0100

#1289626 — [GIT PULL 0/9] perf/core improvements and fixes

FromArnaldo Carvalho de Melo <acme@kernel.org>
Date2015-12-11 15:30 +0100
Subject[GIT PULL 0/9] perf/core improvements and fixes
Message-ID<qEwRQ-5G2-9@gated-at.bofh.it>
Hi Ingo,

	Please consider pulling,

- Arnaldo

The following changes since commit e7a7865cc0da306542db0b9205cb0a467f59e33d:

  perf symbols: Fix dso__load_sym to put dso (2015-12-10 16:29:32 -0300)

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 93b0ba3c60da89043ce2b9f601cd2b3da408903b:

  perf tools: Clear struct machine during machine__init() (2015-12-11 09:32:41 -0300)

----------------------------------------------------------------
perf/core improvements and fixes:

User visible:

- Fix 'perf top' annotation in --stdio (Namhyung Kim)

- Support hw breakpoint events (mem:0xAddress) in the default output mode in
  'perf script' (Wang Nan)

Infrastructure:

- Do not hold the hists lock while emitting one specific warning (Namhyung Kim)

- Fetch map names from correct strtab, worked so far because llvm/clang
  uses just one string table (Wang Nan)

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

----------------------------------------------------------------
Namhyung Kim (4):
      perf top: Do not convert address for perf_top__record_precise_ip()
      perf top: Access hists->lock only if needed
      perf top: Fix annotation on --stdio
      perf top: Cleanup condition in perf_top__record_precise_ip()

Wang Nan (5):
      tools lib bpf: Check return value of strdup when reading map names
      tools lib bpf: Fetch map names from correct strtab
      perf data: Add u32_hex data type
      perf script: Add support for PERF_TYPE_BREAKPOINT
      perf tools: Clear struct machine during machine__init()

 tools/lib/bpf/libbpf.c            | 24 +++++++++++++-----
 tools/perf/builtin-script.c       | 14 +++++++++++
 tools/perf/builtin-top.c          | 52 +++++++++++++++++----------------------
 tools/perf/util/data-convert-bt.c |  2 ++
 tools/perf/util/machine.c         |  1 +
 5 files changed, 57 insertions(+), 36 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]


#1289628 — [PATCH 9/9] perf tools: Clear struct machine during machine__init()

FromArnaldo Carvalho de Melo <acme@kernel.org>
Date2015-12-11 15:30 +0100
Subject[PATCH 9/9] perf tools: Clear struct machine during machine__init()
Message-ID<qEwRR-5G2-39@gated-at.bofh.it>
In reply to#1289626
From: Wang Nan <wangnan0@huawei.com>

There are so many test cases use stack allocated 'struct machine'.
Including:
  test__hists_link
  test__hists_filter
  test__mmap_thread_lookup
  test__thread_mg_share
  test__hists_output
  test__hists_cumulate

Also, in non-test code (for example, machine__new_host()) there are
code use 'malloc()' to alloc struct machine.

These are dangerous operations, cause some tests fail or hung in
machines__exit(). For example, in

 machines__exit ->
   machine__destroy_kernel_maps ->
     map_groups__remove ->
       maps__remove ->
         pthread_rwlock_wrlock

a incorrectly initialized lock causes unintended behavior.

This patch memset(0) that structure in machine__init() to ensure all
fields in 'struct machine' are initialized to zero.

Signed-off-by: Wang Nan <wangnan0@huawei.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Zefan Li <lizefan@huawei.com>
Cc: pi3orama@163.com
Link: http://lkml.kernel.org/r/1449541544-67621-17-git-send-email-wangnan0@huawei.com
[ Use memset, see 'man bzero' ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/machine.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
index f5882b8c8db9..1407d5107480 100644
--- a/tools/perf/util/machine.c
+++ b/tools/perf/util/machine.c
@@ -25,6 +25,7 @@ static void dsos__init(struct dsos *dsos)
 
 int machine__init(struct machine *machine, const char *root_dir, pid_t pid)
 {
+	memset(machine, 0, sizeof(*machine));
 	map_groups__init(&machine->kmaps, machine);
 	RB_CLEAR_NODE(&machine->rb_node);
 	dsos__init(&machine->dsos);
-- 
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]


#1289629 — [PATCH 2/9] perf top: Access hists->lock only if needed

FromArnaldo Carvalho de Melo <acme@kernel.org>
Date2015-12-11 15:30 +0100
Subject[PATCH 2/9] perf top: Access hists->lock only if needed
Message-ID<qEwRR-5G2-45@gated-at.bofh.it>
In reply to#1289626
From: Namhyung Kim <namhyung@kernel.org>

The perf_top__record_precise_ip() releases and regrabs the
he->hists->lock because it can sleep if there's an error.  But it should
be done conditionally as it slows down the fast path.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1449802616-16170-2-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-top.c | 28 +++++++++++++++-------------
 1 file changed, 15 insertions(+), 13 deletions(-)

diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 3b0978e5578a..586798acf7db 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -194,21 +194,23 @@ static void perf_top__record_precise_ip(struct perf_top *top,
 
 	pthread_mutex_unlock(&notes->lock);
 
-	/*
-	 * This function is now called with he->hists->lock held.
-	 * Release it before going to sleep.
-	 */
-	pthread_mutex_unlock(&he->hists->lock);
+	if (unlikely(err)) {
+		/*
+		 * This function is now called with he->hists->lock held.
+		 * Release it before going to sleep.
+		 */
+		pthread_mutex_unlock(&he->hists->lock);
+
+		if (err == -ERANGE && !he->ms.map->erange_warned)
+			ui__warn_map_erange(he->ms.map, sym, ip);
+		else if (err == -ENOMEM) {
+			pr_err("Not enough memory for annotating '%s' symbol!\n",
+			       sym->name);
+			sleep(1);
+		}
 
-	if (err == -ERANGE && !he->ms.map->erange_warned)
-		ui__warn_map_erange(he->ms.map, sym, ip);
-	else if (err == -ENOMEM) {
-		pr_err("Not enough memory for annotating '%s' symbol!\n",
-		       sym->name);
-		sleep(1);
+		pthread_mutex_lock(&he->hists->lock);
 	}
-
-	pthread_mutex_lock(&he->hists->lock);
 }
 
 static void perf_top__show_details(struct perf_top *top)
-- 
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]


#1289630 — [PATCH 7/9] perf data: Add u32_hex data type

FromArnaldo Carvalho de Melo <acme@kernel.org>
Date2015-12-11 15:30 +0100
Subject[PATCH 7/9] perf data: Add u32_hex data type
Message-ID<qEwRR-5G2-35@gated-at.bofh.it>
In reply to#1289626
From: Wang Nan <wangnan0@huawei.com>

Add hexadecimal u32 to base data type, which is useful for raw output
because raw data is u32 aligned.

Signed-off-by: Wang Nan <wangnan0@huawei.com>
Cc: David S. Miller <davem@davemloft.net>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Brendan Gregg <brendan.d.gregg@gmail.com>
Cc: David S. Miller <davem@davemloft.net>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Zefan Li <lizefan@huawei.com>
Cc: pi3orama@163.com
Link: http://lkml.kernel.org/r/1449541544-67621-12-git-send-email-wangnan0@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/data-convert-bt.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/perf/util/data-convert-bt.c b/tools/perf/util/data-convert-bt.c
index 5bfc1198ab46..34cd1e4039d3 100644
--- a/tools/perf/util/data-convert-bt.c
+++ b/tools/perf/util/data-convert-bt.c
@@ -63,6 +63,7 @@ struct ctf_writer {
 			struct bt_ctf_field_type	*s32;
 			struct bt_ctf_field_type	*u32;
 			struct bt_ctf_field_type	*string;
+			struct bt_ctf_field_type	*u32_hex;
 			struct bt_ctf_field_type	*u64_hex;
 		};
 		struct bt_ctf_field_type *array[6];
@@ -982,6 +983,7 @@ do {							\
 	CREATE_INT_TYPE(cw->data.u64, 64, false, false);
 	CREATE_INT_TYPE(cw->data.s32, 32, true,  false);
 	CREATE_INT_TYPE(cw->data.u32, 32, false, false);
+	CREATE_INT_TYPE(cw->data.u32_hex, 32, false, true);
 	CREATE_INT_TYPE(cw->data.u64_hex, 64, false, true);
 
 	cw->data.string  = bt_ctf_field_type_string_create();
-- 
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]


#1290961

FromIngo Molnar <mingo@kernel.org>
Date2015-12-14 09:40 +0100
Message-ID<qFwPM-3DO-31@gated-at.bofh.it>
In reply to#1289626
* Arnaldo Carvalho de Melo <acme@kernel.org> wrote:

> Hi Ingo,
> 
> 	Please consider pulling,
> 
> - Arnaldo
> 
> The following changes since commit e7a7865cc0da306542db0b9205cb0a467f59e33d:
> 
>   perf symbols: Fix dso__load_sym to put dso (2015-12-10 16:29:32 -0300)
> 
> 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 93b0ba3c60da89043ce2b9f601cd2b3da408903b:
> 
>   perf tools: Clear struct machine during machine__init() (2015-12-11 09:32:41 -0300)
> 
> ----------------------------------------------------------------
> perf/core improvements and fixes:
> 
> User visible:
> 
> - Fix 'perf top' annotation in --stdio (Namhyung Kim)
> 
> - Support hw breakpoint events (mem:0xAddress) in the default output mode in
>   'perf script' (Wang Nan)
> 
> Infrastructure:
> 
> - Do not hold the hists lock while emitting one specific warning (Namhyung Kim)
> 
> - Fetch map names from correct strtab, worked so far because llvm/clang
>   uses just one string table (Wang Nan)
> 
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> 
> ----------------------------------------------------------------
> Namhyung Kim (4):
>       perf top: Do not convert address for perf_top__record_precise_ip()
>       perf top: Access hists->lock only if needed
>       perf top: Fix annotation on --stdio
>       perf top: Cleanup condition in perf_top__record_precise_ip()
> 
> Wang Nan (5):
>       tools lib bpf: Check return value of strdup when reading map names
>       tools lib bpf: Fetch map names from correct strtab
>       perf data: Add u32_hex data type
>       perf script: Add support for PERF_TYPE_BREAKPOINT
>       perf tools: Clear struct machine during machine__init()
> 
>  tools/lib/bpf/libbpf.c            | 24 +++++++++++++-----
>  tools/perf/builtin-script.c       | 14 +++++++++++
>  tools/perf/builtin-top.c          | 52 +++++++++++++++++----------------------
>  tools/perf/util/data-convert-bt.c |  2 ++
>  tools/perf/util/machine.c         |  1 +
>  5 files changed, 57 insertions(+), 36 deletions(-)

Pulled, thanks a lot Arnaldo!

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