Skip to contentSkip to conversation

perf fails to mmap data file (JFFS2)

PATCH New Kenth Eriksson 2 participants 3 messages Sep 3, 2015 – Sep 4, 2015 perf events

lore
Share & tools
lore
#0 lore raw

perf on 4.1 fails to mmap the perf data file (in __perf_session__process_events) with error code 22 (invalid argument). I believe the JFFS2 file system does not support PROT_READ and MAP_SHARED. How can this be fixed? Can we change from MAP_SHARED to MAP_PRIVATE, or is there a reason to make it shared?

Thanks,
Kenth

#1 lore raw
Quoted 5 lines · Kenth Eriksson

perf on 4.1 fails to mmap the perf data file (in __perf_session__process_events) with error code 22 (invalid argument). I believe the JFFS2 file system does not support PROT_READ and MAP_SHARED. How can this be fixed? Can we change from MAP_SHARED to MAP_PRIVATE, or is there a reason to make it shared?

MAP_PRIVATE should be fine.

-Andi

#2 lore raw

PATCH 1/1 Fix mmap error for perf data file. Not all file systems, e.g. JFFS2, support MAP_SHARED.

---
 tools/perf/util/session.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
tools/perf/util/session.c +1 -2
index 0c74012..c6617fe 100644
@@ -1338,11 +1338,10 @@ static int __perf_session__process_events(struct perf_session *session,
 	memset(mmaps, 0, sizeof(mmaps));
 
 	mmap_prot  = PROT_READ;
-	mmap_flags = MAP_SHARED;
+	mmap_flags = MAP_PRIVATE;
 
 	if (session->header.needs_swap) {
 		mmap_prot  |= PROT_WRITE;
-		mmap_flags = MAP_PRIVATE;
 	}
 remap:
 	buf = mmap(NULL, mmap_size, mmap_prot, mmap_flags, fd,
Signature · 1 line
2.3.6