lkml.org 
[lkml]   [2019]   [Mar]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH V4 03/23] perf/x86/intel/ds: Extract code of event update in short period
    Date
    From: Kan Liang <kan.liang@linux.intel.com>

    The drain_pebs() could be called twice in a short period for auto-reload
    event in pmu::read(). The intel_pmu_save_and_restart_reload() should be
    called to update the event->count.
    This case should also be handled on Icelake. Extract the codes for reuse
    later.

    Signed-off-by: Kan Liang <kan.liang@linux.intel.com>
    ---

    No changes since V3.

    arch/x86/events/intel/ds.c | 34 +++++++++++++++++++++-------------
    1 file changed, 21 insertions(+), 13 deletions(-)

    diff --git a/arch/x86/events/intel/ds.c b/arch/x86/events/intel/ds.c
    index c02cd19fe640..efc054aee3c1 100644
    --- a/arch/x86/events/intel/ds.c
    +++ b/arch/x86/events/intel/ds.c
    @@ -1491,6 +1491,26 @@ static void intel_pmu_drain_pebs_core(struct pt_regs *iregs)
    __intel_pmu_pebs_event(event, iregs, at, top, 0, n);
    }

    +static void intel_pmu_pebs_event_update_no_drain(struct cpu_hw_events *cpuc,
    + int size)
    +{
    + struct perf_event *event;
    + int bit;
    +
    + /*
    + * The drain_pebs() could be called twice in a short period
    + * for auto-reload event in pmu::read(). There are no
    + * overflows have happened in between.
    + * It needs to call intel_pmu_save_and_restart_reload() to
    + * update the event->count for this case.
    + */
    + for_each_set_bit(bit, (unsigned long *)&cpuc->pebs_enabled, size) {
    + event = cpuc->events[bit];
    + if (event->hw.flags & PERF_X86_EVENT_AUTO_RELOAD)
    + intel_pmu_save_and_restart_reload(event, 0);
    + }
    +}
    +
    static void intel_pmu_drain_pebs_nhm(struct pt_regs *iregs)
    {
    struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
    @@ -1518,19 +1538,7 @@ static void intel_pmu_drain_pebs_nhm(struct pt_regs *iregs)
    }

    if (unlikely(base >= top)) {
    - /*
    - * The drain_pebs() could be called twice in a short period
    - * for auto-reload event in pmu::read(). There are no
    - * overflows have happened in between.
    - * It needs to call intel_pmu_save_and_restart_reload() to
    - * update the event->count for this case.
    - */
    - for_each_set_bit(bit, (unsigned long *)&cpuc->pebs_enabled,
    - size) {
    - event = cpuc->events[bit];
    - if (event->hw.flags & PERF_X86_EVENT_AUTO_RELOAD)
    - intel_pmu_save_and_restart_reload(event, 0);
    - }
    + intel_pmu_pebs_event_update_no_drain(cpuc, size);
    return;
    }

    --
    2.17.1
    \
     
     \ /
      Last update: 2019-03-26 17:13    [W:4.395 / U:0.032 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site