lkml.org 
[lkml]   [2011]   [Aug]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    SubjectRe: [PATCH -tip v3 2/5] perf: change perf_event_header.misc to PERF_RECORD_MISC_USER for BTS
    From
    Date
    On Thu, 2011-08-11 at 21:06 +0900, Akihiro Nagai wrote:
    > Change perf_event_headder.misc to PERF_RECORD_MISC_USER for
    > BTS records, because BTS traces both kernel and user spaces
    > nevertheless perf specifies to trace only kernel or user space.

    Now I'm confused..

    If BTS traces both kernel and user, the MISC bit should reflect the
    right state per-sample, on x86 that's easy enough to do by the address.


    > ---
    >
    > arch/x86/kernel/cpu/perf_event_intel_ds.c | 8 ++++++++
    > 1 files changed, 8 insertions(+), 0 deletions(-)
    >
    > diff --git a/arch/x86/kernel/cpu/perf_event_intel_ds.c b/arch/x86/kernel/cpu/perf_event_intel_ds.c
    > index 1b1ef3a..323f3f0 100644
    > --- a/arch/x86/kernel/cpu/perf_event_intel_ds.c
    > +++ b/arch/x86/kernel/cpu/perf_event_intel_ds.c
    > @@ -340,6 +340,14 @@ static int intel_pmu_drain_bts_buffer(void)
    > */
    > perf_prepare_sample(&header, &data, event, &regs);
    >
    > + /*
    > + * Since BTS can not trace kernel and user space separately, set

    Uhm, IA32_DEBUGCTL_MSR.BTS_OFF_{OS,USR} seem to suggest it can?!

    > + * PERF_RECORD_MISC_USER in header.misc to resolve both kernel and
    > + * user DSOs and symbols.
    > + */
    > + header.misc &= ~PERF_RECORD_MISC_CPUMODE_MASK;
    > + header.misc |= PERF_RECORD_MISC_USER;


    So what's wrong with something like:

    header.misc |= is_kernel_address(at->from) ?
    PERF_RECORD_MISC_KERNEL :
    PERF_RECORD_MISC_USER;

    > if (perf_output_begin(&handle, event, header.size * (top - at)))
    > return 1;
    >
    >



    \
     
     \ /
      Last update: 2011-08-11 14:21    [W:0.024 / U:62.156 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site