1. 27 4月, 2018 26 次提交
  2. 26 4月, 2018 10 次提交
  3. 25 4月, 2018 4 次提交
    • K
      perf stat: Fix duplicate PMU name for interval print · 80ee8c58
      Kan Liang 提交于
      PMU name is printed repeatedly for interval print, for example:
      
        perf stat --no-merge -e 'unc_m_clockticks' -a -I 1000
        #           time             counts unit events
           1.001053069        243,702,144      unc_m_clockticks [uncore_imc_4]
           1.001053069        244,268,304      unc_m_clockticks [uncore_imc_2]
           1.001053069        244,427,386      unc_m_clockticks [uncore_imc_0]
           1.001053069        244,583,760      unc_m_clockticks [uncore_imc_5]
           1.001053069        244,738,971      unc_m_clockticks [uncore_imc_3]
           1.001053069        244,880,309      unc_m_clockticks [uncore_imc_1]
           2.002024821        240,818,200      unc_m_clockticks [uncore_imc_4] [uncore_imc_4]
           2.002024821        240,767,812      unc_m_clockticks [uncore_imc_2] [uncore_imc_2]
           2.002024821        240,764,215      unc_m_clockticks [uncore_imc_0] [uncore_imc_0]
           2.002024821        240,759,504      unc_m_clockticks [uncore_imc_5] [uncore_imc_5]
           2.002024821        240,755,992      unc_m_clockticks [uncore_imc_3] [uncore_imc_3]
           2.002024821        240,750,403      unc_m_clockticks [uncore_imc_1] [uncore_imc_1]
      
      For each print, the PMU name is unconditionally appended to the
      counter->name.
      
      Need to check the counter->name first. If the PMU name is already
      appended, do nothing.
      
      Committer notes:
      
      Add and use perf_evsel->uniquified_name bool instead of doing the more
      expensive strstr(event->name, pmu->name).
      Signed-off-by: NKan Liang <kan.liang@linux.intel.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Agustin Vega-Frias <agustinv@codeaurora.org>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Ganapatrao Kulkarni <ganapatrao.kulkarni@cavium.com>
      Cc: Jin Yao <yao.jin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Shaokun Zhang <zhangshaokun@hisilicon.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Fixes: 8c5421c0 ("perf pmu: Display pmu name when printing unmerged events in stat")
      Link: http://lkml.kernel.org/r/1524594014-79243-5-git-send-email-kan.liang@linux.intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      80ee8c58
    • K
      perf evsel: Only fall back group read for leader · 121f325f
      Kan Liang 提交于
      Perf doesn't support mixed events from different PMUs (except software
      event) in a group. The perf stat should output <not counted>/<not
      supported> for all events, but it doesn't. For example,
      
        perf stat -e '{cycles,uncore_imc_5/umask=0xF,event=0x4/,instructions}'
             <not counted>      cycles
             <not supported>    uncore_imc_5/umask=0xF,event=0x4/
                 1,024,300      instructions
      
      If perf fails to open an event, it doesn't error out directly. It will
      disable some features and retry, until the event is opened or all
      features are disabled. The disabled features will not be re-enabled. The
      group read is one of these features.
      
      For the example as above, the IMC event and the leader event "cycles"
      are from different PMUs. Opening the IMC event must fail. The group read
      feature must be disabled for IMC event and the followed event
      "instructions". The "instructions" event has the same PMU as the leader
      "cycles". It can be opened successfully. Since the group read feature
      has been disabled, the "instructions" event will be read as a single
      event, which definitely has a value.
      
      The group read fallback is still useful for the case which kernel
      doesn't support group read. It is good enough to be handled only by the
      leader.
      
      For the fallback request from members, it must be caused by an error.
      The fallback only breaks the semantics of group.  Limit the group read
      fallback only for the leader.
      
      Committer testing:
      
      On a broadwell t450s notebook:
      
      Before:
      
        # perf stat -e '{cycles,unc_cbo_cache_lookup.read_i,instructions}' sleep 1
      
        Performance counter stats for 'sleep 1':
      
           <not counted>      cycles
         <not supported>      unc_cbo_cache_lookup.read_i
                 818,206      instructions
      
             1.003170887 seconds time elapsed
      
        Some events weren't counted. Try disabling the NMI watchdog:
      	echo 0 > /proc/sys/kernel/nmi_watchdog
      	perf stat ...
      	echo 1 > /proc/sys/kernel/nmi_watchdog
      
      After:
      
        # perf stat -e '{cycles,unc_cbo_cache_lookup.read_i,instructions}' sleep 1
      
        Performance counter stats for 'sleep 1':
      
           <not counted>      cycles
         <not supported>      unc_cbo_cache_lookup.read_i
           <not counted>      instructions
      
             1.001380511 seconds time elapsed
      
        Some events weren't counted. Try disabling the NMI watchdog:
      	echo 0 > /proc/sys/kernel/nmi_watchdog
      	perf stat ...
      	echo 1 > /proc/sys/kernel/nmi_watchdog
        #
      Reported-by: NAndi Kleen <ak@linux.intel.com>
      Signed-off-by: NKan Liang <kan.liang@linux.intel.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Agustin Vega-Frias <agustinv@codeaurora.org>
      Cc: Ganapatrao Kulkarni <ganapatrao.kulkarni@cavium.com>
      Cc: Jin Yao <yao.jin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Shaokun Zhang <zhangshaokun@hisilicon.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Fixes:  82bf311e ("perf stat: Use group read for event groups")
      Link: http://lkml.kernel.org/r/1524594014-79243-3-git-send-email-kan.liang@linux.intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      121f325f
    • K
      perf stat: Print out hint for mixed PMU group error · 30060eae
      Kan Liang 提交于
      Perf doesn't support mixed events from different PMUs (except software
      event) in a group. For this case, only "<not counted>" or "<not
      supported>" are printed out. There is no hint which guides users to fix
      the issue.
      
      Checking the PMU type of events to determine if they are from the same
      PMU. There may be false alarm for the checking. E.g. the core PMU has
      different PMU type. But it should not happen often.
      
      The false alarm can also be tolerated, because:
      
      - It only happens on error path.
      - It just provides a possible solution for the issue.
      Signed-off-by: NKan Liang <kan.liang@linux.intel.com>
      Cc: Agustin Vega-Frias <agustinv@codeaurora.org>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Ganapatrao Kulkarni <ganapatrao.kulkarni@cavium.com>
      Cc: Jin Yao <yao.jin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Shaokun Zhang <zhangshaokun@hisilicon.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Link: http://lkml.kernel.org/r/1524594014-79243-2-git-send-email-kan.liang@linux.intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      30060eae
    • K
      perf pmu: Fix core PMU alias list for X86 platform · 292c34c1
      Kan Liang 提交于
      When counting uncore event with alias, core event is mistakenly
      involved, for example:
      
        perf stat --no-merge -e "unc_m_cas_count.all" -C0  sleep 1
      
        Performance counter stats for 'CPU(s) 0':
      
                       0      unc_m_cas_count.all [uncore_imc_4]
                       0      unc_m_cas_count.all [uncore_imc_2]
                       0      unc_m_cas_count.all [uncore_imc_0]
                 153,640      unc_m_cas_count.all [cpu]
                       0      unc_m_cas_count.all [uncore_imc_5]
                  25,026      unc_m_cas_count.all [uncore_imc_3]
                       0      unc_m_cas_count.all [uncore_imc_1]
      
             1.001447890 seconds time elapsed
      
      The reason is that current implementation doesn't check PMU name of a
      event when adding its alias into the alias list for core PMU. The
      uncore event aliases are mistakenly added.
      
      This bug was introduced in:
        commit 14b22ae0 ("perf pmu: Add helper function is_pmu_core to
        detect PMU CORE devices")
      
      Checking the PMU name for all PMUs on X86 and other architectures except
      ARM.
      There is no behavior change for ARM.
      Signed-off-by: NKan Liang <kan.liang@linux.intel.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Agustin Vega-Frias <agustinv@codeaurora.org>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Ganapatrao Kulkarni <ganapatrao.kulkarni@cavium.com>
      Cc: Jin Yao <yao.jin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Shaokun Zhang <zhangshaokun@hisilicon.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Fixes: 14b22ae0 ("perf pmu: Add helper function is_pmu_core to detect PMU CORE devices")
      Link: http://lkml.kernel.org/r/1524594014-79243-1-git-send-email-kan.liang@linux.intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      292c34c1