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


Groups > linux.kernel > #1681997

[PATCH v2 tip/perf/core 5/6] perf top: support lookup of symbols in other mount namespaces.

From Krister Johansen <kjlx@templeofstupid.com>
Newsgroups linux.kernel
Subject [PATCH v2 tip/perf/core 5/6] perf top: support lookup of symbols in other mount namespaces.
Date 2017-07-06 03:50 +0200
Message-ID <u045A-5Wp-15@gated-at.bofh.it> (permalink)
References <tZZpf-2RM-9@gated-at.bofh.it> <u045z-5Wp-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


The perf top command needs to unshare its fs from the helper threads
in order to successfully setns(2) during its symbol lookup.  It also
needs to impelement a force flag to ignore ownership of perf-<pid>.map
files.

Signed-off-by: Krister Johansen <kjlx@templeofstupid.com>
---
 tools/perf/Documentation/perf-top.txt |  4 ++++
 tools/perf/builtin-top.c              | 15 +++++++++++++++
 2 files changed, 19 insertions(+)

diff --git a/tools/perf/Documentation/perf-top.txt b/tools/perf/Documentation/perf-top.txt
index e71d638..d864ea6 100644
--- a/tools/perf/Documentation/perf-top.txt
+++ b/tools/perf/Documentation/perf-top.txt
@@ -237,6 +237,10 @@ Default is to monitor all CPUS.
 --hierarchy::
 	Enable hierarchy output.
 
+--force::
+	Don't do ownership validation.
+
+
 INTERACTIVE PROMPTING KEYS
 --------------------------
 
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 6052376..ef2aef4 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -586,6 +586,13 @@ static void *display_thread_tui(void *arg)
 		.refresh	= top->delay_secs,
 	};
 
+	/* In order to read symbols from other namespaces perf to  needs to call
+	 * setns(2).  This isn't permitted if the struct_fs has multiple users.
+	 * unshare(2) the fs so that we may continue to setns into namespaces
+	 * that we're observing.
+	 */
+	(void) unshare(CLONE_FS);
+
 	perf_top__sort_new_samples(top);
 
 	/*
@@ -627,6 +634,13 @@ static void *display_thread(void *arg)
 	struct perf_top *top = arg;
 	int delay_msecs, c;
 
+	/* In order to read symbols from other namespaces perf to  needs to call
+	 * setns(2).  This isn't permitted if the struct_fs has multiple users.
+	 * unshare(2) the fs so that we may continue to setns into namespaces
+	 * that we're observing.
+	 */
+	(void) unshare(CLONE_FS);
+
 	display_setup_sig();
 	pthread__unblock_sigwinch();
 repeat:
@@ -1205,6 +1219,7 @@ int cmd_top(int argc, const char **argv)
 		    "Show raw trace event output (do not use print fmt or plugins)"),
 	OPT_BOOLEAN(0, "hierarchy", &symbol_conf.report_hierarchy,
 		    "Show entries in a hierarchy"),
+	OPT_BOOLEAN(0, "force", &symbol_conf.force, "don't complain, do it"),
 	OPT_END()
 	};
 	const char * const top_usage[] = {
-- 
2.7.4

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [PATCH tip/perf/core 6/7] perf documentation: updates for  target-ns. Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-07-03 20:50 +0200
  Re: [PATCH tip/perf/core 6/7] perf documentation: updates for  target-ns. Krister Johansen <kjlx@templeofstupid.com> - 2017-07-05 22:50 +0200
    [PATCH v2 tip/perf/core 3/6] perf probe: allow placing uprobes in alternate namespaces. Krister Johansen <kjlx@templeofstupid.com> - 2017-07-06 03:50 +0200
      [PATCH] perf probe: Fix build failure for get_target_map() Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com> - 2017-07-17 12:40 +0200
        Re: [PATCH] perf probe: Fix build failure for get_target_map() Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-07-17 15:20 +0200
          Re: [PATCH] perf probe: Fix build failure for get_target_map() Michael Ellerman <mpe@ellerman.id.au> - 2017-07-18 11:20 +0200
    [PATCH v2 tip/perf/core 6/6] perf buildid-cache: cache debuginfo Krister Johansen <kjlx@templeofstupid.com> - 2017-07-06 03:50 +0200
    [PATCH v2 tip/perf/core 5/6] perf top: support lookup of symbols in other mount namespaces. Krister Johansen <kjlx@templeofstupid.com> - 2017-07-06 03:50 +0200
    [PATCH v2 tip/perf/core 4/6] perf buildid-cache: support binary objects from other namespaces Krister Johansen <kjlx@templeofstupid.com> - 2017-07-06 03:50 +0200
    [PATCH v2 tip/perf/core 0/6] namespace tracing improvements Krister Johansen <kjlx@templeofstupid.com> - 2017-07-06 03:50 +0200
      [PATCH v2 tip/perf/core 2/6] perf maps: lookup maps in both intitial mountns and inner mountns. Krister Johansen <kjlx@templeofstupid.com> - 2017-07-06 03:50 +0200
      [PATCH v2 tip/perf/core 1/6] perf symbols: find symbols in different mount namespace Krister Johansen <kjlx@templeofstupid.com> - 2017-07-06 03:50 +0200
        Re: [PATCH v2 tip/perf/core 1/6] perf symbols: find symbols in  different mount namespace Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-07-06 21:50 +0200
          Re: [PATCH v2 tip/perf/core 1/6] perf symbols: find symbols in  different mount namespace Krister Johansen <kjlx@templeofstupid.com> - 2017-07-07 21:40 +0200
            Re: [PATCH v2 tip/perf/core 1/6] perf symbols: find symbols in  different mount namespace Thomas-Mich Richter <tmricht@linux.vnet.ibm.com> - 2017-07-10 08:20 +0200
              Re: [PATCH v2 tip/perf/core 1/6] perf symbols: find symbols in  different mount namespace Krister Johansen <kjlx@templeofstupid.com> - 2017-07-11 00:50 +0200
                Re: [PATCH v2 tip/perf/core 1/6] perf symbols: find symbols in  different mount namespace Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-07-11 01:00 +0200
                Re: [PATCH v2 tip/perf/core 1/6] perf symbols: find symbols in  different mount namespace Krister Johansen <kjlx@templeofstupid.com> - 2017-07-11 01:40 +0200
                Re: [PATCH v2 tip/perf/core 1/6] perf symbols: find symbols in  different mount namespace Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-07-11 15:00 +0200
                Re: [PATCH v2 tip/perf/core 1/6] perf symbols: find symbols in  different mount namespace Krister Johansen <kjlx@templeofstupid.com> - 2017-07-11 19:20 +0200

csiph-web