1. 13 9月, 2017 38 次提交
    • A
      perf vendor events: Add JSON metrics for Skylake · 2e006a24
      Andi Kleen 提交于
      Add JSON metrics for Skylake.
      
      Committer testing:
      
        # grep "model name" /proc/cpuinfo | head -1
        model name	: Intel(R) Core(TM) i5-7500 CPU @ 3.40GHz
        # uname -a
        Linux seventh 4.12.0-rc6+ #1 SMP Fri Jun 30 16:40:55 -03 2017 x86_64 x86_64 x86_64 GNU/Linux
        # perf stat --metric-only -M Summary -a sleep 1
      
         Performance counter stats for 'system wide':
      
        Instructions         CPI                  CLKS                 CPU_Utilization      GFLOPs               SMT_2T_Utilization   Kernel_Utilization
        34021097.0               0.0            119424171.0              0.0                 0.0                 0.0                 0.0
      
               1.001001793 seconds time elapsed
      
        # perf list metricgroup
      
        List of pre-defined events (to be used in -e):
      
        Metric Groups:
      
        DSB
        FLOPS
        Frontend
        Frontend_Bandwidth
        Memory_BW
        Memory_Bound
        Memory_Lat
        Pipeline
        Ports_Utilization
        Power
        SMT
        Summary
        TLB
        TopDownL1
        Unknown_Branches
        # perf stat --metric-only -M Ports_Utilization -a sleep 1
      
         Performance counter stats for 'system wide':
      
        ILP
        1475828.0
      
             1.000688547 seconds time elapsed
      
        # perf stat -v --metric-only -M Ports_Utilization -a sleep 1
        Using CPUID GenuineIntel-6-9E
        metric expr uops_executed.thread / ( uops_executed.core_cycles_ge_1 / 2) if #smt_on else uops_executed.core_cycles_ge_1 for ILP
        found event uops_executed.thread
        found event uops_executed.core_cycles_ge_1
        adding {uops_executed.thread,uops_executed.core_cycles_ge_1}:W
        uops_executed.thread -> cpu/umask=0x1,period=2000003,event=0xb1/
        uops_executed.core_cycles_ge_1 -> cpu/umask=0x2,period=2000003,cmask=1,event=0xb1/
        uops_executed.thread: 8115271 4002547654 4002547654
        uops_executed.core_cycles_ge_1: 3282969 4002547654 4002547654
      
         Performance counter stats for 'system wide':
      
        ILP
        3282969.0
      
               1.000719870 seconds time elapsed
      
        #
      Signed-off-by: NAndi Kleen <ak@linux.intel.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Link: http://lkml.kernel.org/r/20170905195235.GW2482@two.firstfloor.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      2e006a24
    • A
      perf vendor events: Add JSON metrics for Broadwell · cf979623
      Andi Kleen 提交于
      Add JSON metrics for Broadwell.
      
      Commiter testing:
      
        # uname -a
        Linux jouet 4.13.0-rc7+ #3 SMP Sat Sep 2 09:04:44 -03 2017 x86_64 x86_64 x86_64 GNU/Linux
        # grep "model name" /proc/cpuinfo  | head -1
        model name	: Intel(R) Core(TM) i7-5600U CPU @ 2.60GHz
        # perf list metricgroup
      
        List of pre-defined events (to be used in -e):
      
        Metric Groups:
      
        DSB
        FLOPS
        Frontend
        Frontend_Bandwidth
        Memory_BW
        Memory_Bound
        Memory_Lat
        Pipeline
        Ports_Utilization
        Power
        SMT
        Summary
        TLB
        TopDownL1
        Unknown_Branches
        # perf stat -M Power --metric-only -a sleep 1
      
         Performance counter stats for 'system wide':
      
        Turbo_Utilization  C3_Core_Residency  C6_Core_Residency  C7_Core_Residency  C2_Pkg_Residency  C3_Pkg_Residency  C6_Pkg_Residency  C7_Pkg_Residency
             1.1               0.0                 0.0               0.0                0.0               0.0               0.0               0.0
      
               1.003502904 seconds time elapsed
      
        #
        # perf stat -M Memory_BW --metric-only -a sleep 1
      
         Performance counter stats for 'system wide':
      
        MLP
             1.7
      
               1.001364525 seconds time elapsed
      
        #
        # perf stat -M TLB --metric-only -a sleep 1
      
         Performance counter stats for 'system wide':
      
        Page_Walks_Utilization
             0.1
      
               1.005962198 seconds time elapsed
      
        #
        # perf stat -M Summary --metric-only -a sleep 1
      
         Performance counter stats for 'system wide':
      
        Instructions   CPI          CLKS          CPU_Utilization   GFLOPs  SMT_2T_Utilization  Kernel_Utilization
        7281856697.0       0.0    11150898087.0     1.0              0.0    1.0                 0.7
      
               1.012134025 seconds time elapsed
      
        #
      
      Running in verbose mode shows which counters and expressions are being
      used:
      
        # perf stat -v -M Summary --metric-only -a sleep 1
        Using CPUID GenuineIntel-6-3D
        metric expr 1 / inst_retired.any / cycles for CPI
        found event inst_retired.any
        found event cycles
        metric expr cpu_clk_unhalted.thread for CLKS
        found event cpu_clk_unhalted.thread
        metric expr inst_retired.any for Instructions
        found event inst_retired.any
        metric expr cpu_clk_unhalted.ref_tsc / msr@tsc@ for CPU_Utilization
        found event cpu_clk_unhalted.ref_tsc
        found event msr/tsc/
        metric expr ( 1*( fp_arith_inst_retired.scalar_single + fp_arith_inst_retired.scalar_double ) + 2* fp_arith_inst_retired.128b_packed_double + 4*( fp_arith_inst_retired.128b_packed_single + fp_arith_inst_retired.256b_packed_double ) + 8* fp_arith_inst_retired.256b_packed_single ) / 1000000000 / duration_time for GFLOPs
        found event fp_arith_inst_retired.scalar_single
        found event fp_arith_inst_retired.scalar_double
        found event fp_arith_inst_retired.128b_packed_double
        found event fp_arith_inst_retired.128b_packed_single
        found event fp_arith_inst_retired.256b_packed_double
        found event fp_arith_inst_retired.256b_packed_single
        found event duration_time
        metric expr 1 - cpu_clk_thread_unhalted.one_thread_active / ( cpu_clk_thread_unhalted.ref_xclk_any / 2 ) if #smt_on else 0 for SMT_2T_Utilization
        found event cpu_clk_thread_unhalted.one_thread_active
        found event cpu_clk_thread_unhalted.ref_xclk_any
        metric expr cpu_clk_unhalted.ref_tsc:u / cpu_clk_unhalted.ref_tsc for Kernel_Utilization
        found event cpu_clk_unhalted.ref_tsc:u
        found event cpu_clk_unhalted.ref_tsc
        adding {inst_retired.any,cycles}:W,{cpu_clk_unhalted.thread}:W,{inst_retired.any}:W,{cpu_clk_unhalted.ref_tsc,msr/tsc/}:W,{fp_arith_inst_retired.scalar_single,fp_arith_inst_retired.scalar_double,fp_arith_inst_retired.128b_packed_double,fp_arith_inst_retired.128b_packed_single,fp_arith_inst_retired.256b_packed_double,fp_arith_inst_retired.256b_packed_single,duration_time}:W,{cpu_clk_thread_unhalted.one_thread_active,cpu_clk_thread_unhalted.ref_xclk_any}:W,{cpu_clk_unhalted.ref_tsc:u,cpu_clk_unhalted.ref_tsc}:W
        inst_retired.any -> cpu/event=0xc0/
        cpu_clk_unhalted.thread -> cpu/event=0x3c/
        inst_retired.any -> cpu/event=0xc0/
        cpu_clk_unhalted.ref_tsc -> cpu/umask=0x3,period=2000003,event=0/
        fp_arith_inst_retired.scalar_single -> cpu/umask=0x2,period=2000003,event=0xc7/
        fp_arith_inst_retired.scalar_double -> cpu/umask=0x1,period=2000003,event=0xc7/
        fp_arith_inst_retired.128b_packed_double -> cpu/umask=0x4,period=2000003,event=0xc7/
        fp_arith_inst_retired.128b_packed_single -> cpu/umask=0x8,period=2000003,event=0xc7/
        fp_arith_inst_retired.256b_packed_double -> cpu/umask=0x10,period=2000003,event=0xc7/
        fp_arith_inst_retired.256b_packed_single -> cpu/umask=0x20,period=2000003,event=0xc7/
        cpu_clk_thread_unhalted.one_thread_active -> cpu/umask=0x2,period=2000003,event=0x3c/
        cpu_clk_thread_unhalted.ref_xclk_any -> cpu/umask=0x1,any=1,period=2000003,event=0x3c/
        cpu_clk_unhalted.ref_tsc -> cpu/umask=0x3,period=2000003,event=0/
        cpu_clk_unhalted.ref_tsc -> cpu/umask=0x3,period=2000003,event=0/
        Weak group for fp_arith_inst_retired.scalar_single/7 failed
        Weak group for cpu_clk_unhalted.ref_tsc:u/2 failed
        inst_retired.any: 8704146437 4026374016 619883741
        cycles: 11180800018 4026374016 619883741
        cpu_clk_unhalted.thread: 11140030295 4026323772 931621933
        inst_retired.any: 8643115117 4026260510 1243595906
        cpu_clk_unhalted.ref_tsc: 10201638510 4026184297 1247351077
        msr/tsc/: 10378022785 4026184297 1247351077
        fp_arith_inst_retired.scalar_single: 134697 4026102728 1559210545
        fp_arith_inst_retired.scalar_double: 274339 4026007348 1870014984
        fp_arith_inst_retired.128b_packed_double: 1639 4025886054 1866736918
        fp_arith_inst_retired.128b_packed_single: 0 4025776614 2175106569
        fp_arith_inst_retired.256b_packed_double: 0 4025681734 1235551129
        fp_arith_inst_retired.256b_packed_single: 0 4025582962 1232398454
        duration_time: 0 4025552913 4025552913
        cpu_clk_thread_unhalted.one_thread_active: 10505 4025474649 923893076
        cpu_clk_thread_unhalted.ref_xclk_any: 394992110 4025474649 923893076
        cpu_clk_unhalted.ref_tsc:u: 5341421014 4025360315 1231634198
        cpu_clk_unhalted.ref_tsc: 10258278508 4025252611 307909362
      
         Performance counter stats for 'system wide':
      
        Instructions         CPI                  CLKS                 CPU_Utilization      GFLOPs               SMT_2T_Utilization   Kernel_Utilization
        8704146437.0             0.0            11140030295.0            1.0                 0.0                 1.0                 0.5
      
               1.006783654 seconds time elapsed
      
        #
      Signed-off-by: NAndi Kleen <ak@linux.intel.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Link: http://lkml.kernel.org/r/20170905195235.GW2482@two.firstfloor.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      cf979623
    • A
      perf stat: Fall weak group back even for EBADF · 35c1980e
      Andi Kleen 提交于
      It's not possible to run a package event and a per cpu event in the same
      group. This is used by some of the power metrics.  They work correctly
      when not using a group.
      
      Normally weak groups should handle that, but in this case EBADF is
      returned instead of the normal EINVAL.
      
        $ strace -e perf_event_open ./perf stat -v -e '{cstate_pkg/c2-residency/,msr/tsc/}:W' -a sleep 1
        Using CPUID GenuineIntel-6-3E
        perf_event_open({type=0x17 /* PERF_TYPE_??? */, size=PERF_ATTR_SIZE_VER5, config=0, ...}, -1, 0, -1, PERF_FLAG_FD_CLOEXEC) = -1 EINVAL (Invalid argument)
        perf_event_open({type=0x17 /* PERF_TYPE_??? */, size=PERF_ATTR_SIZE_VER5, config=0, ...}, -1, 0, -1, 0) = -1 EINVAL (Invalid argument)
        perf_event_open({type=0x17 /* PERF_TYPE_??? */, size=PERF_ATTR_SIZE_VER5, config=0, ...}, -1, 0, -1, 0) = -1 EINVAL (Invalid argument)
        perf_event_open({type=0x17 /* PERF_TYPE_??? */, size=PERF_ATTR_SIZE_VER5, config=0, ...}, -1, 0, -1, 0) = -1 EINVAL (Invalid argument)
        perf_event_open({type=0x17 /* PERF_TYPE_??? */, size=PERF_ATTR_SIZE_VER5, config=0, ...}, -1, 0, -1, 0) = 3
        perf_event_open({type=0x7 /* PERF_TYPE_??? */, size=PERF_ATTR_SIZE_VER5, config=0, ...}, -1, 0, 3, 0) = 4
        perf_event_open({type=0x7 /* PERF_TYPE_??? */, size=PERF_ATTR_SIZE_VER5, config=0, ...}, -1, 1, 0, 0) = -1 EBADF (Bad file descriptor)
      
      and perf errors out.
      
      Make weak groups trigger a fall back for EBADF too. Then this case works correctly:
      
        $ perf stat -v -e '{cstate_pkg/c2-residency/,msr/tsc/}:W' -a sleep 1
        Using CPUID GenuineIntel-6-3E
        Weak group for cstate_pkg/c2-residency//2 failed
        cstate_pkg/c2-residency/: 476709882 1000598460 1000598460
        msr/tsc/: 39625837911 12007369110 12007369110
      
         Performance counter stats for 'system wide':
      
               476,709,882      cstate_pkg/c2-residency/
            39,625,837,911      msr/tsc/
      
               1.000697588 seconds time elapsed
      
        This fixes perf stat -M Power ...
      
        $ perf stat -M Power --metric-only -a sleep 1
      
         Performance counter stats for 'system wide':
      
        Turbo_Utilization  C3_Core_Residency  C6_Core_Residency C7_Core_Residency  C2_Pkg_Residency   C3_Pkg_Residency  C6_Pkg_Residency  C7_Pkg_Residency
             1.0                 0.7                30.0               0.0               0.9                 0.1               0.4                 0.0
      
               1.001240740 seconds time elapsed
      Signed-off-by: NAndi Kleen <ak@linux.intel.com>
      Acked-by: NJiri Olsa <jolsa@kernel.org>
      Link: http://lkml.kernel.org/r/20170905211324.32427-1-andi@firstfloor.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      35c1980e
    • A
      perf tools: Make copyfile_offset() static · c23c2a0f
      Arnaldo Carvalho de Melo 提交于
      There are no usage outside util.c and this is the only remaining reason
      for fcntl.h to be included in util.h, to get the loff_t definition in
      Alpine Linux, so make it static.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/n/tip-2dzlsao7k6ihozs5karw6kpx@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      c23c2a0f
    • T
      perf config: Allow creating empty config set for config file autogeneration · 55421b4f
      Taeung Song 提交于
      When there isn't a config file (e.g. ~/.perfconfig) or it has nothing,
      the config set wasn't created.
      
      If the config set does not exist, a config file can't be autogenerated.
      
      So allow creating a empty config set in the above case,
      then we can support the config file autogeneration.
      
      Before:
      
        $ rm -f ~/.perfconfig
        $ perf config --user report.children=false
      
        $ cat ~/.perfconfig
        cat: /root/.perfconfig: No such file or directory
      
      But I think it should work even if there isn't a config file.
      
      After:
      
        $ rm -f ~/.perfconfig
        $ perf config --user report.children=false
      
        $ cat ~/.perfconfig
        # this file is auto-generated.
        [report]
            children = false
      
      NOTE:
      
      As a result, if perf_config_set__init() fails, it looks as if the config
      set isn't freed. But it isn't a problem.  Because the config set will be
      freed by perf_config_set__delete() at the end of cmd_config().
      Signed-off-by: NTaeung Song <treeze.taeung@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: http://lkml.kernel.org/r/1504754336-9824-1-git-send-email-treeze.taeung@gmail.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      55421b4f
    • T
      perf config: Write a config file just once · 5c261555
      Taeung Song 提交于
      Currently set_config() can be repeatedly called for each input config on
      the below case:
      
        $ perf config kmem.default=slab report.children=false ...
      
      But it's a waste, so only once write a config file gathering all given
      config key=value pairs.
      Signed-off-by: NTaeung Song <treeze.taeung@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: http://lkml.kernel.org/r/1504754331-9776-1-git-send-email-treeze.taeung@gmail.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      5c261555
    • K
      perf tools: Use scandir() to replace readdir() · ecdad24d
      Kan Liang 提交于
      In perf_event__synthesize_threads() perf goes through all proc files
      serially by readdir.
      
      scandir() does a snapshoot of /proc, which is multithreading friendly.
      
      It's possible that some threads which are added during event synthesize.
      But the number of lost threads should be small.  They should not impact
      the final analysis.
      Signed-off-by: NKan Liang <kan.liang@intel.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Lukasz Odzioba <lukasz.odzioba@intel.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/1504806954-150842-3-git-send-email-kan.liang@intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      ecdad24d
    • J
      perf ui progress: Add size info into progress bar · 8233822f
      Jiri Olsa 提交于
      Adding the size values '[current/total]' into progress bar, to show more
      detailed progress of data reading.
      
      Adding new ui_progress__init_size function to specify we want to display
      the size.
      Signed-off-by: NJiri Olsa <jolsa@kernel.org>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/r/20170908120510.22515-5-jolsa@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      8233822f
    • J
      perf ui progress: Add ui specific init function · 25cc4eb4
      Jiri Olsa 提交于
      Adding ui specific init function allowing to setup the progress bar
      width based on current screen scales.
      
      Adding TUI init function to get more grained update of the progress bar.
      Signed-off-by: NJiri Olsa <jolsa@kernel.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/r/20170908120510.22515-4-jolsa@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      25cc4eb4
    • J
      perf tools: Add python-clean target · 80f87355
      Jiri Olsa 提交于
      To be able to cleanup only python related binaries.
      Signed-off-by: NJiri Olsa <jolsa@kernel.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/r/20170908084621.31595-3-jolsa@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      80f87355
    • A
      perf script: Support user regs · b1491ace
      Andi Kleen 提交于
      Teach perf script to print user regs.
      
        % perf record --user-regs=ip,sp ...
        % perf script -F ip,sym,uregs
        ...
         ffffffff9e060c24 native_write_msr ABI:2    SP:0x7ffd0ea06c38    IP:0x7fe77f55b637
         ffffffff9e060c24 native_write_msr ABI:2    SP:0x7ffd0ea06c38    IP:0x7fe77f55b637
         ffffffff9e060c24 native_write_msr ABI:2    SP:0x7ffd0ea06c38    IP:0x7fe77f55b637
         ffffffff9e060c24 native_write_msr ABI:2    SP:0x7ffd0ea06c38    IP:0x7fe77f55b637
         ffffffff9e00cc12 intel_pmu_handle_irq ABI:2    SP:0x7ffd0ea06c38    IP:0x7fe77f55b637
      
      v2: Rebased on top of phys-addr patches
      Signed-off-by: NAndi Kleen <ak@linux.intel.com>
      Link: http://lkml.kernel.org/r/20170905184057.26135-1-andi@firstfloor.org
      [ Use PRIu64 for regs->abi in print_sample_uregs() ]
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      b1491ace
    • A
      perf record: Support direct --user-regs arguments · 84c41742
      Andi Kleen 提交于
      USER_REGS can currently only collected implicitely with call graph
      recording. Sometimes it is useful to see them separately, and filter
      them. Add a new --user-regs option to record that is similar to
      --intr-regs, but acts on user regs.
      Signed-off-by: NAndi Kleen <ak@linux.intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Link: http://lkml.kernel.org/r/20170905170029.19722-1-andi@firstfloor.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      84c41742
    • A
      perf stat: Update walltime_nsecs_stats in interval mode · b90f1333
      Andi Kleen 提交于
      Some metrics (like GFLOPs) need walltime_nsecs_stats for each interval.
      Compute it for each interval instead of only at the end.
      
      Pointed out by Jiri.
      Signed-off-by: NAndi Kleen <ak@linux.intel.com>
      Acked-by: NJiri Olsa <jolsa@kernel.org>
      Link: http://lkml.kernel.org/r/20170831194036.30146-12-andi@firstfloor.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      b90f1333
    • A
      perf stat: Hide internal duration_time counter · e864c5ca
      Andi Kleen 提交于
      Some perf stat metrics use an internal "duration_time" metric. It is not
      correctly printed however. So hide it during output to avoid confusing
      users with 0 counts.
      Signed-off-by: NAndi Kleen <ak@linux.intel.com>
      Acked-by: NJiri Olsa <jolsa@kernel.org>
      Link: http://lkml.kernel.org/r/20170831194036.30146-11-andi@firstfloor.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      e864c5ca
    • A
      perf stat: Support duration_time for metrics · fd48aad9
      Andi Kleen 提交于
      Some of the metrics formulas (like GFLOPs) need to know how long the
      measurement period is. Support an internal event called duration_time,
      which reports time in second. It maps to the dummy event, but is special
      cased for statistics to report the walltime duration.
      
      So far it is not printed, but only used internally for metrics.
      Signed-off-by: NAndi Kleen <ak@linux.intel.com>
      Acked-by: NJiri Olsa <jolsa@kernel.org>
      Link: http://lkml.kernel.org/r/20170831194036.30146-10-andi@firstfloor.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      fd48aad9
    • A
      perf stat: Don't use ctx for saved values lookup · 4e1a0963
      Andi Kleen 提交于
      We don't need to use ctx to look up events for saved values.  The
      context is already part of the evsel pointer, which is the primary key.
      Signed-off-by: NAndi Kleen <ak@linux.intel.com>
      Acked-by: NJiri Olsa <jolsa@kernel.org>
      Link: http://lkml.kernel.org/r/20170831194036.30146-9-andi@firstfloor.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      4e1a0963
    • A
      perf list: Add metric groups to perf list · 71b0acce
      Andi Kleen 提交于
      Add code to perf list to print metric groups, and metrics
      that don't have an event name. The metricgroup code collects
      the eventgroups and events into a rblist, and then prints
      them according to the configured filters.
      
      The metricgroups are printed by default, but can be
      limited by perf list metric or perf list metricgroup
      
        % perf list metricgroup
        ..
        Metric Groups:
      
        DSB:
          DSB_Coverage
                [Fraction of Uops delivered by the DSB (aka Decoded Icache; or Uop Cache)]
        FLOPS:
          GFLOPs
                [Giga Floating Point Operations Per Second]
        Frontend:
          IFetch_Line_Utilization
                [Rough Estimation of fraction of fetched lines bytes that were likely consumed by program instructions]
        Frontend_Bandwidth:
          DSB_Coverage
                [Fraction of Uops delivered by the DSB (aka Decoded Icache; or Uop Cache)]
        Memory_BW:
          MLP
                [Memory-Level-Parallelism (average number of L1 miss demand load when there is at least 1 such miss)]
      
      v2: Check return value of asprintf to fix warning on FC26
      Fix key in lookup/addition for the groups list
      Signed-off-by: NAndi Kleen <ak@linux.intel.com>
      Acked-by: NJiri Olsa <jolsa@kernel.org>
      Link: http://lkml.kernel.org/r/20170831194036.30146-8-andi@firstfloor.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      71b0acce
    • A
      perf stat: Support JSON metrics in perf stat · b18f3e36
      Andi Kleen 提交于
      Add generic support for standalone metrics specified in JSON files to
      perf stat. A metric is a formula that uses multiple events to compute a
      higher level result (e.g. IPC).
      
      Previously metrics were always tied to an event and automatically
      enabled with that event. But now change it that we can have standalone
      metrics. They are in the same JSON data structure as events, but don't
      have an event name.
      
      We also allow to organize the metrics in metric groups, which allows a
      short cut to select several related metrics at once.
      
      Add a new -M / --metrics option to perf stat that adds the metrics or
      metric groups specified.
      
      Add the core code to manage and parse the metric groups. They are
      collected from the JSON data structures into a separate rblist.  When
      computing shadow values look for metrics in that list.  Then they are
      computed using the existing saved values infrastructure in stat-shadow.c
      
      The actual JSON metrics are in a separate pull request.
      
        % perf stat -M Summary --metric-only -a sleep 1
      
         Performance counter stats for 'system wide':
      
        Instructions   CLKS          CPU_Utilization  GFLOPs   SMT_2T_Utilization   Kernel_Utilization
        317614222.0    1392930775.0  0.0              0.0      0.2                  0.1
      
             1.001497549 seconds time elapsed
      
        % perf stat -M GFLOPs flops
      
         Performance counter stats for 'flops':
      
           3,999,541,471  fp_comp_ops_exe.sse_scalar_single #  1.2 GFLOPs   (66.65%)
                      14  fp_comp_ops_exe.sse_scalar_double                 (66.65%)
                       0  fp_comp_ops_exe.sse_packed_double                 (66.67%)
                       0  fp_comp_ops_exe.sse_packed_single                 (66.70%)
                       0  simd_fp_256.packed_double                         (66.70%)
                       0  simd_fp_256.packed_single                         (66.67%)
                       0  duration_time
      
             3.238372845 seconds time elapsed
      
      v2: Add missing header file
      v3: Move find_map to pmu.c
      Signed-off-by: NAndi Kleen <ak@linux.intel.com>
      Acked-by: NJiri Olsa <jolsa@kernel.org>
      Link: http://lkml.kernel.org/r/20170831194036.30146-7-andi@firstfloor.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      b18f3e36
    • A
      perf pmu: Extract function to get JSON alias map · d77ade9f
      Andi Kleen 提交于
      Extract the code to get the per cpu JSON alias into a separate function
      for reuse. No behavior changes.
      Signed-off-by: NAndi Kleen <ak@linux.intel.com>
      Acked-by: NJiri Olsa <jolsa@kernel.org>
      Link: http://lkml.kernel.org/r/20170831194036.30146-6-andi@firstfloor.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      d77ade9f
    • A
      perf stat: Print generic metric header even for failed expressions · 4ed962eb
      Andi Kleen 提交于
      Print the generic metric header even when the expression evaluation
      failed. Otherwise an expression that fails on the first collections due
      to division by zero may suddenly reappear later without an header.
      Signed-off-by: NAndi Kleen <ak@linux.intel.com>
      Acked-by: NJiri Olsa <jolsa@kernel.org>
      Link: http://lkml.kernel.org/r/20170831194036.30146-5-andi@firstfloor.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      4ed962eb
    • A
      perf stat: Factor out generic metric printing · bba49af8
      Andi Kleen 提交于
      The 'perf stat' shadow metric printing already supports generic metrics.
      Factor out the code doing that into a separate function that can be
      re-used in a later patch.
      
      No behavior changes.
      
      v2: Fix indentation
      Signed-off-by: NAndi Kleen <ak@linux.intel.com>
      Acked-by: NJiri Olsa <jolsa@kernel.org>
      Link: http://lkml.kernel.org/r/20170831194036.30146-4-andi@firstfloor.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      bba49af8
    • A
      perf vendor events: Support metric_group and no event name in JSON parser · 3ba36d36
      Andi Kleen 提交于
      Some enhancements to the JSON parser to prepare for metrics support
      
      - Parse the new MetricGroup field
      - Support JSON events with no event name, that have only MetricName.
      Signed-off-by: NAndi Kleen <ak@linux.intel.com>
      Acked-by: NJiri Olsa <jolsa@kernel.org>
      Link: http://lkml.kernel.org/r/20170831194036.30146-3-andi@firstfloor.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      3ba36d36
    • A
      perf tools: Support weak groups in 'perf stat' · 5a5dfe4b
      Andi Kleen 提交于
      Setting up groups can be complicated due to the complicated scheduling
      restrictions of different PMUs.
      
      User tools usually don't understand all these restrictions.
      
      Still in many cases it is useful to set up groups and they work most of
      the time. However if the group is set up wrong some members will not
      report any value because they never get scheduled.
      
      Add a concept of a 'weak group': try to set up a group, but if it's not
      schedulable fallback to not using a group. That gives us the best of
      both worlds: groups if they work, but still a usable fallback if they
      don't.
      
      In theory it would be possible to have more complex fallback strategies
      (e.g. try to split the group in half), but the simple fallback of not
      using a group seems to work for now.
      
      So far the weak group is only implemented for perf stat, not for record.
      
      Here's an unschedulable group (on IvyBridge with SMT on)
      
        % perf stat -e '{branches,branch-misses,l1d.replacement,l2_lines_in.all,l2_rqsts.all_code_rd}' -a sleep 1
      
              73,806,067      branches
               4,848,144      branch-misses             #    6.57% of all branches
              14,754,458      l1d.replacement
              24,905,558      l2_lines_in.all
         <not supported>      l2_rqsts.all_code_rd         <------- will never report anything
      
      With the weak group:
      
        % perf stat -e '{branches,branch-misses,l1d.replacement,l2_lines_in.all,l2_rqsts.all_code_rd}:W' -a sleep 1
      
             125,366,055      branches                                                      (80.02%)
               9,208,402      branch-misses             #    7.35% of all branches          (80.01%)
              24,560,249      l1d.replacement                                               (80.00%)
              43,174,971      l2_lines_in.all                                               (80.05%)
              31,891,457      l2_rqsts.all_code_rd                                          (79.92%)
      
      The extra event scheduled with some extra multiplexing
      
      v2: Move fallback code to separate function.
      Add comment on for_each_group_member
      Adjust to new perf_evsel__close interface
      v3: Fix debug print out.
      
      Committer testing:
      
      Before:
      
        # perf stat -e '{branches,branch-misses,l1d.replacement,l2_lines_in.all,l2_rqsts.all_code_rd}' -a sleep 1
      
         Performance counter stats for 'system wide':
      
           <not counted>      branches
           <not counted>      branch-misses
           <not counted>      l1d.replacement
           <not counted>      l2_lines_in.all
         <not supported>      l2_rqsts.all_code_rd
      
             1.002147212 seconds time elapsed
      
        # perf stat -e '{branches,l1d.replacement,l2_lines_in.all,l2_rqsts.all_code_rd}' -a sleep 1
      
         Performance counter stats for 'system wide':
      
              83,207,892      branches
              11,065,444      l1d.replacement
              28,484,024      l2_lines_in.all
              12,186,179      l2_rqsts.all_code_rd
      
             1.001739493 seconds time elapsed
      
      After:
      
        # perf stat -e '{branches,branch-misses,l1d.replacement,l2_lines_in.all,l2_rqsts.all_code_rd}':W -a sleep 1
      
         Performance counter stats for 'system wide':
      
             543,323,909      branches                                                      (80.01%)
              27,100,512      branch-misses             #    4.99% of all branches          (80.02%)
              50,402,905      l1d.replacement                                               (80.03%)
              67,385,892      l2_lines_in.all                                               (80.01%)
              21,352,885      l2_rqsts.all_code_rd                                          (79.94%)
      
             1.001086658 seconds time elapsed
      
        #
      Signed-off-by: NAndi Kleen <ak@linux.intel.com>
      Acked-by: NJiri Olsa <jolsa@kernel.org>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Link: http://lkml.kernel.org/r/20170831194036.30146-2-andi@firstfloor.org
      [ Add a "'perf stat' only, for now" comment in the man page, suggested by Jiri ]
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      5a5dfe4b
    • D
      perf sched timehist: Add pid and tid options · 0f59d7a3
      David Ahern 提交于
      Add options to only show event for specific pid(s) and tid(s).
      Signed-off-by: NDavid Ahern <dsahern@gmail.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: http://lkml.kernel.org/r/1504288152-19690-1-git-send-email-dsahern@gmail.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      0f59d7a3
    • I
      Merge tag 'perf-urgent-for-mingo-4.14-20170912' of... · b130a699
      Ingo Molnar 提交于
      Merge tag 'perf-urgent-for-mingo-4.14-20170912' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent
      
      Pull perf/urgent fixes from Arnaldo Carvalho de Melo:
      
      - Fix TUI progress bar when delta from new total from that of the
        previous update is greater than the progress "step" (screen width
        progress bar block))  (Jiri Olsa)
      
      - Make tools/lib/api make DEBUG=1 build use -D_FORTIFY_SOURCE=2 not
        to cripple debuginfo, just like tools/perf/ does (Jiri Olsa)
      
      - Avoid leaking the 'perf.data' file to workloads started from the
        'perf record' command line by using the O_CLOEXEC open flag (Jiri Olsa)
      
      - Fix building when libunwind's 'unwind.h' file is present in the
        include path, clashing with tools/perf/util/unwind.h (Milian Wolff)
      
      - Check per .perfconfig section entry flag, not just per section (Taeung Song)
      
      - Support running perf binaries with a dash in their name, needed to
        run perf as an AppImage (Milian Wolff)
      
      - Wait for the right child by using waitpid() when running workloads
        from 'perf stat', also to fix using perf as an AppImage (Milian Wolff)
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: NIngo Molnar <mingo@kernel.org>
      b130a699
    • L
      Merge tag 'f2fs-for-4.14' of git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs · 6d8ef53e
      Linus Torvalds 提交于
      Pull f2fs updates from Jaegeuk Kim:
       "In this round, we've mostly tuned f2fs to provide better user
        experience for Android. Especially, we've worked on atomic write
        feature again with SQLite community in order to support it officially.
        And we added or modified several facilities to analyze and enhance IO
        behaviors.
      
        Major changes include:
         - add app/fs io stat
         - add inode checksum feature
         - support project/journalled quota
         - enhance atomic write with new ioctl() which exposes feature set
         - enhance background gc/discard/fstrim flows with new gc_urgent mode
         - add F2FS_IOC_FS{GET,SET}XATTR
         - fix some quota flows"
      
      * tag 'f2fs-for-4.14' of git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs: (63 commits)
        f2fs: hurry up to issue discard after io interruption
        f2fs: fix to show correct discard_granularity in sysfs
        f2fs: detect dirty inode in evict_inode
        f2fs: clear radix tree dirty tag of pages whose dirty flag is cleared
        f2fs: speed up gc_urgent mode with SSR
        f2fs: better to wait for fstrim completion
        f2fs: avoid race in between read xattr & write xattr
        f2fs: make get_lock_data_page to handle encrypted inode
        f2fs: use generic terms used for encrypted block management
        f2fs: introduce f2fs_encrypted_file for clean-up
        Revert "f2fs: add a new function get_ssr_cost"
        f2fs: constify super_operations
        f2fs: fix to wake up all sleeping flusher
        f2fs: avoid race in between atomic_read & atomic_inc
        f2fs: remove unneeded parameter of change_curseg
        f2fs: update i_flags correctly
        f2fs: don't check inode's checksum if it was dirtied or writebacked
        f2fs: don't need to update inode checksum for recovery
        f2fs: trigger fdatasync for non-atomic_write file
        f2fs: fix to avoid race in between aio and gc
        ...
      6d8ef53e
    • L
      Merge tag 'ceph-for-4.14-rc1' of git://github.com/ceph/ceph-client · cdb897e3
      Linus Torvalds 提交于
      Pull ceph updates from Ilya Dryomov:
       "The highlights include:
      
         - a large series of fixes and improvements to the snapshot-handling
           code (Zheng Yan)
      
         - individual read/write OSD requests passed down to libceph are now
           limited to 16M in size to avoid hitting OSD-side limits (Zheng Yan)
      
         - encode MStatfs v2 message to allow for more accurate space usage
           reporting (Douglas Fuller)
      
         - switch to the new writeback error tracking infrastructure (Jeff
           Layton)"
      
      * tag 'ceph-for-4.14-rc1' of git://github.com/ceph/ceph-client: (35 commits)
        ceph: stop on-going cached readdir if mds revokes FILE_SHARED cap
        ceph: wait on writeback after writing snapshot data
        ceph: fix capsnap dirty pages accounting
        ceph: ignore wbc->range_{start,end} when write back snapshot data
        ceph: fix "range cyclic" mode writepages
        ceph: cleanup local variables in ceph_writepages_start()
        ceph: optimize pagevec iterating in ceph_writepages_start()
        ceph: make writepage_nounlock() invalidate page that beyonds EOF
        ceph: properly get capsnap's size in get_oldest_context()
        ceph: remove stale check in ceph_invalidatepage()
        ceph: queue cap snap only when snap realm's context changes
        ceph: handle race between vmtruncate and queuing cap snap
        ceph: fix message order check in handle_cap_export()
        ceph: fix NULL pointer dereference in ceph_flush_snaps()
        ceph: adjust 36 checks for NULL pointers
        ceph: delete an unnecessary return statement in update_dentry_lease()
        ceph: ENOMEM pr_err in __get_or_create_frag() is redundant
        ceph: check negative offsets in ceph_llseek()
        ceph: more accurate statfs
        ceph: properly set snap follows for cap reconnect
        ...
      cdb897e3
    • R
      xfs: XFS_IS_REALTIME_INODE() should be false if no rt device present · b31ff3cd
      Richard Wareing 提交于
      If using a kernel with CONFIG_XFS_RT=y and we set the RHINHERIT flag on
      a directory in a filesystem that does not have a realtime device and
      create a new file in that directory, it gets marked as a real time file.
      When data is written and a fsync is issued, the filesystem attempts to
      flush a non-existent rt device during the fsync process.
      
      This results in a crash dereferencing a null buftarg pointer in
      xfs_blkdev_issue_flush():
      
        BUG: unable to handle kernel NULL pointer dereference at 0000000000000008
        IP: xfs_blkdev_issue_flush+0xd/0x20
        .....
        Call Trace:
          xfs_file_fsync+0x188/0x1c0
          vfs_fsync_range+0x3b/0xa0
          do_fsync+0x3d/0x70
          SyS_fsync+0x10/0x20
          do_syscall_64+0x4d/0xb0
          entry_SYSCALL64_slow_path+0x25/0x25
      
      Setting RT inode flags does not require special privileges so any
      unprivileged user can cause this oops to occur.  To reproduce, confirm
      kernel is compiled with CONFIG_XFS_RT=y and run:
      
        # mkfs.xfs -f /dev/pmem0
        # mount /dev/pmem0 /mnt/test
        # mkdir /mnt/test/foo
        # xfs_io -c 'chattr +t' /mnt/test/foo
        # xfs_io -f -c 'pwrite 0 5m' -c fsync /mnt/test/foo/bar
      
      Or just run xfstests with MKFS_OPTIONS="-d rtinherit=1" and wait.
      
      Kernels built with CONFIG_XFS_RT=n are not exposed to this bug.
      
      Fixes: f538d4da ("[XFS] write barrier support")
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NRichard Wareing <rwareing@fb.com>
      Signed-off-by: NDave Chinner <david@fromorbit.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      b31ff3cd
    • L
      Merge tag 'dma-mapping-4.14' of git://git.infradead.org/users/hch/dma-mapping · 52269718
      Linus Torvalds 提交于
      Pull dma-mapping updates from Christoph Hellwig:
      
       - removal of the old dma_alloc_noncoherent interface
      
       - remove unused flags to dma_declare_coherent_memory
      
       - restrict OF DMA configuration to specific physical busses
      
       - use the iommu mailing list for dma-mapping questions and patches
      
      * tag 'dma-mapping-4.14' of git://git.infradead.org/users/hch/dma-mapping:
        dma-coherent: fix dma_declare_coherent_memory() logic error
        ARM: imx: mx31moboard: Remove unused 'dma' variable
        dma-coherent: remove an unused variable
        MAINTAINERS: use the iommu list for the dma-mapping subsystem
        dma-coherent: remove the DMA_MEMORY_MAP and DMA_MEMORY_IO flags
        dma-coherent: remove the DMA_MEMORY_INCLUDES_CHILDREN flag
        of: restrict DMA configuration
        dma-mapping: remove dma_alloc_noncoherent and dma_free_noncoherent
        i825xx: switch to switch to dma_alloc_attrs
        au1000_eth: switch to dma_alloc_attrs
        sgiseeq: switch to dma_alloc_attrs
        dma-mapping: reduce dma_mapping_error inline bloat
      52269718
    • L
      Merge tag 'uuid-for-4.14' of git://git.infradead.org/users/hch/uuid · ae71948f
      Linus Torvalds 提交于
      Pull uuid updates from Christoph Hellwig:
       "Just a single conversion to the new UUID API for this merge window"
      
      * tag 'uuid-for-4.14' of git://git.infradead.org/users/hch/uuid:
        efi: switch to use new generic UUID API
      ae71948f
    • L
      Merge tag 'selinux-pr-20170831' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/selinux · 7f85565a
      Linus Torvalds 提交于
      Pull selinux updates from Paul Moore:
       "A relatively quiet period for SELinux, 11 patches with only two/three
        having any substantive changes.
      
        These noteworthy changes include another tweak to the NNP/nosuid
        handling, per-file labeling for cgroups, and an object class fix for
        AF_UNIX/SOCK_RAW sockets; the rest of the changes are minor tweaks or
        administrative updates (Stephen's email update explains the file
        explosion in the diffstat).
      
        Everything passes the selinux-testsuite"
      
      [ Also a couple of small patches from the security tree from Tetsuo
        Handa for Tomoyo and LSM cleanup. The separation of security policy
        updates wasn't all that clean - Linus ]
      
      * tag 'selinux-pr-20170831' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/selinux:
        selinux: constify nf_hook_ops
        selinux: allow per-file labeling for cgroupfs
        lsm_audit: update my email address
        selinux: update my email address
        MAINTAINERS: update the NetLabel and Labeled Networking information
        selinux: use GFP_NOWAIT in the AVC kmem_caches
        selinux: Generalize support for NNP/nosuid SELinux domain transitions
        selinux: genheaders should fail if too many permissions are defined
        selinux: update the selinux info in MAINTAINERS
        credits: update Paul Moore's info
        selinux: Assign proper class to PF_UNIX/SOCK_RAW sockets
        tomoyo: Update URLs in Documentation/admin-guide/LSM/tomoyo.rst
        LSM: Remove security_task_create() hook.
      7f85565a
    • L
      Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 680352bd
      Linus Torvalds 提交于
      Pull x86 fixes from Ingo Molnar:
       "Two fixes: dead code removal, plus a SME memory encryption fix on
        32-bit kernels that crashed Xen guests"
      
      * 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/cpu: Remove unused and undefined __generic_processor_info() declaration
        x86/mm: Make the SME mask a u64
      680352bd
    • L
      Merge branch 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 040b9d7c
      Linus Torvalds 提交于
      Pull scheduler fixes from Ingo Molnar:
       "Three fixes:
      
         - fix a suspend/resume cpusets bug
      
         - fix a !CONFIG_NUMA_BALANCING bug
      
         - fix a kerneldoc warning"
      
      * 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        sched/fair: Fix nuisance kernel-doc warning
        sched/cpuset/pm: Fix cpuset vs. suspend-resume bugs
        sched/fair: Fix wake_affine_llc() balancing rules
      040b9d7c
    • L
      Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · e6328a7a
      Linus Torvalds 提交于
      Pull perf tooling updates from Ingo Molnar:
       "Perf tooling updates and fixes"
      
      * 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        perf annotate browser: Help for cycling thru hottest instructions with TAB/shift+TAB
        perf stat: Only auto-merge events that are PMU aliases
        perf test: Add test case for PERF_SAMPLE_PHYS_ADDR
        perf script: Support physical address
        perf mem: Support physical address
        perf sort: Add sort option for physical address
        perf tools: Support new sample type for physical address
        perf vendor events powerpc: Remove duplicate events
        perf intel-pt: Fix syntax in documentation of config option
        perf test powerpc: Fix 'Object code reading' test
        perf trace: Support syscall name globbing
        perf syscalltbl: Support glob matching on syscall names
        perf report: Calculate the average cycles of iterations
      e6328a7a
    • L
      Merge branch 'irq-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 33f82bda
      Linus Torvalds 提交于
      Pull irq fixes from Ingo Molnar:
       "A sparse irq race/locking fix, and a MSI irq domains population fix"
      
      * 'irq-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        genirq: Make sparse_irq_lock protect what it should protect
        genirq/msi: Fix populating multiple interrupts
      33f82bda
    • C
      f2fs: hurry up to issue discard after io interruption · e6c6de18
      Chao Yu 提交于
      Once we encounter I/O interruption during issuing discards, we will delay
      long time before next round, but if system status is I/O idle during the
      time, it may loses opportunity to issue discards. So this patch changes
      to hurry up to issue discard after io interruption.
      
      Besides, this patch also fixes to issue discards accurately with assigned
      rate.
      Signed-off-by: NChao Yu <yuchao0@huawei.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      e6c6de18
    • C
      f2fs: fix to show correct discard_granularity in sysfs · 80647e5f
      Chao Yu 提交于
      Fix below incorrect display when reading discard_granularity sysfs node.
      
      $ cat /sys/fs/f2fs/<device>/discard_granularity
      $ 16
      $ echo 32 > /sys/fs/f2fs/<device>/discard_granularity
      $ cat /sys/fs/f2fs/<device>/discard_granularity
      $ 16
      Signed-off-by: NChao Yu <yuchao0@huawei.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      80647e5f
    • C
      f2fs: detect dirty inode in evict_inode · ca7d802a
      Chao Yu 提交于
      Add a bugon in f2fs_evict_inode to detect inconsistent status between
      inode cache and related node page cache.
      Signed-off-by: NChao Yu <yuchao0@huawei.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
      ca7d802a
  2. 12 9月, 2017 2 次提交
    • M
      perf stat: Wait for the correct child · dfc9eec7
      Milian Wolff 提交于
      When packaging the perf userland application into an AppImage, the
      wait() call in perf stat returned too early. It turned out that some
      other child process exited, but not the one perf stat launched:
      
        $ sudo strace -e fork,execve,clone,wait4 -f ./perf-x86_64.AppImage stat sleep 1
        execve("./perf-git.3a73b7f9-x86_64.AppImage", ["./perf-git.3a73b7f9-x86_64.AppIm"..., "stat", "sleep", "1"], 0x7ffec1bbf050 /* 18 vars */) = 0
        clone(child_stack=NULL, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7f6a6e7efe50) = 3912
        strace: Process 3912 attached
        [pid  3912] clone(child_stack=NULL, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7f6a6e7efe50) = 3914
        strace: Process 3914 attached
        [pid  3912] +++ exited with 0 +++
        [pid  3911] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=3912, si_uid=0, si_status=0, si_utime=0, si_stime=0} ---
        [pid  3914] clone(strace: Process 3915 attached
        child_stack=0x7f6a6d9fefb0, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID, parent_tidptr=0x7f6a6d9ff9d0, tls=0x7f6a6d9ff700, child_tidptr=0x7f6a6d9ff9d0) = 3915
        [pid  3911] execve("/tmp/.mount_perf-g6VYMpl/AppRun", ["./perf-git.3a73b7f9-x86_64.AppIm"..., "stat", "sleep", "1"], 0x14aab70 /* 21 vars */) = 0
        [pid  3911] clone(child_stack=NULL, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7f4ae113c4d0) = 3916
        strace: Process 3916 attached
        [pid  3911] wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 3912
        [pid  3916] execve("/usr/libexec/perf-core/sleep", ["sleep", "1"], 0x27d3650 /* 22 vars */) = -1 ENOENT (No such file or directory)
        [pid  3916] execve("/tmp/./sleep", ["sleep", "1"], 0x27d3650 /* 22 vars */) = -1 ENOENT (No such file or directory)
        [pid  3916] execve("/home/milian/.bin/sleep", ["sleep", "1"], 0x27d3650 /* 22 vars */) = -1 ENOENT (No such file or directory)
        [pid  3916] execve("/usr/lib/icecream/libexec/icecc/bin/sleep", ["sleep", "1"], 0x27d3650 /* 22 vars */) = -1 ENOENT (No such file or directory)
        [pid  3916] execve("/ssd2/milian/projects/compiled/other/bin/sleep", ["sleep", "1"], 0x27d3650 /* 22 vars */) = -1 ENOENT (No such file or directory)
        [pid  3916] execve("/home/milian/.bin/kf5/sleep", ["sleep", "1"], 0x27d3650 /* 22 vars */) = -1 ENOENT (No such file or directory)
        [pid  3916] execve("/ssd2/milian/projects/compiled/kf5/bin/sleep", ["sleep", "1"], 0x27d3650 /* 22 vars */) = -1 ENOENT (No such file or directory)
        [pid  3916] execve("/home/milian/projects/compiled/other/bin/sleep", ["sleep", "1"], 0x27d3650 /* 22 vars */) = -1 ENOENT (No such file or directory)
        [pid  3916] execve("/home/milian/projects/compiled/kf5/bin/sleep", ["sleep", "1"], 0x27d3650 /* 22 vars */) = -1 ENOENT (No such file or directory)
        [pid  3916] execve("/usr/local/sbin/sleep", ["sleep", "1"], 0x27d3650 /* 22 vars */) = -1 ENOENT (No such file or directory)
        [pid  3916] execve("/usr/local/bin/sleep", ["sleep", "1"], 0x27d3650 /* 22 vars */) = -1 ENOENT (No such file or directory)
        [pid  3916] execve("/usr/bin/sleep", ["sleep", "1"], 0x27d3650 /* 22 vars */
         Performance counter stats for 'sleep 1':
      
             <not counted>	task-clock
             <not counted>	context-switches
             <not counted>	cpu-migrations
             <not counted>	page-faults
             <not counted>	cycles
             <not counted>	instructions
             <not counted>      branches
             <not counted>      branch-misses
      
               0.000047194 seconds time elapsed
      
        [pid  3916] --- SIGTERM {si_signo=SIGTERM, si_code=SI_USER, si_pid=3911, si_uid=0} ---
        [pid  3916] +++ killed by SIGTERM +++
        [pid  3911] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_KILLED, si_pid=3916, si_uid=0, si_status=SIGTERM, si_utime=0, si_stime=0} ---
        [pid  3915] --- SIGPIPE {si_signo=SIGPIPE, si_code=SI_USER, si_pid=3914, si_uid=0} ---
        [pid  3911] +++ exited with 0 +++
        [pid  3915] --- SIGHUP {si_signo=SIGHUP, si_code=SI_USER, si_pid=3914, si_uid=0} ---
        [pid  3915] +++ exited with 0 +++
        +++ exited with 0 +++
      
      This patch uses waitpid instead to ensure the call waits for the
      debuggee application launched by 'perf stat'. This fixes 'perf stat'
      when launched from an AppImage:
      
        $ ./perf-x86_64.AppImage stat sleep 1
      
         Performance counter stats for 'sleep 1':
      
                0.357235      task-clock (msec)         #    0.000 CPUs utilized
                       1      context-switches          #    0.003 M/sec
                       0      cpu-migrations            #    0.000 K/sec
                      50      page-faults               #    0.140 M/sec
                 1269602      cycles                    #    3.554 GHz
                  654278      instructions              #    0.52  insn per cycle
                  129963      branches                  #  363.803 M/sec
                    7082      branch-misses             #    5.45% of all branches
      
             1.000633420 seconds time elapsed
      Signed-off-by: NMilian Wolff <milian.wolff@kdab.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/r/20170912152523.4497-1-milian.wolff@kdab.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      dfc9eec7
    • M
      perf tools: Support running perf binaries with a dash in their name · 3192f1ed
      Milian Wolff 提交于
      Previously the part behind "perf-" was interpreted as an internal perf
      command. If the suffix could not be handled, the execution was stopped.
      This makes it impossible to launch perf binaries that got renamed to
      have the `perf-` prefix. This is e.g. the case for appimages (e.g.
      "perf-x86_64.AppImage"), but would also apply to all other scenarios
      where users symlink or rename perf themselves:
      
      Status quo with the broken behavior:
      
        $ ln -s ./perf ./perf-custom-suffix
        $ ./perf-custom-suffix list
        cannot handle custom-suffix internally$
      
      Also note the missing newline at the end of the error message.
      
      With this patch applied, the above works properly:
      
        $ ./perf-custom-suffix list
      
        List of pre-defined events (to be used in -e):
        ...
      Signed-off-by: NMilian Wolff <milian.wolff@kdab.com>
      Acked-by: NDavid Ahern <dsahern@gmail.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Yao Jin <yao.jin@linux.intel.com>
      Link: http://lkml.kernel.org/r/20170911111422.31903-1-milian.wolff@kdab.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      3192f1ed