diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2023-02-15 23:40:54 +0100 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2023-02-15 23:40:56 +0100 |
commit | cb5e3ca248435f19fce0254987ba894a25611974 (patch) | |
tree | 0a381f24b9d537b10e2079e38a3adeb5da59fcc0 /kern | |
parent | b0c0a49918b6fd5f75cbd7565429a1398ddc80a9 (diff) | |
download | gnumach-cb5e3ca248435f19fce0254987ba894a25611974.tar.gz gnumach-cb5e3ca248435f19fce0254987ba894a25611974.tar.bz2 gnumach-cb5e3ca248435f19fce0254987ba894a25611974.zip |
Document spl levels of locks taken during interrupts
Diffstat (limited to 'kern')
-rw-r--r-- | kern/mach_clock.c | 1 | ||||
-rw-r--r-- | kern/processor.h | 3 | ||||
-rw-r--r-- | kern/sched.h | 4 | ||||
-rw-r--r-- | kern/sched_prim.c | 15 | ||||
-rw-r--r-- | kern/thread.h | 1 |
5 files changed, 15 insertions, 9 deletions
diff --git a/kern/mach_clock.c b/kern/mach_clock.c index ed38c76b..a3656948 100644 --- a/kern/mach_clock.c +++ b/kern/mach_clock.c @@ -119,6 +119,7 @@ MACRO_BEGIN \ } while ((time)->seconds != mtime->check_seconds64); \ MACRO_END +/* Shall be taken at splsched only */ def_simple_lock_data(static, timer_lock) /* lock for ... */ timer_elt_data_t timer_head; /* ordered list of timeouts */ /* (doubles as end-of-list) */ diff --git a/kern/processor.h b/kern/processor.h index abc2e866..17b784a3 100644 --- a/kern/processor.h +++ b/kern/processor.h @@ -56,7 +56,7 @@ struct processor_set { struct run_queue runq; /* runq for this set */ queue_head_t idle_queue; /* idle processors */ int idle_count; /* how many ? */ - decl_simple_lock_data(, idle_lock) /* lock for above */ + decl_simple_lock_data(, idle_lock) /* lock for above, shall be taken at splsched only */ queue_head_t processors; /* all processors here */ int processor_count; /* how many ? */ boolean_t empty; /* true if no processors */ @@ -221,6 +221,7 @@ extern processor_t processor_ptr[NCPUS]; #define pset_ref_lock(pset) simple_lock(&(pset)->ref_lock) #define pset_ref_unlock(pset) simple_unlock(&(pset)->ref_lock) +/* Shall be taken at splsched only */ #define processor_lock(pr) simple_lock(&(pr)->lock) #define processor_unlock(pr) simple_unlock(&(pr)->lock) diff --git a/kern/sched.h b/kern/sched.h index 588e0aa6..07d27ff5 100644 --- a/kern/sched.h +++ b/kern/sched.h @@ -64,7 +64,9 @@ struct run_queue { queue_head_t runq[NRQS]; /* one for each priority */ - decl_simple_lock_data(, lock) /* one lock for all queues */ + decl_simple_lock_data(, lock) /* one lock for all queues, + shall be taken at splsched + only */ int low; /* low queue value */ int count; /* count of threads runable */ }; diff --git a/kern/sched_prim.c b/kern/sched_prim.c index 713d379e..dd0f492b 100644 --- a/kern/sched_prim.c +++ b/kern/sched_prim.c @@ -127,8 +127,9 @@ timer_elt_data_t recompute_priorities_timer; #define NUMQUEUES 1031 +/* Shall be taken at splsched only */ +decl_simple_lock_data(static, wait_lock[NUMQUEUES]) /* Lock for... */ queue_head_t wait_queue[NUMQUEUES]; -decl_simple_lock_data(static, wait_lock[NUMQUEUES]) /* NOTE: we want a small positive integer out of this */ #define wait_hash(event) \ @@ -1251,7 +1252,7 @@ void thread_setrun( */ processor = th->last_processor; if (processor->state == PROCESSOR_IDLE) { - simple_lock(&processor->lock); + processor_lock(processor); simple_lock(&pset->idle_lock); if ((processor->state == PROCESSOR_IDLE) #if MACH_HOST @@ -1264,11 +1265,11 @@ void thread_setrun( processor->next_thread = th; processor->state = PROCESSOR_DISPATCHING; simple_unlock(&pset->idle_lock); - simple_unlock(&processor->lock); + processor_unlock(processor); return; } simple_unlock(&pset->idle_lock); - simple_unlock(&processor->lock); + processor_unlock(processor); } #endif /* HW_FOOTPRINT */ @@ -1309,7 +1310,7 @@ void thread_setrun( * processor here because it may not be the current one. */ if (processor->state == PROCESSOR_IDLE) { - simple_lock(&processor->lock); + processor_lock(processor); pset = processor->processor_set; simple_lock(&pset->idle_lock); if (processor->state == PROCESSOR_IDLE) { @@ -1319,11 +1320,11 @@ void thread_setrun( processor->next_thread = th; processor->state = PROCESSOR_DISPATCHING; simple_unlock(&pset->idle_lock); - simple_unlock(&processor->lock); + processor_unlock(processor); return; } simple_unlock(&pset->idle_lock); - simple_unlock(&processor->lock); + processor_unlock(processor); } rq = &(processor->runq); run_queue_enqueue(rq,th); diff --git a/kern/thread.h b/kern/thread.h index 7252f410..a5abefcc 100644 --- a/kern/thread.h +++ b/kern/thread.h @@ -387,6 +387,7 @@ extern void thread_unfreeze( #define thread_pcb(th) ((th)->pcb) +/* Shall be taken at splsched only */ #define thread_lock(th) simple_lock(&(th)->lock) #define thread_unlock(th) simple_unlock(&(th)->lock) |