summaryrefslogtreecommitdiffstats
path: root/sys/opencrypto
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2004-07-22 18:35:43 +0000
committerrwatson <rwatson@FreeBSD.org>2004-07-22 18:35:43 +0000
commit861b3c44169cf75066afaaa69d2ec46483eac929 (patch)
treef7e2beb855def63afc1059aa39f7053e07c81046 /sys/opencrypto
parentd37648bc1fa202ca6ba0cfb549bdd91c0e4d916c (diff)
downloadFreeBSD-src-861b3c44169cf75066afaaa69d2ec46483eac929.zip
FreeBSD-src-861b3c44169cf75066afaaa69d2ec46483eac929.tar.gz
Push acquisition of Giant from fdrop_closed() into fo_close() so that
individual file object implementations can optionally acquire Giant if they require it: - soo_close(): depends on debug.mpsafenet - pipe_close(): Giant not acquired - kqueue_close(): Giant required - vn_close(): Giant required - cryptof_close(): Giant required (conservative) Notes: Giant is still acquired in close() even when closing MPSAFE objects due to kqueue requiring Giant in the calling closef() code. Microbenchmarks indicate that this removal of Giant cuts 3%-3% off of pipe create/destroy pairs from user space with SMP compiled into the kernel. The cryptodev and opencrypto code appears MPSAFE, but I'm unable to test it extensively and so have left Giant over fo_close(). It can probably be removed given some testing and review.
Diffstat (limited to 'sys/opencrypto')
-rw-r--r--sys/opencrypto/cryptodev.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/sys/opencrypto/cryptodev.c b/sys/opencrypto/cryptodev.c
index 9b0da7c..26b2447 100644
--- a/sys/opencrypto/cryptodev.c
+++ b/sys/opencrypto/cryptodev.c
@@ -623,12 +623,19 @@ cryptof_close(struct file *fp, struct thread *td)
struct fcrypt *fcr = fp->f_data;
struct csession *cse;
+ /*
+ * XXXRW: The cryptodev and called code all appears to be
+ * MPSAFE, but I'm not set up to test it. Acquire Giant
+ * for now.
+ */
+ mtx_lock(&Giant);
while ((cse = TAILQ_FIRST(&fcr->csessions))) {
TAILQ_REMOVE(&fcr->csessions, cse, next);
(void)csefree(cse);
}
FREE(fcr, M_XDATA);
fp->f_data = NULL;
+ mtx_unlock(&Giant);
return 0;
}
OpenPOWER on IntegriCloud