Skip to content

Commit

Permalink
Replace deprecated pthread_yield with sched_yield.
Browse files Browse the repository at this point in the history
pthread_yield is deprecated from glibc 2.34 hence
replacing it with sched_yield.

Signed-off-by: Yogaraj Alamenda <[email protected]>
  • Loading branch information
Yogaraj-Alamenda committed Jul 22, 2022
1 parent bb10128 commit d514406
Show file tree
Hide file tree
Showing 21 changed files with 67 additions and 66 deletions.
1 change: 1 addition & 0 deletions e_qat.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
# include <unistd.h>
# include <string.h>
# include <semaphore.h>
# include <sched.h>

# ifdef QAT_OPENSSL_3
# include "qat_prov_err.h"
Expand Down
4 changes: 2 additions & 2 deletions qat_hw_asym_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -302,9 +302,9 @@ int qat_mod_exp(BIGNUM *res, const BIGNUM *base, const BIGNUM *exp,
loop around and try again until the request
completes and we can continue. */
if ((job_ret = qat_pause_job(op_done.job, ASYNC_STATUS_OK)) == 0)
pthread_yield();
sched_yield();
} else {
pthread_yield();
sched_yield();
}
}
while (!op_done.flag ||
Expand Down
8 changes: 4 additions & 4 deletions qat_hw_chachapoly.c
Original file line number Diff line number Diff line change
Expand Up @@ -955,9 +955,9 @@ static int qat_chacha20_poly1305_tls_cipher(EVP_CIPHER_CTX * ctx, unsigned char
loop around and try again until the request
completes and we can continue. */
if ((job_ret = qat_pause_job(op_done.job, ASYNC_STATUS_OK)) == 0)
pthread_yield();
sched_yield();
} else {
pthread_yield();
sched_yield();
}
} while (!op_done.flag ||
QAT_CHK_JOB_RESUMED_UNEXPECTEDLY(job_ret));
Expand Down Expand Up @@ -1262,9 +1262,9 @@ static int qat_chacha20_poly1305_do_cipher(EVP_CIPHER_CTX * ctx, unsigned char *
loop around and try again until the request
completes and we can continue. */
if ((job_ret = qat_pause_job(op_done.job, ASYNC_STATUS_OK)) == 0)
pthread_yield();
sched_yield();
} else {
pthread_yield();
sched_yield();
}
} while (!op_done.flag ||
QAT_CHK_JOB_RESUMED_UNEXPECTEDLY(job_ret));
Expand Down
4 changes: 2 additions & 2 deletions qat_hw_ciphers.c
Original file line number Diff line number Diff line change
Expand Up @@ -1685,9 +1685,9 @@ int qat_chained_ciphers_do_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
loop around and try again until the request
completes and we can continue. */
if ((job_ret = qat_pause_job(done.opDone.job, ASYNC_STATUS_OK)) == 0)
pthread_yield();
sched_yield();
} else {
pthread_yield();
sched_yield();
}
} while (!done.opDone.flag ||
QAT_CHK_JOB_RESUMED_UNEXPECTEDLY(job_ret));
Expand Down
8 changes: 4 additions & 4 deletions qat_hw_dh.c
Original file line number Diff line number Diff line change
Expand Up @@ -474,9 +474,9 @@ int qat_dh_generate_key(DH *dh)
loop around and try again until the request
completes and we can continue. */
if ((job_ret = qat_pause_job(op_done.job, ASYNC_STATUS_OK)) == 0)
pthread_yield();
sched_yield();
} else {
pthread_yield();
sched_yield();
}
}
while (!op_done.flag ||
Expand Down Expand Up @@ -801,9 +801,9 @@ int qat_dh_compute_key(unsigned char *key, const BIGNUM *in_pub_key, DH *dh)
loop around and try again until the request
completes and we can continue. */
if ((job_ret = qat_pause_job(op_done.job, ASYNC_STATUS_OK)) == 0)
pthread_yield();
sched_yield();
} else {
pthread_yield();
sched_yield();
}
}
while (!op_done.flag ||
Expand Down
8 changes: 4 additions & 4 deletions qat_hw_dsa.c
Original file line number Diff line number Diff line change
Expand Up @@ -556,9 +556,9 @@ DSA_SIG *qat_dsa_do_sign(const unsigned char *dgst, int dlen,
loop around and try again until the request
completes and we can continue. */
if ((job_ret = qat_pause_job(op_done.job, ASYNC_STATUS_OK)) == 0)
pthread_yield();
sched_yield();
} else {
pthread_yield();
sched_yield();
}
} while (!op_done.flag ||
QAT_CHK_JOB_RESUMED_UNEXPECTEDLY(job_ret));
Expand Down Expand Up @@ -916,9 +916,9 @@ int qat_dsa_do_verify(const unsigned char *dgst, int dgst_len,
loop around and try again until the request
completes and we can continue. */
if ((job_ret = qat_pause_job(op_done.job, ASYNC_STATUS_OK)) == 0)
pthread_yield();
sched_yield();
} else {
pthread_yield();
sched_yield();
}
}
while (!op_done.flag ||
Expand Down
12 changes: 6 additions & 6 deletions qat_hw_ec.c
Original file line number Diff line number Diff line change
Expand Up @@ -502,9 +502,9 @@ int qat_ecdh_compute_key(unsigned char **outX, size_t *outlenX,
loop around and try again until the request
completes and we can continue. */
if ((job_ret = qat_pause_job(op_done.job, ASYNC_STATUS_OK)) == 0)
pthread_yield();
sched_yield();
} else {
pthread_yield();
sched_yield();
}
}
while (!op_done.flag ||
Expand Down Expand Up @@ -1266,9 +1266,9 @@ ECDSA_SIG *qat_ecdsa_do_sign(const unsigned char *dgst, int dgst_len,
loop around and try again until the request
completes and we can continue. */
if ((job_ret = qat_pause_job(op_done.job, ASYNC_STATUS_OK)) == 0)
pthread_yield();
sched_yield();
} else {
pthread_yield();
sched_yield();
}
}
while (!op_done.flag ||
Expand Down Expand Up @@ -1686,9 +1686,9 @@ int qat_ecdsa_do_verify(const unsigned char *dgst, int dgst_len,
loop around and try again until the request
completes and we can continue. */
if ((job_ret = qat_pause_job(op_done.job, ASYNC_STATUS_OK)) == 0)
pthread_yield();
sched_yield();
} else {
pthread_yield();
sched_yield();
}
}
while (!op_done.flag ||
Expand Down
12 changes: 6 additions & 6 deletions qat_hw_ecx.c
Original file line number Diff line number Diff line change
Expand Up @@ -401,9 +401,9 @@ int qat_pkey_ecx_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey)
loop around and try again until the request
completes and we can continue. */
if ((job_ret = qat_pause_job(op_done.job, ASYNC_STATUS_OK)) == 0)
pthread_yield();
sched_yield();
} else {
pthread_yield();
sched_yield();
}
}
while (!op_done.flag ||
Expand Down Expand Up @@ -738,9 +738,9 @@ int qat_pkey_ecx_derive25519(EVP_PKEY_CTX *ctx, unsigned char *key, size_t *keyl
loop around and try again until the request
completes and we can continue. */
if ((job_ret = qat_pause_job(op_done.job, ASYNC_STATUS_OK)) == 0)
pthread_yield();
sched_yield();
} else {
pthread_yield();
sched_yield();
}
}
while (!op_done.flag ||
Expand Down Expand Up @@ -1030,9 +1030,9 @@ int qat_pkey_ecx_derive448(EVP_PKEY_CTX *ctx, unsigned char *key, size_t *keylen
loop around and try again until the request
completes and we can continue. */
if ((job_ret = qat_pause_job(op_done.job, ASYNC_STATUS_OK)) == 0)
pthread_yield();
sched_yield();
} else {
pthread_yield();
sched_yield();
}
}
while (!op_done.flag ||
Expand Down
8 changes: 4 additions & 4 deletions qat_hw_gcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1208,9 +1208,9 @@ int qat_aes_gcm_tls_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
loop around and try again until the request
completes and we can continue. */
if ((job_ret = qat_pause_job(op_done.job, ASYNC_STATUS_OK)) == 0)
pthread_yield();
sched_yield();
} else {
pthread_yield();
sched_yield();
}
} while (!op_done.flag ||
QAT_CHK_JOB_RESUMED_UNEXPECTEDLY(job_ret));
Expand Down Expand Up @@ -1530,9 +1530,9 @@ int qat_aes_gcm_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
loop around and try again until the request
completes and we can continue. */
if ((job_ret = qat_pause_job(op_done.job, 0)) == 0)
pthread_yield();
sched_yield();
} else {
pthread_yield();
sched_yield();
}
} while (!op_done.flag ||
QAT_CHK_JOB_RESUMED_UNEXPECTEDLY(job_ret));
Expand Down
4 changes: 2 additions & 2 deletions qat_hw_hkdf.c
Original file line number Diff line number Diff line change
Expand Up @@ -701,9 +701,9 @@ int qat_hkdf_derive(EVP_PKEY_CTX *ctx, unsigned char *key, size_t *olen)
loop around and try again until the request
completes and we can continue. */
if ((job_ret = qat_pause_job(op_done.job, ASYNC_STATUS_OK)) == 0)
pthread_yield();
sched_yield();
} else {
pthread_yield();
sched_yield();
}
}
while (!op_done.flag ||
Expand Down
4 changes: 2 additions & 2 deletions qat_hw_prf.c
Original file line number Diff line number Diff line change
Expand Up @@ -741,9 +741,9 @@ int qat_prf_tls_derive(EVP_PKEY_CTX *ctx, unsigned char *key, size_t *olen)
loop around and try again until the request
completes and we can continue. */
if ((job_ret = qat_pause_job(op_done.job, ASYNC_STATUS_OK)) == 0)
pthread_yield();
sched_yield();
} else {
pthread_yield();
sched_yield();
}
}
while (!op_done.flag ||
Expand Down
6 changes: 3 additions & 3 deletions qat_hw_rsa.c
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ static int qat_rsa_decrypt(CpaCyRsaDecryptOpData * dec_op_data, int rsa_len,
loop around and try again until the request
completes and we can continue. */
if ((job_ret = qat_pause_job(op_done.job, ASYNC_STATUS_OK)) == 0)
pthread_yield();
sched_yield();
}
while (!op_done.flag ||
QAT_CHK_JOB_RESUMED_UNEXPECTEDLY(job_ret));
Expand Down Expand Up @@ -659,12 +659,12 @@ static int qat_rsa_encrypt(CpaCyRsaEncryptOpData * enc_op_data,
loop around and try again until the request
completes and we can continue. */
if ((job_ret = qat_pause_job(op_done.job, ASYNC_STATUS_OK)) == 0)
pthread_yield();
sched_yield();
} else {
if(getEnableInlinePolling()) {
icp_sal_CyPollInstance(qat_instance_handles[inst_num], 0);
} else {
pthread_yield();
sched_yield();
}
}
} while (!op_done.flag ||
Expand Down
2 changes: 1 addition & 1 deletion qat_hw_rsa_crt.c
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ int qat_rsa_decrypt_CRT(CpaCyRsaDecryptOpData * dec_op_data, int rsa_len,
icp_sal_CyPollInstance(qat_instance_handles[inst_num], 0);
}
else
pthread_yield();
sched_yield();
} while(op_done.req != op_done.resp);

/* discard results if the 2nd request sending failed */
Expand Down
4 changes: 2 additions & 2 deletions qat_hw_sha3.c
Original file line number Diff line number Diff line change
Expand Up @@ -946,9 +946,9 @@ static int qat_sha3_update(EVP_MD_CTX *ctx, const void *in, size_t len)
loop around and try again until the request
completes and we can continue. */
if ((job_ret = qat_pause_job(op_done.job, ASYNC_STATUS_OK)) == 0)
pthread_yield();
sched_yield();
} else {
pthread_yield();
sched_yield();
}
} while (!op_done.flag ||
QAT_CHK_JOB_RESUMED_UNEXPECTEDLY(job_ret));
Expand Down
12 changes: 6 additions & 6 deletions qat_prov_hw_ecx.c
Original file line number Diff line number Diff line change
Expand Up @@ -332,9 +332,9 @@ void *qat_pkey_ecx_keygen(void *genctx, OSSL_CALLBACK *osslcb,
loop around and try again until the request
completes and we can continue. */
if ((job_ret = qat_pause_job(op_done.job, ASYNC_STATUS_OK)) == 0)
pthread_yield();
sched_yield();
} else {
pthread_yield();
sched_yield();
}
}
while (!op_done.flag ||
Expand Down Expand Up @@ -646,9 +646,9 @@ int qat_pkey_ecx_derive25519(void *vecxctx, unsigned char *secret, size_t *secre
loop around and try again until the request
completes and we can continue. */
if ((job_ret = qat_pause_job(op_done.job, ASYNC_STATUS_OK)) == 0)
pthread_yield();
sched_yield();
} else {
pthread_yield();
sched_yield();
}
}
while (!op_done.flag ||
Expand Down Expand Up @@ -930,9 +930,9 @@ int qat_pkey_ecx_derive448(void *vecxctx, unsigned char *secret, size_t *secretl
loop around and try again until the request
completes and we can continue. */
if ((job_ret = qat_pause_job(op_done.job, ASYNC_STATUS_OK)) == 0)
pthread_yield();
sched_yield();
} else {
pthread_yield();
sched_yield();
}
}
while (!op_done.flag ||
Expand Down
4 changes: 2 additions & 2 deletions qat_prov_sw_ecx.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ void* multibuff_x25519_keygen(void *genctx, OSSL_CALLBACK *osslcb,
loop around and try again until the request
completes and we can continue. */
if ((job_ret = qat_pause_job(job, ASYNC_STATUS_OK)) == 0)
pthread_yield();
sched_yield();
} while (QAT_CHK_JOB_RESUMED_UNEXPECTEDLY(job_ret));

DEBUG("Finished: %p status = %d\n", x25519_keygen_req, sts);
Expand Down Expand Up @@ -300,7 +300,7 @@ int multibuff_x25519_derive(void *vecxctx, unsigned char *secret,
loop around and try again until the request
completes and we can continue. */
if ((job_ret = qat_pause_job(job, ASYNC_STATUS_OK)) == 0)
pthread_yield();
sched_yield();
} while (QAT_CHK_JOB_RESUMED_UNEXPECTEDLY(job_ret));

DEBUG("Finished: %p status = %d\n", x25519_derive_req, sts);
Expand Down
10 changes: 5 additions & 5 deletions qat_sw_ec.c
Original file line number Diff line number Diff line change
Expand Up @@ -857,7 +857,7 @@ int mb_ecdsa_sign(int type, const unsigned char *dgst, int dlen,
* loop around and try again until the request
* completes and we can continue. */
if ((job_ret = qat_pause_job(job, ASYNC_STATUS_OK)) == 0)
pthread_yield();
sched_yield();
} while (QAT_CHK_JOB_RESUMED_UNEXPECTEDLY(job_ret));

DEBUG("Finished: %p status = %d\n", ecdsa_sign_req, sts);
Expand Down Expand Up @@ -1015,7 +1015,7 @@ int mb_ecdsa_sign_setup(EC_KEY *eckey, BN_CTX *ctx_in,
* loop around and try again until the request
* completes and we can continue. */
if ((job_ret = qat_pause_job(job, ASYNC_STATUS_OK)) == 0)
pthread_yield();
sched_yield();
} while (QAT_CHK_JOB_RESUMED_UNEXPECTEDLY(job_ret));

DEBUG("Finished: %p status = %d\n", ecdsa_sign_setup_req, sts);
Expand Down Expand Up @@ -1248,7 +1248,7 @@ ECDSA_SIG *mb_ecdsa_sign_sig(const unsigned char *dgst, int dlen,
* loop around and try again until the request
* completes and we can continue. */
if ((job_ret = qat_pause_job(job, ASYNC_STATUS_OK)) == 0)
pthread_yield();
sched_yield();
} while (QAT_CHK_JOB_RESUMED_UNEXPECTEDLY(job_ret));

DEBUG("Finished: %p status = %d\n", ecdsa_sign_sig_req, sts);
Expand Down Expand Up @@ -1455,7 +1455,7 @@ int mb_ecdh_generate_key(EC_KEY *ecdh)
* loop around and try again until the request
* completes and we can continue. */
if ((job_ret = qat_pause_job(job, ASYNC_STATUS_OK)) == 0)
pthread_yield();
sched_yield();
} while (QAT_CHK_JOB_RESUMED_UNEXPECTEDLY(job_ret));

DEBUG("Finished: %p status = %d\n", ecdh_keygen_req, sts);
Expand Down Expand Up @@ -1637,7 +1637,7 @@ int mb_ecdh_compute_key(unsigned char **out,
* loop around and try again until the request
* completes and we can continue. */
if ((job_ret = qat_pause_job(job, ASYNC_STATUS_OK)) == 0)
pthread_yield();
sched_yield();
} while (QAT_CHK_JOB_RESUMED_UNEXPECTEDLY(job_ret));

DEBUG("Finished: %p status = %d\n", ecdh_compute_req, sts);
Expand Down
4 changes: 2 additions & 2 deletions qat_sw_ecx.c
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ int multibuff_x25519_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey)
loop around and try again until the request
completes and we can continue. */
if ((job_ret = qat_pause_job(job, ASYNC_STATUS_OK)) == 0)
pthread_yield();
sched_yield();
} while (QAT_CHK_JOB_RESUMED_UNEXPECTEDLY(job_ret));

DEBUG("Finished: %p status = %d\n", x25519_keygen_req, sts);
Expand Down Expand Up @@ -447,7 +447,7 @@ int multibuff_x25519_derive(EVP_PKEY_CTX *ctx,
loop around and try again until the request
completes and we can continue. */
if ((job_ret = qat_pause_job(job, ASYNC_STATUS_OK)) == 0)
pthread_yield();
sched_yield();
} while (QAT_CHK_JOB_RESUMED_UNEXPECTEDLY(job_ret));

DEBUG("Finished: %p status = %d\n", x25519_derive_req, sts);
Expand Down
Loading

0 comments on commit d514406

Please sign in to comment.