[Linux-hls-cvs] hls/hls hls_debug.c,1.4,1.5 hls_hooks.c,1.6,1.7 hls_sched_ps.c,1.9,1.10 hls_sched_re
Status: Pre-Alpha
Brought to you by:
lucabe
Update of /cvsroot/linux-hls/hls/hls
In directory sc8-pr-cvs1:/tmp/cvs-serv6094/hls
Modified Files:
hls_debug.c hls_hooks.c hls_sched_ps.c hls_sched_res.c
hls_sched_rr.c hls_sched_th.c hls_utils.c
Log Message:
Lot of changes....
- Unbreak the debugging stuff
- Some random cleanups
- Fixes in the RR scheduler (I hope... MAXIMUM_PRIORITY does not seem to be
a valid priority)
- Allow the RES scheduler to be scheduled (there's a fixme: some functions
still have to be properly implemented)
- change Q e T from long long to long in the RES scheduler
- Implement the "rt scheduler" stuff
Index: hls_debug.c
===================================================================
RCS file: /cvsroot/linux-hls/hls/hls/hls_debug.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** hls_debug.c 25 Feb 2003 09:18:52 -0000 1.4
--- hls_debug.c 8 Nov 2003 10:34:31 -0000 1.5
***************
*** 127,131 ****
*/
#if 0
! for (i=0; i<MAXIMUM_PRIORITY; i++) {
if (KiReadySummary & (1<<i)) {
PRLIST_ENTRY ListHead = &KiDispatcherReadyListHead[i];
--- 127,131 ----
*/
#if 0
! for (i=0; i<HLS_MAXIMUM_PRIORITY; i++) {
if (KiReadySummary & (1<<i)) {
PRLIST_ENTRY ListHead = &KiDispatcherReadyListHead[i];
Index: hls_hooks.c
===================================================================
RCS file: /cvsroot/linux-hls/hls/hls/hls_hooks.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** hls_hooks.c 25 Feb 2003 09:18:52 -0000 1.6
--- hls_hooks.c 8 Nov 2003 10:34:31 -0000 1.7
***************
*** 14,17 ****
--- 14,19 ----
#include "hls_internal.h"
+ #include "hls_hooks.h"
+
/* This could be fixed... */
#include "thr.h"
***************
*** 40,45 ****
hls_hard_printk("HLSCreateThreadHook --- WAI = %d [%d]\n", whereami, Thread->pid);
hls_printk("HLSCreateThreadHook --- WAI = %d [%d]\n", whereami, Thread->pid);
- /*
hls_panic("Entering HLSCreateThreadHook with WAI != 0\n");
asm("cli");asm("halt");
*/
--- 42,47 ----
hls_hard_printk("HLSCreateThreadHook --- WAI = %d [%d]\n", whereami, Thread->pid);
hls_printk("HLSCreateThreadHook --- WAI = %d [%d]\n", whereami, Thread->pid);
hls_panic("Entering HLSCreateThreadHook with WAI != 0\n");
+ /*
asm("cli");asm("halt");
*/
***************
*** 143,148 ****
hls_hard_printk("HLSUnblockThreadHook --- WAI = %d [%d]\n", whereami, Thread->pid);
hls_printk("HLSUnblockThreadHook --- WAI = %d [%d]\n", whereami, Thread->pid);
- /*
hls_panic("Entering HLSUnblockThreadHook with WAI != 0\n");
asm("cli");asm("halt");
*/
--- 145,150 ----
hls_hard_printk("HLSUnblockThreadHook --- WAI = %d [%d]\n", whereami, Thread->pid);
hls_printk("HLSUnblockThreadHook --- WAI = %d [%d]\n", whereami, Thread->pid);
hls_panic("Entering HLSUnblockThreadHook with WAI != 0\n");
+ /*
asm("cli");asm("halt");
*/
***************
*** 261,266 ****
hls_hard_printk("HLSExitThreadHook --- WAI = %d [%d]\n", whereami, Thread->pid);
hls_printk("HLSExitThreadHook --- WAI = %d [%d]\n", whereami, Thread->pid);
- /*
hls_panic("Entering HLSExitThreadHook with WAI != 0\n");
asm("cli");asm("halt");
*/
--- 263,268 ----
hls_hard_printk("HLSExitThreadHook --- WAI = %d [%d]\n", whereami, Thread->pid);
hls_printk("HLSExitThreadHook --- WAI = %d [%d]\n", whereami, Thread->pid);
hls_panic("Entering HLSExitThreadHook with WAI != 0\n");
+ /*
asm("cli");asm("halt");
*/
***************
*** 316,321 ****
hls_hard_printk("HLSBlockThreadHook --- WAI = %d [%d]\n", whereami, Thread->pid);
hls_printk("HLSBlockThreadHook --- WAI = %d [%d]\n", whereami, Thread->pid);
- /*
hls_panic("Entering HLSBlockThreadHook with WAI != 0\n");
asm("cli");asm("halt");
*/
--- 318,323 ----
hls_hard_printk("HLSBlockThreadHook --- WAI = %d [%d]\n", whereami, Thread->pid);
hls_printk("HLSBlockThreadHook --- WAI = %d [%d]\n", whereami, Thread->pid);
hls_panic("Entering HLSBlockThreadHook with WAI != 0\n");
+ /*
asm("cli");asm("halt");
*/
***************
*** 353,358 ****
if (t->InState != HLS_Ready) {
! hls_hard_printk("HYPERERROR!!! Strange internal state: %x\n", t->InState);
! hls_printk("HYPERERROR!!! Strange internal state: %x\n", t->InState);
}
t->InState = HLS_Waiting;
--- 355,360 ----
if (t->InState != HLS_Ready) {
! hls_hard_printk("HYPERERROR!!! Strange internal state [%d]: %x\n", Thread->pid, t->InState);
! hls_printk("HYPERERROR!!! Strange internal state [%d]: %x\n", Thread->pid, t->InState);
}
t->InState = HLS_Waiting;
Index: hls_sched_ps.c
===================================================================
RCS file: /cvsroot/linux-hls/hls/hls/hls_sched_ps.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** hls_sched_ps.c 25 Feb 2003 09:18:53 -0000 1.9
--- hls_sched_ps.c 8 Nov 2003 10:34:31 -0000 1.10
***************
*** 593,597 ****
HLSDbgPrint (9, ("(%s) got a message\n",
Inst->Self->Name));
-
switch (m->type) {
case MSG_SETDEFPRI:
--- 593,596 ----
***************
*** 627,633 ****
HLS_ASSERT (IsBVP (Inst, bvp));
{
! struct PS_UD *ud = BVPtoPSUD(bvp);
struct ps_msg_body *body;
body = m->body;
HLS_ASSERT(body);
--- 626,633 ----
HLS_ASSERT (IsBVP (Inst, bvp));
{
! struct PS_UD *ud;
struct ps_msg_body *body;
+ ud = BVPtoPSUD(bvp);
body = m->body;
HLS_ASSERT(body);
***************
*** 675,679 ****
HLS_ASSERT (0);
}
!
return status;
}
--- 675,679 ----
HLS_ASSERT (0);
}
!
return status;
}
Index: hls_sched_res.c
===================================================================
RCS file: /cvsroot/linux-hls/hls/hls/hls_sched_res.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** hls_sched_res.c 25 Feb 2003 09:18:53 -0000 1.10
--- hls_sched_res.c 8 Nov 2003 10:34:31 -0000 1.11
***************
*** 323,327 ****
for (i=0; i<DL_REC_INDEX; i++) {
! DbgPrint ("Time %lld ActualAmount %lld Stolen %lld\n",
DL_RECS[i].Time,
DL_RECS[i].ActualAmount,
--- 323,327 ----
for (i=0; i<DL_REC_INDEX; i++) {
! DbgPrint ("Time %ld ActualAmount %ld Stolen %ld\n",
DL_RECS[i].Time,
DL_RECS[i].ActualAmount,
***************
*** 341,348 ****
--- 341,353 ----
}
+ /* FIXME: This is triggered by hourglass... */
static void RES_T_CallbackRevoke (struct HLS_VPROC *tvp)
{
+ #if 0
// not allowed to revoke from reservation scheduler
HLS_ASSERT (0);
+ #else
+ hls_printk("FIXME: Please implement hls_sched_res:CallbackRemove()");
+ #endif
}
***************
*** 437,445 ****
#endif
! HLSDbgPrint (11, ("(%s) ud->StartTime is %lld, now is %lld\n",
ud->udvp->TopSched->Name,
ud->StartTime, Now));
! HLSDbgPrint (11, ("(%s) deduction starting as %lld but compensating for %lu clock ints\n",
ud->udvp->TopSched->Name,
Deduction, ClockInts));
--- 442,450 ----
#endif
! HLSDbgPrint (11, ("(%s) ud->StartTime is %ld, now is %ld\n",
ud->udvp->TopSched->Name,
ud->StartTime, Now));
! HLSDbgPrint (11, ("(%s) deduction starting as %ld but compensating for %lu clock ints\n",
ud->udvp->TopSched->Name,
Deduction, ClockInts));
***************
*** 473,477 ****
HLS_ASSERT (ud->StartTime != -1);
! HLSDbgPrint (9, ("(%s) deducting %lld from budget; %lld remains\n",
ud->udvp->TopSched->Name,
Deduction, ud->Budget - Deduction));
--- 478,482 ----
HLS_ASSERT (ud->StartTime != -1);
! HLSDbgPrint (9, ("(%s) deducting %ld from budget; %ld remains\n",
ud->udvp->TopSched->Name,
Deduction, ud->Budget - Deduction));
***************
*** 480,484 ****
if (ud->Budget < -((WNT_TIME)ID->TimeIncrement)) {
! hls_printk("(%s) hrm: budget is %lld, less than theoretical minimum of %lld\n",
ud->udvp->TopSched->Name,
ud->Budget, -((WNT_TIME)ID->TimeIncrement));
--- 485,489 ----
if (ud->Budget < -((WNT_TIME)ID->TimeIncrement)) {
! hls_printk("(%s) hrm: budget is %ld, less than theoretical minimum of %ld\n",
ud->udvp->TopSched->Name,
ud->Budget, -((WNT_TIME)ID->TimeIncrement));
***************
*** 544,548 ****
static void ReplenishBudget (struct RES_UD *ud)
{
! HLSDbgPrint (9, ("(%s) now is %lld; replenishing budget to %lld, previously was %lld\n",
ud->udvp->TopSched->Name,
HLSGetCurrentTime (),
--- 549,553 ----
static void ReplenishBudget (struct RES_UD *ud)
{
! HLSDbgPrint (9, ("(%s) now is %ld; replenishing budget to %ld, previously was %ld\n",
ud->udvp->TopSched->Name,
HLSGetCurrentTime (),
***************
*** 604,608 ****
#ifdef HLS_DEBUG
if (Now - ud->Deadline > Inst->TimeIncrement) {
! HLSDbgPrint (4, ("(%s) hrm: replenishing budget at %lld, later than %lu\n",
ud->udvp->TopSched->Name,
Now - ud->Deadline, Inst->TimeIncrement));
--- 609,613 ----
#ifdef HLS_DEBUG
if (Now - ud->Deadline > Inst->TimeIncrement) {
! HLSDbgPrint (4, ("(%s) hrm: replenishing budget at %ld, later than %lu\n",
ud->udvp->TopSched->Name,
Now - ud->Deadline, Inst->TimeIncrement));
***************
*** 636,640 ****
WNT_TIME RelTime = Earliest - Now;
! HLSDbgPrint (9, ("(%s) ResSetTimer: earliest period expiration is in %lld units\n",
Inst->Self->Name, RelTime));
--- 641,645 ----
WNT_TIME RelTime = Earliest - Now;
! HLSDbgPrint (9, ("(%s) ResSetTimer: earliest period expiration is in %ld units\n",
Inst->Self->Name, RelTime));
***************
*** 645,649 ****
HLS_ASSERT (ud->Budget > 0);
RelTime = ud->Budget;
! HLSDbgPrint (9, ("(%s) ResSetTimer: however, running reservation will use up budget in %lld units\n",
Inst->Self->Name, RelTime));
}
--- 650,654 ----
HLS_ASSERT (ud->Budget > 0);
RelTime = ud->Budget;
! HLSDbgPrint (9, ("(%s) ResSetTimer: however, running reservation will use up budget in %ld units\n",
Inst->Self->Name, RelTime));
}
***************
*** 656,660 ****
hls_stop_timer(Inst->Self);
}
! HLSDbgPrint (9, ("(%s) ResSetTimer: setting timer to go off in %lld units\n",
Inst->Self->Name, RelTime));
HLSSetTimer (-RelTime, Inst->Self);
--- 661,665 ----
hls_stop_timer(Inst->Self);
}
! HLSDbgPrint (9, ("(%s) ResSetTimer: setting timer to go off in %ld units\n",
Inst->Self->Name, RelTime));
HLSSetTimer (-RelTime, Inst->Self);
***************
*** 812,816 ****
HLS_ASSERT (res);
! HLSDbgPrint (5, ("(%s) attempting to set reservation parameters to %lld / %lld\n",
Inst->Self->Name, res->Amount, res->Period));
--- 817,821 ----
HLS_ASSERT (res);
! HLSDbgPrint (5, ("(%s) attempting to set reservation parameters to %lu / %lu\n",
Inst->Self->Name, res->Amount, res->Period));
***************
*** 842,851 ****
}
if (res->Period > MAX_RES_PERIOD) {
! HLSDbgPrint (5, ("(%s) rejecting res because period %lld is greater than %lld\n",
Inst->Self->Name, res->Period, MAX_RES_PERIOD));
return HLS_INVALID_PARAMETER;
}
if (res->Period < MIN_RES_PERIOD) {
! HLSDbgPrint (5, ("(%s) rejecting res because period %lld is less than %lld\n",
Inst->Self->Name, res->Period, MIN_RES_PERIOD));
return HLS_INVALID_PARAMETER;
--- 847,856 ----
}
if (res->Period > MAX_RES_PERIOD) {
! HLSDbgPrint (5, ("(%s) rejecting res because period %lu is greater than %lu\n",
Inst->Self->Name, res->Period, MAX_RES_PERIOD));
return HLS_INVALID_PARAMETER;
}
if (res->Period < MIN_RES_PERIOD) {
! HLSDbgPrint (5, ("(%s) rejecting res because period %lu is less than %lu\n",
Inst->Self->Name, res->Period, MIN_RES_PERIOD));
return HLS_INVALID_PARAMETER;
***************
*** 954,958 ****
return HLS_INVALID_PARAMETER;
}
! sscanf(s, "%lld %lld", &res.Amount, &res.Period);
status = BeginRes(Inst, bvp, &res);
}
--- 959,963 ----
return HLS_INVALID_PARAMETER;
}
! sscanf(s, "%lu %lu", &res.Amount, &res.Period);
status = BeginRes(Inst, bvp, &res);
}
Index: hls_sched_rr.c
===================================================================
RCS file: /cvsroot/linux-hls/hls/hls/hls_sched_rr.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** hls_sched_rr.c 25 Feb 2003 09:18:53 -0000 1.11
--- hls_sched_rr.c 8 Nov 2003 10:34:31 -0000 1.12
***************
*** 502,506 ****
while (1) {
! for (i=1; i<MAXIMUM_PRIORITY; i++) {
if (Inst->ReadyMask & (1 << i)) {
if (y == x) {
--- 502,506 ----
while (1) {
! for (i=1; i < HLS_MAXIMUM_PRIORITY; i++) {
if (Inst->ReadyMask & (1 << i)) {
if (y == x) {
***************
*** 928,932 ****
HLS_ASSERT (Inst->ReadyMask & 0x01); // FIXME - WTF?
! for (i=1; i<MAXIMUM_PRIORITY; i++) {
if (Inst->ReadyMask & (1<<i)) {
--- 928,932 ----
HLS_ASSERT (Inst->ReadyMask & 0x01); // FIXME - WTF?
! for (i=1; i < HLS_MAXIMUM_PRIORITY; i++) {
if (Inst->ReadyMask & (1<<i)) {
***************
*** 1082,1086 ****
HLS_ASSERT (ud);
if (m->Pri < 1 ||
! m->Pri > MAXIMUM_PRIORITY) {
HLSDbgPrint (9, ("(%s) oops: pri %d is out of range\n",
Inst->Self->Name, m->Pri));
--- 1082,1086 ----
HLS_ASSERT (ud);
if (m->Pri < 1 ||
! m->Pri > (HLS_MAXIMUM_PRIORITY - 1)) { /* Luca */
HLSDbgPrint (9, ("(%s) oops: pri %d is out of range\n",
Inst->Self->Name, m->Pri));
***************
*** 1171,1175 ****
int i;
! Inst->ReadyList = (LIST_ENTRY *)hls_malloc(sizeof (LIST_ENTRY[MAXIMUM_PRIORITY]));
HLS_ASSERT (Inst->ReadyList);
--- 1171,1175 ----
int i;
! Inst->ReadyList = (LIST_ENTRY *)hls_malloc(sizeof (LIST_ENTRY[HLS_MAXIMUM_PRIORITY]));
HLS_ASSERT (Inst->ReadyList);
***************
*** 1191,1195 ****
Inst->TProcs[i] = NULL;
}
! for (i=0; i<MAXIMUM_PRIORITY; i++) {
INIT_LIST_HEAD(&Inst->ReadyList[i]);
}
--- 1191,1195 ----
Inst->TProcs[i] = NULL;
}
! for (i=0; i < HLS_MAXIMUM_PRIORITY; i++) {
INIT_LIST_HEAD(&Inst->ReadyList[i]);
}
Index: hls_sched_th.c
===================================================================
RCS file: /cvsroot/linux-hls/hls/hls/hls_sched_th.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** hls_sched_th.c 25 Feb 2003 09:18:53 -0000 1.6
--- hls_sched_th.c 8 Nov 2003 10:34:31 -0000 1.7
***************
*** 34,38 ****
// HLS_ASSERT (!HLSProc[vp->Proc].CurrentThread);
!
HLSScheduleThread (Inst->Thread, vp->Proc);
}
--- 34,41 ----
// HLS_ASSERT (!HLSProc[vp->Proc].CurrentThread);
!
! if ((Inst->Thread)->state != 0) {
! hls_printk("Granting CPU to thread with state %ld\n", Inst->Thread->state);
! }
HLSScheduleThread (Inst->Thread, vp->Proc);
}
Index: hls_utils.c
===================================================================
RCS file: /cvsroot/linux-hls/hls/hls/hls_utils.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** hls_utils.c 25 Feb 2003 09:18:53 -0000 1.14
--- hls_utils.c 8 Nov 2003 10:34:31 -0000 1.15
***************
*** 13,16 ****
--- 13,19 ----
#include "thr.h"
+ struct HLS_SCHED_INSTANCE *HLSDefaultSched;
+ struct HLS_SCHED_INSTANCE *hls_rt_sched;
+
int hls_setparam_ascii(struct HLS_SCHED_INSTANCE *inst, char *param)
{
***************
*** 215,221 ****
HLSDefaultSched = p;
if (wasnull) {
! convert_tasks();
}
}
char *hls_instance_name(int i)
--- 218,239 ----
HLSDefaultSched = p;
if (wasnull) {
! hls_convert_tasks();
}
}
+ char *hls_rt_name(void)
+ {
+ if (hls_rt_sched == NULL) {
+ return "";
+ }
+
+ HLSDbgPrint(5, ("RT Scheduler %p: %s\n",
+ hls_rt_sched, hls_rt_sched->Name));
+
+ return hls_rt_sched->Name;
+ }
+ void hls_setrt(void *p)
+ {
+ hls_rt_sched = p;
+ }
char *hls_instance_name(int i)
***************
*** 388,393 ****
#endif
- struct HLS_SCHED_INSTANCE *HLSDefaultSched;
-
#ifdef __INTERNAL_SCHEDULERS__
extern int rr_module_init(void);
--- 406,409 ----
***************
*** 455,458 ****
--- 471,475 ----
#endif
HLSDefaultSched = HLSFP2;
+ hls_rt_sched = HLSFP1;
#endif
}
|