Skip to content

Commit 366367a

Browse files
hfreudehcahca
authored andcommitted
s390/zcrypt: Introduce cprb mempool for ep11 misc functions
Introduce a cprb mempool for the zcrypt ep11 misc functions (zcrypt_ep11misc.*) do some preparation rework to support a do-not-allocate path through some zcrypt ep11 misc functions. The mempool is controlled by the zcrypt module parameter "mempool_threshold" which shall control the minimal amount of memory items for CCA and EP11. The mempool shall support "mempool_threshold" requests/replies in parallel which means for EP11 to hold a send and receive buffer memory per request. Each of this cprb space items is limited to 8 KB. So by default the mempool consumes 5 * 2 * 8KB = 80KB If the mempool is depleted upon one ep11 misc functions is called with the ZCRYPT_XFLAG_NOMEMALLOC xflag set, the function will fail with -ENOMEM and the caller is responsible for taking further actions. This is only part of an rework to support a new xflag ZCRYPT_XFLAG_NOMEMALLOC but not yet complete. Signed-off-by: Harald Freudenberger <freude@linux.ibm.com> Reviewed-by: Holger Dengler <dengler@linux.ibm.com> Link: https://lore.kernel.org/r/20250424133619.16495-8-freude@linux.ibm.com Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
1 parent 9bdb5f7 commit 366367a

3 files changed

Lines changed: 96 additions & 62 deletions

File tree

drivers/s390/crypto/zcrypt_api.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2166,6 +2166,10 @@ int __init zcrypt_api_init(void)
21662166
if (rc)
21672167
goto out_ccamisc_init_failed;
21682168

2169+
rc = zcrypt_ep11misc_init();
2170+
if (rc)
2171+
goto out_ep11misc_init_failed;
2172+
21692173
/* Register the request sprayer. */
21702174
rc = misc_register(&zcrypt_misc_device);
21712175
if (rc < 0)
@@ -2177,6 +2181,8 @@ int __init zcrypt_api_init(void)
21772181
return 0;
21782182

21792183
out_misc_register_failed:
2184+
zcrypt_ep11misc_exit();
2185+
out_ep11misc_init_failed:
21802186
zcrypt_ccamisc_exit();
21812187
out_ccamisc_init_failed:
21822188
zcdn_exit();

0 commit comments

Comments
 (0)