(2012/01/30 18:35), Peter Zijlstra wrote:
> On Mon, 2012-01-30 at 13:43 +0900, Akihiro Nagai wrote:
>> @@ -330,6 +342,14 @@ int intel_pmu_drain_bts_buffer(void)
>> return 1;
>>
>> for (; at< top; at++) {
>> + /*
>> + * To resolve user space symbols and DSOs correctly, set
>> + * PERF_RECORD_MISC_USER if from_addr or to_addr is user space.
>> + */
>> + if (!kernel_ip(data.ip) || !kernel_ip(data.addr)) {
>> + header.misc&= ~PERF_RECORD_MISC_CPUMODE_MASK;
>> + header.misc |= PERF_RECORD_MISC_USER;
>> + }
>> data.ip = at->from;
>> data.addr = at->to;
>
> Why not key off of the from? If its a jump from userspace its a user
> event, its a jump from kernel space its a kernel event?
Of course, originally, perf does that. And, in those cases,
BTS records the both addresses of kernel and user in one
perf_sample on branches from kernel to user. Current perf
sets PERF_RECORD_MISC_KERNEL to all BTS events, and
perf-script doesn't resolve symbols and DSOs about the
user-space address, because it is a kernel event. So, to
solve both kernel and user symbols on an event, I had to
add this change.
Thank you,