Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751592AbdGZR1W (ORCPT ); Wed, 26 Jul 2017 13:27:22 -0400 Received: from terminus.zytor.com ([65.50.211.136]:37587 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750907AbdGZR1U (ORCPT ); Wed, 26 Jul 2017 13:27:20 -0400 Date: Wed, 26 Jul 2017 10:23:45 -0700 From: tip-bot for Krister Johansen Message-ID: Cc: linux-kernel@vger.kernel.org, alexander.shishkin@linux.intel.com, acme@redhat.com, kjlx@templeofstupid.com, tglx@linutronix.de, tmricht@linux.vnet.ibm.com, hpa@zytor.com, peterz@infradead.org, mingo@kernel.org, brendan.d.gregg@gmail.com Reply-To: brendan.d.gregg@gmail.com, mingo@kernel.org, peterz@infradead.org, hpa@zytor.com, tmricht@linux.vnet.ibm.com, tglx@linutronix.de, kjlx@templeofstupid.com, alexander.shishkin@linux.intel.com, acme@redhat.com, linux-kernel@vger.kernel.org In-Reply-To: <1499305693-1599-6-git-send-email-kjlx@templeofstupid.com> References: <1499305693-1599-6-git-send-email-kjlx@templeofstupid.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf top: Support lookup of symbols in other mount namespaces. Git-Commit-ID: 868a832918f621b7576655c00067f20326ef3931 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2971 Lines: 80 Commit-ID: 868a832918f621b7576655c00067f20326ef3931 Gitweb: http://git.kernel.org/tip/868a832918f621b7576655c00067f20326ef3931 Author: Krister Johansen AuthorDate: Wed, 5 Jul 2017 18:48:12 -0700 Committer: Arnaldo Carvalho de Melo CommitDate: Tue, 25 Jul 2017 22:43:16 -0300 perf top: Support lookup of symbols in other mount namespaces. 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-.map files. Signed-off-by: Krister Johansen Cc: Alexander Shishkin Cc: Brendan Gregg Cc: Peter Zijlstra Cc: Thomas-Mich Richter Link: http://lkml.kernel.org/r/1499305693-1599-6-git-send-email-kjlx@templeofstupid.com Signed-off-by: Arnaldo Carvalho de Melo --- 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 e5a8f24..ee954bd 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c @@ -587,6 +587,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. + */ + unshare(CLONE_FS); + perf_top__sort_new_samples(top); /* @@ -628,6 +635,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. + */ + unshare(CLONE_FS); + display_setup_sig(); pthread__unblock_sigwinch(); repeat: @@ -1206,6 +1220,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[] = {