• Harald Freudenberger's avatar
    s390/zcrypt: improve zcrypt retry behavior · c3384369
    Harald Freudenberger authored
    This patch reworks and improves the zcrypt retry behavior:
    - The zcrypt_rescan_req counter has been removed. This
      counter variable has been increased on some transport
      errors and was used as a gatekeeper for AP bus rescans.
    - Rework of the zcrypt_process_rescan() function to not
      use the above counter variable any more. Instead now
      always the ap_bus_force_rescan() function is called
      (as this has been improved with a previous patch).
    - As the zcrpyt_process_rescan() function is called in
      all cprb send functions in case of the first attempt
      to send failed with ENODEV now before the next attempt
      to send an cprb is started.
    - Introduce a define ZCRYPT_WAIT_BINDINGS_COMPLETE_MS
      for the amount of milliseconds to have the zcrypt API
      wait for AP bindings complete. This amount has been
      reduced to 30s (was 60s). Some playing around showed
      that 30s is a really fair limit.
    
    The result of the above together with the patches to
    improve the AP scan bus functions is that after the
    first loop of cprb send retries when the result is a
    ENODEV the AP bus scan is always triggered (synchronous).
    If the AP bus scan detects changes in the configuration,
    all the send functions now retry when the first attempt
    was failing with ENODEV in the hope that now a suitable
    device has appeared.
    
    About concurrency: The ap_bus_force_rescan() uses a mutex
    to ensure only one active AP bus scan is running. Another
    caller of this function is blocked as long as the scan is
    running but does not cause yet another scan. Instead the
    result of the 'other' scan is used. This affects only tasks
    which run into an initial ENODEV. Tasks with successful
    delivery of cprbs will never invoke the bus scan and thus
    never get blocked by the mutex.
    Signed-off-by: default avatarHarald Freudenberger <freude@linux.ibm.com>
    Reviewed-by: default avatarHolger Dengler <dengler@linux.ibm.com>
    Signed-off-by: default avatarHeiko Carstens <hca@linux.ibm.com>
    c3384369
zcrypt_api.h 5.73 KB