diff options
author | David Gwynne <dlg@cvs.openbsd.org> | 2014-10-22 05:37:55 +0000 |
---|---|---|
committer | David Gwynne <dlg@cvs.openbsd.org> | 2014-10-22 05:37:55 +0000 |
commit | 54c29ef14de47468834da3c421a4515d51f9ce2e (patch) | |
tree | b1b495ba6c3edf4ea62a898f9faefe08165d1837 /sys/crypto/crypto.c | |
parent | e66612e69ec38d1f57481f95da5adb0b0adf25f2 (diff) |
make the crypto taskq protect things at IPL_VM instead of IPL_HIGH.
everything else in crypto.c uses splvm/IPL_VM. it seems this IPL_HIGH
came about because the hand rolled task list and thread that crypto
used to use was converted to workqs, which unconditionally used
IPL_HIGH internally. when it was converted from workqs to tasks it
blindly ported the protection workqs gave.
tested by many via tech@ and snapshots
ok kettenis@
Diffstat (limited to 'sys/crypto/crypto.c')
-rw-r--r-- | sys/crypto/crypto.c | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/sys/crypto/crypto.c b/sys/crypto/crypto.c index ee8bd8dfe41..e56c04b65a8 100644 --- a/sys/crypto/crypto.c +++ b/sys/crypto/crypto.c @@ -1,4 +1,4 @@ -/* $OpenBSD: crypto.c,v 1.68 2014/10/20 00:40:33 dlg Exp $ */ +/* $OpenBSD: crypto.c,v 1.69 2014/10/22 05:37:54 dlg Exp $ */ /* * The author of this code is Angelos D. Keromytis (angelos@cis.upenn.edu) * @@ -453,20 +453,16 @@ void crypto_freereq(struct cryptop *crp) { struct cryptodesc *crd; - int s; if (crp == NULL) return; - s = splvm(); - while ((crd = crp->crp_desc) != NULL) { crp->crp_desc = crd->crd_next; pool_put(&cryptodesc_pool, crd); } pool_put(&cryptop_pool, crp); - splx(s); } /* @@ -477,20 +473,14 @@ crypto_getreq(int num) { struct cryptodesc *crd; struct cryptop *crp; - int s; - s = splvm(); - crp = pool_get(&cryptop_pool, PR_NOWAIT | PR_ZERO); - if (crp == NULL) { - splx(s); + if (crp == NULL) return NULL; - } while (num--) { crd = pool_get(&cryptodesc_pool, PR_NOWAIT | PR_ZERO); if (crd == NULL) { - splx(s); crypto_freereq(crp); return NULL; } @@ -499,19 +489,20 @@ crypto_getreq(int num) crp->crp_desc = crd; } - splx(s); return crp; } void crypto_init(void) { - crypto_taskq = taskq_create("crypto", 1, IPL_HIGH); + crypto_taskq = taskq_create("crypto", 1, IPL_VM); pool_init(&cryptop_pool, sizeof(struct cryptop), 0, 0, 0, "cryptop", NULL); + pool_setipl(&cryptop_pool, IPL_VM); pool_init(&cryptodesc_pool, sizeof(struct cryptodesc), 0, 0, 0, "cryptodesc", NULL); + pool_setipl(&cryptodesc_pool, IPL_VM); } /* |