Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/opencrypto add locking notes.



details:   https://anonhg.NetBSD.org/src/rev/27196a6dd869
branches:  trunk
changeset: 824466:27196a6dd869
user:      knakahara <knakahara%NetBSD.org@localhost>
date:      Tue Jun 06 01:48:33 2017 +0000

description:
add locking notes.

diffstat:

 sys/opencrypto/cryptodev.h |  16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)

diffs (28 lines):

diff -r 884f52892d4f -r 27196a6dd869 sys/opencrypto/cryptodev.h
--- a/sys/opencrypto/cryptodev.h        Tue Jun 06 01:47:23 2017 +0000
+++ b/sys/opencrypto/cryptodev.h        Tue Jun 06 01:48:33 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cryptodev.h,v 1.35 2017/06/06 01:45:57 knakahara Exp $ */
+/*     $NetBSD: cryptodev.h,v 1.36 2017/06/06 01:48:33 knakahara Exp $ */
 /*     $FreeBSD: src/sys/opencrypto/cryptodev.h,v 1.2.2.6 2003/07/02 17:04:50 sam Exp $        */
 /*     $OpenBSD: cryptodev.h,v 1.33 2002/07/17 23:52:39 art Exp $      */
 
@@ -646,4 +646,18 @@
 #endif
 
 #endif /* _KERNEL */
+/*
+ * Locking notes:
+ * + crypto_drivers itself is protected by crypto_drv_mtx (an adaptive lock)
+ * + crypto_drivers[i] and its all members are protected by
+ *   crypto_drivers[i].cc_lock (a spin lock)
+ *       spin lock as crypto_unblock() can be called in interrupt context
+ * + crp_q and crp_kq are procted by crypto_q_mtx (an adaptive lock)
+ * + crp_ret_q, crp_ret_kq and crypto_exit_flag are protected by
+ *   crypto_ret_q_mtx (a spin lock)
+ *       spin lock as crypto_done() can be called in interrupt context
+ *
+ * Locking order:
+ *     - crypto_q_mtx => crypto_drv_mtx => crypto_drivers[i].cc_lock
+ */
 #endif /* _CRYPTO_CRYPTO_H_ */



Home | Main Index | Thread Index | Old Index