Re: [PATCH v2 13/20] s390/zcrypt: Add small mempool for cca info list entries

Holger Dengler
2025-03-20T14:34:53Z

On 04/03/2025 18:21, Harald Freudenberger wrote:
> Add a small memory pool for (pre-)allocating cca info list
> entries. These entries are rather small and the pool is a simple
> way to support the xflag ZCRYPT_XFLAG_NOMEMALLOC to avoid mallocs.
>
> Signed-off-by: Harald Freudenberger <freude@linux.ibm.com>

With the requested change,
Reviewed-by: Holger Dengler <dengler@linux.ibm.com>

> ---
> drivers/s390/crypto/zcrypt_ccamisc.c | 67 ++++++++++++++++++++--------
> drivers/s390/crypto/zcrypt_ccamisc.h | 3 +-
> drivers/s390/crypto/zcrypt_cex4.c | 4 +-
> 3 files changed, 53 insertions(+), 21 deletions(-)
>
> diff --git a/drivers/s390/crypto/zcrypt_ccamisc.c b/drivers/s390/crypto/zcrypt_ccamisc.c
> index ff7ba2622484..e4ec922aae0d 100644
> --- a/drivers/s390/crypto/zcrypt_ccamisc.c
> +++ b/drivers/s390/crypto/zcrypt_ccamisc.c
[...]
> @@ -1828,6 +1834,7 @@ static int findcard(u64 mkvp, u16 *pcardnr, u16 *pdomain,
> u16 card, dom;
> struct cca_info ci;
> int i, rc, oi = -1;
> + u32 xflg = 0; /* xflags */

I'm confused. Why not just calling it xflags? Anyhow, as mentioned earlier: findcard() has no consumers, so please remove it completely.

>
> /* mkvp must not be zero, minhwtype needs to be >= 0 */
> if (mkvp == 0 || minhwtype < 0)
> @@ -1859,8 +1866,8 @@ static int findcard(u64 mkvp, u16 *pcardnr, u16 *pdomain,
> if (!verify)
> break;
> /* verify: refresh card info */
> - if (fetch_cca_info(card, dom, &ci) == 0) {
> - cca_info_cache_update(card, dom, &ci);
> + if (fetch_cca_info(card, dom, &ci, xflg) == 0) {
> + cca_info_cache_update(card, dom, &ci, xflg);
> if (ci.hwtype >= minhwtype &&
> ci.cur_aes_mk_state == '2' &&
> ci.cur_aes_mkvp == mkvp)
> @@ -1882,8 +1889,8 @@ static int findcard(u64 mkvp, u16 *pcardnr, u16 *pdomain,
> card = AP_QID_CARD(device_status[i].qid);
> dom = AP_QID_QUEUE(device_status[i].qid);
> /* fresh fetch mkvp from adapter */
> - if (fetch_cca_info(card, dom, &ci) == 0) {
> - cca_info_cache_update(card, dom, &ci);
> + if (fetch_cca_info(card, dom, &ci, xflg) == 0) {
> + cca_info_cache_update(card, dom, &ci, xflg);
> if (ci.hwtype >= minhwtype &&
> ci.cur_aes_mk_state == '2' &&
> ci.cur_aes_mkvp == mkvp)
[...]

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