1. 13 9月, 2017 1 次提交
    • P
      s390/perf: fix bug when creating per-thread event · fc3100d6
      Pu Hou 提交于
      A per-thread event could not be created correctly like below:
      
          perf record --per-thread -e rB0000 -- sleep 1
          Error:
          The sys_perf_event_open() syscall returned with 19 (No such device) for event (rB0000).
          /bin/dmesg may provide additional information.
          No CONFIG_PERF_EVENTS=y kernel support configured?
      
      This bug was introduced by:
      
          commit c311c797
          Author: Alexey Dobriyan <adobriyan@gmail.com>
          Date:   Mon May 8 15:56:15 2017 -0700
      
          cpumask: make "nr_cpumask_bits" unsigned
      
      If a per-thread event is not attached to any CPU, the cpu field
      in struct perf_event is -1. The above commit converts the CPU number
      to unsigned int, which result in an illegal CPU number.
      
      Fixes: c311c797 ("cpumask: make "nr_cpumask_bits" unsigned")
      Cc: <stable@vger.kernel.org> # v4.12+
      Cc: Alexey Dobriyan <adobriyan@gmail.com>
      Acked-by: NHeiko Carstens <heiko.carstens@de.ibm.com>
      Signed-off-by: NPu Hou <bjhoupu@linux.vnet.ibm.com>
      Signed-off-by: NMartin Schwidefsky <schwidefsky@de.ibm.com>
      fc3100d6
  2. 13 7月, 2017 1 次提交
  3. 12 6月, 2017 1 次提交
    • H
      s390: rename struct psw_bits members · a7525982
      Heiko Carstens 提交于
      Rename a couple of the struct psw_bits members so it is more obvious
      for what they are good. Initially I thought using the single character
      names from the PoP would be sufficient and obvious, but admittedly
      that is not true.
      
      The current implementation is not easy to use, if one has to look into
      the source file to figure out which member represents the 'per' bit
      (which is the 'r' member).
      
      Therefore rename the members to sane names that are identical to the
      uapi psw mask defines:
      
      r -> per
      i -> io
      e -> ext
      t -> dat
      m -> mcheck
      w -> wait
      p -> pstate
      Signed-off-by: NHeiko Carstens <heiko.carstens@de.ibm.com>
      Signed-off-by: NMartin Schwidefsky <schwidefsky@de.ibm.com>
      a7525982
  4. 09 5月, 2017 1 次提交
    • A
      cpumask: make "nr_cpumask_bits" unsigned · c311c797
      Alexey Dobriyan 提交于
      Bit searching functions accept "unsigned long" indices but
      "nr_cpumask_bits" is "int" which is signed, so inevitable sign
      extensions occur on x86_64.  Those MOVSX are #1 MOVSX bloat by number of
      uses across whole kernel.
      
      Change "nr_cpumask_bits" to unsigned, this number can't be negative
      after all.  It allows to do implicit zero-extension on x86_64 without
      MOVSX.
      
      Change signed comparisons into unsigned comparisons where necessary.
      
      Other uses looks fine because it is either argument passed to a function
      or comparison is already unsigned.
      
      Net win on allyesconfig type of kernel: ~2.8 KB (!)
      
      	add/remove: 0/0 grow/shrink: 8/725 up/down: 93/-2926 (-2833)
      	function                                     old     new   delta
      	xen_exit_mmap                                691     735     +44
      	qstat_read                                   426     440     +14
      	__cpufreq_cooling_register                  1678    1687      +9
      	trace_rb_cpu_prepare                         447     455      +8
      	vermagic                                      54      60      +6
      	nfp_driver_version                            54      60      +6
      	rcu_torture_stats_print                     1147    1151      +4
      	find_next_push_cpu                           267     269      +2
      	xen_irq_resume                               961     960      -1
      				...
      	init_vp_index                                946     906     -40
      	od_set_powersave_bias                        328     281     -47
      	power_cpu_exit                               193     139     -54
      	arch_show_interrupts                        3538    3484     -54
      	select_idle_sibling                         1558    1471     -87
      	Total: Before=158358910, After=158356077, chg -0.00%
      
      Same arguments apply to "nr_cpu_ids" but I haven't yet found enough
      courage to delve into this issue (and proper fix may require new type
      "cpu_t" which is whole separate story).
      
      Link: http://lkml.kernel.org/r/20170309205322.GA1728@avx2Signed-off-by: NAlexey Dobriyan <adobriyan@gmail.com>
      Cc: Rusty Russell <rusty@rustcorp.com.au>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      c311c797
  5. 05 4月, 2017 1 次提交
    • M
      s390/cpumf: simplify detection of guest samples · df26c2e8
      Martin Schwidefsky 提交于
      There are three different code levels in regard to the identification
      of guest samples. They differ in the way the LPP instruction is used.
      
      1) Old kernels without the LPP instruction. The guest program parameter
         is always zero.
      2) Newer kernels load the process pid into the program parameter with LPP.
         The guest program parameter is non-zero if the guest executes in a
         process != idle.
      3) The latest kernels load ((1UL << 31) | pid) with LPP to make the value
         non-zero even for the idle task. The guest program parameter is non-zero
         if the guest is running.
      
      All kernels load the process pid to CR4 on context switch. The CPU sampling
      code uses the value in CR4 to decide between guest and host samples in case
      the guest program parameter is zero. The three cases:
      
      1) CR4==pid, gpp==0
      2) CR4==pid, gpp==pid
      3) CR4==pid, gpp==((1UL << 31) | pid)
      
      The load-control instruction to load the pid into CR4 is expensive and the
      goal is to remove it. To distinguish the host CR4 from the guest pid for
      the idle process the maximum value 0xffff for the PASN is used.
      This adds a fourth case for a guest OS with an updated kernel:
      
      4) CR4==0xffff, gpp=((1UL << 31) | pid)
      
      The host kernel will have CR4==0xffff and will use (gpp!=0 || CR4!==0xffff)
      to identify guest samples. This works nicely with all 4 cases, the only
      possible issue would be a guest with an old kernel (gpp==0) and a process
      pid of 0xffff. Well, don't do that..
      Suggested-by: NChristian Borntraeger <borntraeger@de.ibm.com>
      Reviewed-by: NChristian Borntraeger <borntraeger@de.ibm.com>
      Signed-off-by: NMartin Schwidefsky <schwidefsky@de.ibm.com>
      df26c2e8
  6. 25 12月, 2016 1 次提交
  7. 12 12月, 2016 1 次提交
  8. 23 11月, 2016 1 次提交
  9. 16 7月, 2016 1 次提交
    • D
      perf, events: add non-linear data support for raw records · 7e3f977e
      Daniel Borkmann 提交于
      This patch adds support for non-linear data on raw records. It
      extends raw records to have one or multiple fragments that will
      be written linearly into the ring slot, where each fragment can
      optionally have a custom callback handler to walk and extract
      complex, possibly non-linear data.
      
      If a callback handler is provided for a fragment, then the new
      __output_custom() will be used instead of __output_copy() for
      the perf_output_sample() part. perf_prepare_sample() does all
      the size calculation only once, so perf_output_sample() doesn't
      need to redo the same work anymore, meaning real_size and padding
      will be cached in the raw record. The raw record becomes 32 bytes
      in size without holes; to not increase it further and to avoid
      doing unnecessary recalculations in fast-path, we can reuse
      next pointer of the last fragment, idea here is borrowed from
      ZERO_OR_NULL_PTR(), which should keep the perf_output_sample()
      path for PERF_SAMPLE_RAW minimal.
      
      This facility is needed for BPF's event output helper as a first
      user that will, in a follow-up, add an additional perf_raw_frag
      to its perf_raw_record in order to be able to more efficiently
      dump skb context after a linear head meta data related to it.
      skbs can be non-linear and thus need a custom output function to
      dump buffers. Currently, the skb data needs to be copied twice;
      with the help of __output_custom() this work only needs to be
      done once. Future users could be things like XDP/BPF programs
      that work on different context though and would thus also have
      a different callback function.
      
      The few users of raw records are adapted to initialize their frag
      data from the raw record itself, no change in behavior for them.
      The code is based upon a PoC diff provided by Peter Zijlstra [1].
      
        [1] http://thread.gmane.org/gmane.linux.network/421294Suggested-by: NPeter Zijlstra <peterz@infradead.org>
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      Acked-by: NAlexei Starovoitov <ast@kernel.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      7e3f977e
  10. 14 7月, 2016 1 次提交
  11. 28 6月, 2016 1 次提交
  12. 03 5月, 2016 1 次提交
  13. 17 3月, 2016 1 次提交
  14. 02 3月, 2016 1 次提交
  15. 14 10月, 2015 1 次提交
  16. 03 8月, 2015 1 次提交
  17. 28 5月, 2015 1 次提交
    • L
      kernel/params: constify struct kernel_param_ops uses · 9c27847d
      Luis R. Rodriguez 提交于
      Most code already uses consts for the struct kernel_param_ops,
      sweep the kernel for the last offending stragglers. Other than
      include/linux/moduleparam.h and kernel/params.c all other changes
      were generated with the following Coccinelle SmPL patch. Merge
      conflicts between trees can be handled with Coccinelle.
      
      In the future git could get Coccinelle merge support to deal with
      patch --> fail --> grammar --> Coccinelle --> new patch conflicts
      automatically for us on patches where the grammar is available and
      the patch is of high confidence. Consider this a feature request.
      
      Test compiled on x86_64 against:
      
      	* allnoconfig
      	* allmodconfig
      	* allyesconfig
      
      @ const_found @
      identifier ops;
      @@
      
      const struct kernel_param_ops ops = {
      };
      
      @ const_not_found depends on !const_found @
      identifier ops;
      @@
      
      -struct kernel_param_ops ops = {
      +const struct kernel_param_ops ops = {
      };
      
      Generated-by: Coccinelle SmPL
      Cc: Rusty Russell <rusty@rustcorp.com.au>
      Cc: Junio C Hamano <gitster@pobox.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: cocci@systeme.lip6.fr
      Cc: linux-kernel@vger.kernel.org
      Signed-off-by: NLuis R. Rodriguez <mcgrof@suse.com>
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      9c27847d
  18. 13 3月, 2015 1 次提交
  19. 03 11月, 2014 1 次提交
  20. 28 10月, 2014 1 次提交
    • P
      perf: Fix and clean up initialization of pmu::event_idx · c719f560
      Peter Zijlstra 提交于
      Andy reported that the current state of event_idx is rather confused.
      So remove all but the x86_pmu implementation and change the default to
      return 0 (the safe option).
      Reported-by: NAndy Lutomirski <luto@amacapital.net>
      Signed-off-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Christoph Lameter <cl@linux.com>
      Cc: Cody P Schafer <cody@linux.vnet.ibm.com>
      Cc: Cody P Schafer <dev@codyps.com>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
      Cc: Himangi Saraogi <himangi774@gmail.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Paul Gortmaker <paul.gortmaker@windriver.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: sukadev@linux.vnet.ibm.com <sukadev@linux.vnet.ibm.com>
      Cc: Thomas Huth <thuth@linux.vnet.ibm.com>
      Cc: Vince Weaver <vincent.weaver@maine.edu>
      Cc: linux390@de.ibm.com
      Cc: linuxppc-dev@lists.ozlabs.org
      Cc: linux-s390@vger.kernel.org
      Signed-off-by: NIngo Molnar <mingo@kernel.org>
      c719f560
  21. 27 8月, 2014 1 次提交
    • C
      s390: Replace __get_cpu_var uses · eb7e7d76
      Christoph Lameter 提交于
      __get_cpu_var() is used for multiple purposes in the kernel source. One of
      them is address calculation via the form &__get_cpu_var(x).  This calculates
      the address for the instance of the percpu variable of the current processor
      based on an offset.
      
      Other use cases are for storing and retrieving data from the current
      processors percpu area.  __get_cpu_var() can be used as an lvalue when
      writing data or on the right side of an assignment.
      
      __get_cpu_var() is defined as :
      
      #define __get_cpu_var(var) (*this_cpu_ptr(&(var)))
      
      __get_cpu_var() always only does an address determination. However, store
      and retrieve operations could use a segment prefix (or global register on
      other platforms) to avoid the address calculation.
      
      this_cpu_write() and this_cpu_read() can directly take an offset into a
      percpu area and use optimized assembly code to read and write per cpu
      variables.
      
      This patch converts __get_cpu_var into either an explicit address
      calculation using this_cpu_ptr() or into a use of this_cpu operations that
      use the offset.  Thereby address calculations are avoided and less registers
      are used when code is generated.
      
      At the end of the patch set all uses of __get_cpu_var have been removed so
      the macro is removed too.
      
      The patch set includes passes over all arches as well. Once these operations
      are used throughout then specialized macros can be defined in non -x86
      arches as well in order to optimize per cpu access by f.e.  using a global
      register that may be set to the per cpu base.
      
      Transformations done to __get_cpu_var()
      
      1. Determine the address of the percpu instance of the current processor.
      
      	DEFINE_PER_CPU(int, y);
      	int *x = &__get_cpu_var(y);
      
          Converts to
      
      	int *x = this_cpu_ptr(&y);
      
      2. Same as #1 but this time an array structure is involved.
      
      	DEFINE_PER_CPU(int, y[20]);
      	int *x = __get_cpu_var(y);
      
          Converts to
      
      	int *x = this_cpu_ptr(y);
      
      3. Retrieve the content of the current processors instance of a per cpu
      variable.
      
      	DEFINE_PER_CPU(int, y);
      	int x = __get_cpu_var(y)
      
         Converts to
      
      	int x = __this_cpu_read(y);
      
      4. Retrieve the content of a percpu struct
      
      	DEFINE_PER_CPU(struct mystruct, y);
      	struct mystruct x = __get_cpu_var(y);
      
         Converts to
      
      	memcpy(&x, this_cpu_ptr(&y), sizeof(x));
      
      5. Assignment to a per cpu variable
      
      	DEFINE_PER_CPU(int, y)
      	__get_cpu_var(y) = x;
      
         Converts to
      
      	this_cpu_write(y, x);
      
      6. Increment/Decrement etc of a per cpu variable
      
      	DEFINE_PER_CPU(int, y);
      	__get_cpu_var(y)++
      
         Converts to
      
      	this_cpu_inc(y)
      
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      CC: linux390@de.ibm.com
      Acked-by: NHeiko Carstens <heiko.carstens@de.ibm.com>
      Signed-off-by: NChristoph Lameter <cl@linux.com>
      Signed-off-by: NTejun Heo <tj@kernel.org>
      eb7e7d76
  22. 03 4月, 2014 1 次提交
  23. 13 1月, 2014 1 次提交
  24. 16 12月, 2013 10 次提交