1. 01 Mar, 2022 13 commits
    • Tony Krowiak's avatar
      s390/ap: notify drivers on config changed and scan complete callbacks · 28391585
      Tony Krowiak authored
      This patch introduces an extension to the ap bus to notify device drivers
      when the host AP configuration changes - i.e., adapters, domains or
      control domains are added or removed. When an adapter or domain is added to
      the host's AP configuration, the AP bus will create the associated queue
      devices in the linux sysfs device model. Each new type 10 (i.e., CEX4) or
      newer queue device with an APQN that is not reserved for the default device
      driver will get bound to the vfio_ap device driver. Likewise, whan an
      adapter or domain is removed from the host's AP configuration, the AP bus
      will remove the associated queue devices from the sysfs device model. Each
      of the queues that is bound to the vfio_ap device driver will get unbound.
      
      With the introduction of hot plug support, binding or unbinding of a
      queue device will result in plugging or unplugging one or more queues from
      a guest that is using the queue. If there are multiple changes to the
      host's AP configuration, it could result in the probe and remove callbacks
      getting invoked multiple times. Each time queues are plugged into or
      unplugged from a guest, the guest's VCPUs must be taken out of SIE.
      If this occurs multiple times due to changes in the host's AP
      configuration, that can have an undesirable negative affect on the guest's
      performance.
      
      To alleviate this problem, this patch introduces two new callbacks: one to
      notify the vfio_ap device driver when the AP bus scan routine detects a
      change to the host's AP configuration; and, one to notify the driver when
      the AP bus is done scanning. This will allow the vfio_ap driver to do
      bulk processing of all affected adapters, domains and control domains for
      affected guests rather than plugging or unplugging them one at a time when
      the probe or remove callback is invoked. The two new callbacks are:
      
      void (*on_config_changed)(struct ap_config_info *new_config_info,
                                struct ap_config_info *old_config_info);
      
      This callback is invoked at the start of the AP bus scan
      function when it determines that the host AP configuration information
      has changed since the previous scan. This is done by storing
      an old and current QCI info struct and comparing them. If there is any
      difference, the callback is invoked.
      
      void (*on_scan_complete)(struct ap_config_info *new_config_info,
                               struct ap_config_info *old_config_info);
      
      The on_scan_complete callback is invoked after the ap bus scan is
      completed if the host AP configuration data has changed.
      Signed-off-by: default avatarTony Krowiak <akrowiak@linux.ibm.com>
      Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
      28391585
    • Tony Krowiak's avatar
      s390/ap: driver callback to indicate resource in use · 4f8206b8
      Tony Krowiak authored
      Introduces a new driver callback to prevent a root user from re-assigning
      the APQN of a queue that is in use by a non-default host device driver to
      a default host device driver and vice versa. The callback will be invoked
      whenever a change to the AP bus's sysfs apmask or aqmask attributes would
      result in one or more APQNs being re-assigned. If the callback responds
      in the affirmative for any driver queried, the change to the apmask or
      aqmask will be rejected with a device busy error.
      
      For this patch, only non-default drivers will be queried. Currently,
      there is only one non-default driver, the vfio_ap device driver. The
      vfio_ap device driver facilitates pass-through of an AP queue to a
      guest. The idea here is that a guest may be administered by a different
      sysadmin than the host and we don't want AP resources to unexpectedly
      disappear from a guest's AP configuration (i.e., adapters and domains
      assigned to the matrix mdev). This will enforce the proper procedure for
      removing AP resources intended for guest usage which is to
      first unassign them from the matrix mdev, then unbind them from the
      vfio_ap device driver.
      Signed-off-by: default avatarTony Krowiak <akrowiak@linux.ibm.com>
      Reviewed-by: default avatarHarald Freudenberger <freude@linux.ibm.com>
      Reviewed-by: default avatarHalil Pasic <pasic@linux.ibm.com>
      Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
      4f8206b8
    • Vasily Gorbik's avatar
      s390/test_unwind: fix and extend kprobes test · 9ba142f4
      Vasily Gorbik authored
      Running kprobe test on a kernel built with clang 14 didn't actually
      trigger pgm_pre_handler() and no unwinder code was called. Even though
      do_report_trap() is a global symbol, clang inlined it in several local
      functions including illegal_op() handler, so that kprobbing a global
      symbol didn't have a desired effect.
      
      To achieve the same test result (unwinding from a program check
      handler) introduce a local function and probe an instruction in the
      middle, so that kprobe doesn't take KPROBE_ON_FTRACE path.
      
      While at it, add another test for KPROBE_ON_FTRACE.
      Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
      9ba142f4
    • Vasily Gorbik's avatar
      s390/test_unwind: add ftrace test · 829ec749
      Vasily Gorbik authored
      Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
      829ec749
    • Vasily Gorbik's avatar
      s390/test_unwind: add "backtrace" module parameter · 8a0c9705
      Vasily Gorbik authored
      By default no backtraces are printed when a test succeeds, but sometimes
      it is useful to spot issues automated test doesn't cover. Add "backtrace"
      module parameter to force it.
      Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
      8a0c9705
    • Vasily Gorbik's avatar
      s390/test_unwind: minor cleanup · 93bd3232
      Vasily Gorbik authored
      - make current_test static
      - use current_test consistently
      - add TEST_WITH_FLAGS macro to contract parametrized tests definition
      Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
      93bd3232
    • Vasily Gorbik's avatar
      81eac907
    • Vasily Gorbik's avatar
      s390: always use the packed stack layout · 42b01a55
      Vasily Gorbik authored
      -mpacked-stack option has been supported by both minimum
      gcc and clang versions for a while. With commit e2bc3e91
      ("scripts/min-tool-version.sh: Raise minimum clang version to 13.0.0
      for s390") minimum clang version now also supports a combination
      of flags -mpacked-stack -mbackchain -pg -mfentry and fulfills
      all requirements to always enable the packed stack layout.
      Reviewed-by: default avatarHeiko Carstens <hca@linux.ibm.com>
      Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
      42b01a55
    • Vasily Gorbik's avatar
      Merge branch 'fixes' into features · 9a4f03ad
      Vasily Gorbik authored
      This helps to avoid several merge conflicts later.
      
      * fixes:
        s390/extable: fix exception table sorting
        s390/ftrace: fix arch_ftrace_get_regs implementation
        s390/ftrace: fix ftrace_caller/ftrace_regs_caller generation
        s390/setup: preserve memory at OLDMEM_BASE and OLDMEM_SIZE
        s390/cio: verify the driver availability for path_event call
        s390/module: fix building test_modules_helpers.o with clang
        MAINTAINERS: downgrade myself to Reviewer for s390
        MAINTAINERS: add Alexander Gordeev as maintainer for s390
      Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
      9a4f03ad
    • Heiko Carstens's avatar
      s390/extable: fix exception table sorting · c194dad2
      Heiko Carstens authored
      s390 has a swap_ex_entry_fixup function, however it is not being used
      since common code expects a swap_ex_entry_fixup define. If it is not
      defined the default implementation will be used. So fix this by adding
      a proper define.
      However also the implementation of the function must be fixed, since a
      NULL value for handler has a special meaning and must not be adjusted.
      
      Luckily all of this doesn't fix a real bug currently: the main extable
      is correctly sorted during build time, and for runtime sorting there
      is currently no case where the handler field is not NULL.
      
      Fixes: 05a68e89 ("s390/kernel: expand exception table logic to allow new handling options")
      Acked-by: default avatarIlya Leoshkevich <iii@linux.ibm.com>
      Reviewed-by: default avatarAlexander Gordeev <agordeev@linux.ibm.com>
      Signed-off-by: default avatarHeiko Carstens <hca@linux.ibm.com>
      Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
      c194dad2
    • Heiko Carstens's avatar
      s390/ftrace: fix arch_ftrace_get_regs implementation · 1389f179
      Heiko Carstens authored
      arch_ftrace_get_regs is supposed to return a struct pt_regs pointer
      only if the pt_regs structure contains all register contents, which
      means it must have been populated when created via ftrace_regs_caller.
      
      If it was populated via ftrace_caller the contents are not complete
      (the psw mask part is missing), and therefore a NULL pointer needs be
      returned.
      
      The current code incorrectly always returns a struct pt_regs pointer.
      
      Fix this by adding another pt_regs flag which indicates if the
      contents are complete, and fix arch_ftrace_get_regs accordingly.
      
      Fixes: 89497968 ("s390/ftrace: provide separate ftrace_caller/ftrace_regs_caller implementations")
      Reported-by: default avatarChristophe Leroy <christophe.leroy@csgroup.eu>
      Reported-by: default avatarNaveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
      Reviewed-by: default avatarSven Schnelle <svens@linux.ibm.com>
      Acked-by: default avatarIlya Leoshkevich <iii@linux.ibm.com>
      Signed-off-by: default avatarHeiko Carstens <hca@linux.ibm.com>
      Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
      1389f179
    • Heiko Carstens's avatar
      s390/ftrace: fix ftrace_caller/ftrace_regs_caller generation · 9fa881f7
      Heiko Carstens authored
      ftrace_caller was used for both ftrace_caller and ftrace_regs_caller,
      which means that the target address of the hotpatch trampoline was
      never updated.
      
      With commit 89497968 ("s390/ftrace: provide separate
      ftrace_caller/ftrace_regs_caller implementations") a separate
      ftrace_regs_caller entry point was implemeted, however it was
      forgotten to implement the necessary changes for ftrace_modify_call
      and ftrace_make_call, where the branch target has to be modified
      accordingly.
      
      Therefore add the missing code now.
      
      Fixes: 89497968 ("s390/ftrace: provide separate ftrace_caller/ftrace_regs_caller implementations")
      Reviewed-by: default avatarSven Schnelle <svens@linux.ibm.com>
      Acked-by: default avatarIlya Leoshkevich <iii@linux.ibm.com>
      Signed-off-by: default avatarHeiko Carstens <hca@linux.ibm.com>
      Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
      9fa881f7
    • Alexander Egorenkov's avatar
      s390/setup: preserve memory at OLDMEM_BASE and OLDMEM_SIZE · 6b4b54c7
      Alexander Egorenkov authored
      We need to preserve the values at OLDMEM_BASE and OLDMEM_SIZE which are
      used by zgetdump in case when kdump crashes. In that case zgetdump will
      attempt to read OLDMEM_BASE and OLDMEM_SIZE in order to find out where
      the memory range [0 - OLDMEM_SIZE] belonging to the production kernel is.
      
      Fixes: f1a54694 ("s390/setup: don't reserve memory that occupied decompressor's head")
      Cc: stable@vger.kernel.org # 5.15+
      Signed-off-by: default avatarAlexander Egorenkov <egorenar@linux.ibm.com>
      Acked-by: default avatarVasily Gorbik <gor@linux.ibm.com>
      Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
      6b4b54c7
  2. 09 Feb, 2022 4 commits
  3. 06 Feb, 2022 23 commits