aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephane Eranian <eranian@google.com>2013-01-24 10:10:39 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2013-04-01 11:19:02 -0400
commit2fe85427e3bf65d791700d065132772fc26e4d75 (patch)
tree8561cc61ebf26c519dec1ea0340e5af295632ebb
parent9ad64c0f481c37a63dd39842a0fd264bee44a097 (diff)
perf: Add PERF_RECORD_MISC_MMAP_DATA to RECORD_MMAP
Type of mapping was lost and made it hard for a tool to distinguish code vs. data mmaps. Perf has the ability to distinguish the two. Use a bit in the header->misc bitmask to keep track of the mmap type. If PERF_RECORD_MISC_MMAP_DATA is set then the mapping is not executable (!VM_EXEC). If not set, then the mapping is executable. Signed-off-by: Stephane Eranian <eranian@google.com> Cc: peterz@infradead.org Cc: ak@linux.intel.com Cc: acme@redhat.com Cc: jolsa@redhat.com Cc: namhyung.kim@lge.com Link: http://lkml.kernel.org/r/1359040242-8269-16-git-send-email-eranian@google.com Signed-off-by: Ingo Molnar <mingo@kernel.org> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r--include/uapi/linux/perf_event.h1
-rw-r--r--kernel/events/core.c3
2 files changed, 4 insertions, 0 deletions
diff --git a/include/uapi/linux/perf_event.h b/include/uapi/linux/perf_event.h
index 5b5762006855..964a450a6e2c 100644
--- a/include/uapi/linux/perf_event.h
+++ b/include/uapi/linux/perf_event.h
@@ -445,6 +445,7 @@ struct perf_event_mmap_page {
445#define PERF_RECORD_MISC_GUEST_KERNEL (4 << 0) 445#define PERF_RECORD_MISC_GUEST_KERNEL (4 << 0)
446#define PERF_RECORD_MISC_GUEST_USER (5 << 0) 446#define PERF_RECORD_MISC_GUEST_USER (5 << 0)
447 447
448#define PERF_RECORD_MISC_MMAP_DATA (1 << 13)
448/* 449/*
449 * Indicates that the content of PERF_SAMPLE_IP points to 450 * Indicates that the content of PERF_SAMPLE_IP points to
450 * the actual instruction that triggered the event. See also 451 * the actual instruction that triggered the event. See also
diff --git a/kernel/events/core.c b/kernel/events/core.c
index 77c96d18c23a..98c0845fcd20 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -4791,6 +4791,9 @@ got_name:
4791 mmap_event->file_name = name; 4791 mmap_event->file_name = name;
4792 mmap_event->file_size = size; 4792 mmap_event->file_size = size;
4793 4793
4794 if (!(vma->vm_flags & VM_EXEC))
4795 mmap_event->event_id.header.misc |= PERF_RECORD_MISC_MMAP_DATA;
4796
4794 mmap_event->event_id.header.size = sizeof(mmap_event->event_id) + size; 4797 mmap_event->event_id.header.size = sizeof(mmap_event->event_id) + size;
4795 4798
4796 rcu_read_lock(); 4799 rcu_read_lock();