git: kernel - Fix very annoying lockup (SMP)

看板DFBSD_commit作者時間15年前 (2011/01/12 07:01), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/1
commit cfaeae2ac9bf2ac78367308f7070d4a11c1680d2 Author: Matthew Dillon <dillon@apollo.backplane.com> Date: Tue Jan 11 14:36:24 2011 -0800 kernel - Fix very annoying lockup (SMP) * Fix an extremely annoying lockup that took a week+ to find. The cpusync code is rather fragile and any for (;;) or while (1) style loops in the kernel can trip it up and cause a deadlock. These loops are careful to call lwkt_process_ipiq() to ensure that cpusync processing occurs. However, there is a race in the LWKT thread migration code where a thread deschedules itself on one cpu and schedules itself on another via a remote ipi. The target cpu expects the thread's TDF_RUNNING state to clear and will loop until that happens. An IPI could sneak itself into the deschedule/lwkt_switch() path and deadlock against a cpusync, preventing the thread from leaving the TDF_RUNNING state. The solution is to ensure that lwkt_process_ipiq() is *NOT* run in the lwkt_switch() path if the calling thread has descheduled itself. * The original bug could be reproduced by running blogbench in one window and a while (1) ps axl shell script in another. * Add DEBUG_PUSH_INFO(msg)/DEBUG_POP_INFO() macros which record (msg) in the globaldata structure as a debugging aid. * Remove unused platform/pc64/x86_64/systimer.c file. The entire contents of this file was #ifdef'd out and its functionality is handled elsewhere by the lapic timer code. * #if 0 out numerous debugging bits but don't remove the code because it is extremely useful for finding lockup conditions. Summary of changes: sys/kern/kern_ktr.c | 4 + sys/kern/lwkt_ipiq.c | 52 ++++++++++++++++ sys/kern/lwkt_thread.c | 48 ++++++++++----- sys/platform/pc32/apic/mpapic.c | 4 + sys/platform/pc32/i386/pmap.c | 2 + sys/platform/pc32/i386/pmap_inval.c | 2 + sys/platform/pc64/apic/mpapic.c | 54 +++++++++++++--- sys/platform/pc64/conf/files | 1 - sys/platform/pc64/x86_64/pmap.c | 2 + sys/platform/pc64/x86_64/pmap_inval.c | 2 + sys/platform/pc64/x86_64/systimer.c | 109 --------------------------------- sys/sys/globaldata.h | 26 ++++++++- 12 files changed, 168 insertions(+), 138 deletions(-) delete mode 100644 sys/platform/pc64/x86_64/systimer.c http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/cfaeae2ac9bf2ac78367308f7070d4a11c1680d2 -- DragonFly BSD source repository
文章代碼(AID): #1DBE4pSg (DFBSD_commit)