1. 22 Jun, 2023 1 commit
    • Thomas Richter's avatar
      s390/cpum_cf: rework PER_CPU_DEFINE of struct cpu_cf_events · 9b9cf3c7
      Thomas Richter authored
      Struct cpu_cf_events is a large data structure and is statically defined
      for each possible CPU. Rework this and replace it by dynamically
      allocated data structures created when a perf_event_open() system call
      is invoked or an access via character device /dev/hwctr takes place.
      
      It is replaced by an array of pointers to all possible CPUs and
      reference counting. The array of pointers is allocated when the first
      event is created. For each online CPU an event is installed on, a struct
      cpu_cf_events is allocated and a pointer to struct cpu_cf_events is
      stored in the array:
      
                         CPU   0   1   2   3  ...  N
                             +---+---+---+---+---+---+
       cpu_cf_root::cpucf--> | * |   |   |   |...|   |
                             +-|-+---+---+---+---+---+
                               |
                               |
                              \|/
                           +-------------+
      		     |cpu_cf_events|
      		     |             |
                           +-------------+
      
      With this approach the large data structure is only allocated when
      an event is actually installed and used.
      Also implement proper reference counting for allocation and removal.
      
      During interrupt processing make sure the pointer to cpu_cf_events
      is valid. The interrupt handler is shared and might be called when
      no event is active.
      This requires checking for a valid pointer to struct cpu_cf_events.
      When the pointer to the per-cpu cpu_cf_events is NULL, simply return.
      Signed-off-by: default avatarThomas Richter <tmricht@linux.ibm.com>
      Acked-by: default avatarSumanth Korikkar <sumanthk@linux.ibm.com>
      Acked-by: default avatarHeiko Carstens <hca@linux.ibm.com>
      Signed-off-by: default avatarAlexander Gordeev <agordeev@linux.ibm.com>
      9b9cf3c7
  2. 20 Jun, 2023 2 commits
    • Thomas Richter's avatar
      s390/cpum_cf: open access to hwctr device for CAP_PERFMON privileged process · d0d3e218
      Thomas Richter authored
      The device /dev/hwctr was introduced to access complete
      CPU Measurement facility counter sets via an ioctl system call.
      The access the to device is limited to privileged processes
      running as root or superuser. The capability CAP_SYS_ADMIN
      is required.  The device permissions are read/write for the
      device owner root. There is no need for this restriction.
      
      Make the device access permission read/write for all and
      reduce the capabilities to CAP_PERFMON.
      Any user space program with the CAP_PERFMON capability assigned to it
      can now read and display the CPU Measurement facility counter sets.
      
      For more details on perf tool usage and security, see linux
      documentation in Documentation/admin-guide/perf-security.rst.
      Signed-off-by: default avatarThomas Richter <tmricht@linux.ibm.com>
      Acked-by: default avatarHeiko Carstens <hca@linux.ibm.com>
      Signed-off-by: default avatarAlexander Gordeev <agordeev@linux.ibm.com>
      d0d3e218
    • Sumanth Korikkar's avatar
      s390/module: fix rela calculation for R_390_GOTENT · 11458e2b
      Sumanth Korikkar authored
      During  module load, module layout allocation occurs by initially
      allowing the architecture to frob the sections. This is performed via
      module_frob_arch_sections().
      
      However, the size of each module memory types like text,data,rodata etc
      are updated correctly only after layout_sections().
      
      After calculation of required module memory sizes for each types,
      move_module() is responsible for allocating the module memory for each
      type from modules vaddr range.
      
      Considering the sequence above, module_frob_arch_sections() updates the
      module mod_arch_specific got_offset before module memory text type size
      is fully updated in layout_sections().  Hence mod_arch_specific
      got_offset points to currently zero.
      
      As per s390 ABI,
      R_390_GOTENT :  (G + O + A - P) >> 1
      where
      G=me->mem[MOD_TEXT].base+me->arch.got_offset
      O=info->got_offset
      A=rela->r_addend
      P=loc
      
      fix R_390_GOTENT calculation in apply_rela().
      
      Note: currently this doesn't break anything because me->arch.got_offset
      is zero.  However, reordering of functions in the future could break it.
      Signed-off-by: default avatarSumanth Korikkar <sumanthk@linux.ibm.com>
      Acked-by: default avatarHeiko Carstens <hca@linux.ibm.com>
      Signed-off-by: default avatarAlexander Gordeev <agordeev@linux.ibm.com>
      11458e2b
  3. 06 Jun, 2023 4 commits
  4. 01 Jun, 2023 7 commits
  5. 15 May, 2023 5 commits
  6. 14 May, 2023 13 commits
  7. 13 May, 2023 8 commits