perf symbols: Find symbols in different mount namespace
Teach perf how to resolve symbols from binaries that are in a different mount namespace from the tool. This allows perf to generate meaningful stack traces even if the binary resides in a different mount namespace from the tool. Signed-off-by: Krister Johansen <kjlx@templeofstupid.com> Tested-by: Brendan Gregg <brendan.d.gregg@gmail.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas-Mich Richter <tmricht@linux.vnet.ibm.com> Link: http://lkml.kernel.org/r/1499305693-1599-2-git-send-email-kjlx@templeofstupid.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:

committed by
Arnaldo Carvalho de Melo

parent
86bcdb5a43
commit
843ff37bb5
@@ -18,6 +18,8 @@
|
||||
#include "symbol.h"
|
||||
#include "strlist.h"
|
||||
#include "intlist.h"
|
||||
#include "namespaces.h"
|
||||
#include "vdso.h"
|
||||
#include "header.h"
|
||||
#include "path.h"
|
||||
#include "sane_ctype.h"
|
||||
@@ -1436,9 +1438,17 @@ int dso__load(struct dso *dso, struct map *map)
|
||||
struct symsrc *syms_ss = NULL, *runtime_ss = NULL;
|
||||
bool kmod;
|
||||
unsigned char build_id[BUILD_ID_SIZE];
|
||||
struct nscookie nsc;
|
||||
|
||||
nsinfo__mountns_enter(dso->nsinfo, &nsc);
|
||||
pthread_mutex_lock(&dso->lock);
|
||||
|
||||
/* The vdso files always live in the host container, so don't go looking
|
||||
* for them in the container's mount namespace.
|
||||
*/
|
||||
if (dso__is_vdso(dso))
|
||||
nsinfo__mountns_exit(&nsc);
|
||||
|
||||
/* check again under the dso->lock */
|
||||
if (dso__loaded(dso, map->type)) {
|
||||
ret = 1;
|
||||
@@ -1584,6 +1594,7 @@ out_free:
|
||||
out:
|
||||
dso__set_loaded(dso, map->type);
|
||||
pthread_mutex_unlock(&dso->lock);
|
||||
nsinfo__mountns_exit(&nsc);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
Reference in New Issue
Block a user