s390/ap: introduce mutex to lock the AP bus scan
authorHarald Freudenberger <freude@linux.ibm.com>
Tue, 30 Jan 2024 16:42:50 +0000 (17:42 +0100)
committerHeiko Carstens <hca@linux.ibm.com>
Thu, 7 Mar 2024 13:41:14 +0000 (14:41 +0100)
commiteacf5b3651c530e0666efbd64e1d1115258c5903
treee04ffab6f080d930fc4e89137453b8678e99737b
parentb5caf05ee8795a628992fe7b5ac3e7b9bbd735c5
s390/ap: introduce mutex to lock the AP bus scan

Rework the invocations around ap_scan_bus():
- Protect ap_scan_bus() with a mutex to make sure only one
  scan at a time is running.
- The workqueue invocation which is triggered by either the
  module init or via AP bus scan timer expiration uses this
  mutex and if there is already a scan running, the work
  is simple aborted (as the job is done by another task).
- The ap_bus_force_rescan() which is invoked by higher level
  layers mostly on failures which indicate a bus scan may
  help is reworked to call ap_scan_bus() direct instead of
  enqueuing work into a system workqueue and waiting for that
  to finish. Of course the mutex is respected and in case of
  another task already running a bus scan the shortcut of
  waiting for this scan to finish and reusing the scan result
  is taken.

Signed-off-by: Harald Freudenberger <freude@linux.ibm.com>
Reviewed-by: Holger Dengler <dengler@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
drivers/s390/crypto/ap_bus.c
drivers/s390/crypto/ap_bus.h