Re: [PATCH v4 12/24] s390/zcrypt: Remove CCA and EP11 card and domain info caches

Holger Dengler
2025-04-11T13:26:01Z

On 09/04/2025 16:02, Harald Freudenberger wrote:
> Remove the caching of the CCA and EP11 card and domain info.
> In nearly all places where the card or domain info is fetched
> the verify param was enabled and thus the cache was bypassed.
> The only real place where info from the cache was used was
> in the sysfs pseudo files in cases where the card/queue was
> switched to "offline". All other callers insisted on getting
> fresh info and thus a communication to the card was enforced.
>
> Signed-off-by: Harald Freudenberger <freude@linux.ibm.com>

See my comment below. With that
Reviewed-by: Holger Dengler <dengler@linux.ibm.com>

> ---
> drivers/s390/crypto/pkey_cca.c | 16 ++--
> drivers/s390/crypto/zcrypt_ccamisc.c | 89 +------------------
> drivers/s390/crypto/zcrypt_ccamisc.h | 8 +-
> drivers/s390/crypto/zcrypt_cex4.c | 35 ++++----
> drivers/s390/crypto/zcrypt_ep11misc.c | 120 ++++----------------------
> drivers/s390/crypto/zcrypt_ep11misc.h | 2 +-
> 6 files changed, 46 insertions(+), 224 deletions(-)
>
[...]
> diff --git a/drivers/s390/crypto/zcrypt_ccamisc.c b/drivers/s390/crypto/zcrypt_ccamisc.c
> index 3a6a5b785a0d..7e24b78d4e56 100644
> --- a/drivers/s390/crypto/zcrypt_ccamisc.c
> +++ b/drivers/s390/crypto/zcrypt_ccamisc.c
[...]
> @@ -1771,24 +1701,14 @@ static int fetch_cca_info(u16 cardnr, u16 domain, struct cca_info *ci)
> /*
> * Fetch cca information about a CCA queue.
> */
> -int cca_get_info(u16 card, u16 dom, struct cca_info *ci, int verify)
> +int cca_get_info(u16 card, u16 dom, struct cca_info *ci)
> {
> - int rc;
> -
> - rc = cca_info_cache_fetch(card, dom, ci);
> - if (rc || verify) {
> - rc = fetch_cca_info(card, dom, ci);
> - if (rc == 0)
> - cca_info_cache_update(card, dom, ci);
> - }
> -
> - return rc;
> + return fetch_cca_info(card, dom, ci);

Why not remove this function completely and rename fetch_cca_info()?

> }
> EXPORT_SYMBOL(cca_get_info);
>
> int cca_findcard2(u32 **apqns, u32 *nr_apqns, u16 cardnr, u16 domain,
> - int minhwtype, int mktype, u64 cur_mkvp, u64 old_mkvp,
> - int verify)
> + int minhwtype, int mktype, u64 cur_mkvp, u64 old_mkvp)
> {
> struct zcrypt_device_status_ext *device_status;
> u32 *_apqns = NULL, _nr_apqns = 0;
[...]

--
Mit freundlichen Grüßen / Kind regards
Holger Dengler
--
IBM Systems, Linux on IBM Z Development
dengler@linux.ibm.com