perf tools: Pass machine to vdso__dso_findnew()
This is preparation for removing the global variables used in vdso.c and thereby fixing the lifetime of the VDSO temporary file. Reviewed-by: Jiri Olsa <jolsa@redhat.com> Signed-off-by: Adrian Hunter <adrian.hunter@intel.com> Cc: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Namhyung Kim <namhyung@gmail.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/r/1406035081-14301-45-git-send-email-adrian.hunter@intel.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
		
					parent
					
						
							
								6d363459d7
							
						
					
				
			
			
				commit
				
					
						2a03068c5c
					
				
			
		
					 5 changed files with 14 additions and 10 deletions
				
			
		| 
						 | 
					@ -1095,7 +1095,7 @@ int machine__process_mmap2_event(struct machine *machine,
 | 
				
			||||||
	else
 | 
						else
 | 
				
			||||||
		type = MAP__FUNCTION;
 | 
							type = MAP__FUNCTION;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	map = map__new(&machine->user_dsos, event->mmap2.start,
 | 
						map = map__new(machine, event->mmap2.start,
 | 
				
			||||||
			event->mmap2.len, event->mmap2.pgoff,
 | 
								event->mmap2.len, event->mmap2.pgoff,
 | 
				
			||||||
			event->mmap2.pid, event->mmap2.maj,
 | 
								event->mmap2.pid, event->mmap2.maj,
 | 
				
			||||||
			event->mmap2.min, event->mmap2.ino,
 | 
								event->mmap2.min, event->mmap2.ino,
 | 
				
			||||||
| 
						 | 
					@ -1145,7 +1145,7 @@ int machine__process_mmap_event(struct machine *machine, union perf_event *event
 | 
				
			||||||
	else
 | 
						else
 | 
				
			||||||
		type = MAP__FUNCTION;
 | 
							type = MAP__FUNCTION;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	map = map__new(&machine->user_dsos, event->mmap.start,
 | 
						map = map__new(machine, event->mmap.start,
 | 
				
			||||||
			event->mmap.len, event->mmap.pgoff,
 | 
								event->mmap.len, event->mmap.pgoff,
 | 
				
			||||||
			event->mmap.pid, 0, 0, 0, 0, 0, 0,
 | 
								event->mmap.pid, 0, 0, 0, 0, 0, 0,
 | 
				
			||||||
			event->mmap.filename,
 | 
								event->mmap.filename,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -13,6 +13,7 @@
 | 
				
			||||||
#include "build-id.h"
 | 
					#include "build-id.h"
 | 
				
			||||||
#include "util.h"
 | 
					#include "util.h"
 | 
				
			||||||
#include "debug.h"
 | 
					#include "debug.h"
 | 
				
			||||||
 | 
					#include "machine.h"
 | 
				
			||||||
#include <linux/string.h>
 | 
					#include <linux/string.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const char *map_type__name[MAP__NR_TYPES] = {
 | 
					const char *map_type__name[MAP__NR_TYPES] = {
 | 
				
			||||||
| 
						 | 
					@ -137,7 +138,7 @@ void map__init(struct map *map, enum map_type type,
 | 
				
			||||||
	map->erange_warned = false;
 | 
						map->erange_warned = false;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct map *map__new(struct list_head *dsos__list, u64 start, u64 len,
 | 
					struct map *map__new(struct machine *machine, u64 start, u64 len,
 | 
				
			||||||
		     u64 pgoff, u32 pid, u32 d_maj, u32 d_min, u64 ino,
 | 
							     u64 pgoff, u32 pid, u32 d_maj, u32 d_min, u64 ino,
 | 
				
			||||||
		     u64 ino_gen, u32 prot, u32 flags, char *filename,
 | 
							     u64 ino_gen, u32 prot, u32 flags, char *filename,
 | 
				
			||||||
		     enum map_type type)
 | 
							     enum map_type type)
 | 
				
			||||||
| 
						 | 
					@ -173,9 +174,9 @@ struct map *map__new(struct list_head *dsos__list, u64 start, u64 len,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (vdso) {
 | 
							if (vdso) {
 | 
				
			||||||
			pgoff = 0;
 | 
								pgoff = 0;
 | 
				
			||||||
			dso = vdso__dso_findnew(dsos__list);
 | 
								dso = vdso__dso_findnew(machine);
 | 
				
			||||||
		} else
 | 
							} else
 | 
				
			||||||
			dso = __dsos__findnew(dsos__list, filename);
 | 
								dso = __dsos__findnew(&machine->user_dsos, filename);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (dso == NULL)
 | 
							if (dso == NULL)
 | 
				
			||||||
			goto out_delete;
 | 
								goto out_delete;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -119,7 +119,7 @@ typedef int (*symbol_filter_t)(struct map *map, struct symbol *sym);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void map__init(struct map *map, enum map_type type,
 | 
					void map__init(struct map *map, enum map_type type,
 | 
				
			||||||
	       u64 start, u64 end, u64 pgoff, struct dso *dso);
 | 
						       u64 start, u64 end, u64 pgoff, struct dso *dso);
 | 
				
			||||||
struct map *map__new(struct list_head *dsos__list, u64 start, u64 len,
 | 
					struct map *map__new(struct machine *machine, u64 start, u64 len,
 | 
				
			||||||
		     u64 pgoff, u32 pid, u32 d_maj, u32 d_min, u64 ino,
 | 
							     u64 pgoff, u32 pid, u32 d_maj, u32 d_min, u64 ino,
 | 
				
			||||||
		     u64 ino_gen, u32 prot, u32 flags,
 | 
							     u64 ino_gen, u32 prot, u32 flags,
 | 
				
			||||||
		     char *filename, enum map_type type);
 | 
							     char *filename, enum map_type type);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -11,6 +11,7 @@
 | 
				
			||||||
#include "vdso.h"
 | 
					#include "vdso.h"
 | 
				
			||||||
#include "util.h"
 | 
					#include "util.h"
 | 
				
			||||||
#include "symbol.h"
 | 
					#include "symbol.h"
 | 
				
			||||||
 | 
					#include "machine.h"
 | 
				
			||||||
#include "linux/string.h"
 | 
					#include "linux/string.h"
 | 
				
			||||||
#include "debug.h"
 | 
					#include "debug.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -90,9 +91,9 @@ void vdso__exit(void)
 | 
				
			||||||
		unlink(vdso_file);
 | 
							unlink(vdso_file);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct dso *vdso__dso_findnew(struct list_head *head)
 | 
					struct dso *vdso__dso_findnew(struct machine *machine)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct dso *dso = dsos__find(head, VDSO__MAP_NAME, true);
 | 
						struct dso *dso = dsos__find(&machine->user_dsos, VDSO__MAP_NAME, true);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!dso) {
 | 
						if (!dso) {
 | 
				
			||||||
		char *file;
 | 
							char *file;
 | 
				
			||||||
| 
						 | 
					@ -103,7 +104,7 @@ struct dso *vdso__dso_findnew(struct list_head *head)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		dso = dso__new(VDSO__MAP_NAME);
 | 
							dso = dso__new(VDSO__MAP_NAME);
 | 
				
			||||||
		if (dso != NULL) {
 | 
							if (dso != NULL) {
 | 
				
			||||||
			dsos__add(head, dso);
 | 
								dsos__add(&machine->user_dsos, dso);
 | 
				
			||||||
			dso__set_long_name(dso, file, false);
 | 
								dso__set_long_name(dso, file, false);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -12,7 +12,9 @@ static inline bool is_vdso_map(const char *filename)
 | 
				
			||||||
	return !strcmp(filename, VDSO__MAP_NAME);
 | 
						return !strcmp(filename, VDSO__MAP_NAME);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct dso *vdso__dso_findnew(struct list_head *head);
 | 
					struct machine;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					struct dso *vdso__dso_findnew(struct machine *machine);
 | 
				
			||||||
void vdso__exit(void);
 | 
					void vdso__exit(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif /* __PERF_VDSO__ */
 | 
					#endif /* __PERF_VDSO__ */
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue