-
Notifications
You must be signed in to change notification settings - Fork 7
[WIP] Explore BESTWAIT hardware steering for scheduler optimization #57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -35,13 +35,10 @@ void H2K_intpool_int(u32_t intnum, H2K_thread_context *me, u32_t hwtnum, H2K_vmb | |
| H2K_ring_remove(&vmblock->intpool,woken); | ||
| woken->r00 = intnum; | ||
| if (me != NULL) { | ||
| H2K_runlist_remove(me); | ||
| H2K_ready_append(me); | ||
| } else { | ||
| H2K_gp->wait_mask = (u32_t)Q6_R_clrbit_RR(H2K_gp->wait_mask,hwtnum); | ||
| } | ||
| H2K_gp->priomask = (u32_t)Q6_R_clrbit_RR(H2K_gp->priomask,hwtnum); | ||
| highprio_imask(hwtnum); | ||
| H2K_runlist_push(woken); | ||
| H2K_switch(me,woken); | ||
| } | ||
|
|
@@ -88,7 +85,6 @@ int H2K_intpool_wait(u32_t int_ack_num, H2K_thread_context *me) | |
| } | ||
| } | ||
| /* FIXME: check pending intpool interrupts */ | ||
| H2K_runlist_remove(me); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Getting rid of the runlist entirely is a little scary... very cool if we could do that though! |
||
| H2K_ring_append(&vmblock->intpool,me); | ||
| me->status = H2K_STATUS_INTBLOCKED; /* OR INTPOOL_BLOCKED? */ | ||
| me->r00 = (u32_t)-1; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -42,9 +42,9 @@ static inline void H2K_futex_pi_raise(u32_t prio, H2K_id_t destid) | |
| H2K_ready_insert(dest); | ||
| } else if (dest->status == H2K_STATUS_RUNNING) { | ||
| H2K_runlist_set_thread_prio(dest, prio); | ||
| if (H2K_gp->priomask & (1<<dest->hthread)) { | ||
| H2K_raise_lowprio(); | ||
| } | ||
| /* Sync hardware STID.PRIO so BESTWAIT sees the boosted priority | ||
| * immediately -- avoids spurious preemption of the holder. */ | ||
| set_thread_stid_prio(dest->hthread, prio); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should become the "setprio" instruction after the inline after the change, I think? |
||
| /* Need to update lowprio */ | ||
| } else if (dest->status == H2K_STATUS_INTBLOCKED) { | ||
| /* Waiting on interrupt, but we want it to have high priority when it starts up */ | ||
|
|
@@ -92,7 +92,6 @@ s32_t H2K_futex_lock_pi(u32_t *lock, H2K_thread_context *me) | |
| } | ||
| H2K_futex_pi_raise(me->prio,x.dest); | ||
| me->futex_ptr = pa; | ||
| H2K_runlist_remove(me); | ||
| me->r0100 = 0; | ||
| me->status = H2K_STATUS_BLOCKED; | ||
| H2K_futex_hash_add_ring(&H2K_gp->futexhash[FUTEX_HASHVAL(pa)],me); | ||
|
|
@@ -130,8 +129,10 @@ s32_t H2K_futex_unlock_pi(u32_t *lock, H2K_thread_context *me) | |
| H2K_atomic_swap(lock,H2K_id_from_context(ret).raw+1); | ||
| } | ||
| H2K_safemem_unlock(); | ||
| /* Restore my priority */ | ||
| /* Restore priority in software and hardware atomically -- BESTWAIT | ||
| * comparator reads STID.PRIO; without the hardware sync the stale | ||
| * boosted value hides me from the comparator causing a priority inversion. */ | ||
| H2K_runlist_set_thread_prio(me, me->base_prio); | ||
| set_thread_stid_prio(me->hthread, me->base_prio); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This could also be the "setprio" instruction or re-writing our whole STID register |
||
| return (s32_t)H2K_check_sanity_unlock(0); | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -348,10 +348,11 @@ boot_continuation: | |
| SETCONST(H2K_GP,H2K_kg) | ||
|
|
||
| /* Set up rising edge triggered */ | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. probably want to fix the comments. |
||
| TMP = #-1 | ||
| TMP = #0 | ||
| /* Set imask to -1, since we are not lowest priority at boot */ | ||
| /* (other idle threads) */ | ||
| imask = TMP | ||
| TMP = #-1 | ||
| #if ARCHV < 65 | ||
| iel = TMP | ||
| iahl = TMP | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
recommend keeping MAX_PRIO and setting it to 254 or smaller.