git: kernel - Separate inherited mplocks from td_mplocks and fix

看板DFBSD_commit作者時間15年前 (2010/08/31 04:01), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/1
commit 3933a3ab606b81b57423112e261ca5426deac2e6 Author: Matthew Dillon <dillon@apollo.backplane.com> Date: Mon Aug 30 12:29:06 2010 -0700 kernel - Separate inherited mplocks from td_mplocks and fix a gettoken bug * Separate out td_mpcount into td_xpcount and td_mpcount. td_xpcount is an inherited mpcount. A preempting thread inherits the mpcount on the thread being preempted until it switches out to guarantee that the mplock remains atomic through the preemption (as expected by the poor thread that got preempted). * Fix a serious but hard to reproduce bug in lwkt_gettoken(). This function marks the token reference as being MPSAFE if td_mpcount is non-zero even when the token is not a MPSAFE token. However, until this patch td_mpcount also included inherited mpcounts when one thread preempts another and the inherited mpcounts could go away if the thread blocks or switches, leaving the token unprotected. * Fix a less serious bug where a new token reference was being populated prior to td_toks_stop being incremented, and where an existing token reference was being depopulated after td_toks_stop is decremented. Nothing can race us but switch around the index increment/decrement to protect the slot being operated upon. * Add a ton of assertions in the interrupt, trap, and syscall paths To assert that the mplock, number of tokens, and critcount remain unchanged across driver and other calls. Summary of changes: sys/kern/kern_intr.c | 51 ++++++++++++++++++++++++++++ sys/kern/kern_mplock.c | 56 ++++++++++++++++++------------ sys/kern/kern_shutdown.c | 20 +++++++++-- sys/kern/lwkt_thread.c | 62 +++++++++++++++++---------------- sys/kern/lwkt_token.c | 20 +++++++---- sys/platform/pc32/i386/trap.c | 16 +++++++-- sys/platform/pc64/x86_64/trap.c | 16 +++++++-- sys/platform/vkernel/i386/trap.c | 20 +++++++++-- sys/platform/vkernel64/x86_64/trap.c | 22 ++++++++++-- sys/sys/mplock2.h | 17 ++++++++- sys/sys/thread.h | 11 +++++- 11 files changed, 231 insertions(+), 80 deletions(-) http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/3933a3ab606b81b57423112e261ca5426deac2e6 -- DragonFly BSD source repository
文章代碼(AID): #1CV0u5LQ (DFBSD_commit)