linux-hls-cvs Mailing List for Hierarchical Loadable Schedulers (Page 2)
Status: Pre-Alpha
Brought to you by:
lucabe
You can subscribe to this list here.
| 2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(7) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2003 |
Jan
|
Feb
(13) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(3) |
Sep
|
Oct
|
Nov
(14) |
Dec
(9) |
| 2004 |
Jan
|
Feb
|
Mar
|
Apr
(12) |
May
|
Jun
(2) |
Jul
(4) |
Aug
(4) |
Sep
|
Oct
(4) |
Nov
(4) |
Dec
|
| 2005 |
Jan
(4) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(2) |
Sep
|
Oct
|
Nov
|
Dec
|
| 2009 |
Jan
|
Feb
|
Mar
(4) |
Apr
|
May
(2) |
Jun
(7) |
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
| 2010 |
Jan
(1) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
(2) |
Sep
|
Oct
|
Nov
|
Dec
|
| 2011 |
Jan
|
Feb
|
Mar
(2) |
Apr
(1) |
May
(1) |
Jun
(2) |
Jul
(1) |
Aug
(2) |
Sep
|
Oct
|
Nov
|
Dec
|
| 2012 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2013 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(2) |
Oct
|
Nov
(1) |
Dec
(1) |
| 2014 |
Jan
|
Feb
|
Mar
(2) |
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
(2) |
| 2016 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
| 2017 |
Jan
|
Feb
(1) |
Mar
|
Apr
(3) |
May
(2) |
Jun
(2) |
Jul
(3) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Luca A. <lu...@us...> - 2004-06-20 13:14:51
|
Update of /cvsroot/linux-hls/qosman/us In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18837/us Modified Files: Makefile Log Message: - Change default debugging... Index: Makefile =================================================================== RCS file: /cvsroot/linux-hls/qosman/us/Makefile,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** Makefile 21 Feb 2004 13:01:51 -0000 1.1.1.1 --- Makefile 20 Jun 2004 13:14:43 -0000 1.2 *************** *** 5,9 **** LIB_OBJS = clnt-us.o qman-c.o simpleadj.o adj.o pid.o DAEMON_OBJS = srv-us.o prop.o pscompr.o qman-s.o ! DEBUG = -D__PS_DEBUG__ -DQOSDBG -D__ADJ_DEBUG__ CFLAGS = -O2 -Wall -Wstrict-prototypes CPPFLAGS = $(DEBUG) -I$(CBS_DIR)/include $(INCLUDE) --- 5,9 ---- LIB_OBJS = clnt-us.o qman-c.o simpleadj.o adj.o pid.o DAEMON_OBJS = srv-us.o prop.o pscompr.o qman-s.o ! DEBUG = -D__PS_DEBUG__ -DQOSDBG #-D__ADJ_DEBUG__ CFLAGS = -O2 -Wall -Wstrict-prototypes CPPFLAGS = $(DEBUG) -I$(CBS_DIR)/include $(INCLUDE) |
|
From: Luca A. <lu...@us...> - 2004-06-20 13:11:40
|
Update of /cvsroot/linux-hls/cbs/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15683/src Modified Files: cbs.c Log Message: - Better debugging Index: cbs.c =================================================================== RCS file: /cvsroot/linux-hls/cbs/src/cbs.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** cbs.c 9 Apr 2004 13:22:18 -0000 1.2 --- cbs.c 20 Jun 2004 13:11:31 -0000 1.3 *************** *** 24,27 **** --- 24,28 ---- + static unsigned long long int prev_exec_set_time = 0; static unsigned long long int last_update_time = 0; static struct cbs_struct *exec = NULL; *************** *** 357,360 **** --- 358,362 ---- cbs_dispatch(new_exec, time, 0); exec = new_exec; + prev_exec_set_time = time; } } *************** *** 380,385 **** #ifndef __MULTITASK__ if (current != exec->task) { ! sched_warning("CBS WARNING: current (%d) != Exec (%d)!!!\n", ! current->pid, exec->task->pid); } #endif --- 382,388 ---- #ifndef __MULTITASK__ if (current != exec->task) { ! sched_warning("CBS WARNING: current (%d) != Exec (%d) in cbs_postpone() --- %Lu - %Lu = %Lu (%ld)!!!\n", ! current->pid, exec->task->pid, prev_exec_set_time, time, time - prev_exec_set_time, ! clock2us(time - prev_exec_set_time)); } #endif *************** *** 490,494 **** #ifndef __MULTITASK__ if (current != exec->task) { ! sched_warning("CBS WARNING: current (%d) != Exec (%d)!!!\n", current->pid, exec->task->pid); } --- 493,497 ---- #ifndef __MULTITASK__ if (current != exec->task) { ! sched_warning("CBS WARNING: current (%d) != Exec (%d) in sleep_postpone()!!!\n", current->pid, exec->task->pid); } |
|
From: Luca A. <lu...@us...> - 2004-04-09 13:54:50
|
Update of /cvsroot/linux-hls/qosman/demos In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24263 Added Files: mpcore.c mpcore.h txtdemo.c Log Message: As usual, I forgot "cvs add" --- NEW FILE: mpcore.h --- #ifndef __MP_CORE_H__ #define __MP_CORE_H__ struct controls { GtkWidget *prbar; GtkWidget *d_area; GdkRectangle u_area; GdkGC *gc; }; int file_end(void); void file_set_end(void); FILE *file_open(char *fname, ImageDesc *img); struct controls *window_prepare(int w, int h); void frame_display(struct controls *c, ImageDesc *img, unsigned char *b); #endif /* __MP_CORE_H__ */ --- NEW FILE: txtdemo.c --- #include<sys/types.h> #include<sys/wait.h> #include<signal.h> #include<stdio.h> #include<curses.h> #include <local.h> #include "qos.h" #include "req.h" #define Q0 1000 #define T 40000 #define TS (T / 4) #define W 1 extern struct reqactions pidactions; DWORD times[10000]; int global; static void exit_handler(int dummy) { endwin(); printf("The QoS task is exiting...\n"); qtask_unregister(getpid()); exit(0); } void tb(WORD i) { WINDOW *scr; struct sigaction sa; int res; char c; int l; /* TODO: Init */ scr = initscr(); sa.sa_handler = exit_handler; sigemptyset(&sa.sa_mask); sa.sa_flags=0; res = sigaction(SIGQUIT, &sa, NULL); if (res < 0) { perror("SigAction"); exit(-1); } res = sigaction(SIGQUIT, &sa, NULL); if (res < 0) { perror("SigAction"); exit(-1); } res = sigaction(SIGINT, &sa, NULL); if (res < 0) { perror("SigAction"); exit(-1); } res = sigaction(SIGTERM, &sa, NULL); if (res < 0) { perror("SigAction"); exit(-1); } c = '|'; l = 0; for (;;) { int j; /* <Do Something> */ global = 1; while (global != 600000) { j = global; j++; global = j; } switch (c) { case '|': c = '/'; break; case '/': c = '-'; break; case '-': c = '\\'; break; case '\\': c = '|'; break; default: mvwprintw(scr, 5, i * 2 + 5, "Error?"); exit(-1); } mvwprintw(scr, i * 2 + 5, 10, "\t%c\t\t%d\t\t%d", c, l, i); l = qman_task_endcycle(); refresh(); } } int main(int argc, char *argv[]) { struct qtask_attr t; struct qman_attr initparm; ID qt; char name[80]; int dummy; cprintf("Goin' to initialize the QoS Library..."); initparm.psu = 0.1; initparm.rmu = 0.9; /* RM upper bound = 0.9 */ initparm.psq = 1000; if (qman_init(&initparm) < 0) { printf("Error initializing the QoS Library...\n"); exit(-1); } cprintf(" done!\n"); qman_feedback(&pidactions); t.wcet = Q0; t.per = T; t.reduce = T / TS; t.w = W; if (argc > 1) { t.arg = atoi(argv[1]); } else { t.arg = 0; } sprintf(name, "QDemo Task %d", t.arg); t.name = name; t.body = tb; t.model = MM_TASK; qt = qman_task(&t); if (qt == 0) { printf("QoS Task creation failed...\n"); exit(-1); } wait(&dummy); printf("Waited...\n"); for(;;); exit(0); } --- NEW FILE: mpcore.c --- #include <stdio.h> #include <stdlib.h> #include <gtk/gtk.h> #include <mpeg.h> #include "mpcore.h" static GdkPixmap *screen; static int end = 0; int file_end(void) { return end; } void file_set_end(void) { end = 1; } void frame_display(struct controls *c, ImageDesc *img, unsigned char *b) { gdk_draw_rgb_32_image(screen, c->gc, 0, 0, img->Width, img->Height, GDK_RGB_DITHER_MAX, b, img->Width * 4); gtk_widget_draw(GTK_WIDGET(c->d_area), &c->u_area); } static gint delete_event(GtkWidget * widget, GdkEvent * event, gpointer data) { end = 1; return (TRUE); } static gboolean expose_event(GtkWidget * widget, GdkEventExpose * event, gpointer data) { if ((screen != NULL) && (!end)) { gdk_draw_pixmap(widget->window, widget->style->fg_gc[GTK_WIDGET_STATE(widget)], screen, event->area.x, event->area.y, event->area.x, event->area.y, event->area.width, event->area.height); } return TRUE; } static gint configure_event(GtkWidget * widget, GdkEventConfigure * event) { if (!screen) { screen = gdk_pixmap_new(widget->window, widget->allocation.width, widget->allocation.height, -1); gdk_draw_rectangle(screen, widget->style->white_gc, TRUE, 0, 0, widget->allocation.width, widget->allocation.height); } return TRUE; } FILE *file_open(char *fname, ImageDesc *img) { FILE *f; f = fopen(fname, "rb"); if (fname == NULL) { perror("Error opening:"); exit(-1); } SetMPEGOption(MPEG_DITHER, FULL_COLOR_DITHER); if (!OpenMPEG(f, img)) { fprintf(stderr, "OpenMPEG on %s failed\n", fname); exit(-1); } return f; } struct controls *window_prepare(int w, int h) { GdkGC *gc1; GtkWidget *vbox; GtkWidget *hbox; GtkWidget *label; GtkObject *adj2; GtkWidget *window; GdkColor black; GdkColor white; char buff[80]; gint expid, confid; struct controls *c; c = malloc(sizeof(struct controls)); if (c == NULL) { return NULL; } gdk_rgb_init(); gtk_widget_set_default_colormap(gdk_rgb_get_cmap()); gtk_widget_set_default_visual(gdk_rgb_get_visual()); window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_default_size(GTK_WINDOW(window), w, h + 50); vbox = gtk_vbox_new(FALSE, 0); hbox = gtk_hbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(vbox)); adj2 = gtk_adjustment_new(0.0, 0.0, 21.0, 0.1, 1.0, 1.0); c->prbar = gtk_progress_bar_new_with_adjustment(GTK_ADJUSTMENT(adj2)); gtk_box_pack_start(GTK_BOX(vbox), c->prbar, TRUE, TRUE, 0); gtk_widget_show(c->prbar); //drawing area c->d_area = gtk_drawing_area_new(); gtk_drawing_area_size(GTK_DRAWING_AREA(c->d_area), w, h); expid = gtk_signal_connect(GTK_OBJECT(c->d_area), "expose_event", GTK_SIGNAL_FUNC(expose_event), NULL); confid = gtk_signal_connect(GTK_OBJECT(c->d_area), "configure_event", GTK_SIGNAL_FUNC(configure_event), NULL); gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(c->d_area), FALSE, FALSE, 5); gtk_widget_show(c->d_area); sprintf(buff, "QoSlib Demo"); label = gtk_label_new(buff); gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(label), FALSE, FALSE, 5); gtk_widget_show(label); gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(hbox), FALSE, FALSE, 5); gtk_widget_show(hbox); gtk_widget_show(vbox); gtk_widget_show(window); gtk_signal_connect(GTK_OBJECT(window), "delete_event", GTK_SIGNAL_FUNC(delete_event), NULL); c->u_area.x = 0; c->u_area.y = 0; c->u_area.width = c->d_area->allocation.width; c->u_area.height = c->d_area->allocation.height; c->gc = gdk_gc_new(c->d_area->window); gc1 = gdk_gc_new(c->d_area->window); gdk_color_black(gdk_colormap_get_system(), &black); gdk_color_white(gdk_colormap_get_system(), &white); gdk_gc_set_foreground(c->gc, &black); gdk_gc_set_background(c->gc, &white); gdk_gc_set_foreground(gc1, &white); gdk_gc_set_background(gc1, &black); return c; } |
|
From: Luca A. <lu...@us...> - 2004-04-09 13:53:21
|
Update of /cvsroot/linux-hls/qosman/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23177/src Modified Files: adj.c clnt-us.c pid.c prop.c pscompr.c qman-c.c qman-s.c qosport-ks.c simpleadj.c srv-ks.c srv-us.c Log Message: - Some cleanups in the demos - New "text only" demo (will be used to test the pps model) - Interface change (names...) - Fix bug in feeback functions statistics - Resynch with my local tree (too many changes to mention) Index: prop.c =================================================================== RCS file: /cvsroot/linux-hls/qosman/src/prop.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** prop.c 21 Feb 2004 13:01:53 -0000 1.1.1.1 --- prop.c 9 Apr 2004 13:39:57 -0000 1.2 *************** *** 41,45 **** /* This file implements the proportional compression function */ /************************************************************************/ - /* #include <stdlib.h> What is this for??? */ #include <basetype.h> #include <funcs.h> --- 41,44 ---- *************** *** 47,51 **** #include "prop.h" #ifdef __PROP_STATS__ ! #include "stats.h" #endif --- 46,50 ---- #include "prop.h" #ifdef __PROP_STATS__ ! /* #include "stats.h" */ #endif Index: simpleadj.c =================================================================== RCS file: /cvsroot/linux-hls/qosman/src/simpleadj.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** simpleadj.c 21 Feb 2004 13:01:54 -0000 1.1.1.1 --- simpleadj.c 9 Apr 2004 13:39:57 -0000 1.2 *************** *** 46,73 **** #include <funcs.h> ! #include "simpleadj.h" ! ! /* #define __ADJ_DEBUG__ */ /* This is only usefull in a multithreaded environment... */ ! void simpleadj_init(void) { } ! void *simpleadj_create(DWORD q, DWORD desired, DWORD ts, DWORD period) { ! return NULL; } ! void simpleadj_destroy(void *parms) { } ! REAL simpleadj_feedb(void *parms, int l) { ! return 1; } ! void simpleadj_setb(void *parms, REAL band) { } --- 46,84 ---- #include <funcs.h> ! struct feedbk_stat; ! #include "req.h" /* This is only usefull in a multithreaded environment... */ ! static void simpleadj_init(void) { } ! static void *simpleadj_create(DWORD q, DWORD desired, DWORD ts, DWORD period) { ! return NULL; } ! static void simpleadj_destroy(void *parms) { } ! static REAL simpleadj_feedb(void *parms, int l) { ! return 1; } ! static void simpleadj_setb(void *parms, REAL band) ! { ! } ! ! static void simpleadj_setstats(struct feedbk_stat *p, int iden) { } + struct reqactions simpleactions = { + simpleadj_init, + simpleadj_create, + simpleadj_destroy, + simpleadj_setb, + simpleadj_feedb, + simpleadj_setstats + }; Index: qman-c.c =================================================================== RCS file: /cvsroot/linux-hls/qosman/src/qman-c.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** qman-c.c 21 Feb 2004 13:01:54 -0000 1.1.1.1 --- qman-c.c 9 Apr 2004 13:39:57 -0000 1.2 *************** *** 48,52 **** #include "server.h" #include "req.h" - #include "simpleadj.h" #include "qos.h" #include "stats.h" --- 48,51 ---- *************** *** 55,84 **** #define SINGLE - /* - #define QOSDBG - */ - /* For communication between adaptive tasks and the global QoS adapter... */ ! PORT qosport = 0; /* PPS task scheduling quantum */ static DWORD ppsq = 0; ! ! void (*req_init) (void) = simpleadj_init; ! void *(*req_create) (DWORD q, DWORD desired, DWORD maxfb, DWORD period) = ! simpleadj_create; ! void (*req_destroy) (void *parms) = simpleadj_destroy; ! void (*req_setb) (void *parms, REAL band) = simpleadj_setb; ! REAL (*req_feedb) (void *parms, int l) = simpleadj_feedb; ! ! /* This is the function to plug a different feedback function in */ ! void setreq(struct reqactions *p) ! { ! req_init = p->req_init; ! req_create = p->req_create; ! req_destroy = p->req_destroy; ! req_setb = p->req_setb; ! req_feedb = p->req_feedb; ! } /* --- 54,64 ---- #define SINGLE /* For communication between adaptive tasks and the global QoS adapter... */ ! static PORT qosport = 0; /* PPS task scheduling quantum */ static DWORD ppsq = 0; ! static struct reqactions req; ! extern struct reqactions simpleactions; /* *************** *** 86,110 **** * to the QoS Manager Task */ ! void globalfeedbk(ID task, REAL newb) { struct qoscmd cmd; cmd.task = task; ! cmd.newvalue = newb; ! cmd.type = GLOB_QCHANGE; sendtoport(qosport, &cmd); } ! void p_change(ID task, WORD newp) { struct qoscmd cmd; ! cmd.type = P_CHANGE; cmd.task = task; ! cmd.newvalue1 = newp; sendtoport(qosport, &cmd); } void qtask_register(ID task, REAL b, unsigned int w, DWORD p, DWORD dl, DWORD q) { --- 66,114 ---- * to the QoS Manager Task */ ! static void p_change(ID task, WORD newp) { struct qoscmd cmd; + + cmd.type = P_CHANGE; cmd.task = task; ! cmd.newvalue1 = newp; sendtoport(qosport, &cmd); } ! static void q_change(ID task, WORD newq) { struct qoscmd cmd; ! cmd.type = Q_CHANGE; cmd.task = task; ! cmd.newvalue1 = newq; sendtoport(qosport, &cmd); } + static void b_change(ID task, REAL newb) + { + struct qoscmd cmd; + + cmd.type = B_CHANGE; + cmd.task = task; + cmd.newvalue = newb; + + sendtoport(qosport, &cmd); + } + + #ifndef SINGLE + static void globalfeedbk(ID task, REAL newb) + { + struct qoscmd cmd; + cmd.task = task; + cmd.newvalue = newb; + cmd.type = GLOB_QCHANGE; + + sendtoport(qosport, &cmd); + } + #endif + void qtask_register(ID task, REAL b, unsigned int w, DWORD p, DWORD dl, DWORD q) { *************** *** 154,189 **** } - void q_change(ID task, WORD newq) - { - struct qoscmd cmd; - cmd.type = Q_CHANGE; - cmd.task = task; - cmd.newvalue1 = newq; - sendtoport(qosport, &cmd); - } ! void b_change(ID task, REAL newb) { ! struct qoscmd cmd; ! ! cmd.type = B_CHANGE; ! cmd.task = task; ! cmd.newvalue = newb; ! ! sendtoport(qosport, &cmd); } ! int qman_init(struct qmparm *p) { ppsq = p->psq; /* Usefull only for multithreaded environments, like HARTIK */ ! req_init(); - cprintf("Connecting...\n"); qosport = connecttoport("QoS_Port", sizeof(struct qoscmd), O_WRONLY | O_NONBLOCK); - cprintf("Connected!!!\n"); if (qosport < 0) { return -1; --- 158,182 ---- } ! /****************************************************************************/ ! /* Interface Functions */ ! /****************************************************************************/ ! /* This is the function to plug a different feedback function in */ ! void qman_feedback(struct reqactions *p) { ! memcpy(&req, p, sizeof(struct reqactions)); } ! int qman_init(struct qman_attr *p) { ppsq = p->psq; + memcpy(&req, &simpleactions, sizeof(struct reqactions)); /* Usefull only for multithreaded environments, like HARTIK */ ! req.req_init(); qosport = connecttoport("QoS_Port", sizeof(struct qoscmd), O_WRONLY | O_NONBLOCK); if (qosport < 0) { return -1; *************** *** 196,200 **** * Creates a QoS Managed Task */ ! ID qset_addtask(struct qparm * t) { REAL band; --- 189,193 ---- * Creates a QoS Managed Task */ ! ID qman_task(struct qtask_attr *t) { REAL band; *************** *** 205,209 **** newtask = getfreedescriptor(); band = USEC2BAND(t->wcet, t->per); ! #ifdef QOSDBG cprintf("Creating new QoS task with bandwidth %lu ( = %d / %d)", real_to_int(band), t->wcet, t->per); --- 198,202 ---- newtask = getfreedescriptor(); band = USEC2BAND(t->wcet, t->per); ! #ifdef __QOSDBG_CLIENT__ cprintf("Creating new QoS task with bandwidth %lu ( = %d / %d)", real_to_int(band), t->wcet, t->per); *************** *** 221,229 **** /* qos_abort(111); */ } ! #ifdef QOSDBG cprintf(" --- deadline %d\n", drel); #endif /* initial Q, desired late value... */ ! newtask->adj = req_create(t->wcet, 0, drel /* ??? */, t->per); newtask->period = t->per; res = inittask(t->name, t->body, t->arg, t->w, t->wcet, t->per, drel, --- 214,222 ---- /* qos_abort(111); */ } ! #ifdef __QOSDBG_CLIENT__ cprintf(" --- deadline %d\n", drel); #endif /* initial Q, desired late value... */ ! newtask->adj = req.req_create(t->wcet, 0, drel /* ??? */, t->per); newtask->period = t->per; res = inittask(t->name, t->body, t->arg, t->w, t->wcet, t->per, drel, *************** *** 235,239 **** newtask->id = res; ! #ifdef QOSDBG cprintf("Task created and activated!!!\n"); #endif --- 228,232 ---- newtask->id = res; ! #ifdef __QOSDBG_CLIENT__ cprintf("Task created and activated!!!\n"); #endif *************** *** 242,246 **** } ! void qtask_changeperiod(WORD newp) { ID p; --- 235,239 ---- } ! void qman_task_changeperiod(WORD newp) { ID p; *************** *** 251,255 **** } ! void qtask_end(int retvalue) { ID p; --- 244,248 ---- } ! void qman_task_end(int retvalue) { ID p; *************** *** 260,264 **** #if 0 /* TODO!!!! */ set[i].valid = UNVALID; ! req_destroy(set[i].adj); rescale_destroy(set[i].compress); endtask(); --- 253,257 ---- #if 0 /* TODO!!!! */ set[i].valid = UNVALID; ! req.req_destroy(set[i].adj); rescale_destroy(set[i].compress); endtask(); *************** *** 273,277 **** * - go to sleep :) */ ! int qtask_endcycle(void) { int l; --- 266,270 ---- * - go to sleep :) */ ! int qman_task_endcycle(void) { int l; *************** *** 285,313 **** /* First of all, set the compressed bandwidth */ ! #ifdef QOSDBG cprintf("QTask EndCycle (%d): old bandwidth = %lu...\n", myid, real_to_int(oldb)); #endif ! req_setb(myself->adj, oldb); #ifdef SINGLE ! l = howlate(myid) - myself->period; ! #ifdef QOSDBG cprintf(" Scheduling Error: %d\n", l); #endif ! newb = req_feedb(myself->adj, l); ! #ifdef QOSDBG cprintf(" Requested BW (from controller): %lu\n", real_to_int(newb)); #endif b_change(myid, newb); #else ! l = howlate(myid) - myself->period; ! newb = req_feedb(myself->adj, l); globalfeedbk(myid, newb); #endif - // resetcount(); - endinstance(); --- 278,304 ---- /* First of all, set the compressed bandwidth */ ! #ifdef __QOSDBG_CLIENT__ cprintf("QTask EndCycle (%d): old bandwidth = %lu...\n", myid, real_to_int(oldb)); #endif ! req.req_setb(myself->adj, oldb); #ifdef SINGLE ! l = internal_howlate(myid) - myself->period; ! #ifdef __QOSDBG_CLIENT__ cprintf(" Scheduling Error: %d\n", l); #endif ! newb = req.req_feedb(myself->adj, l); ! #ifdef __QOSDBG_CLIENT__ cprintf(" Requested BW (from controller): %lu\n", real_to_int(newb)); #endif b_change(myid, newb); #else ! l = internal_howlate(myid) - myself->period; ! newb = req.req_feedb(myself->adj, l); globalfeedbk(myid, newb); #endif endinstance(); *************** *** 318,322 **** * Creates a new PPS task */ ! ID ps_addtask(struct psparm * t) { ID res; --- 309,313 ---- * Creates a new PPS task */ ! ID qman_pstask(struct pstask_attr *t) { ID res; *************** *** 326,330 **** newtask = getfreedescriptor(); ! #ifdef QOSDBG cprintf("Parameters: Q=%ld, W=%lu", t->quantum, t->w); #endif --- 317,321 ---- newtask = getfreedescriptor(); ! #ifdef __QOSDBG_CLIENT__ cprintf("Parameters: Q=%ld, W=%lu", t->quantum, t->w); #endif *************** *** 343,347 **** } newtask->id = res; ! #ifdef QOSDBG cprintf("Created!!!\n"); #endif --- 334,338 ---- } newtask->id = res; ! #ifdef __QOSDBG_CLIENT__ cprintf("Created!!!\n"); #endif *************** *** 349,350 **** --- 340,356 ---- return res; } + + void qman_setstats(struct feedbk_stat *p, int id) + { + req.req_setstats(p, id); + } + + int qman_howlate(ID task) + { + return internal_howlate(task); + } + int qman_budget(ID task) + { + return internal_budget(task); + } + Index: pid.c =================================================================== RCS file: /cvsroot/linux-hls/qosman/src/pid.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** pid.c 21 Feb 2004 13:01:53 -0000 1.1.1.1 --- pid.c 9 Apr 2004 13:39:57 -0000 1.2 *************** *** 25,35 **** #include "stats.h" #include "req.h" - #include "pid.h" #define MAXADJ 64 - //#define __ADJ_DEBUG__ #define min(a,b) (a < b) ? a : b #ifdef __ADJ_STATS__ /* Statistics... */ --- 25,46 ---- #include "stats.h" #include "req.h" #define MAXADJ 64 #define min(a,b) (a < b) ? a : b + struct pidparm { + int iden; + int progr; + + REAL oldb; + REAL p1; + REAL p2; + int desired; + int ts; + int period; + int oldepsilon; + }; + #ifdef __ADJ_STATS__ /* Statistics... */ *************** *** 38,50 **** static int static_id; - struct reqactions pidactions = { - pid_init, - pid_create, - pid_destroy, - pid_setb, - pid_feedb, - pid_setstats - }; - /* P1 * 1000 and P2 * 1000 */ #define P1 100 --- 49,52 ---- *************** *** 135,138 **** --- 137,141 ---- alpha = real_mul(parms->oldb, real_sum(real_sum(parms->p1, parms->p2), int_to_real(-2))); + #if 0 cprintf("a: %ld=", real_to_int(alpha)); cprintf("(%ld + %ld + %ld (%ld)) * %d\n", real_to_int(parms->p1) *************** *** 140,144 **** real_to_int(real_sum(real_sum(parms->p1, parms->p2), int_to_real(-2))), real_to_int(parms->oldb)); ! /* beta = parms->oldb * (1.0 - parms->p1 * parms->p2); */ beta = real_mul(parms->oldb, real_sum(int_to_real(1), --- 143,147 ---- real_to_int(real_sum(real_sum(parms->p1, parms->p2), int_to_real(-2))), real_to_int(parms->oldb)); ! #endif /* beta = parms->oldb * (1.0 - parms->p1 * parms->p2); */ beta = real_mul(parms->oldb, real_sum(int_to_real(1), *************** *** 148,155 **** --- 151,160 ---- alpha = real_mul(parms->oldb, real_sum(real_sum(parms->p1, parms->p2), int_to_real(-1))); + #if 0 cprintf("a: %ld=", real_to_int(alpha)); cprintf("%ld + %ld + %ld (%ld)\n", real_to_int(parms->p1) , real_to_int(parms->p2), -1, real_sum(real_sum(parms->p1, parms->p2), int_to_real(-1))); + #endif /* beta = parms->oldb * (-parms->p1 * parms->p2); */ *************** *** 199,203 **** #ifdef __ADJ_STATS__ ! if (pidstats != NULL) { pidstats[parms->iden][parms->progr].time = /*qos_time()*/ parms->progr; pidstats[parms->iden][parms->progr].l = epsilon; --- 204,208 ---- #ifdef __ADJ_STATS__ ! if (pidstats[parms->iden] != NULL) { pidstats[parms->iden][parms->progr].time = /*qos_time()*/ parms->progr; pidstats[parms->iden][parms->progr].l = epsilon; *************** *** 228,229 **** --- 233,243 ---- parms->oldb = band; } + + struct reqactions pidactions = { + pid_init, + pid_create, + pid_destroy, + pid_setb, + pid_feedb, + pid_setstats + }; Index: qosport-ks.c =================================================================== RCS file: /cvsroot/linux-hls/qosman/src/qosport-ks.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** qosport-ks.c 21 Feb 2004 13:01:54 -0000 1.1.1.1 --- qosport-ks.c 9 Apr 2004 13:39:57 -0000 1.2 *************** *** 28,36 **** static wait_queue_head_t qos_dev_queue; static ssize_t qosdev_read(struct file *f, char *buf, size_t count, loff_t *pos); static ssize_t qosdev_write(struct file *f, const char *buf, size_t count, loff_t *dummy); static int qosdev_open(struct inode *in, struct file *f); static int qosdev_close(struct inode *in, struct file *f); ! struct file_operations qos_fops = { read: qosdev_read, write: qosdev_write, --- 28,87 ---- static wait_queue_head_t qos_dev_queue; + #if 0 static ssize_t qosdev_read(struct file *f, char *buf, size_t count, loff_t *pos); static ssize_t qosdev_write(struct file *f, const char *buf, size_t count, loff_t *dummy); static int qosdev_open(struct inode *in, struct file *f); static int qosdev_close(struct inode *in, struct file *f); ! #endif ! ! static int available_qos_data(void) ! { ! return (queue_head != queue_tail); ! } ! ! static ssize_t qosdev_read(struct file *f, char *buf, size_t count, loff_t *pos) ! { ! /* No read() on the QoS device */ ! return -1; ! ! } ! ! static ssize_t qosdev_write(struct file *f, const char *buf, size_t count, loff_t *dummy) ! { ! if (count != msgdim) { ! /* FIXME: find a better error code */ ! return -1; ! } ! if ((queue_tail + 1) % MAX_MESSAGES == queue_head) { ! /* Here, we consider the queue as full... */ ! /* FIXME: find a better error code */ ! return -1; ! } ! if (copy_from_user(qos_queue + queue_tail * msgdim, buf, count)) { ! return -EFAULT; ! } ! if (!available_qos_data()) { ! wake_up_interruptible(&qos_dev_queue); ! } ! queue_tail = (queue_tail + 1) % MAX_MESSAGES; ! ! return count; ! } ! ! static int qosdev_open(struct inode *in, struct file *f) ! { ! MOD_INC_USE_COUNT; ! ! return 0; ! } ! ! static int qosdev_close(struct inode *in, struct file *f) ! { ! MOD_DEC_USE_COUNT; ! ! return 0; ! } ! ! static struct file_operations qos_fops = { read: qosdev_read, write: qosdev_write, *************** *** 38,41 **** --- 89,96 ---- release: qosdev_close }; + + + + /* Err... Probably we will need to store the message dimension in * a general way. For now, let's make it simple... *************** *** 75,83 **** } - static int available_qos_data(void) - { - return (queue_head != queue_tail); - } - int receivefromport(PORT port, void *p) { --- 130,133 ---- *************** *** 97,144 **** return 1; } - - static ssize_t qosdev_read(struct file *f, char *buf, size_t count, loff_t *pos) - { - /* No read() on the QoS device */ - return -1; - - } - - - - static ssize_t qosdev_write(struct file *f, const char *buf, size_t count, loff_t *dummy) - { - if (count != msgdim) { - /* FIXME: find a better error code */ - return -1; - } - if ((queue_tail + 1) % MAX_MESSAGES == queue_head) { - /* Here, we consider the queue as full... */ - /* FIXME: find a better error code */ - return -1; - } - if (copy_from_user(qos_queue + queue_tail * msgdim, buf, count)) { - return -EFAULT; - } - if (!available_qos_data()) { - wake_up_interruptible(&qos_dev_queue); - } - queue_tail = (queue_tail + 1) % MAX_MESSAGES; - - return count; - } - - static int qosdev_open(struct inode *in, struct file *f) - { - MOD_INC_USE_COUNT; - - return 0; - } - - static int qosdev_close(struct inode *in, struct file *f) - { - MOD_DEC_USE_COUNT; - - return 0; - } - --- 147,148 ---- Index: pscompr.c =================================================================== RCS file: /cvsroot/linux-hls/qosman/src/pscompr.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** pscompr.c 21 Feb 2004 13:01:54 -0000 1.1.1.1 --- pscompr.c 9 Apr 2004 13:39:57 -0000 1.2 *************** *** 41,50 **** /* This file implements the bandwidth assignment for PPS tasks */ /************************************************************************/ - /* #include <stdlib.h> Check!!! */ #include <basetype.h> #include <funcs.h> #include "ps.h" ! #include "stats.h" #define MAXPPS 64 --- 41,49 ---- /* This file implements the bandwidth assignment for PPS tasks */ /************************************************************************/ #include <basetype.h> #include <funcs.h> #include "ps.h" ! /* #include "stats.h" */ #define MAXPPS 64 *************** *** 54,58 **** #ifdef __PS_STATS__ ! struct taskstat propstats[10000][10]; static int sk = 0; #endif --- 53,57 ---- #ifdef __PS_STATS__ ! static struct taskstat propstats[10000][10]; static int sk = 0; #endif Index: srv-ks.c =================================================================== RCS file: /cvsroot/linux-hls/qosman/src/srv-ks.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** srv-ks.c 21 Feb 2004 13:01:54 -0000 1.1.1.1 --- srv-ks.c 9 Apr 2004 13:39:57 -0000 1.2 *************** *** 27,39 **** #include <cbs.h> - /* - #include <time.h> - #include <scheduler.h> - */ /* FIXME: fill the #includes */ #include <global.h> - //#include "server.h" /* 4 server_init */ - MODULE_LICENSE("GPL"); --- 27,33 ---- *************** *** 52,70 **** int cprintf(char *s, ...) { ! static char buff[1024]; ! va_list parms; ! int result; ! va_start(parms, s); ! result = vsprintf(buff, s, parms); ! va_end(parms); ! printk("%s", buff); ! ! return (result); } void qman_error(const char *s) { ! cprintf("%s\n", s); } /* --- 46,64 ---- int cprintf(char *s, ...) { ! static char buff[1024]; ! va_list parms; ! int result; ! va_start(parms, s); ! result = vsprintf(buff, s, parms); ! va_end(parms); ! printk("%s", buff); ! ! return (result); } void qman_error(const char *s) { ! cprintf("%s\n", s); } /* *************** *** 73,80 **** void qos_abort(int code) { ! /* FIXME: We are a kernel module... WTF should we do here? */ ! cprintf("Aborting... code = %d\n", code); ! ! BUG(); } --- 67,74 ---- void qos_abort(int code) { ! /* FIXME: We are a kernel module... WTF should we do here? */ ! cprintf("Aborting... code = %d\n", code); ! ! BUG(); } *************** *** 87,100 **** struct qtask_global *manager_registertask(void) { ! struct qtask_global *p; ! p = kmalloc(sizeof(struct qtask_global), GFP_ATOMIC); ! return p; } void manager_unregistertask(struct qtask_global *p) { ! kfree(p); } --- 81,94 ---- struct qtask_global *manager_registertask(void) { ! struct qtask_global *p; ! p = kmalloc(sizeof(struct qtask_global), GFP_ATOMIC); ! return p; } void manager_unregistertask(struct qtask_global *p) { ! kfree(p); } *************** *** 108,112 **** DWORD sys_utilization(REAL rmu) { ! return fake_u; } --- 102,106 ---- DWORD sys_utilization(REAL rmu) { ! return fake_u; } Index: clnt-us.c =================================================================== RCS file: /cvsroot/linux-hls/qosman/src/clnt-us.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** clnt-us.c 21 Feb 2004 13:01:53 -0000 1.1.1.1 --- clnt-us.c 9 Apr 2004 13:39:57 -0000 1.2 *************** *** 37,44 **** #include "client.h" - /* - #define QOSDBG - */ - #define MAX_RSV 100 --- 37,40 ---- *************** *** 53,71 **** int cprintf(char *s, ...) { ! char buff[1024]; ! va_list parms; ! int result; ! va_start(parms, s); ! result = vsprintf(buff, s, parms); ! va_end(parms); ! write(logfile, buff, strlen(buff)); ! return (result); } void qman_error(const char *s) { ! cprintf("%s: %s\n", s, strerror(errno)); } --- 49,67 ---- int cprintf(char *s, ...) { ! char buff[1024]; ! va_list parms; ! int result; ! va_start(parms, s); ! result = vsprintf(buff, s, parms); ! va_end(parms); ! write(logfile, buff, strlen(buff)); ! return (result); } void qman_error(const char *s) { ! cprintf("%s: %s\n", s, strerror(errno)); } *************** *** 80,84 **** struct qtask_local *getfreedescriptor(void) { ! return &localdescr; } --- 76,80 ---- struct qtask_local *getfreedescriptor(void) { ! return &localdescr; } *************** *** 89,101 **** struct qtask_local *getdescr(void) { ! return &localdescr; } ID currenttask(void) { ! struct qtask_local *p; ! p = getdescr(); ! return p->id; } --- 85,97 ---- struct qtask_local *getdescr(void) { ! return &localdescr; } ID currenttask(void) { ! struct qtask_local *p; ! p = getdescr(); ! return p->id; } *************** *** 105,175 **** */ ID inittask(char *name, void (*body) (WORD), ! WORD arg, unsigned int w, DWORD q, DWORD period, DWORD drel, BYTE model) { ! pid_t pid; ! int res; ! struct sched_param sp; ! struct cbs_param cs; ! struct qtask_local *myself; #ifdef QOSDBG ! cprintf(" Creatin' task with period...%d\n", period); #endif ! pid = fork(); ! if (pid < 0) { ! qman_error("Cannot fork task!!!\n"); ! return NULLID; ! } ! if (pid == 0) { ! struct sigaction sa; ! struct itimerval it; /* Remember: My ID is my PID... */ ! qtask_register(getpid(), USEC2BAND(q, period), w, period, drel, q); ! /* Make periodic... */ ! /* We must setup a periodic signal (setitimer)*/ ! sa.sa_handler = activation_handler; ! sigemptyset(&sa.sa_mask); ! sa.sa_flags=0; ! res = sigaction(SIGALRM, &sa, NULL); ! it.it_interval.tv_sec = 0; ! it.it_interval.tv_usec = period; ! it.it_value.tv_sec = 0; ! it.it_value.tv_usec = period; ! res = setitimer(ITIMER_REAL, &it, NULL); ! if (res < 0) { ! qman_error("ITimerSet"); ! exit(-1); ! } ! myself = getdescr(); ! myself->id = getpid(); ! cprintf(" In child..."); ! body(arg); ! /* We should not arrive here... */ ! cprintf(" Task finished...\n"); ! qtask_unregister(getpid()); ! exit(0); ! } ! /* Here, we must transform the child in a CBS guy */ ! sp.sched_size = sizeof(struct cbs_param); ! sp.sched_p = &cs; ! cs.signature = CBS_SIGNATURE; ! cs.max_budget = q; ! cs.period = drel; ! res = sched_setscheduler(pid, SCHED_CBS, &sp); ! if (res < 0) { ! cprintf("Cannot create the CPU reserve for task %s!!!\n", name); ! return NULLID; ! } ! return pid; } --- 101,174 ---- */ ID inittask(char *name, void (*body) (WORD), ! WORD arg, unsigned int w, DWORD q, DWORD period, DWORD drel, BYTE model) { ! pid_t pid; ! int res; ! struct sched_param sp; ! struct cbs_param cs; ! struct qtask_local *myself; #ifdef QOSDBG ! cprintf(" Creatin' task with period...%d\n", period); #endif ! pid = fork(); ! if (pid < 0) { ! qman_error("Cannot fork task!!!\n"); ! return NULLID; ! } ! if (pid == 0) { ! struct sigaction sa; ! struct itimerval it; /* Remember: My ID is my PID... */ ! qtask_register(getpid(), USEC2BAND(q, period), w, period, drel, q); ! if (model == MM_TASK) { ! /* Make periodic... */ ! /* We must setup a periodic signal (setitimer)*/ ! sa.sa_handler = activation_handler; ! sigemptyset(&sa.sa_mask); ! sa.sa_flags=0; ! res = sigaction(SIGALRM, &sa, NULL); ! it.it_interval.tv_sec = 0; ! it.it_interval.tv_usec = period; ! it.it_value.tv_sec = 0; ! it.it_value.tv_usec = period; ! res = setitimer(ITIMER_REAL, &it, NULL); ! if (res < 0) { ! qman_error("ITimerSet"); ! /* FIXME: Maybe return error? */ ! exit(-1); ! } ! } ! myself = getdescr(); ! myself->id = getpid(); ! cprintf(" In child..."); ! body(arg); ! /* We should not arrive here... */ ! cprintf(" Task finished...\n"); ! qtask_unregister(getpid()); ! exit(0); ! } ! /* Here, we must transform the child in a CBS guy */ ! sp.sched_size = sizeof(struct cbs_param); ! sp.sched_p = &cs; ! cs.signature = CBS_SIGNATURE; ! cs.max_budget = q; ! cs.period = drel; ! res = sched_setscheduler(pid, SCHED_CBS, &sp); ! if (res < 0) { ! cprintf("Cannot create the CPU reserve for task %s!!!\n", name); ! return NULLID; ! } ! return pid; } *************** *** 177,231 **** DWORD q) { ! pid_t pid; ! // struct timespec rq, z; ! unsigned long int t; ! int res; ! struct qtask_local *myself; ! struct sched_param sp; ! struct cbs_param cs; #ifdef QOSDBG ! cprintf("Creatin' PS task\n"); #endif ! /* Create the task with a long period (like a bkg task...) */ ! t = 1000000; ! pid = fork(); ! if (pid < 0) { ! qman_error("Cannot fork task!!!\n"); ! ! return NULLID; ! } ! if (pid == 0) { ! myself = getdescr(); ! myself->id = getpid(); ! pstask_register(getpid(), weight, q); ! body(arg); ! /* We should not arrive here... */ ! cprintf("PS task finished...\n"); ! pstask_unregister(getpid()); ! exit(0); ! } ! /* Here, we must transform the child in a CBS guy */ ! sp.sched_size = sizeof(struct cbs_param); ! sp.sched_p = &cs; ! cs.signature = CBS_SIGNATURE; ! cs.max_budget = q; ! cs.period = t; ! res = sched_setscheduler(pid, SCHED_CBS, &sp); ! if (res < 0) { ! cprintf("Cannot create the CPU reserve for task %s!!!\n", name); ! return NULLID; ! } ! return pid; } int endinstance(void) { ! return pause(); } --- 176,230 ---- DWORD q) { ! pid_t pid; ! unsigned long int t; ! int res; ! struct qtask_local *myself; ! struct sched_param sp; ! struct cbs_param cs; #ifdef QOSDBG ! cprintf("Creatin' PS task\n"); #endif ! /* Create the task with a long period (like a bkg task...) */ ! t = 1000000; ! pid = fork(); ! if (pid < 0) { ! qman_error("Cannot fork task!!!\n"); ! return NULLID; ! } ! if (pid == 0) { ! myself = getdescr(); ! myself->id = getpid(); ! pstask_register(getpid(), weight, q); ! ! body(arg); ! /* We should not arrive here... */ ! cprintf("PS task finished...\n"); ! pstask_unregister(getpid()); ! exit(0); ! } ! /* Here, we must transform the child in a CBS guy */ ! sp.sched_size = sizeof(struct cbs_param); ! sp.sched_p = &cs; ! cs.signature = CBS_SIGNATURE; ! cs.max_budget = q; ! cs.period = t; ! res = sched_setscheduler(pid, SCHED_CBS, &sp); ! if (res < 0) { ! cprintf("Cannot create the CPU reserve for task %s!!!\n", name); ! return NULLID; ! } ! ! return pid; } int endinstance(void) { ! return pause(); } *************** *** 235,296 **** REAL glob_getband(ID task) { ! int res; ! struct sched_param sp; ! struct cbs_error ce; ! DWORD q, t; ! REAL band; ! int id; ! id = currenttask(); ! /* We need some way to get the current parameters of this task... */ ! sp.sched_size = sizeof(struct cbs_error); ! sp.sched_p = &ce; ! ce.signature = E_SIGNATURE; ! res = sched_getparam(getpid(), &sp); ! if (res < 0) { ! cprintf("Cannot get the scheduling parameters for task %d!!!\n", ! getpid()); ! return 0; ! } ! q = ce.max_budget; ! t = ce.period; ! band = USEC2BAND(q, t); ! return band; } PORT connecttoport(char *name, int size, int mode) { ! int res = -1; ! char localname[256]; ! sprintf(localname, "/tmp/%s", name); #ifdef QOSDBG ! cprintf("Connecting to the QoS server through port %s\n", name); #endif ! res = open(localname, mode); #ifdef QOSDBG ! cprintf("%s --> ", localname); #endif ! if (res < 0) { ! return -1; ! } #ifdef QOSDBG ! cprintf("Connected\n"); #endif ! msgdim = size; ! return res; /* In Linux, this is not used... */ } int sendtoport(PORT port, void *p) { ! write(port, p, msgdim); ! return 1; } --- 234,295 ---- REAL glob_getband(ID task) { ! int res; ! struct sched_param sp; ! struct cbs_error ce; ! DWORD q, t; ! REAL band; ! int id; ! id = currenttask(); ! /* We need some way to get the current parameters of this task... */ ! sp.sched_size = sizeof(struct cbs_error); ! sp.sched_p = &ce; ! ce.signature = E_SIGNATURE; ! res = sched_getparam(getpid(), &sp); ! if (res < 0) { ! cprintf("Cannot get the scheduling parameters for task %d!!!\n", ! getpid()); ! return 0; ! } ! q = ce.max_budget; ! t = ce.period; ! band = USEC2BAND(q, t); ! return band; } PORT connecttoport(char *name, int size, int mode) { ! int res = -1; ! char localname[256]; ! sprintf(localname, "/tmp/%s", name); #ifdef QOSDBG ! cprintf("Connecting to the QoS server through port %s\n", name); #endif ! res = open(localname, mode); #ifdef QOSDBG ! cprintf("%s --> ", localname); #endif ! if (res < 0) { ! return -1; ! } #ifdef QOSDBG ! cprintf("Connected\n"); #endif ! msgdim = size; ! return res; /* In Linux, this is not used... */ } int sendtoport(PORT port, void *p) { ! write(port, p, msgdim); ! return 1; } *************** *** 300,339 **** int qostask_init(int p) { ! return 1; } ! int howlate(ID dummy) { ! int res; ! struct sched_param sp; ! struct cbs_error ce; ! sp.sched_size = sizeof(struct cbs_error); ! sp.sched_p = &ce; ! ce.signature = E_SIGNATURE; ! res = sched_getparam(getpid(), &sp); ! if (res < 0) { ! cprintf("Cannot get the scheduling error!!!\n"); ! return -1; ! } ! return (int)ce.e; } ! int getq(ID dummy) { ! int res; ! struct sched_param sp; ! struct cbs_error ce; ! sp.sched_size = sizeof(struct cbs_error); ! sp.sched_p = &ce; ! ce.signature = E_SIGNATURE; ! res = sched_getparam(getpid(), &sp); ! if (res < 0) { ! cprintf("Cannot get the scheduling error!!!\n"); ! return -1; ! } ! return (int)ce.max_budget; } --- 299,338 ---- int qostask_init(int p) { ! return 1; } ! int internal_howlate(ID dummy) { ! int res; ! struct sched_param sp; ! struct cbs_error ce; ! sp.sched_size = sizeof(struct cbs_error); ! sp.sched_p = &ce; ! ce.signature = E_SIGNATURE; ! res = sched_getparam(getpid(), &sp); ! if (res < 0) { ! cprintf("Cannot get the scheduling error!!!\n"); ! return -1; ! } ! return (int)ce.e; } ! int internal_budget(ID dummy) { ! int res; ! struct sched_param sp; ! struct cbs_error ce; ! sp.sched_size = sizeof(struct cbs_error); ! sp.sched_p = &ce; ! ce.signature = E_SIGNATURE; ! res = sched_getparam(getpid(), &sp); ! if (res < 0) { ! cprintf("Cannot get the scheduling error!!!\n"); ! return -1; ! } ! return (int)ce.max_budget; } Index: srv-us.c =================================================================== RCS file: /cvsroot/linux-hls/qosman/src/srv-us.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** srv-us.c 21 Feb 2004 13:01:54 -0000 1.1.1.1 --- srv-us.c 9 Apr 2004 13:39:57 -0000 1.2 *************** *** 35,40 **** #include <cbs.h> - //#include "server.h" /* 4 server_init */ - #define CSERV 1000000 #define TSERV 10000000 --- 35,38 ---- Index: qman-s.c =================================================================== RCS file: /cvsroot/linux-hls/qosman/src/qman-s.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** qman-s.c 21 Feb 2004 13:01:54 -0000 1.1.1.1 --- qman-s.c 9 Apr 2004 13:39:57 -0000 1.2 *************** *** 26,37 **** static REAL rmu = 0; ! struct qtask_global *qosq; /* task set */ ! void (*rescale_init) (REAL fbw) = prop_init; ! void *(*rescale_create) (REAL u, unsigned int w) = prop_create; ! void (*rescale_destroy) (void *p) = prop_destroy; ! REAL (*rescale_getband) (void *p) = prop_getband; ! void (*rescale_setband) (void *p, REAL u) = prop_setband; ! void (*rescale_compress) (void) = prop_compress; /* --- 26,37 ---- static REAL rmu = 0; ! static struct qtask_global *qosq; /* task set */ ! static void (*rescale_init) (REAL fbw) = prop_init; ! static void *(*rescale_create) (REAL u, unsigned int w) = prop_create; ! static void (*rescale_destroy) (void *p) = prop_destroy; ! static REAL (*rescale_getband) (void *p) = prop_getband; ! static void (*rescale_setband) (void *p, REAL u) = prop_setband; ! static void (*rescale_compress) (void) = prop_compress; /* *************** *** 39,43 **** * action runs... */ ! void adjustparms(void) { struct qtask_global *p; --- 39,43 ---- * action runs... */ ! static void adjustparms(void) { struct qtask_global *p; *************** *** 48,52 **** p->oldq = p->q; #ifdef QOSDBG ! cprintf(" Task %d: Changin' Q from %lu", p->id, p->q); #endif p->q = BAND2CAPACITY(p->drel, rescale_getband(p->compress)); --- 48,52 ---- p->oldq = p->q; #ifdef QOSDBG ! cprintf(" Task %d: Changin' Q from %lu", p->id, p->q); #endif p->q = BAND2CAPACITY(p->drel, rescale_getband(p->compress)); Index: adj.c =================================================================== RCS file: /cvsroot/linux-hls/qosman/src/adj.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** adj.c 21 Feb 2004 13:01:53 -0000 1.1.1.1 --- adj.c 9 Apr 2004 13:39:57 -0000 1.2 *************** *** 48,58 **** #include "stats.h" #include "req.h" - #include "adj.h" #define MAXADJ 64 - //#define __ADJ_DEBUG__ #define min(a,b) (a < b) ? a : b #ifdef __ADJ_STATS__ /* Statistics... */ --- 48,71 ---- #include "stats.h" #include "req.h" #define MAXADJ 64 #define min(a,b) (a < b) ? a : b + struct adjparm { + int iden; + int progr; + + int busy; + REAL oldb; + REAL b; + REAL incr; + int desired; + REAL max; + int period; + REAL acc; + }; + + #ifdef __ADJ_STATS__ /* Statistics... */ *************** *** 61,73 **** static int static_id; - struct reqactions adjactions = { - adj_init, - adj_create, - adj_destroy, - adj_setb, - adj_feedb, - adj_setstats - }; - /* * Inits the feeedback function environment... --- 74,77 ---- *************** *** 90,94 **** } adjstats[i] = p; ! #endif __ADJ_STATS__ } --- 94,98 ---- } adjstats[i] = p; ! #endif /* __ADJ_STATS__ */ } *************** *** 98,118 **** void *adj_create(DWORD q, DWORD desired, DWORD ts, DWORD period) { ! struct adjparm *parms; ! parms = qos_alloc(sizeof(struct adjparm)); ! parms->b = USEC2BAND(q, period); #ifdef __ADJ_DEBUG__ ! cprintf(" Creating ADJ Controller: b = %f\n", parms->b); #endif ! parms->oldb = parms->b; ! parms->incr = 20 * parms->b; ! parms->desired = desired; ! parms->max = USEC2BAND(q, ts); /* FIXME: How to set the max value? */ ! parms->period = period; ! parms->acc = 0; ! parms->iden = static_id++; ! parms->progr = 0; ! return parms; } --- 102,122 ---- void *adj_create(DWORD q, DWORD desired, DWORD ts, DWORD period) { ! struct adjparm *parms; ! parms = qos_alloc(sizeof(struct adjparm)); ! parms->b = USEC2BAND(q, period); #ifdef __ADJ_DEBUG__ ! cprintf(" Creating ADJ Controller: b = %f\n", parms->b); #endif ! parms->oldb = parms->b; ! parms->incr = 20 * parms->b; ! parms->desired = desired; ! parms->max = USEC2BAND(q, ts); /* FIXME: How to set the max value? */ ! parms->period = period; ! parms->acc = 0; ! parms->iden = static_id++; ! parms->progr = 0; ! return parms; } *************** *** 122,128 **** void adj_destroy(void *p) { ! struct adjparm *parms = (struct adjparm *) p; ! qos_free(parms); } --- 126,132 ---- void adj_destroy(void *p) { ! struct adjparm *parms = (struct adjparm *) p; ! qos_free(parms); } *************** *** 132,195 **** REAL adj_feedb(void *p, int l) { ! struct adjparm *parms = (struct adjparm *) p; ! REAL newb; #ifdef __ADJ_DEBUG__ ! cprintf(" Period: %d --- Old BW: %lu --- err: %d --- BW: %lu\n", ! parms->period, real_to_int(parms->oldb), ! l - parms->desired, real_to_int(parms->b)); #endif /* newb = parms->oldb + ((l - parms->desired) * parms->b) / parms->period; */ /* WHAT A MESS!!! Use some helping variables... */ ! newb = real_sum(parms->oldb, ! real_int_div((real_int_mul(parms->b, (l - parms->desired))), ! parms->period)); #ifdef __ADJ_DEBUG__ ! cprintf(" Proportional BW: %lu\n", real_to_int(newb)); #endif ! if (l == parms->desired) { ! if (parms->acc >= real_int_div(parms->incr, 1)) { ! REAL tmp; ! tmp = real_sub(parms->acc, real_int_div(parms->incr, 1)); ! parms->acc = tmp; ! } else { ! parms->acc = 0; ! } } else { ! REAL tmp; ! ! tmp = real_sum(parms->acc, parms->incr); ! parms->acc = tmp; } #ifdef __ADJ_DEBUG__ ! cprintf(" Accumulated value: %lu\n", real_to_int(parms->acc)); #endif ! /* Saturation */ ! if (newb > parms->max) { ! newb = parms->max; ! } #ifdef __ADJ_STATS__ ! /* FIXME */ ! if (adjstats != NULL) { ! adjstats[parms->iden][parms->progr].time = /*qos_time()*/ parms->progr; ! adjstats[parms->iden][parms->progr].l = l; ! adjstats[parms->iden][parms->progr].band = newb; ! adjstats[parms->iden][parms->progr].fval[0] = parms->oldb; ! adjstats[parms->iden][parms->progr].fval[1] = ! (parms->b * (l - parms->desired)) / parms->period; ! adjstats[parms->iden][parms->progr].fval[2] = parms->acc; ! adjstats[parms->iden][parms->progr++].q = ! BAND2CAPACITY(parms->period, newb); ! } #endif ! parms->oldb = newb; ! return newb; } --- 136,199 ---- REAL adj_feedb(void *p, int l) { ! struct adjparm *parms = (struct adjparm *) p; ! REAL newb; #ifdef __ADJ_DEBUG__ ! cprintf(" Period: %d --- Old BW: %lu --- err: %d --- BW: %lu\n", ! parms->period, real_to_int(parms->oldb), ! l - parms->desired, real_to_int(parms->b)); #endif /* newb = parms->oldb + ((l - parms->desired) * parms->b) / parms->period; */ /* WHAT A MESS!!! Use some helping variables... */ ! newb = real_sum(parms->oldb, ! real_int_div((real_int_mul(parms->b, (l - parms->desired))), ! parms->period)); #ifdef __ADJ_DEBUG__ ! cprintf(" Proportional BW: %lu\n", real_to_int(newb)); #endif ! if (l == parms->desired) { ! if (parms->acc >= real_int_div(parms->incr, 1)) { ! REAL tmp; ! tmp = real_sub(parms->acc, real_int_div(parms->incr, 1)); ! parms->acc = tmp; } else { ! parms->acc = 0; } + } else { + REAL tmp; + + tmp = real_sum(parms->acc, parms->incr); + parms->acc = tmp; + } #ifdef __ADJ_DEBUG__ ! cprintf(" Accumulated value: %lu\n", real_to_int(parms->acc)); #endif ! /* Saturation */ ! if (newb > parms->max) { ! newb = parms->max; ! } #ifdef __ADJ_STATS__ ! /* FIXME */ ! if (adjstats[parms->iden] != NULL) { ! adjstats[parms->iden][parms->progr].time = /*qos_time()*/ parms->progr; ! adjstats[parms->iden][parms->progr].l = l; ! adjstats[parms->iden][parms->progr].band = newb; ! adjstats[parms->iden][parms->progr].fval[0] = parms->oldb; ! adjstats[parms->iden][parms->progr].fval[1] = ! (parms->b * (l - parms->desired)) / parms->period; ! adjstats[parms->iden][parms->progr].fval[2] = parms->acc; ! adjstats[parms->iden][parms->progr++].q = ! BAND2CAPACITY(parms->period, newb); ! } #endif ! parms->oldb = newb; ! return newb; } *************** *** 199,204 **** void adj_setb(void *p, REAL band) { ! struct adjparm *parms = (struct adjparm *) p; ! parms->oldb = band; } --- 203,217 ---- void adj_setb(void *p, REAL band) { ! struct adjparm *parms = (struct adjparm *) p; ! parms->oldb = band; } + + struct reqactions adjactions = { + adj_init, + adj_create, + adj_destroy, + adj_setb, + adj_feedb, + adj_setstats + }; |
|
From: Luca A. <lu...@us...> - 2004-04-09 13:53:21
|
Update of /cvsroot/linux-hls/qosman/demos In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23177/demos Modified Files: Makefile mpdemo.c ppsdemo.c qtest.c test1.c Log Message: - Some cleanups in the demos - New "text only" demo (will be used to test the pps model) - Interface change (names...) - Fix bug in feeback functions statistics - Resynch with my local tree (too many changes to mention) Index: qtest.c =================================================================== RCS file: /cvsroot/linux-hls/qosman/demos/qtest.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** qtest.c 21 Feb 2004 13:01:52 -0000 1.1.1.1 --- qtest.c 9 Apr 2004 13:39:56 -0000 1.2 *************** *** 32,35 **** --- 32,37 ---- */ + #include<sys/types.h> + #include<sys/wait.h> #include<stdio.h> *************** *** 46,52 **** #include "qos.h" #include "req.h" - #include "adj.h" - #include "pid.h" extern TASK mpbody(WORD id); int ac; --- 48,53 ---- #include "qos.h" #include "req.h" + extern struct reqactions pidactions; extern TASK mpbody(WORD id); int ac; *************** *** 68,76 **** int main(int argc, char *argv[]) { ! struct qparm t; ! struct qmparm initparm; ID qt1, qt2; char name[80]; int i; ac = argc; --- 69,78 ---- int main(int argc, char *argv[]) { ! struct qtask_attr t; ! struct qman_attr initparm; ID qt1, qt2; char name[80]; int i; + int dummy; ac = argc; *************** *** 89,93 **** cprintf(" done!\n"); /* setreq(&adjactions); */ ! setreq(&pidactions); t.wcet = 1000; t.per = 33000; --- 91,95 ---- cprintf(" done!\n"); /* setreq(&adjactions); */ ! qman_feedback(&pidactions); t.wcet = 1000; t.per = 33000; *************** *** 98,103 **** t.name = name; t.body = mpbody; ! qt1 = qset_addtask(&t); if (qt1 == 0) { printf("QoS Task creation failed...\n"); --- 100,106 ---- t.name = name; t.body = mpbody; + t.model = MM_TASK; ! qt1 = qman_task(&t); if (qt1 == 0) { printf("QoS Task creation failed...\n"); *************** *** 113,118 **** t.name = name; t.body = mpbody; ! qt2 = qset_addtask(&t); if (qt2 == 0) { printf("QoS Task creation failed...\n"); --- 116,122 ---- t.name = name; t.body = mpbody; + t.model = MM_TASK; ! qt2 = qman_task(&t); if (qt2 == 0) { printf("QoS Task creation failed...\n"); *************** *** 122,127 **** printf("Waiting...\n"); ! for (;;); ! sleep(20); exit(0); --- 126,131 ---- printf("Waiting...\n"); ! wait(&dummy); wait(&dummy); ! sleep(2); exit(0); Index: Makefile =================================================================== RCS file: /cvsroot/linux-hls/qosman/demos/Makefile,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** Makefile 21 Feb 2004 13:01:51 -0000 1.1.1.1 --- Makefile 9 Apr 2004 13:39:56 -0000 1.2 *************** *** 1,12 **** - #Makefile for rk kernel modules - QOS = qos - LINUXDIR=../../linux - LINUXINCLUDE=$(LINUXDIR)/include CFLAGS = `gtk-config --cflags` ! CFLAGS += -I$(LINUXINCLUDE) \ ! -I../include -I../us/include\ ! -D__RK__ -O2 \ ! -Wall -Wstrict-prototypes GTKLIB = `gtk-config --libs` O_OBJS = --- 1,5 ---- QOS = qos CFLAGS = `gtk-config --cflags` ! CFLAGS += -I../include -I../us/include -O2 -Wall -Wstrict-prototypes GTKLIB = `gtk-config --libs` O_OBJS = *************** *** 15,24 **** all: $(TESTS) ! mpdemo: qtest.o mpdemo.o ../libqos.a ! gcc qtest.o mpdemo.o -L.. -lqos -L../../lib -lmpeg $(GTKLIB) -o mpdemo ! ppsdemo: test1.o ppsdemo.o ../libqos.a ! gcc test1.o ppsdemo.o -L.. -lqos -L../../lib -lmpeg $(GTKLIB) -o ppsdemo deps :$(O_OBJS:.o=.c) --- 8,19 ---- all: $(TESTS) ! mpdemo: mpcore.o qtest.o mpdemo.o ../libqos.a ! gcc qtest.o mpdemo.o mpcore.o -L.. -lqos -L../../lib -lmpeg $(GTKLIB) -o mpdemo ! ppsdemo: mpcore.o test1.o ppsdemo.o ../libqos.a ! gcc test1.o mpcore.o ppsdemo.o -L.. -lqos -L../../lib -lmpeg $(GTKLIB) -o ppsdemo + txtdemo: txtdemo.o + gcc txtdemo.o -L.. -lqos -lncurses -o txtdemo deps :$(O_OBJS:.o=.c) Index: mpdemo.c =================================================================== RCS file: /cvsroot/linux-hls/qosman/demos/mpdemo.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** mpdemo.c 21 Feb 2004 13:01:52 -0000 1.1.1.1 --- mpdemo.c 9 Apr 2004 13:39:56 -0000 1.2 *************** *** 43,46 **** --- 43,47 ---- #include <mpeg.h> + #include "mpcore.h" #if 0 #include <rk/rk.h> *************** *** 54,60 **** #include "qos.h" - static GdkPixmap *screen; - static GdkGC *gc, *gc1; - static unsigned long long int timevect[10000]; static unsigned long int timevect1[10000]; --- 55,58 ---- *************** *** 63,68 **** static struct feedbk_stat fstats[10000]; - static int end = 0; - extern gint ac; extern gchar *av[]; --- 61,64 ---- *************** *** 71,109 **** #define MAXSLIDE 150 - gint delete_event(GtkWidget * widget, GdkEvent * event, gpointer data) - { - end = 1; - - return (TRUE); - } - - gboolean expose_event(GtkWidget * widget, GdkEventExpose * event, - gpointer data) - { - if ((screen != NULL) && (!end)) { - gdk_draw_pixmap(widget->window, - widget->style->fg_gc[GTK_WIDGET_STATE(widget)], - screen, event->area.x, event->area.y, - event->area.x, event->area.y, event->area.width, - event->area.height); - } - - return TRUE; - } - - gint configure_event(GtkWidget * widget, GdkEventConfigure * event) - { - if (!screen) { - screen = - gdk_pixmap_new(widget->window, widget->allocation.width, - widget->allocation.height, -1); - gdk_draw_rectangle(screen, widget->style->white_gc, TRUE, 0, 0, - widget->allocation.width, - widget->allocation.height); - } - return TRUE; - } - - void save_results(void) { --- 67,70 ---- *************** *** 170,174 **** } - //gint mpdbody(gint argc, gchar *argv[]) gint mpbody(int num) --- 131,134 ---- *************** *** 176,192 **** gint argc; gchar **argv; GtkWidget *prbar; GtkWidget *d_area; - GtkWidget *window; - GtkWidget *vbox; - GtkWidget *hbox; - GtkWidget *label; - GtkObject *adj2; - GdkColor black; - GdkColor white; GdkRectangle u_area; ! char buff[80]; int x, y, ox, oy, dir; - gint expid, confid; long int l; FILE *mpeg; --- 136,146 ---- gint argc; gchar **argv; + struct controls *c; + #if 0 GtkWidget *prbar; GtkWidget *d_area; GdkRectangle u_area; ! #endif int x, y, ox, oy, dir; long int l; FILE *mpeg; *************** *** 207,284 **** } ! mpeg = fopen(argv[1], "rb"); ! if (mpeg == NULL) { ! perror("Error opening:"); ! exit(-1); ! } ! SetMPEGOption(MPEG_DITHER, FULL_COLOR_DITHER); ! if (!OpenMPEG(mpeg, &img)) { ! fprintf(stderr, "OpenMPEG on %s failed\n", argv[1]); ! exit(-1); ! } ! ! ! pid_setstats(fstats, -1); ! rgbbuff = malloc(img.Size * sizeof(char)); printf("Image: %dx%dx%d\n", img.Width, img.Height, img.Depth); - gdk_rgb_init(); - gtk_widget_set_default_colormap(gdk_rgb_get_cmap()); - gtk_widget_set_default_visual(gdk_rgb_get_visual()); - - window = gtk_window_new(GTK_WINDOW_TOPLEVEL); - gtk_window_set_default_size(GTK_WINDOW(window), img.Width, - img.Height + 50); - - vbox = gtk_vbox_new(FALSE, 0); - hbox = gtk_hbox_new(FALSE, 0); - gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(vbox)); - - - adj2 = gtk_adjustment_new(0.0, 0.0, 21.0, 0.1, 1.0, 1.0); - prbar = gtk_progress_bar_new_with_adjustment(GTK_ADJUSTMENT(adj2)); - gtk_box_pack_start(GTK_BOX(vbox), prbar, TRUE, TRUE, 0); - gtk_widget_show(prbar); - //drawing area - d_area = gtk_drawing_area_new(); - gtk_drawing_area_size(GTK_DRAWING_AREA(d_area), img.Width, img.Height); - expid = - gtk_signal_connect(GTK_OBJECT(d_area), "expose_event", - GTK_SIGNAL_FUNC(expose_event), NULL); - confid = - gtk_signal_connect(GTK_OBJECT(d_area), "configure_event", - GTK_SIGNAL_FUNC(configure_event), NULL); - gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(d_area), FALSE, FALSE, 5); - gtk_widget_show(d_area); - - sprintf(buff, "QoSlib Demo"); - label = gtk_label_new(buff); - gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(label), FALSE, FALSE, 5); - gtk_widget_show(label); - - gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(hbox), FALSE, FALSE, 5); - - gtk_widget_show(hbox); - gtk_widget_show(vbox); - gtk_widget_show(window); - gtk_signal_connect(GTK_OBJECT(window), "delete_event", - GTK_SIGNAL_FUNC(delete_event), NULL); - - u_area.x = 0; - u_area.y = 0; - u_area.width = d_area->allocation.width; - u_area.height = d_area->allocation.height; - gc = gdk_gc_new(d_area->window); - gc1 = gdk_gc_new(d_area->window); - - gdk_color_black(gdk_colormap_get_system(), &black); - gdk_color_white(gdk_colormap_get_system(), &white); - gdk_gc_set_foreground(gc, &black); - gdk_gc_set_background(gc, &white); - gdk_gc_set_foreground(gc1, &white); - gdk_gc_set_background(gc1, &black); - x = 60; y = 60; --- 161,171 ---- } ! mpeg = file_open(argv[1], &img); + qman_setstats(fstats, -1); + rgbbuff = malloc(img.Size * sizeof(char)); printf("Image: %dx%dx%d\n", img.Width, img.Height, img.Depth); x = 60; y = 60; *************** *** 288,295 **** i = 0; cprintf("[MPEGDemo] Starting to play...\n"); ! // rt_wait_for_start_time(); ! while (!end) { gettimeofday(&now, NULL); timevect[i] = now.tv_usec + now.tv_sec * 1000000; --- 175,183 ---- i = 0; + c = window_prepare(img.Width, img.Height); + cprintf("[MPEGDemo] Starting to play...\n"); ! while (!file_end()) { gettimeofday(&now, NULL); timevect[i] = now.tv_usec + now.tv_sec * 1000000; *************** *** 302,317 **** gtk_main_iteration_do(FALSE); } ! if (!end) { moreframes = GetMPEGFrame(rgbbuff); if (moreframes == 0) { ! end = 1; } ! gdk_draw_rgb_32_image(screen, gc, ! 0, 0, img.Width, img.Height, ! GDK_RGB_DITHER_MAX, rgbbuff, ! img.Width * 4); ! gtk_widget_draw(GTK_WIDGET(d_area), &u_area); } ! l = howlate(0); // timevect2[i] = l; l = l / 5000; --- 190,201 ---- gtk_main_iteration_do(FALSE); } ! if (!file_end()) { moreframes = GetMPEGFrame(rgbbuff); if (moreframes == 0) { ! file_set_end(); } ! frame_display(c, &img, rgbbuff); } ! l = qman_howlate(0); // timevect2[i] = l; l = l / 5000; *************** *** 319,329 **** l = MAXSLIDE; } ! gtk_progress_bar_update(GTK_PROGRESS_BAR(prbar), (float) l / (float) MAXSLIDE); gettimeofday(&now, NULL); timevect1[i] = now.tv_usec + now.tv_sec * 1000000; ! timevect3[i] = getq(0); ! timevect2[i++] = qtask_endcycle(); } --- 203,213 ---- l = MAXSLIDE; } ! gtk_progress_bar_update(GTK_PROGRESS_BAR(c->prbar), (float) l / (float) MAXSLIDE); gettimeofday(&now, NULL); timevect1[i] = now.tv_usec + now.tv_sec * 1000000; ! timevect3[i] = qman_budget(0); ! timevect2[i++] = qman_task_endcycle(); } Index: ppsdemo.c =================================================================== RCS file: /cvsroot/linux-hls/qosman/demos/ppsdemo.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** ppsdemo.c 21 Feb 2004 13:01:52 -0000 1.1.1.1 --- ppsdemo.c 9 Apr 2004 13:39:56 -0000 1.2 *************** *** 43,46 **** --- 43,47 ---- #include <mpeg.h> + #include "mpcore.h" #if 0 #include <rk/rk.h> *************** *** 54,66 **** #include "qos.h" - static GdkPixmap *screen; - static GdkGC *gc, *gc1; - static unsigned long long int timevect[10000]; static unsigned long int timevect1[10000]; static unsigned long int timevect2[10000]; - static int end = 0; - extern gint ac; extern gchar *av[]; --- 55,62 ---- *************** *** 68,123 **** #define MAXSLIDE 500 ! gint delete_event(GtkWidget * widget, GdkEvent * event, gpointer data) ! { ! end = 1; ! ! return (TRUE); ! } ! ! gboolean expose_event(GtkWidget * widget, GdkEventExpose * event, ! gpointer data) { ! if ((screen != NULL) && (!end)) { ! gdk_draw_pixmap(widget->window, ! widget->style->fg_gc[GTK_WIDGET_STATE(widget)], ! screen, event->area.x, event->area.y, ! event->area.x, event->area.y, event->area.width, ! event->area.height); } ! return TRUE; ! } ! ! gint configure_event(GtkWidget * widget, GdkEventConfigure * event) ! { ! if (!screen) { ! screen = ! gdk_pixmap_new(widget->window, widget->allocation.width, ! widget->allocation.height, -1); ! gdk_draw_rectangle(screen, widget->style->white_gc, TRUE, 0, 0, ! widget->allocation.width, ! widget->allocation.height); } ! return TRUE; } - //gint mpdbody(gint argc, gchar *argv[]) gint mpbody(int num) { gint argc; gchar **argv; ! GtkWidget *prbar; ! GtkWidget *d_area; ! GtkWidget *window; ! GtkWidget *vbox; ! GtkWidget *hbox; ! GtkWidget *label; ! GtkObject *adj2; ! GdkColor black; ! GdkColor white; ! GdkRectangle u_area; ! char buff[80]; int x, y, ox, oy, dir; - gint expid, confid; long int l; FILE *mpeg; --- 64,118 ---- #define MAXSLIDE 500 ! void results_save(int n) { ! FILE *f; ! int i; ! char filename[20]; ! ! printf("Saving\n"); ! sprintf(filename, "res_%d_if.tim", n); ! f = fopen(filename, "w"); ! for (i = 1; i < 5000; i++) { ! if (timevect1[i] != 0) { ! if (timevect[i] < timevect[i - 1]) { ! timevect[i] = timevect[i - 1]; ! // fprintf(f, "%d\t-1\t%lu\n", i, (unsigned long int)timevect[i] /*- timevect[0]*/); ! } else { ! if (timevect[i - 1] != timevect[i - 2]) { ! fprintf(f, "%d\t%lu\t%lu\n", i, ! (unsigned long int) (timevect[i] - ! timevect[i - 1]), ! (unsigned long int) timevect[i] ! /*- timevect[0]*/ ! ); ! } ! } ! } } + sprintf(filename, "res_%d_ct.tim", n); + fclose(f); ! f = fopen(filename, "w"); ! for (i = 1; i < 500; i++) { ! if (timevect1[i] != 0) { ! fprintf(f, "%d\t%lu\t1\n", i, ! (unsigned long int) (timevect1[i] - timevect[i])); ! } } ! sprintf(filename, "res_%d_l.tim", n); ! f = fopen(filename, "w"); ! for (i = 1; i < 500; i++) { ! fprintf(f, "%d\t%lu\n", i, timevect2[i]); ! } ! ! fclose(f); } gint mpbody(int num) { gint argc; gchar **argv; ! struct controls *c; int x, y, ox, oy, dir; long int l; FILE *mpeg; *************** *** 125,133 **** ImageDesc img; unsigned char *rgbbuff; struct timeval now; ! FILE *f; ! char filename[20]; ! int i; sleep(1); --- 120,127 ---- ImageDesc img; unsigned char *rgbbuff; + int i; struct timeval now; ! // FILE *f; sleep(1); *************** *** 140,212 **** } ! mpeg = fopen(argv[1], "rb"); ! if (mpeg == NULL) { ! perror("Error opening:"); ! exit(-1); ! } ! SetMPEGOption(MPEG_DITHER, FULL_COLOR_DITHER); ! if (!OpenMPEG(mpeg, &img)) { ! fprintf(stderr, "OpenMPEG on %s failed\n", argv[1]); ! exit(-1); ! } rgbbuff = malloc(img.Size * sizeof(char)); printf("Image: %dx%dx%d\n", img.Width, img.Height, img.Depth); - gdk_rgb_init(); - gtk_widget_set_default_colormap(gdk_rgb_get_cmap()); - gtk_widget_set_default_visual(gdk_rgb_get_visual()); - - window = gtk_window_new(GTK_WINDOW_TOPLEVEL); - gtk_window_set_default_size(GTK_WINDOW(window), img.Width, - img.Height + 50); - - vbox = gtk_vbox_new(FALSE, 0); - hbox = gtk_hbox_new(FALSE, 0); - gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(vbox)); - - - adj2 = gtk_adjustment_new(0.0, 0.0, 21.0, 0.1, 1.0, 1.0); - prbar = gtk_progress_bar_new_with_adjustment(GTK_ADJUSTMENT(adj2)); - gtk_box_pack_start(GTK_BOX(vbox), prbar, TRUE, TRUE, 0); - gtk_widget_show(prbar); - //drawing area - d_area = gtk_drawing_area_new(); - gtk_drawing_area_size(GTK_DRAWING_AREA(d_area), img.Width, img.Height); - expid = - gtk_signal_connect(GTK_OBJECT(d_area), "expose_event", - GTK_SIGNAL_FUNC(expose_event), NULL); - confid = - gtk_signal_connect(GTK_OBJECT(d_area), "configure_event", - GTK_SIGNAL_FUNC(configure_event), NULL); - gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(d_area), FALSE, FALSE, 5); - gtk_widget_show(d_area); - - sprintf(buff, "QoSlib Demo"); - label = gtk_label_new(buff); - gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(label), FALSE, FALSE, 5); - gtk_widget_show(label); - - gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(hbox), FALSE, FALSE, 5); - - gtk_widget_show(hbox); - gtk_widget_show(vbox); - gtk_widget_show(window); - gtk_signal_connect(GTK_OBJECT(window), "delete_event", - GTK_SIGNAL_FUNC(delete_event), NULL); - - u_area.x = 0; - u_area.y = 0; - u_area.width = d_area->allocation.width; - u_area.height = d_area->allocation.height; - gc = gdk_gc_new(d_area->window); - gc1 = gdk_gc_new(d_area->window); - - gdk_color_black(gdk_colormap_get_system(), &black); - gdk_color_white(gdk_colormap_get_system(), &white); - gdk_gc_set_foreground(gc, &black); - gdk_gc_set_background(gc, &white); - gdk_gc_set_foreground(gc1, &white); - gdk_gc_set_background(gc1, &black); - x = 60; y = 60; --- 134,142 ---- } ! mpeg = file_open(argv[1], &img); ! rgbbuff = malloc(img.Size * sizeof(char)); printf("Image: %dx%dx%d\n", img.Width, img.Height, img.Depth); x = 60; y = 60; *************** *** 216,221 **** i = 0; cprintf("Starting...\n"); ! while (!end) { gettimeofday(&now, NULL); timevect[i] = now.tv_usec + now.tv_sec * 1000000; --- 146,153 ---- i = 0; + c = window_prepare(img.Width, img.Height); + cprintf("Starting...\n"); ! while (!file_end()) { gettimeofday(&now, NULL); timevect[i] = now.tv_usec + now.tv_sec * 1000000; *************** *** 228,243 **** gtk_main_iteration_do(FALSE); } ! if (!end) { moreframes = GetMPEGFrame(rgbbuff); if (moreframes == 0) { ! end = 1; } ! gdk_draw_rgb_32_image(screen, gc, ! 0, 0, img.Width, img.Height, ! GDK_RGB_DITHER_MAX, rgbbuff, ! img.Width * 4); ! gtk_widget_draw(GTK_WIDGET(d_area), &u_area); } ! l = howlate(0); timevect2[i] = l; l = l / 33000; --- 160,171 ---- gtk_main_iteration_do(FALSE); } ! if (!file_end()) { moreframes = GetMPEGFrame(rgbbuff); if (moreframes == 0) { ! file_set_end(); } ! frame_display(c, &img, rgbbuff); } ! l = qman_howlate(0); timevect2[i] = l; l = l / 33000; *************** *** 245,249 **** l = MAXSLIDE; } ! gtk_progress_bar_update(GTK_PROGRESS_BAR(prbar), (float) l / (float) MAXSLIDE); --- 173,177 ---- l = MAXSLIDE; } ! gtk_progress_bar_update(GTK_PROGRESS_BAR(c->prbar), (float) l / (float) MAXSLIDE); *************** *** 256,295 **** free(rgbbuff); ! printf("Saving\n"); ! sprintf(filename, "res_%d_if.tim", num); ! f = fopen(filename, "w"); ! for (i = 1; i < 5000; i++) { ! if (timevect1[i] != 0) { ! if (timevect[i] < timevect[i - 1]) { ! timevect[i] = timevect[i - 1]; ! // fprintf(f, "%d\t-1\t%lu\n", i, (unsigned long int)timevect[i] /*- timevect[0]*/); ! } else { ! if (timevect[i - 1] != timevect[i - 2]) { ! fprintf(f, "%d\t%lu\t%lu\n", i, ! (unsigned long int) (timevect[i] - ! timevect[i - 1]), ! (unsigned long int) timevect[i] ! /*- timevect[0]*/ ! ); ! } ! } ! } ! } ! sprintf(filename, "res_%d_ct.tim", num); ! f = fopen(filename, "w"); ! for (i = 1; i < 500; i++) { ! if (timevect1[i] != 0) { ! fprintf(f, "%d\t%lu\t1\n", i, ! (unsigned long int) (timevect1[i] - timevect[i])); ! } ! } ! sprintf(filename, "res_%d_l.tim", num); ! f = fopen(filename, "w"); ! for (i = 1; i < 500; i++) { ! fprintf(f, "%d\t%lu\n", i, timevect2[i]); ! } ! ! fclose(f); ! cprintf("Returning\n"); return 1; --- 184,189 ---- free(rgbbuff); ! results_save(num); ! cprintf("Returning\n"); return 1; Index: test1.c =================================================================== RCS file: /cvsroot/linux-hls/qosman/demos/test1.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** test1.c 21 Feb 2004 13:01:52 -0000 1.1.1.1 --- test1.c 9 Apr 2004 13:39:56 -0000 1.2 *************** *** 43,51 **** #include <local.h> /*#include <arch/basetype.h>*/ #include "qos.h" #include "req.h" - #include "adj.h" extern TASK mpbody(WORD id); int ac; --- 43,52 ---- #include <local.h> /*#include <arch/basetype.h>*/ + #include <wait.h> #include "qos.h" #include "req.h" + extern struct reqactions adjactions; extern TASK mpbody(WORD id); int ac; *************** *** 67,75 **** int main(int argc, char *argv[]) { ! struct psparm t; ! struct qmparm initparm; ID qt1, qt2; char name[80]; ! int i; ac = argc; --- 68,76 ---- int main(int argc, char *argv[]) { ! struct pstask_attr t; ! struct qman_attr initparm; ID qt1, qt2; char name[80]; ! int i, dummy; ac = argc; *************** *** 87,91 **** ! setreq(&adjactions); printf("Init Done!!!\n"); t.quantum = 3000; --- 88,92 ---- ! qman_feedback(&adjactions); printf("Init Done!!!\n"); t.quantum = 3000; *************** *** 96,100 **** t.body = mpbody; ! qt1 = ps_addtask(&t); if (qt1 == 0) { printf("QoS Task creation failed...\n"); --- 97,101 ---- t.body = mpbody; ! qt1 = qman_pstask(&t); if (qt1 == 0) { printf("QoS Task creation failed...\n"); *************** *** 109,113 **** t.body = mpbody; ! qt2 = ps_addtask(&t); if (qt2 == 0) { printf("QoS Task creation failed...\n"); --- 110,114 ---- t.body = mpbody; ! qt2 = qman_pstask(&t); if (qt2 == 0) { printf("QoS Task creation failed...\n"); *************** *** 117,122 **** printf("Waiting...\n"); ! for (;;); ! sleep(20); exit(0); --- 118,123 ---- printf("Waiting...\n"); ! wait(&dummy); wait(&dummy); ! sleep(2); exit(0); |
|
From: Luca A. <lu...@us...> - 2004-04-09 13:53:21
|
Update of /cvsroot/linux-hls/qosman/us/include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23177/us/include Modified Files: funcs.h global.h local.h Log Message: - Some cleanups in the demos - New "text only" demo (will be used to test the pps model) - Interface change (names...) - Fix bug in feeback functions statistics - Resynch with my local tree (too many changes to mention) Index: local.h =================================================================== RCS file: /cvsroot/linux-hls/qosman/us/include/local.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** local.h 21 Feb 2004 13:01:51 -0000 1.1.1.1 --- local.h 9 Apr 2004 13:39:58 -0000 1.2 *************** *** 15,17 **** --- 15,20 ---- #include <req.h> #include <qos.h> + + int internal_howlate(ID dummy); + int internal_budget(ID dummy); #endif /* __LOCAL_H__ */ Index: global.h =================================================================== RCS file: /cvsroot/linux-hls/qosman/us/include/global.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** global.h 21 Feb 2004 13:01:51 -0000 1.1.1.1 --- global.h 9 Apr 2004 13:39:58 -0000 1.2 *************** *** 12,18 **** #include <ps.h> - //#include <req.h> - //#include <qos.h> - int server_init(REAL psu, REAL psq, REAL init_rmu); --- 12,15 ---- Index: funcs.h =================================================================== RCS file: /cvsroot/linux-hls/qosman/us/include/funcs.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** funcs.h 21 Feb 2004 13:01:51 -0000 1.1.1.1 --- funcs.h 9 Apr 2004 13:39:58 -0000 1.2 *************** *** 2,8 **** #define __FUNCS_H__ #include <basetype.h> - /* - #include <stdio.h> - */ #define max(a,b) (((a) > (b)) ? (a) : (b)) --- 2,5 ---- |
|
From: Luca A. <lu...@us...> - 2004-04-09 13:53:17
|
Update of /cvsroot/linux-hls/qosman/ks/include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23177/ks/include Modified Files: global.h local.h Log Message: - Some cleanups in the demos - New "text only" demo (will be used to test the pps model) - Interface change (names...) - Fix bug in feeback functions statistics - Resynch with my local tree (too many changes to mention) Index: local.h =================================================================== RCS file: /cvsroot/linux-hls/qosman/ks/include/local.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** local.h 21 Feb 2004 13:01:51 -0000 1.1.1.1 --- local.h 9 Apr 2004 13:39:57 -0000 1.2 *************** *** 1,5 **** #ifndef __LOCAL_H__ #define __LOCAL_H__ - /* #include <linux/slab.h> */ #include <basetype.h> --- 1,4 ---- *************** *** 12,15 **** #include <qos.h> - #endif /* __LOCAL_H__ */ --- 11,13 ---- Index: global.h =================================================================== RCS file: /cvsroot/linux-hls/qosman/ks/include/global.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** global.h 21 Feb 2004 13:01:51 -0000 1.1.1.1 --- global.h 9 Apr 2004 13:39:57 -0000 1.2 *************** *** 9,15 **** #include <ps.h> - // #include <req.h> - // #include <qos.h> - int server_init(REAL psu, REAL psq, REAL init_rmu); --- 9,12 ---- |
|
From: Luca A. <lu...@us...> - 2004-04-09 13:53:15
|
Update of /cvsroot/linux-hls/qosman/include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23177/include Modified Files: qos.h Removed Files: adj.h pid.h simpleadj.h Log Message: - Some cleanups in the demos - New "text only" demo (will be used to test the pps model) - Interface change (names...) - Fix bug in feeback functions statistics - Resynch with my local tree (too many changes to mention) --- simpleadj.h DELETED --- --- pid.h DELETED --- Index: qos.h =================================================================== RCS file: /cvsroot/linux-hls/qosman/include/qos.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** qos.h 21 Feb 2004 13:01:52 -0000 1.1.1.1 --- qos.h 9 Apr 2004 13:39:57 -0000 1.2 *************** *** 2,45 **** #define __QOS_H__ /* This should be the interface file */ /* Structure used for creating a PPS task */ ! struct psparm { ! char *name; ! TASK(*body) (WORD); ! int arg; ! DWORD quantum; ! unsigned int w; }; /* Structure used for creating a MM or ED task */ ! struct qparm { ! char *name; ! TASK(*body) (WORD); ! int arg; ! DWORD wcet; ! unsigned int w; ! int reduce; ! DWORD per; ! BYTE model; }; /* General parameters for the QoS library */ ! struct qmparm { ! REAL psu; ! DWORD psq; ! REAL rmu; }; /* Prototypes */ ! int qman_init(struct qmparm *p); ! ID qset_addtask(struct qparm *t); ! ID ps_addtask(struct psparm *t); ! void qtask_end(int retvalue); ! int qtask_endcycle(void); ! void qtask_changeperiod(WORD p); ! void setreq(struct reqactions *p); ! int howlate(ID task); #endif /* __QOS_H__ */ --- 2,50 ---- #define __QOS_H__ + #define MM_TASK 1 + #define ED_TASK 2 + /* This should be the interface file */ /* Structure used for creating a PPS task */ ! struct pstask_attr { ! char *name; ! TASK(*body) (WORD); ! int arg; ! DWORD quantum; ! unsigned int w; }; /* Structure used for creating a MM or ED task */ ! struct qtask_attr { ! char *name; ! TASK(*body) (WORD); ! int arg; ! DWORD wcet; ! unsigned int w; ! int reduce; ! DWORD per; ! BYTE model; }; /* General parameters for the QoS library */ ! struct qman_attr { ! REAL psu; ! DWORD psq; ! REAL rmu; }; /* Prototypes */ ! int qman_init(struct qman_attr *p); ! void qman_setstats(struct feedbk_stat *p, int id); ! ID qman_task(struct qtask_attr *t); ! ID qman_pstask(struct pstask_attr *t); ! void qman_task_end(int retvalue); ! int qman_task_endcycle(void); ! void qman_task_changeperiod(WORD p); ! void qman_feedback(struct reqactions *p); ! int qman_howlate(ID task); ! int qman_budget(ID task); #endif /* __QOS_H__ */ --- adj.h DELETED --- |
|
From: Luca A. <lu...@us...> - 2004-04-09 13:35:37
|
Update of /cvsroot/linux-hls/cbs/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19590/src Modified Files: cbs.c Log Message: Cosmetics Index: cbs.c =================================================================== RCS file: /cvsroot/linux-hls/cbs/src/cbs.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** cbs.c 21 Feb 2004 13:06:36 -0000 1.1.1.1 --- cbs.c 9 Apr 2004 13:22:18 -0000 1.2 *************** *** 1022,1026 **** } ! #endif --- 1022,1026 ---- } ! #endif /* __SLEEP__ */ *************** *** 1069,1073 **** (p->reactive).param=p; sched_init_timer(&(p->reactive)); ! #endif --- 1069,1073 ---- (p->reactive).param=p; sched_init_timer(&(p->reactive)); ! #endif /* __SLEEP__ */ |
Update of /cvsroot/linux-hls/hls/linux-2.6 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10942 Added Files: Makefile bottom.c bottom.h div.c export.c hls_ctl.c hls_timers.c init.c misc.c procfs.c procfs.h sched.c Log Message: Beginning of a 2.6 backend... Does not work yet! --- NEW FILE: init.c --- /* * Copyright (c) 2002 Luca Abeni * * Module Name: init.c * Abstract: Module initialization and cleanup. * Author: Luca Abeni 2-Feb-2002 * * This is free software; see GPL.txt */ #include <linux/config.h> #if defined(CONFIG_MODVERSIONS) && !defined(MODVERSIONS) #define MODVERSIONS #endif #ifdef MODVERSIONS //#include <linux/modversions.h> #endif #include <linux/module.h> #include <linux/kernel.h> #include <linux/sched.h> #include <data.h> #include "hls_hooks.h" #include "bottom.h" #include "procfs.h" #ifndef CONFIG_GENERIC_SCHEDULER #error Generic Scheduler is not enabled!!! #endif extern void (*block_hook)(struct task_struct *tsk); extern void (*unblock_hook)(struct task_struct *tsk); extern void (*fork_hook)(struct task_struct *tsk); extern void (*cleanup_hook)(struct task_struct *tsk); extern int (*setsched_hook)(pid_t pid, int policy, struct sched_param *param); extern int (*getsched_hook)(pid_t pid, struct sched_param *param); #ifdef __LOG_DEVICE__ #include "logger.h" #define hls_printk log_printf #else #define hls_printk printk #endif MODULE_LICENSE("GPL"); /* FIXME: These prototypes should be removed... */ int hls_setsched(pid_t pid, int policy, struct sched_param *param); extern void HLSInit(void); extern void HLSDeinit (void); extern spinlock_t hls_lock; void hls_convert_tasks(void) { struct task_struct *dummy, *t; /* If all the tasks must be managed by the HLS, we must * ``transform'' all the existing tasks in HLS tasks... */ t = current; if (t->private_data == NULL) { t->policy = SCHED_FIFO; t->rt_priority = HLS_IDLE_PRIORITY; if ((t->state == TASK_INTERRUPTIBLE) || (t->state == TASK_UNINTERRUPTIBLE)) { HLSCreateThreadHook(t, t->state); } else if (t->state == TASK_RUNNING) { HLSCreateThreadHook(t, TASK_UNINTERRUPTIBLE); t->state = TASK_RUNNING; HLSUnblockThreadHook(t); } else { #ifdef VERBOSE hls_printk("state: %ld\n", t->state); #endif } } else { printk("Error: It already is an HLS task!!!\n"); hls_printk("Error: It already is an HLS task!!!\n"); } read_lock(&tasklist_lock); do_each_thread(dummy, t) { #ifdef __FP_DEAMONS__ if (t->tty == NULL) { #ifdef VERBOSE hls_printk("Giving T%d the highest priority\n", t->pid); #endif t->policy = SCHED_FIFO; t->rt_priority = HLS_SCHEDULING_PRIORITY + 1; t->private_data = NULL; } else { #endif #ifdef VERBOSE hls_printk("Transforming T%d in HLS task\t", t->pid); #endif if (t->private_data == NULL) { t->policy = SCHED_FIFO; t->rt_priority = HLS_IDLE_PRIORITY; if ((t->state == TASK_INTERRUPTIBLE) || (t->state == TASK_UNINTERRUPTIBLE)) { HLSCreateThreadHook(t, t->state); } else if (t->state == TASK_RUNNING) { HLSCreateThreadHook(t, TASK_UNINTERRUPTIBLE); t->state = TASK_RUNNING; HLSUnblockThreadHook(t); } else { #ifdef VERBOSE hls_printk("state: %ld\t", t->state); #endif } #ifdef VERBOSE hls_printk("ok!\n"); #endif } else { printk("already PRIVATE_DATA != NULL???\n"); hls_printk("already PRIVATE_DATA != NULL???\n"); } #ifdef __FP_DEAMONS__ } #endif } while_each_thread(dummy, t); read_unlock(&tasklist_lock); } void hls_release_tasks(void) { struct task_struct *dummy, *t; t = current; read_lock(&tasklist_lock); do_each_thread(dummy, t) { if (t->private_data != NULL) { #ifdef VERBOSE printk("Removing task %d from HLS\n", t->pid); #endif if (t->state == TASK_RUNNING) { hls_block_other_thread(t); } HLSExitThreadHook(t); t->private_data = 0; t->policy = SCHED_NORMAL; } } while_each_thread(dummy, t); read_unlock(&tasklist_lock); } int init_module(void) { int res; unsigned long flags; res= hls_proc_init(); if (res < 0) { return res; } if (block_hook != NULL) { printk("Error installing HLS: block_hook != NULL!!!\n"); return -1; } if (unblock_hook != NULL) { printk("Error installing HLS: block_hook != NULL!!!\n"); return -1; } if (fork_hook != NULL) { printk("Error installing HLS: fork_hook != NULL!!!\n"); return -1; } if (cleanup_hook != NULL) { printk("Error installing HLS: cleanup_hook != NULL!!!\n"); return -1; } #ifdef __DO_CLI__ spin_lock_irqsave(&hls_lock, flags); #endif block_hook = hls_bottom_vp_release; unblock_hook = hls_bottom_vp_request; fork_hook = hls_bottom_vp_register; cleanup_hook = hls_bottom_vp_unregister; setsched_hook = hls_setsched; HLSInit(); /* * ??? = hls_bottom_vp_msg; */ #ifdef __CREATE_HIERARCHY__ hls_convert_tasks(); #endif #ifdef __DO_CLI__ spin_unlock_irqrestore(&hls_lock, flags); #endif return 0; } void cleanup_module(void) { unsigned long flags; #ifdef __DO_CLI__ spin_lock_irqsave(&hls_lock, flags); #endif hls_release_tasks(); HLSDeinit(); block_hook = NULL; unblock_hook = NULL; fork_hook = NULL; cleanup_hook = NULL; setsched_hook = NULL; hls_proc_cleanup(); #ifdef __DO_CLI__ spin_unlock_irqrestore(&hls_lock, flags); #endif } --- NEW FILE: sched.c --- /* * Copyright (c) 2002 Luca Abeni * * Module Name: sched.c * Abstract: Moves tasks between schedulers. * Author: Luca Abeni 2-Feb-2002 * * This is free software; see GPL.txt */ static inline struct task_struct *find_process_by_pid(pid_t pid) { struct task_struct *tsk = current; if (pid) { tsk = find_task_by_pid(pid); } return tsk; } /* Return value: * < 0 ---> Failure * = 0 ---> Success * > 0 ---> do the regular Linux thing... */ int hls_setsched(pid_t pid, int policy, struct sched_param *param) { struct task_struct *p; struct hls_param hls_p; struct sched_param sched_p; unsigned long flags; int res; spin_lock_irqsave(&hls_lock, flags); p = find_process_by_pid(pid); if (p == NULL) { spin_unlock_irqrestore(&hls_lock, flags); return -ESRCH; } if (policy != HLS_CBS) { if (p->private_data != NULL) { HLSExitThreadHook(t); p->policy = SCHED_NORMAL; p->private_data = NULL; } spin_unlock_irqrestore(&hls_lock, flags); return 1; } if (copy_from_user(&sched_p, param, sizeof(struct sched_param)) < 0) { spin_unlock_irqrestore(&hls_lock, flags); return -EFAULT; } if (sizeof(struct hls_param) != sched_p.size) { spin_unlock_irqrestore(&hls_lock, flags); return -EFAULT; } if (copy_from_user(&hls_p, sched_p.p, sizeof(struct hls_param)) < 0) { spin_unlock_irqrestore(&hls_lock, flags); return -EFAULT; } /* Extra consinstency check... */ if (hls_p.signature != HLS_SIGNATURE) { spin_unlock_irqrestore(&hls_lock, flags); return -EFAULT; } if (p->private_data == NULL) { printk("HLS Error: %d has private_data = NULL???\n", p->pid); spin_unlock_irqrestore(&hls_lock, flags); return -EINVAL; } res = HLSCtl(p, &hls_p); spin_unlock_irqrestore(&hls_lock, flags); return res; } --- NEW FILE: procfs.c --- /* * Copyright (c) 2002 Luca Abeni * * Module Name: procfs.c * Abstract: ProcFS interface for HLS: allows to create scheduler * instances and to build the schedulers hierarchy. * Author: Luca Abeni 2-Feb-2002 * * This is free software; see GPL.txt */ #include <linux/config.h> #if defined(CONFIG_MODVERSIONS) && !defined(MODVERSIONS) #define MODVERSIONS #endif #ifdef MODVERSIONS //#include <linux/modversions.h> #endif #include <linux/module.h> #include <linux/kernel.h> #include <linux/proc_fs.h> #include <linux/slab.h> #include <data.h> #include <interface-data.h> #include <hls_internal.h> #include "procfs.h" static struct proc_dir_entry *hls_dir, *schedulers_file, *instances_file, *tasks_file, *default_file, *rt_file; #if 0 extern char *hls_scheduler_name(int i); extern char *hls_instance_name(int i); extern char *hls_instance_scheduler(int i); extern char *hls_instance_father(int i); extern struct HLS_SCHED_INSTANCE *HLSFindInstByName (char *Name); extern struct HLS_SCHED_INSTANCE *HLSNewSchedInstance(char *SchedName, char *InstName, struct HLS_SCHED_INSTANCE *Parent); extern void SetDefPriForSched(char Pri, struct HLS_SCHED_INSTANCE *Inst); extern int hls_setparam_ascii(struct HLS_SCHED_INSTANCE *inst, char *param); #endif static int hls_proc_read_rt(char *p, char **s, off_t o, int c, int *eof, void *dummy) { char *name; int len; name = hls_rt_name(); #if (HLS_DEBUG > 0) printk("Read %s (%d)\n", name, strlen(name)); #endif len = strlen(name) + 1; strcpy(p, name); return len; } static int hls_proc_write_rt(struct file *f, const char *b, unsigned long c, void *dummy) { void *sched; char schedname[16]; memcpy(schedname, b, c); schedname[c - 1] = 0; sched = HLSFindInstByName(schedname); if (sched == NULL) { printk("Cannot find %s\n", schedname); return c; } hls_setrt(sched); return c; } static int hls_proc_read_default(char *p, char **s, off_t o, int c, int *eof, void *dummy) { char *name; int len; name = hls_default_name(); #if (HLS_DEBUG > 0) printk("Read %s (%d)\n", name, strlen(name)); #endif len = strlen(name) + 1; strcpy(p, name); return len; } static int hls_proc_write_default(struct file *f, const char *b, unsigned long c, void *dummy) { void *sched; char schedname[16]; memcpy(schedname, b, c); schedname[c - 1] = 0; if (memcmp(schedname, "null", 4)) { printk("Searching for %s\n", schedname); sched = HLSFindInstByName(schedname); if (sched == NULL) { printk("Cannot find %s\n", schedname); return c; } } else { printk("Schedname = NULL\n"); sched = NULL; } hls_setdefault(sched); return c; } static int hls_proc_read_schedulers(char *p, char **s, off_t o, int c, int *eof, void *dummy) { int l, len, i; char *name; len = 0; i = 0; MOD_INC_USE_COUNT; while((name = hls_scheduler_name(i)) != (char *)-1) { if (name != NULL) { l = sprintf(p, "%d %s\n", i, name); p += l; len += l; } i++; } MOD_DEC_USE_COUNT; return len; } static int hls_proc_write_instances(struct file *f, const char *b, unsigned long c, void *dummy) { void *father_sched, *new_instance; char mybuff[64]; char instname[16], schedname[16], fathername[16]; int len, res; memcpy(mybuff, b, c); mybuff[c - 1] = 0; #if (HLS_DEBUG > 0) printk("ProcFSed %s\n", mybuff); #endif sscanf(mybuff, "%s %s %s %n", instname, schedname, fathername, &len); #if (HLS_DEBUG > 0) printk("Creating %s of type %s and father %s\n", instname, schedname, fathername); #endif father_sched = HLSFindInstByName(fathername); if (father_sched == NULL) { printk("Cannot find the parent scheduler\n"); return c; } new_instance = HLSNewSchedInstance(schedname, instname, father_sched); if (new_instance == NULL) { printk("Creation failed!\n"); return c; } SetDefPriForSched(1, new_instance); if ((len > 0) && (len < c)) { #if (HLS_DEBUG > 0) printk("Read %d: remains %s\n", len, mybuff + len); #endif res = hls_setparam_ascii(new_instance, mybuff + len); if (res < 0) { printk("Failed to set the scheduling parameters\n"); /* FIXME: Maybe we should remove this instance... */ } } else { res = hls_setparam_ascii(new_instance, NULL); if (res < 0) { printk("Failed to set the scheduling parameters\n"); /* FIXME: Maybe we should remove this instance... */ } } return c; } static int hls_proc_read_instances(char *p, char **s, off_t o, int c, int *eof, void *type) { int l, len, i; char *name, *schedname, *father; len = 0; i = 0; MOD_INC_USE_COUNT; while((name = hls_instance_name(i)) != (char *)-1) { if (name != NULL) { schedname = hls_instance_scheduler(i); father = hls_instance_father(i); #if 1 if (((type == (void *)2) && (!strcmp(schedname, "thread"))) || ((type == (void *)1) && (strcmp(schedname, "thread")))) { l = sprintf(p, "%d %s %s %s\n", i, name, schedname, father); p += l; len += l; } #else l = sprintf(p, "%d %s %s\n", i, name, schedname); p += l; len += l; #endif } i++; } MOD_DEC_USE_COUNT; return len; } int hls_proc_init(void) { hls_dir = proc_mkdir("HLS", NULL); if(hls_dir == NULL) { return -ENOMEM; } hls_dir->owner = THIS_MODULE; schedulers_file = create_proc_read_entry("schedulers", 0444, hls_dir, hls_proc_read_schedulers, NULL); if(schedulers_file == NULL) { remove_proc_entry("HLS", NULL); return -ENOMEM; } schedulers_file->owner = THIS_MODULE; instances_file = create_proc_entry("instances", 0644, hls_dir); if(instances_file == NULL) { remove_proc_entry("schedulers", hls_dir); remove_proc_entry("HLS", NULL); return -ENOMEM; } instances_file->data = (void *)1; instances_file->read_proc = hls_proc_read_instances; instances_file->write_proc = hls_proc_write_instances; instances_file->owner = THIS_MODULE; tasks_file = create_proc_read_entry("tasks", 0444, hls_dir, hls_proc_read_instances, (void *)2); if(tasks_file == NULL) { remove_proc_entry("instances", hls_dir); remove_proc_entry("schedulers", hls_dir); remove_proc_entry("HLS", NULL); return -ENOMEM; } tasks_file->owner = THIS_MODULE; default_file = create_proc_entry("default", 0644, hls_dir); if(default_file == NULL) { remove_proc_entry("tasks", hls_dir); remove_proc_entry("instances", hls_dir); remove_proc_entry("schedulers", hls_dir); remove_proc_entry("HLS", NULL); return -ENOMEM; } default_file->data = NULL; default_file->read_proc = hls_proc_read_default; default_file->write_proc = hls_proc_write_default; default_file->owner = THIS_MODULE; rt_file = create_proc_entry("rt", 0644, hls_dir); if(rt_file == NULL) { remove_proc_entry("default", hls_dir); remove_proc_entry("tasks", hls_dir); remove_proc_entry("instances", hls_dir); remove_proc_entry("schedulers", hls_dir); remove_proc_entry("HLS", NULL); return -ENOMEM; } rt_file->data = NULL; rt_file->read_proc = hls_proc_read_rt; rt_file->write_proc = hls_proc_write_rt; rt_file->owner = THIS_MODULE; return 0; } void hls_proc_cleanup(void) { remove_proc_entry("rt", hls_dir); remove_proc_entry("default", hls_dir); remove_proc_entry("tasks", hls_dir); remove_proc_entry("instances", hls_dir); remove_proc_entry("schedulers", hls_dir); remove_proc_entry("HLS", NULL); } --- NEW FILE: misc.c --- unsigned char KiFindLeftNibbleBitTable[] = {0, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3}; --- NEW FILE: hls_timers.c --- /* * Copyright (c) 2002 Luca Abeni & John Regehr * * Module Name: hls_timers.c * Abstract: Kernel-dependent part of the timers mechanism. * Author: Luca Abeni 2002, John Regehr 2000 * * This is free software; see GPL.txt */ #include <hls_common.h> /* For struct HLS_SCHED_INSTANCE */ extern spinlock_t hls_lock; /* * expiring scheduler timers call this function */ void hls_timeout(unsigned long arg) { struct HLS_SCHED_INSTANCE *Sched; #ifdef __DO_CLI1__ spin_lock_irqsave(&hls_lock, flags); #endif Sched = (struct HLS_SCHED_INSTANCE *) arg; if (current->state != TASK_RUNNING) { /* hls_printk("Interrupting a blocking call??? [%d]\n", current->pid); */ } Sched->CB->I_TimerCallback(Sched); #ifdef __DO_CLI1__ spin_unlock_irqrestore(&hls_lock, flags); #endif } void hls_stop_timer(struct HLS_SCHED_INSTANCE *Sched) { del_timer_sync(&(Sched->HLSTimer)); } void HLSSetTimer (_int64 T1, struct HLS_SCHED_INSTANCE *Sched) { _int64 T; /* Timer debugging stuff... */ if (timer_pending(&Sched->HLSTimer)) { /* ERROR!!! Timer Posted twice! */ extern int whereami; hls_hard_printk("HLS ERROR: Scheduler %s posted a timer twice!!! WAI = %d\n", Sched->Name, whereami); return; } T = -T1; if (T < 0) { panic("Strange timer..."); } #ifdef __MULDIV__ Sched->HLSTimer.expires = jiffies + llimd(T, HZ, 10000000); #else Sched->HLSTimer.expires = jiffies + (T * HZ) / 10000000; #endif if (Sched->HLSTimer.expires == jiffies) { Sched->HLSTimer.expires++; } Sched->HLSTimer.data = (unsigned long)Sched; Sched->HLSTimer.function = hls_timeout; add_timer(&(Sched->HLSTimer)); } WNT_TIME HLSGetCurrentTime (void) { /* FIXME: For the moment, we are using gettimeofday... * but we can do something smarter! */ #if 0 WNT_TIME t = HLSReadTimeStamp (); HLS_ASSERT (NTtoTicks != 0); return t / NTtoTicks; #else struct timeval tv; WNT_TIME res; do_gettimeofday(&tv); res = ((WNT_TIME)tv.tv_usec * 10) + (WNT_TIME)(tv.tv_sec * 10000000); return res; #endif } --- NEW FILE: bottom.h --- #ifndef __BOTTOM_H__ #define __BOTTOM_H__ extern void hls_bottom_vp_request(struct task_struct *t); extern void hls_bottom_vp_release(struct task_struct *t); extern void hls_bottom_vp_register(struct task_struct *t); extern void hls_bottom_vp_unregister(struct task_struct *t); #endif /* __BOTTOM_H__ */ --- NEW FILE: bottom.c --- /* * Copyright (c) 2002 Luca Abeni * * Module Name: bottom.c * Abstract: This is the low level interface with the Linux kernel, * containing the hooks called by the gensched patch and the * functions used to schedule a task in Linux. * Author: Luca Abeni 2-Feb-2002 * * This is free software; see GPL.txt */ #include <interface-funcs.h> #include <linux/smp_lock.h> #include <linux/kernel.h> #include <linux/sched.h> #include "data.h" #include "interface-data.h" #include "hls_hooks.h" #include "bottom.h" #include "hls_internal.h" #ifndef CONFIG_GENERIC_SCHEDULER #error Generic Scheduler is not enabled!!! #endif /* #define VERBOSE1 */ struct HLS_PROC { void *CurrentThread; int Standby; }; static struct task_struct *my_current[MAXIMUM_PROCESSORS]; extern struct HLS_PROC HLSProc[MAXIMUM_PROCESSORS]; spinlock_t hls_lock __cacheline_aligned = SPIN_LOCK_UNLOCKED; /* inner */ static int wup, lastt; extern int whereami; void show_tasks(void); /* CHECKME: Must acquire rq lock, somewhere... */ void HLSScheduleThread(struct task_struct *t, unsigned long proc) { int sched_non_running; sched_non_running = 0; if (my_current[proc] != NULL) { struct task_struct *c; c = my_current[proc]; #ifdef VERBOSE hls_printk("setting %d to %d... ", current->pid, HLS_IDLE_PRIORITY); #endif if (c->rt_priority != HLS_SCHEDULING_PRIORITY) { printk("HLS ERROR!!! Deschedulign %d with rt_priority = %ld != %d\n", c->pid, c->rt_priority, HLS_SCHEDULING_PRIORITY); } /* Must be implemented in some way... */ #error TODO: Do something smart, here!!! c->rt_priority = HLS_IDLE_PRIORITY; c->prio = MAX_PRIO; array = c->array; array->nr_active--; list_del(&c->run_list); if (list_empty(array->queue + c->prio)) __clear_bit(c->prio, array->bitmap); } else { #ifdef VERBOSE hls_printk("HLS From idle...\n"); #endif } #ifdef VERBOSE hls_printk("current->rt_priority = %ld\n", current->rt_priority); #endif my_current[proc] = t; /* Do we have a new task to schedule? */ if (t != NULL) { sched_non_running = (t->state != TASK_RUNNING); if(t->policy != SCHED_FIFO) { printk("HLS ERROR: Scheduling an HLS task with policy != SCHED_FIFO...\n"); hls_printk("HLS ERROR: Scheduling an HLS task with policy != SCHED_FIFO...\n"); } /* Yes... Schedule it. * The linux dispatcher will do the dirty work for us... */ t->rt_priority = HLS_SCHEDULING_PRIORITY; HLSProc[proc].CurrentThread = t->private_data; c->prio = 0; /* FIXME! */ repeat_lock_task: local_irq_save(rq_flags); rq = task_rq(c); spin_lock(&rq->lock); if (unlikely(rq != task_rq(p))) { spin_unlock_irqrestore(&rq->lock, rq_flags); goto repeat_lock_task; } array = rq->active; list_add_tail(&c->run_list, array->queue + c->prio); __set_bit(c->prio, array->bitmap); array->nr_active++; c->array = array; wup = t->pid; } else { HLSProc[proc].CurrentThread = NULL; wup = -1; } set_tsk_need_resched(current); show_tasks(); lastt = wup; if (sched_non_running) { printk("HLS ERROR: Trying to schedule %d with state = %ld\n", t->pid, t->state); } } void hls_bottom_vp_request(struct task_struct *t) { unsigned long flags; #ifdef __DO_CLI__ spin_lock_irqsave(&hls_lock, flags); #endif #ifdef VERBOSE hls_printk("\nTask %d unblocks (requests the VP)", t->pid); #endif HLSUnblockThreadHook(t); #ifdef VERBOSE hls_printk(" --- DONE the unblock of %d\n\n", t->pid); #endif #ifdef __DO_CLI__ spin_unlock_irqrestore(&hls_lock, flags); #endif } void hls_bottom_vp_release(struct task_struct *t) { unsigned long flags; long int initial_state; #ifdef __DO_CLI__ spin_lock_irqsave(&hls_lock, flags); #endif initial_state = t->state; if (t->state == TASK_RUNNING) { printk("HLS HYPER-ERROR!!! Blocking %d with state == %ld\n", t->pid, t->state); hls_printk("HLS HYPER-ERROR!!! Blocking %d with state == %ld\n", t->pid, t->state); } #ifdef VERBOSE hls_printk("\nTask %d blocks [state %ld] (releases the VP)", t->pid, t->state); hls_printk("State again (before calling): %ld\n", t->state); #endif HLSBlockThreadHook(t); #ifdef VERBOSE hls_printk(" --- DONE the block of %d [state %ld]\n\n", t->pid, t->state); #endif if (initial_state != t->state) { hls_printk("HLS ERROR!!! Task state changed during the hook??? %ld != %ld!!! Correcting...\n", t->state, initial_state); t->state = initial_state; } #ifdef __DO_CLI__ spin_unlock_irqrestore(&hls_lock, flags); #endif } void hls_bottom_vp_register(struct task_struct *t) { unsigned long flags; if (!strcmp(hls_default_name(), "")) { t->private_data = NULL; return; } #ifdef __DO_CLI__ spin_lock_irqsave(&hls_lock, flags); #endif #ifdef VERBOSE hls_printk("\nCreated task %d ", t->pid); hls_printk("HLS parameter is: 0x%lx\n", (unsigned long int)t->hls); #endif if (t->state != TASK_UNINTERRUPTIBLE) { printk("HLS ERROR: Creating task with unexpected state: %ld\n", t->state); hls_printk("HLS ERROR: Creating task with unexpected state: %ld\n", t->state); return; } t->policy = SCHED_FIFO; t->rt_priority = HLS_IDLE_PRIORITY; HLSCreateThreadHook(t, t->state); #ifdef VERBOSE hls_printk(" --- DONE the creation of %d\n\n", t->pid); #endif #ifdef __DO_CLI__ spin_unlock_irqrestore(&hls_lock, flags); #endif } void hls_bottom_vp_unregister(struct task_struct *t) { unsigned long flags; #ifdef __DO_CLI__ spin_lock_irqsave(&hls_lock, flags); #endif #ifdef VERBOSE hls_printk("\n%d exits (Unregisters the VP) \n", t->pid); #endif if (t->private_data != NULL) { HLSExitThreadHook(t); t->policy = SCHED_NORMAL; } #ifdef VERBOSE hls_printk(" --- DONE the end of %d\n\n", t->pid); #endif #ifdef __DO_CLI__ spin_unlock_irqrestore(&hls_lock, flags); #endif } void show_tasks(void) { struct task_struct *dummy, *t; int active; active = 0; read_lock(&tasklist_lock); do_each_thread(dummy, t) { #ifdef VERBOSE1 hls_printk("T%d:\t", t->pid); #endif if (t->private_data) { #ifdef VERBOSE1 hls_printk("HLS "); #endif if (t->rt_priority == HLS_SCHEDULING_PRIORITY) { if (t->state != TASK_RUNNING) { printk("HLS ERROR: Task %d has rt_priority = %ld and state = %ld --- WAI = %d WUP = %d Last = %d\n", t->pid, t->rt_priority, t->state, whereami, wup, lastt); hls_printk("HLS ERROR: Task %d has rt_priority = %ld and state = %ld\n", t->pid, t->rt_priority, t->state); } active++; } } else { #ifdef VERBOSE1 hls_printk("non hls "); #endif } #ifdef VERBOSE1 hls_printk("priority: %ld policy: %ld state: %ld\n", t->rt_priority, t->policy, t->state); #endif } while_each_thread(dummy, t); read_unlock(&tasklist_lock); #if 0 if (active > 1) { printk("Too many active tasks!!! Shutting HLS down...\n"); for_each_task(t) { #ifdef VERBOSE printk("T%d\t", t->pid); #endif if (t->private_data != NULL) { #ifdef VERBOSE printk("HLS!\t"); #endif HLSExitThreadHook(t); t->private_data = 0; t->policy = SCHED_NORMAL; } #ifdef VERBOSE printk("\n"); #endif } HLSDeinit(); block_hook = NULL; unblock_hook = NULL; fork_hook = NULL; cleanup_hook = NULL; } #else if (active > 1) { printk("HLS ERROR: Too many active tasks!!! But doing nothing...\n"); hls_printk("HLS ERROR: Too many active tasks!!! But doing nothing...\n"); } #endif #ifdef VERBOSE if (active == 0) { hls_printk("No active tasks?\n"); } #endif } --- NEW FILE: procfs.h --- #ifndef __PROCFS_H__ #define __PROCFS_H__ int hls_proc_init(void); void hls_proc_cleanup(void); #endif /* __PROCFS_H__ */ --- NEW FILE: hls_ctl.c --- /* * Copyright (c) 2002 Luca Abeni & John Regehr * * Module Name: hls_ctl.c * Abstract: This file implements the user interface for HLS, * allowing to move tasks between scheduler instances. * Author: Luca Abeni 2002, John Regehr 2000 * * This is free software; see GPL.txt */ #include <hls_common.h> #include <hls_internal.h> #include <thr.h> #include <hls.h> #include <hls_hooks.h> #define NOLINUX_TASKS #define HLS_NAME_SIZE 256 #define HLS_PARMS_SIZE 256 struct hls_sched_param { struct sched_param sp; int size; void *p; }; extern spinlock_t hls_lock; static int hls_setparam(struct HLS_VPROC *vp, void *sched_params, int prio) { struct hls_message NewMsg; #ifdef HLS_DEBUG NewMsg.ObjType = RRMsgValue; #endif NewMsg.body = sched_params; if (sched_params == NULL) { NewMsg.type = MSG_SETPRI; } else { NewMsg.type = MSG_SETPARAMS; } NewMsg.Pri = prio; return vp->TopSched->CB->B_Msg(NULL, vp, (MsgHandle)&NewMsg); } static int hls_null_msg(PRKTHREAD t) { int status; struct hls_message NewMsg; struct TH_INSTANCE_DATA *th; HLS_STATUS res; th = HLSFindThread (t); HLS_ASSERT (th); #ifdef HLS_DEBUG NewMsg.ObjType = RRMsgValue; #endif NewMsg.type = MSG_NULL; NewMsg.body = NULL; res = th->vp->TopSched->CB->B_Msg (NULL, th->vp, (MsgHandle)&NewMsg); if (res == HLS_SUCCESS) { status = 0; } else { status = -EINVAL; } HLSDbgPrint (9, ("(infr) HLSNullMsg: done\n")); return status; } static int hls_thread_move(PRKTHREAD t, struct HLS_SCHED_INSTANCE *new_sched) { struct HLS_SCHED_INSTANCE *th_inst; struct TH_INSTANCE_DATA *th, *th1; HLS_STATUS status; VPROC_STATE st; HLSDbgPrint (9, ("(infr) entering MoveThread\n")); th = HLSFindThread(t); if (!th) { HLSDbgPrint (1, ("MoveThread: HLSFindThread returned NULL\n")); return -EINVAL; } HLS_ASSERT (th->vp); HLS_ASSERT (th->vp->BottomSched); th_inst = th->vp->BottomSched; th1 = (struct TH_INSTANCE_DATA *)th_inst->SchedData; /* FIXME: This was put in to check if th1 is always == th... * it seems that it is. So, we can remove the need for th1! if (th == th1) { printk("They are the same!!!\n"); } */ HLS_ASSERT (th1->ObjType == ThInstValue); HLSDbgPrint (3, ("(infr) moving thread %s from %s to %s\n", th_inst->Name, th1->vp->TopSched->Name, new_sched->Name)); st = th1->vp->State; RemoveThread (th1, th1->Thread, HLS_TRUE); HLSDbgPrint (3, ("(infr) removed\n")); HLS_ASSERT (th1->vp->State == VP_Waiting); th1->vp->TopSched = new_sched; status = th1->vp->TopSched->CB->B_RegisterVP(new_sched, th_inst, th1->vp); HLS_ASSERT(status == HLS_SUCCESS); HLSDbgPrint(3, ("(infr) registered\n")); th_inst->Parent = new_sched; /* This cannot be done until the sched param are set... status = HLSSetPri(th1->Thread, HLS_DEFAULT_PRIORITY); HLS_ASSERT(status == HLS_SUCCESS); HLSDbgPrint (3, ("(infr) priority set to 1\n")); */ return st; } void set_state(struct TH_INSTANCE_DATA *th, int st) { switch(st) { case VP_Ready: case VP_Running: HLSDbgPrint (3, ("(infr) ChangeDefault: requesting CPU for thread\n")); // th1->vp->State = VP_Ready; th->vp->TopSched->CB->B_VP_Request(th->vp); break; case VP_Waiting: HLSDbgPrint (3, ("(infr) ChangeDefault: thread is currently blocked\n")); th->vp->State = VP_Waiting; break; default: printk("HLS Error: Unexpected state!!!\n"); HLS_ASSERT (0); } HLSDbgPrint (3, ("(infr) returning\n")); } /* TODO: * - in hls_ctl, Change hls_param *p ---> void *sp, HLS_SCHED_INSTANCE *target_sched * - add an hls_do_something_to_user_parms to get those vales... */ int hls_ctl(PRKTHREAD t, struct HLS_SCHED_INSTANCE *target_sched, void *s_p, int hls_priority) { int status; /* void *s_p; struct HLS_SCHED_INSTANCE *target_sched; */ struct TH_INSTANCE_DATA *th; int state; #if 0 if (p->command == HLS_CMD_NULL_MSG) { return hls_null_msg(t); } #endif #if 0 target_sched = HLSFindInstByName(sched_name); if (!target_sched) { HLSDbgPrint (2, ("(infr) Cannot find scheduler %s\n", sched_name)); return -EINVAL; } #endif /* Find the task instance */ th = HLSFindThread(t); if (!th) { HLSDbgPrint (2, ("(infr) oops - bad news; thread %d not found\n", t->pid)); return -EINVAL; } /* Is it already the task's scheduler? */ if (th->vp->TopSched == target_sched) { /* Yes: We simply do a setparm */ HLSDbgPrint (9, ("(infr) hls_ctl: %s is already scheduled by %s; trying to update params\n", ThreadStr(t), target_sched->Name)); status = hls_setparam(th->vp, s_p, hls_priority); if (status == HLS_SUCCESS) { return 0; } else { return -EINVAL; } } /* We have to move to the new scheduler... */ #ifdef HLS_DEBUG hls_printk("hls_ctl: Moving to %s\n", target_sched->Name); #endif state = hls_thread_move(t, target_sched); if (state < 0) { return -EINVAL; } #ifdef HLS_DEBUG hls_printk(" ...and setting the parameters (Priority %d)!\n", hls_priority); #endif status = hls_setparam(th->vp, s_p, hls_priority); if (status == HLS_SUCCESS) { set_state(th, state); return 0; } else { hls_printk(" hls_setparam failed :(\n"); hls_thread_move(t, HLSDefaultSched); HLSSetPri(th->Thread, HLS_DEFAULT_PRIORITY); set_state(th, state); return -EINVAL; } return 0; } static int hls_parse_param(void *p, struct HLS_SCHED_INSTANCE **sched, void *parms) { struct hls_sched_param sched_p; struct hls_param hls_p; static char sched_name[HLS_NAME_SIZE]; if (copy_from_user(&sched_p, p, sizeof(struct hls_sched_param)) < 0) { return -EFAULT; } if (sizeof(struct hls_param) != sched_p.size) { return -EFAULT; } if (copy_from_user(&hls_p, sched_p.p, sizeof(struct hls_param)) < 0) { return -EFAULT; } /* Extra consinstency check... */ if (hls_p.signature != HLS_SIGNATURE) { return -EFAULT; } if (hls_p.sched_data_size > HLS_PARMS_SIZE) { return -EFAULT; } if (hls_p.sched_data_size == 0) { memset(parms, 0, HLS_PARMS_SIZE); } else { if (copy_from_user(parms, hls_p.sched_data, hls_p.sched_data_size) < 0) { return -EFAULT; } } /* Check if there is room for the scheduler's name... */ if (strlen(hls_p.scheduler) > HLS_NAME_SIZE) { return -EINVAL; } /* ...And get it!!! */ memset(sched_name, 0, HLS_NAME_SIZE); if (copy_from_user(sched_name, hls_p.scheduler, strlen(hls_p.scheduler)) < 0) { return -EFAULT; } *sched = HLSFindInstByName(sched_name); if (!*sched) { printk("Cannot find scheduler %s\n", sched_name); return -EINVAL; } return sched_p.sp.sched_priority; } static int hls_parse_priority(void *p) { struct hls_sched_param sched_p; if (copy_from_user(&sched_p, p, sizeof(struct hls_sched_param)) < 0) { return -EFAULT; } printk("Parse priority: %d\n", sched_p.sp.sched_priority); return sched_p.sp.sched_priority; } static inline struct task_struct *find_process_by_pid(pid_t pid) { struct task_struct *tsk = current; if (pid) { tsk = find_task_by_pid(pid); } return tsk; } /* Return value: * < 0 ---> Failure * = 0 ---> Success * > 0 ---> do the regular Linux thing... */ int hls_setsched(pid_t pid, int policy, struct sched_param *param) { struct task_struct *p; unsigned long flags; char sp[HLS_PARMS_SIZE]; char *sched_param = NULL; struct HLS_SCHED_INSTANCE *s; int res; int priority = HLS_DEFAULT_PRIORITY; int return_to_linux; spin_lock_irqsave(&hls_lock, flags); p = find_process_by_pid(pid); if (p == NULL) { spin_unlock_irqrestore(&hls_lock, flags); return -ESRCH; } return_to_linux = -1; if (policy != SCHED_HLS) { if (policy == SCHED_NORMAL) { if (p->private_data != NULL) { #ifdef NOLINUX_TASKS s = HLSDefaultSched; priority = HLS_DEFAULT_PRIORITY; #else HLSExitThreadHook(p); p->policy = SCHED_NORMAL; p->private_data = NULL; /* We return to use the linux scheduler... * No need to set s & sched_param */ return_to_linux = 1; #endif } else { /* Private data == NULL... * - If NOLINUX_TASKS, transform in HLS * - Otherwise, do nothing */ #ifdef NOLINUX_TASKS p->policy = SCHED_FIFO; p->rt_priority = HLS_IDLE_PRIORITY; HLSCreateThreadHook(p, p->state); #else printk("Policy %d != SCHED_HLS. Doing nothing... (already non-hls)\n", policy); #endif /* We do not need to call hls_ctl... * No need to set s & sched_param */ return_to_linux = 0; } } else { if (p->private_data == NULL) { /* Transform in HLS */ p->policy = SCHED_FIFO; p->rt_priority = HLS_IDLE_PRIORITY; HLSCreateThreadHook(p, p->state); } /* Change scheduler to rt_sched */ priority = hls_parse_priority(param); s = hls_rt_sched; if (priority >= HLS_MAXIMUM_PRIORITY) { priority = HLS_MAXIMUM_PRIORITY - 1; } if (priority < 1) { priority = 1; } } if (return_to_linux >= 0) { spin_unlock_irqrestore(&hls_lock, flags); return return_to_linux; } } else { priority = hls_parse_param(param, &s, sp); sched_param = sp; if (priority < 0) { spin_unlock_irqrestore(&hls_lock, flags); return priority; } } if (p->private_data == NULL) { printk("HLS Error: %d has private_data = NULL???\n", p->pid); #ifdef NOLINUX_TASKS spin_unlock_irqrestore(&hls_lock, flags); return -EINVAL; #else p->policy = SCHED_FIFO; p->rt_priority = HLS_IDLE_PRIORITY; HLSCreateThreadHook(p, p->state); #endif } res = hls_ctl(p, s, sched_param, priority); spin_unlock_irqrestore(&hls_lock, flags); return res; } --- NEW FILE: Makefile --- SCHED_MOD = ../hls/hls_sched_res.o ../hls/hls_sched_ps.o ../hls/hls_sched_rr.o OBJS = ../hls/hls_sched_th.o ../hls/hls_hooks.o ../hls/hls_sched_root.o \ ../hls/hls_sched_join.o ../hls/hls_names.o hls_ctl.o \ hls_timers.o ../hls/hls_debug.o ../hls/hls_init.o \ ../hls/hls_instances.o ../hls/hls_params.o \ init.o bottom.o misc.o procfs.o HLS = /root/src/NewGenSched/hls HLS = $(SUBDIRS)/.. EXTRA_CFLAGS += -I $(HLS)/hls/include -I $(HLS)/linux/include ifdef DEBUG EXTRA_CFLAGS += -DHLS_DEBUG=$(DEBUG) else EXTRA_CFLAGS += -DHLS_DEBUG=0 endif ifdef INT_SCHED OBJS += $(SCHED_MOD) EXTRA_CFLAGS += -D__INTERNAL_SCHEDULERS__ else OBJS += export.o endif ifndef MULDIV OBJS += div.o else EXTRA_CFLAGS += -D__MULDIV__ endif ifdef FP EXTRA_CFLAGS += -D__FP_DEAMONS__ endif ifdef CLI EXTRA_CFLAGS += -D__DO_CLI__ endif ifdef LOG EXTRA_CFLAGS += -I$(LOG)/include -D__LOG_DEVICE__ endif ifdef CREATE EXTRA_CFLAGS += -D__CREATE_HIERARCHY__ endif obj-m = hls_module.o hls_module-objs = $(OBJS) include: $(MAKE) -C include ARCH=$(ARCH) --- NEW FILE: export.c --- /* * Copyright (c) 2002 Luca Abeni * * Module Name: export.c * Abstract: This file exports the HLS API to external HLS schedulers, * when they are built as Linux modules. * Author: Luca Abeni 2-Feb-2002 * * This is free software; see GPL.txt */ #include <interface-funcs.h> #include <interface-data.h> #ifdef HLS_DEBUG #include <hls_debug.h> #endif /* HLS_DEBUG */ #include <hls_interface.h> EXPORT_SYMBOL(HLSRegisterScheduler); EXPORT_SYMBOL(KiFindLeftNibbleBitTable); EXPORT_SYMBOL(HLSNumProcs); EXPORT_SYMBOL(HLSSetTimer); EXPORT_SYMBOL(hls_stop_timer); EXPORT_SYMBOL(HLSGetCurrentTime); #ifdef HLS_DEBUG EXPORT_SYMBOL(VPStateName); EXPORT_SYMBOL(HLS_DBG_PRINT_LEVEL); #endif /* HLS_DEBUG */ --- NEW FILE: div.c --- /* This file contains parts of libgcc2.c, from gcc 2.95.3, which * is released under the following license */ /* More subroutines needed by GCC output code on some machines. */ /* Compile this one with gcc. */ /* Copyright (C) 1989, 92-98, 1999 Free Software Foundation, Inc. This file is part of GNU CC. GNU CC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. GNU CC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GNU CC; see the file COPYING. If not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* As a special exception, if you link this software with other files, some of which are compiled with GCC, to produce an executable, this software does not by itself cause the resulting executable to be covered by the GNU General Public License. This exception does not however invalidate any other reasons why the executable file might be covered by the GNU General Public License. */ #define BITS_PER_UNIT 8 /* Check this!!! */ #define SI_TYPE_SIZE (sizeof (SItype) * BITS_PER_UNIT) typedef int word_type __attribute__ ((mode (__word__))); typedef unsigned int UDItype __attribute__ ((mode (DI))); typedef int DItype __attribute__ ((mode (DI))); typedef int SItype __attribute__ ((mode (SI))); typedef unsigned int USItype __attribute__ ((mode (SI))); #if LIBGCC2_WORDS_BIG_ENDIAN struct DIstruct {SItype high, low;}; #else struct DIstruct {SItype low, high;}; #endif typedef union { struct DIstruct s; DItype ll; } DIunion; #define count_leading_zeros(count, x) \ do { \ USItype __cbtmp; \ __asm__ ("bsrl %1,%0" \ : "=r" (__cbtmp) : "rm" ((USItype) (x))); \ (count) = __cbtmp ^ 31; \ } while (0) #define udiv_qrnnd(q, r, n1, n0, d) \ __asm__ ("divl %4" \ : "=a" ((USItype) (q)), \ "=d" ((USItype) (r)) \ : "0" ((USItype) (n0)), \ "1" ((USItype) (n1)), \ "rm" ((USItype) (d))) #define sub_ddmmss(sh, sl, ah, al, bh, bl) \ __asm__ ("subl %5,%1 sbbl %3,%0" \ : "=r" ((USItype) (sh)), \ "=&r" ((USItype) (sl)) \ : "0" ((USItype) (ah)), \ "g" ((USItype) (bh)), \ "1" ((USItype) (al)), \ "g" ((USItype) (bl))) #define umul_ppmm(w1, w0, u, v) \ __asm__ ("mull %3" \ : "=a" ((USItype) (w0)), \ "=d" ((USItype) (w1)) \ : "%0" ((USItype) (u)), \ "rm" ((USItype) (v))) UDItype __udivmoddi4 (UDItype n, UDItype d, UDItype *rp) { DIunion ww; DIunion nn, dd; DIunion rr; USItype d0, d1, n0, n1, n2; USItype q0, q1; USItype b, bm; nn.ll = n; dd.ll = d; d0 = dd.s.low; d1 = dd.s.high; n0 = nn.s.low; n1 = nn.s.high; #if !UDIV_NEEDS_NORMALIZATION if (d1 == 0) { if (d0 > n1) { /* 0q = nn / 0D */ udiv_qrnnd (q0, n0, n1, n0, d0); q1 = 0; /* Remainder in n0. */ } else { /* qq = NN / 0d */ if (d0 == 0) d0 = 1 / d0; /* Divide intentionally by zero. */ udiv_qrnnd (q1, n1, 0, n1, d0); udiv_qrnnd (q0, n0, n1, n0, d0); /* Remainder in n0. */ } if (rp != 0) { rr.s.low = n0; rr.s.high = 0; *rp = rr.ll; } } #else /* UDIV_NEEDS_NORMALIZATION */ if (d1 == 0) { if (d0 > n1) { /* 0q = nn / 0D */ count_leading_zeros (bm, d0); if (bm != 0) { /* Normalize, i.e. make the most significant bit of the denominator set. */ d0 = d0 << bm; n1 = (n1 << bm) | (n0 >> (SI_TYPE_SIZE - bm)); n0 = n0 << bm; } udiv_qrnnd (q0, n0, n1, n0, d0); q1 = 0; /* Remainder in n0 >> bm. */ } else { /* qq = NN / 0d */ if (d0 == 0) d0 = 1 / d0; /* Divide intentionally by zero. */ count_leading_zeros (bm, d0); if (bm == 0) { /* From (n1 >= d0) /\ (the most significant bit of d0 is set), conclude (the most significant bit of n1 is set) /\ (the leading quotient digit q1 = 1). This special case is necessary, not an optimization. (Shifts counts of SI_TYPE_SIZE are undefined.) */ n1 -= d0; q1 = 1; } else { /* Normalize. */ b = SI_TYPE_SIZE - bm; d0 = d0 << bm; n2 = n1 >> b; n1 = (n1 << bm) | (n0 >> b); n0 = n0 << bm; udiv_qrnnd (q1, n1, n2, n1, d0); } /* n1 != d0... */ udiv_qrnnd (q0, n0, n1, n0, d0); /* Remainder in n0 >> bm. */ } if (rp != 0) { rr.s.low = n0 >> bm; rr.s.high = 0; *rp = rr.ll; } } #endif /* UDIV_NEEDS_NORMALIZATION */ else { if (d1 > n1) { /* 00 = nn / DD */ q0 = 0; q1 = 0; /* Remainder in n1n0. */ if (rp != 0) { rr.s.low = n0; rr.s.high = n1; *rp = rr.ll; } } else { /* 0q = NN / dd */ count_leading_zeros (bm, d1); if (bm == 0) { /* From (n1 >= d1) /\ (the most significant bit of d1 is set), conclude (the most significant bit of n1 is set) /\ (the quotient digit q0 = 0 or 1). This special case is necessary, not an optimization. */ /* The condition on the next line takes advantage of that n1 >= d1 (true due to program flow). */ if (n1 > d1 || n0 >= d0) { q0 = 1; sub_ddmmss (n1, n0, n1, n0, d1, d0); } else q0 = 0; q1 = 0; if (rp != 0) { rr.s.low = n0; rr.s.high = n1; *rp = rr.ll; } } else { USItype m1, m0; /* Normalize. */ b = SI_TYPE_SIZE - bm; d1 = (d1 << bm) | (d0 >> b); d0 = d0 << bm; n2 = n1 >> b; n1 = (n1 << bm) | (n0 >> b); n0 = n0 << bm; udiv_qrnnd (q0, n1, n2, n1, d1); umul_ppmm (m1, m0, q0, d0); if (m1 > n1 || (m1 == n1 && m0 > n0)) { q0--; sub_ddmmss (m1, m0, m1, m0, d1, d0); } q1 = 0; /* Remainder in (n1n0 - m1m0) >> bm. */ if (rp != 0) { sub_ddmmss (n1, n0, n1, n0, m1, m0); rr.s.low = (n1 << b) | (n0 >> bm); rr.s.high = n1 >> bm; *rp = rr.ll; } } } } ww.s.low = q0; ww.s.high = q1; return ww.ll; } DItype __negdi2 (DItype u) { DIunion w; DIunion uu; uu.ll = u; w.s.low = -uu.s.low; w.s.high = -uu.s.high - ((USItype) w.s.low > 0); return w.ll; } DItype __divdi3 (DItype u, DItype v) { word_type c = 0; DIunion uu, vv; DItype w; uu.ll = u; vv.ll = v; if (uu.s.high < 0) c = ~c, uu.ll = __negdi2 (uu.ll); if (vv.s.high < 0) c = ~c, vv.ll = __negdi2 (vv.ll); w = __udivmoddi4 (uu.ll, vv.ll, (UDItype *) 0); if (c) w = __negdi2 (w); return w; } |
Update of /cvsroot/linux-hls/hls/linux-2.6/include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10942/include Added Files: Makefile bitfields.h data.h debug-funcs.h funcs.h hls.h i386-muldiv.h interface-data.h interface-funcs.h ppc-muldiv.h Log Message: Beginning of a 2.6 backend... Does not work yet! --- NEW FILE: interface-funcs.h --- /* * Copyright (c) 2002 Luca Abeni * * Module Name: interface-funcs.h * Abstract: Kernel-dependent bits of the HLS API - Functions. * Author: Luca Abeni 2002 * * This is free software; see GPL.txt */ #ifndef __INTERFACE_FUNCS__ #define __INTERFACE_FUNCS__ #include <linux/config.h> #if defined(CONFIG_MODVERSIONS) && !defined(MODVERSIONS) #define MODVERSIONS #endif #ifdef MODVERSIONS //#include <linux/modversions.h> #endif #include <linux/module.h> #include <linux/init.h> #include <asm/uaccess.h> #include <linux/kernel.h> #include <linux/sched.h> #include <linux/slab.h> #include <linux/list.h> #ifdef __MULDIV__ #include <muldiv.h> #endif #include "bitfields.h" #ifndef CONFIG_GENERIC_SCHEDULER #error Generic Scheduler is not enabled!!! #endif #ifdef __LOG_DEVICE__ #include "logger.h" #define hls_printk log_printf #else #define hls_printk printk #endif #define hls_hard_printk printk #define DbgPrint printk #if 0 #define hls_panic panic #else #define hls_panic(a) BUG() #endif #define LIST_NEXT_ENTRY(l) (l->next) extern inline void *hls_malloc (int size) { return kmalloc (size, GFP_ATOMIC); } extern inline void hls_free (void *mem) { kfree (mem); } #define KeQueryTimeIncrement() (1000000L / HZ) * 10 #endif /* __INTERFACE_FUNCS__ */ --- NEW FILE: Makefile --- muldiv.h: ln -s $(ARCH)-muldiv.h muldiv.h --- NEW FILE: hls.h --- /* * Copyright (c) 2002 Luca Abeni * * Module Name: hls.h * Abstract: Kernel-dependent data needed by HLS. * Author: Luca Abeni 2002 * * This is free software; see GPL.txt */ #ifndef __HLS_H__ #define __HLS_H__ struct hls_struct { int boh; }; #endif /* __HLS_H__ */ --- NEW FILE: bitfields.h --- /* * Copyright (c) 2002 Luca Abeni * * Module Name: bitfields.h * Abstract: As said below, a hack! * Author: Luca Abeni 2002 * * This is free software; see GPL.txt */ /* This is clearly a hack! */ extern unsigned char KiFindLeftNibbleBitTable[]; /* Hasn't Linux anything similar? */ #define FindFirstSetLeftMember(Set, Member) { \ ULONG _Bit; \ ULONG _Mask; \ ULONG _Offset = 16; \ if ((_Mask = Set >> 16) == 0) { \ _Offset = 0; \ _Mask = Set; \ } \ if (_Mask >> 8) { \ _Offset += 8; \ } \ if ((_Bit = Set >> _Offset) & 0xf0) { \ _Bit >>= 4; \ _Offset += 4; \ } \ *(Member) = KiFindLeftNibbleBitTable[_Bit] + _Offset; \ } #define ClearMember(Member, Set) \ do { \ Set = Set & (~(1 << (Member))); \ } /*lint --e(717)*/ while (0); #define SetMember(Member, Set) \ do { \ Set = Set | (1 << (Member)); \ } /*lint --e(717)*/ while (0); --- NEW FILE: debug-funcs.h --- /* * Copyright (c) 2002 Luca Abeni * * Module Name: debug-funcs.h * Abstract: Kernel-dependent bits of the debugging functions. * Author: Luca Abeni 2002 * * This is free software; see GPL.txt */ #ifndef __DEBUG_FUNCS_H__ #define __DEBUG_FUNCS_H__ #define current_task() current #define th_id(t) (t->pid) #endif /* __DEBUG_FUNCS_H__ */ --- NEW FILE: interface-data.h --- /* * Copyright (c) 2002 Luca Abeni * * Module Name: interface-data.h * Abstract: Kernel-dependent bits of the HLS API - Data. * Author: Luca Abeni 2002 * * This is free software; see GPL.txt */ #ifndef __INTERFACE_DATA__ #define __INTERFACE_DATA__ #define LIST_ENTRY struct list_head typedef LIST_ENTRY *PRLIST_ENTRY; #define SCHAR signed char #define ULONG unsigned long typedef long long _int64; typedef long int WNT_TIME; /* FIXME: This must be removed! */ #define MAXIMUM_PROCESSORS 32 #define KTIMER struct timer_list #define PROCT ULONG #define KPRIORITY int #define HLS_MAXIMUM_PRIORITY 32 /* FIXME: Shouldn't this go in rr.h??? */ #define CONTAINING_RECORD(address, type, field) ((type *)( \ (char *)(address) - \ (unsigned long)(&((type *)0)->field))) typedef enum _HLS_BOOL { HLS_FALSE = 0, HLS_TRUE = 0x600 // don't change this value } HLS_BOOL; typedef enum _HLS_STATUS { HLS_SUCCESS = 0xadd0, HLS_NOROOM, HLS_INVALID_PARAMETER } HLS_STATUS; #endif /* __INTERFACE_DATA__ */ --- NEW FILE: i386-muldiv.h --- /* This comes from RTAI... Please, adjust the license stuff!!! */ static inline unsigned long long ulldiv(unsigned long long ull, unsigned long uld, unsigned long *r) { unsigned long long q, rf; unsigned long qh, rh, ql, qf; q = 0; rf = (unsigned long long)(0xFFFFFFFF - (qf = 0xFFFFFFFF / uld) * uld) + 1ULL; while (ull >= uld) { ((unsigned long *)&q)[1] += (qh = ((unsigned long *)&ull)[1] / uld); rh = ((unsigned long *)&ull)[1] - qh * uld; q += rh * (unsigned long long)qf + (ql = ((unsigned long *)&ull)[0] / uld); ull = rh * rf + (((unsigned long *)&ull)[0] - ql * uld); } *r = ull; return q; } // returns (long long)ll = (int)ll*(int)(mult)/(int)div. static inline long long llimd(long long ll, int mult, int div) { __asm__ __volatile (\ "movl %%edx,%%ecx; mull %%esi; movl %%eax,%%ebx; \n\t" "movl %%ecx,%%eax; movl %%edx,%%ecx; mull %%esi; \n\t" "addl %%ecx,%%eax; adcl $0,%%edx; divl %%edi; \n\t" "movl %%eax,%%ecx; movl %%ebx,%%eax; divl %%edi; \n\t" "sal $1,%%edx; cmpl %%edx,%%edi; movl %%ecx,%%edx; \n\t" "jge 1f; addl $1,%%eax; adcl $0,%%edx; 1:" : "=A" (ll) : "A" (ll), "S" (mult), "D" (div) : "%ebx", "%ecx"); return ll; } --- NEW FILE: funcs.h --- /* * Copyright (c) 2002 Luca Abeni * * Module Name: funcs.h * Abstract: Kernel-dependent functions needed by HLS. * Author: Luca Abeni 2002 * * This is free software; see GPL.txt */ #ifndef __FUNCS__ #define __FUNCS__ #define th_cpu(t) (t->thread_info->cpu) #define rt_priority(t) (t->rt_priority) #define HLS_DATA(t) (t->private_data) /* From linux/kernel/sched.h */ #ifdef CONFIG_SMP #define idle_task(cpu) (init_tasks[cpu_number_map(cpu)]) #define can_schedule(p,cpu) \ ((p)->cpus_runnable & (p)->cpus_allowed & (1 << cpu)) #else #define idle_task(cpu) (&init_task) #define can_schedule(p,cpu) (1) #endif #endif /* __FUNCS__ */ --- NEW FILE: ppc-muldiv.h --- /* This comes from RTAI... Please, adjust the license stuff!!! */ static inline unsigned long long ullmul(unsigned long m0, unsigned long m1) { unsigned long long res; __asm__ __volatile__ ("mulhwu %0, %1, %2" : "=r" (((unsigned long *)&res)[0]) : "%r" (m0), "r" (m1)); ((unsigned long *)&res)[1] = m0 * m1; return res; } static inline unsigned long long ulldiv(unsigned long long ull, unsigned long uld, unsigned long *r) { unsigned long long q, rf; unsigned long qh, rh, ql, qf; q = 0; rf = (unsigned long long)(0xFFFFFFFF - (qf = 0xFFFFFFFF / uld) * uld) + 1ULL; while (ull >= uld) { ((unsigned long *)&q)[0] += (qh = ((unsigned long *)&ull)[0] / uld); rh = ((unsigned long *)&ull)[0] - qh * uld; q += rh * (unsigned long long)qf + (ql = ((unsigned long *)&ull)[1] / uld); ull = rh * rf + (((unsigned long *)&ull)[1] - ql * uld); } *r = ull; return q; } // returns (long long)ll = (int)ll*(int)(mult)/(int)div. static inline unsigned long long llimd(unsigned long long ull, unsigned long mult, unsigned long div) { unsigned long long low; unsigned long q, r; low = ullmul(((unsigned long *)&ull)[1], mult); q = ulldiv(ullmul(((unsigned long *)&ull)[0], mult) + ((unsigned long *)&low)[0], div, (unsigned long *)&low); low = ulldiv(low, div, &r); ((unsigned long *)&low)[0] += q; return (r + r) > div ? low + 1 : low; } --- NEW FILE: data.h --- /* * Copyright (c) 2002 Luca Abeni * * Module Name: data.h * Abstract: HLS data * Author: Luca Abeni 2002 * * This is free software; see GPL.txt */ #ifndef __DATA__ #define __DATA__ #define BOOLEAN int #define TRUE 1 #define FALSE 0 #define HANDLE void * #define VOID void #define KTHREAD_STATE long #define PRKTHREAD struct task_struct * #define PKTHREAD struct task_struct * #define HLS_READY_REASON int #define HLS_FASTCALL /* Linux Real-Time priorities go from 0 to 99 */ #define HLS_SCHEDULING_PRIORITY 100 /* The priority is computed as 1000 + rt_priority... * with rp_priority = -2000, it results -1000 * and the task will never be scheduled */ #define HLS_IDLE_PRIORITY -2000 typedef enum _HLS_CTL_COMMAND { HLS_CMD_DUMP_COUNTS = 100, HLS_CMD_WHICH_PROC = 101, HLS_CMD_SET_DEBUG_LEVEL = 102, HLS_CMD_RES = 103, HLS_CMD_SET_TIMERRES = 104, HLS_CMD_GET_STOLEN = 105, HLS_CMD_LIST_RES = 106, HLS_CMD_END_RES = 107, HLS_CMD_NEW_INSTANCE = 108, HLS_CMD_SET_SHARE = 109, HLS_CMD_SET_DEFAULT = 110, HLS_CMD_DESTROY_INSTANCE = 111, HLS_CMD_NULL_MSG = 112, HLS_CMD_MOVE_THREAD = 113 } HLS_CTL_COMMAND; struct hls_param { unsigned long int signature; HLS_CTL_COMMAND command; char *scheduler; int sched_data_size; void *sched_data; }; #define SCHED_HLS 10 #define HLS_SIGNATURE 0x56 #endif /* __DATA__ */ |
|
From: Luca A. <lu...@us...> - 2004-04-04 20:42:10
|
Update of /cvsroot/linux-hls/hls/linux-2.6/include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10680/linux-2.6/include Log Message: Directory /cvsroot/linux-hls/hls/linux-2.6/include added to the repository |
|
From: Luca A. <lu...@us...> - 2004-04-04 20:42:09
|
Update of /cvsroot/linux-hls/hls/linux-2.6 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10680/linux-2.6 Log Message: Directory /cvsroot/linux-hls/hls/linux-2.6 added to the repository |
|
From: Luca A. <lu...@us...> - 2004-04-03 18:32:38
|
Update of /cvsroot/linux-hls/hls/simul In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16778 Added Files: workload.h Log Message: Forgot to commit workload.h some time ago... BTW, check if the cvs ml is fixed, now... --- NEW FILE: workload.h --- #ifndef __WORKLOAD_H__ #define __WORKLOAD_H__ long long int workload_generate(void); #endif /* __WORKLOAD_H__ */ |
|
From: <lu...@us...> - 2003-12-13 12:27:18
|
Update of /cvsroot/linux-hls/hls/simul In directory sc8-pr-cvs1:/tmp/cvs-serv15989/simul Modified Files: Makefile Log Message: - Misc cleanups - Unbreak modular compilation - Provide a way to move all the tasks away from HLS (echo null > /proc/HLS/default) Index: Makefile =================================================================== RCS file: /cvsroot/linux-hls/hls/simul/Makefile,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** Makefile 29 Nov 2003 09:11:35 -0000 1.12 --- Makefile 13 Dec 2003 12:27:15 -0000 1.13 *************** *** 17,21 **** OBJS = hls_sched_th.o hls_hooks.o hls_sched_root.o \ hls_sched_res.o hls_sched_ps.o hls_sched_join.o \ ! hls_utils.o hls_sched_rr.o hls_debug.o \ hls_timers.o \ sim_os.o sim.o sim_events.o sim_cpu.o misc.o sim_list.o \ --- 17,22 ---- OBJS = hls_sched_th.o hls_hooks.o hls_sched_root.o \ hls_sched_res.o hls_sched_ps.o hls_sched_join.o \ ! hls_init.o hls_instances.o hls_params.o \ ! hls_sched_rr.o hls_debug.o \ hls_timers.o \ sim_os.o sim.o sim_events.o sim_cpu.o misc.o sim_list.o \ *************** *** 24,27 **** --- 25,29 ---- # init.o bottom.o misc.o # hls_ctl.o hls_timers.o \ + # hls_utils.o \ simulator: $(OBJS) |
|
From: <lu...@us...> - 2003-12-13 12:27:18
|
Update of /cvsroot/linux-hls/hls/linux
In directory sc8-pr-cvs1:/tmp/cvs-serv15989/linux
Modified Files:
Makefile export.c init.c procfs.c
Log Message:
- Misc cleanups
- Unbreak modular compilation
- Provide a way to move all the tasks away from HLS (echo null > /proc/HLS/default)
Index: Makefile
===================================================================
RCS file: /cvsroot/linux-hls/hls/linux/Makefile,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** Makefile 29 Nov 2003 11:59:01 -0000 1.8
--- Makefile 13 Dec 2003 12:27:15 -0000 1.9
***************
*** 25,30 ****
OBJS = hls_sched_th.o hls_hooks.o hls_sched_root.o hls_sched_join.o \
! hls_utils.o hls_names.o hls_ctl.o hls_timers.o hls_debug.o \
init.o bottom.o misc.o procfs.o
ifdef DEBUG
--- 25,32 ----
OBJS = hls_sched_th.o hls_hooks.o hls_sched_root.o hls_sched_join.o \
! hls_names.o hls_ctl.o hls_timers.o hls_debug.o \
! hls_init.o hls_instances.o hls_params.o \
init.o bottom.o misc.o procfs.o
+ # hls_utils.o
ifdef DEBUG
Index: export.c
===================================================================
RCS file: /cvsroot/linux-hls/hls/linux/export.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** export.c 25 Feb 2003 09:18:55 -0000 1.2
--- export.c 13 Dec 2003 12:27:15 -0000 1.3
***************
*** 28,30 ****
--- 28,31 ----
#ifdef HLS_DEBUG
EXPORT_SYMBOL(VPStateName);
+ EXPORT_SYMBOL(HLS_DBG_PRINT_LEVEL);
#endif /* HLS_DEBUG */
Index: init.c
===================================================================
RCS file: /cvsroot/linux-hls/hls/linux/init.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** init.c 29 Nov 2003 11:59:01 -0000 1.9
--- init.c 13 Dec 2003 12:27:15 -0000 1.10
***************
*** 116,119 ****
--- 116,139 ----
}
+ void hls_release_tasks(void)
+ {
+ struct task_struct *t;
+
+ t = current;
+ for_each_task(t) {
+ if (t->private_data != NULL) {
+ #ifdef VERBOSE
+ printk("Removing task %d from HLS\n", t->pid);
+ #endif
+
+ if (t->state == TASK_RUNNING) {
+ hls_block_other_thread(t);
+ }
+ HLSExitThreadHook(t);
+ t->private_data = 0;
+ t->policy = SCHED_OTHER;
+ }
+ }
+ }
int init_module(void)
***************
*** 152,156 ****
cleanup_hook = hls_bottom_vp_unregister;
setsched_hook = hls_setsched;
!
HLSInit();
/*
--- 172,176 ----
cleanup_hook = hls_bottom_vp_unregister;
setsched_hook = hls_setsched;
!
HLSInit();
/*
***************
*** 169,173 ****
void cleanup_module(void)
{
- struct task_struct *t;
unsigned long flags;
--- 189,192 ----
***************
*** 176,195 ****
#endif
! t = current;
!
! for_each_task(t) {
! if (t->private_data != NULL) {
! #ifdef VERBOSE
! printk("Removing task %d from HLS\n", t->pid);
! #endif
!
! if (t->state == TASK_RUNNING) {
! hls_block_other_thread(t);
! }
! HLSExitThreadHook(t);
! t->private_data = 0;
! t->policy = SCHED_OTHER;
! }
! }
HLSDeinit();
--- 195,199 ----
#endif
! hls_release_tasks();
HLSDeinit();
Index: procfs.c
===================================================================
RCS file: /cvsroot/linux-hls/hls/linux/procfs.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** procfs.c 29 Nov 2003 09:11:35 -0000 1.8
--- procfs.c 13 Dec 2003 12:27:15 -0000 1.9
***************
*** 104,113 ****
schedname[c - 1] = 0;
! sched = HLSFindInstByName(schedname);
! if (sched == NULL) {
! printk("Cannot find %s\n", schedname);
! return c;
}
--- 104,119 ----
schedname[c - 1] = 0;
! if (memcmp(schedname, "null", 4)) {
! printk("Searching for %s\n", schedname);
! sched = HLSFindInstByName(schedname);
! if (sched == NULL) {
! printk("Cannot find %s\n", schedname);
! return c;
! }
! } else {
! printk("Schedname = NULL\n");
! sched = NULL;
}
|
|
From: <lu...@us...> - 2003-12-13 12:27:18
|
Update of /cvsroot/linux-hls/hls/hls
In directory sc8-pr-cvs1:/tmp/cvs-serv15989/hls
Modified Files:
hls_debug.c hls_names.c
Added Files:
hls_init.c hls_instances.c hls_params.c
Removed Files:
hls_utils.c
Log Message:
- Misc cleanups
- Unbreak modular compilation
- Provide a way to move all the tasks away from HLS (echo null > /proc/HLS/default)
--- NEW FILE: hls_init.c ---
#include "hls_common.h"
#include "hls_internal.h"
#include "thr.h"
struct HLS_CALLBACKS *HLSAbsScheds[HLS_MAX_ABS_SCHEDS];
static struct HLS_SCHED_INSTANCE *HLSRootSched;
struct HLS_SCHED_INSTANCE *HLSAllSchedInsts[HLS_MAX_SCHED_INSTS];
struct HLS_SCHED_INSTANCE *HLSDefaultSched;
struct HLS_SCHED_INSTANCE *hls_rt_sched;
#ifdef __CREATE_HIERARCHY__
static struct HLS_SCHED_INSTANCE *HLSFP1 = NULL;
static struct HLS_SCHED_INSTANCE *HLSFP2 = NULL;
static struct HLS_SCHED_INSTANCE *HLSRES = NULL;
static struct HLS_SCHED_INSTANCE *HLSPS1 = NULL;
#ifdef MANY
static struct HLS_SCHED_INSTANCE *HLSFP3 = NULL;
static struct HLS_SCHED_INSTANCE *HLSFP4 = NULL;
#endif
#endif
#ifdef __INTERNAL_SCHEDULERS__
extern int rr_module_init(void);
extern int res_module_init(void);
extern int ps_module_init(void);
#endif
extern struct HLS_CALLBACKS TH_CB;
extern struct HLS_CALLBACKS ROOT_CB;
extern struct HLS_CALLBACKS JOIN_CB;
//extern int hls_setparam_ascii(struct HLS_SCHED_INSTANCE *inst, char *param);
PROCT HLSNumProcs (void)
{
HLS_ASSERT (NR_CPUS > 0);
return (PROCT)(int)NR_CPUS;
}
static void CreateSimpleHierarchy (void)
{
/*
* build the scheduling hierarchy; it's built dynamically, but for
* now always the same way
*/
#ifdef __CREATE_HIERARCHY__
HLSFP1 = HLSNewSchedInstance ("RR", "rr1", HLSRootSched);
HLS_ASSERT (HLSFP1);
HLSFP2 = HLSNewSchedInstance ("RR", "rr2", HLSFP1);
HLS_ASSERT (HLSFP2);
SetDefPriForSched (10, HLSFP2);
hls_setparam_ascii(HLSFP2, "10");
HLSPS1 = HLSNewSchedInstance ("PS", "ps1", HLSFP1);
HLS_ASSERT (HLSPS1);
SetDefPriForSched (11, HLSPS1);
hls_setparam_ascii(HLSPS1, "11");
HLSRES = HLSNewSchedInstance ("RES", "res1", HLSFP1);
HLS_ASSERT (HLSRES);
SetDefPriForSched (20, HLSRES);
hls_setparam_ascii(HLSRES, "20");
// HLSDefaultSched = HLSPS1;
#ifdef HIER
HLSFP3 = HLSNewSchedInstance ("RR", "rr3", HLSFP2);
HLS_ASSERT (HLSFP3);
SetDefPriForSched (10, HLSFP3);
HLSFP4 = HLSNewSchedInstance ("RR", "rr4", HLSFP2);
HLS_ASSERT (HLSFP4);
SetDefPriForSched (11, HLSFP4);
#endif
HLSDefaultSched = HLSFP2;
hls_rt_sched = HLSFP1;
#endif
}
void HLSInit (void)
{
PROCT i;
HLS_STATUS res;
struct HLS_SCHED_INSTANCE *hls_root_sched = NULL;
/*
* Make sure that there's one debug printout that can't be
* suppressed by setting HLS_DBG_PRINT_LEVEL to 0
*/
#if defined(NT_UP)
#ifdef HLS_DEBUG
DbgPrint ("HLS UP initializing (HLS_DBG_PRINT_LEVEL = %d).\n",
HLS_DBG_PRINT_LEVEL);
#else
DbgPrint ("HLS UP initializing (no debugging).\n");
#endif
#else // ndef NT_UP
#ifdef HLS_DEBUG
DbgPrint ("HLS MP initializing (HLS_DBG_PRINT_LEVEL = %d).\n",
HLS_DBG_PRINT_LEVEL);
#else
DbgPrint ("HLS MP initializing (no debugging).\n");
#endif
#endif // def NT_UP
for (i=0; i<MAX_PROCS; i++) {
HLSProc[i].CurrentThread = NULL;
}
{
int j;
for (j=0; j<HLS_MAX_SCHED_INSTS; j++) {
HLSAllSchedInsts[j] = NULL;
}
}
{
int j;
for (j=0; j<HLS_MAX_ABS_SCHEDS; j++) {
HLSAbsScheds[j] = NULL;
}
}
res = HLSRegisterScheduler(&ROOT_CB);
HLS_ASSERT(res == HLS_SUCCESS);
hls_root_sched = HLSNewSchedInstance("ROOT", "root", NULL);
HLS_ASSERT(hls_root_sched);
HLSRootSched = hls_root_sched;
res = HLSRegisterScheduler (&JOIN_CB);
HLS_ASSERT(res == HLS_SUCCESS);
res = HLSRegisterScheduler (&TH_CB);
HLS_ASSERT (res == HLS_SUCCESS);
#ifdef __INTERNAL_SCHEDULERS__
res = rr_module_init();
HLS_ASSERT (res == 0);
res = ps_module_init();
HLS_ASSERT (res == 0);
res = res_module_init();
HLS_ASSERT (res == 0);
CreateSimpleHierarchy ();
#endif
HLSInitState++;
}
void HLSDeinit (void)
{
int i = 0;
struct HLS_SCHED_INSTANCE *sched;
#if 0
#ifdef HIER
HLSDestroySchedInstance (HLSFP3);
HLSDestroySchedInstance (HLSFP4);
#endif
{
struct HLS_SCHED_INSTANCE *res = HLSFindInstByName ("res1");
if (res) {
HLSDestroySchedInstance (res);
}
}
HLSDestroySchedInstance (HLSPS1);
HLSDestroySchedInstance (HLSFP2);
HLSDestroySchedInstance (HLSFP1);
#else
for (i = HLS_MAX_SCHED_INSTS - 1; i >= 0; i--) {
sched = HLSAllSchedInsts[i];
if (sched != NULL) {
if (strcmp(sched->Type, "root")){
HLSDestroySchedInstance(sched);
}
}
}
#endif
HLSDestroySchedInstance (HLSRootSched);
}
--- NEW FILE: hls_instances.c ---
#include "hls_common.h"
#include "hls_internal.h"
#include "thr.h"
extern struct HLS_CALLBACKS *HLSAbsScheds[HLS_MAX_ABS_SCHEDS];
struct HLS_SCHED_INSTANCE *HLSFindInstByName (char *Name)
{
int i;
int index = -1;
for (i=0; i<HLS_MAX_SCHED_INSTS; i++) {
if (HLSAllSchedInsts[i] && strcmp (HLSAllSchedInsts[i]->Name, Name) == 0) {
HLS_ASSERT (index == -1); // enforce no duplicates
index = i;
}
}
return (index == -1) ? NULL : HLSAllSchedInsts[index];
}
static int HLSFindInstIndex (struct HLS_SCHED_INSTANCE *Inst)
{
int i;
int index = -1;
for (i=0; i<HLS_MAX_SCHED_INSTS; i++) {
if (HLSAllSchedInsts[i] == Inst) {
HLS_ASSERT (index == -1);
index = i;
}
}
return index;
}
HLS_STATUS HLSRegisterScheduler (struct HLS_CALLBACKS *NewSchedCB)
{
int i;
for (i=0; i<HLS_MAX_ABS_SCHEDS; i++) {
if (!HLSAbsScheds[i]) {
HLSAbsScheds[i] = NewSchedCB;
HLSDbgPrint (1, ("sched '%s' registered in slot %d\n", NewSchedCB->Name, i));
return HLS_SUCCESS;
}
}
return HLS_NOROOM;
}
HLS_STATUS HLSUnregisterScheduler (struct HLS_CALLBACKS *NewSchedCB)
{
// FIXME
return HLS_SUCCESS;
}
struct HLS_CALLBACKS * HLSFindAbsSched (char *SchedName)
{
int x;
for (x=0; x<HLS_MAX_ABS_SCHEDS; x++) {
if (HLSAbsScheds[x] && strcmp (SchedName, HLSAbsScheds[x]->Name) == 0) {
return HLSAbsScheds[x];
}
}
return NULL;
}
struct HLS_SCHED_INSTANCE *HLSNewSchedInstance (char *SchedName,
char *InstName,
struct HLS_SCHED_INSTANCE *Parent)
{
struct HLS_CALLBACKS *CB = NULL;
struct HLS_SCHED_INSTANCE *i;
CB = HLSFindAbsSched (SchedName);
if (!CB) {
HLSDbgPrint (1, ("HLSNewSchedInstance: can't find instance named '%s'\n",
SchedName));
return NULL;
}
if (HLSFindInstByName (InstName)) {
HLSDbgPrint (1, ("Oops: sched by the name of %s already exists\n",
InstName));
return NULL;
}
i = (struct HLS_SCHED_INSTANCE *) hls_malloc (sizeof (struct HLS_SCHED_INSTANCE));
if (!i) {
HLSDbgPrint (1, ("HLSNewSchedInstance: oops - malloc failed\n"));
return NULL;
}
i->CB = CB;
strncpy (i->Name, InstName, MAX_NAMELEN);
if (HLSNumScheds >= HLS_MAX_SCHED_INSTS) {
HLSDbgPrint (1, ("oops: out of sched slots\n"));
return NULL;
}
HLSNumScheds++;
{
int x;
HLS_ASSERT (HLSFindInstIndex (i) == -1);
for (x=0; x<HLS_MAX_SCHED_INSTS; x++) {
if (!HLSAllSchedInsts[x]) {
HLSAllSchedInsts[x] = i;
break;
}
}
HLS_ASSERT (HLSFindInstIndex (i) != -1);
}
init_timer(&(i->HLSTimer));
#if 0
KeInitializeDpc (&(i->HLSDpc),
(PKDEFERRED_ROUTINE) HLSDpcRoutine,
(void *)i);
#endif
i->CB->I_Init (i, Parent);
HLSDbgPrint (7, ("HLSNewSchedInstance: new instance '%s' of '%s' successfully created\n",
InstName, SchedName));
return i;
}
void HLSDestroySchedInstance (struct HLS_SCHED_INSTANCE *Inst)
{
hls_stop_timer(Inst);
Inst->CB->I_Deinit (Inst);
{
int i = HLSFindInstIndex (Inst);
HLS_ASSERT (i != -1);
HLSAllSchedInsts[i] = NULL;
}
HLSNumScheds--;
hls_free (Inst);
}
void HLSDestroySchedInstanceLite (struct HLS_SCHED_INSTANCE *Inst)
{
{
int i = HLSFindInstIndex (Inst);
HLS_ASSERT (i != -1);
HLSAllSchedInsts[i] = NULL;
}
HLSNumScheds--;
hls_free (Inst);
}
--- NEW FILE: hls_params.c ---
#include "hls_common.h"
#include "hls_internal.h"
#include "thr.h"
struct TH_INSTANCE_DATA *HLSFindThread (PRKTHREAD Thread)
{
struct TH_INSTANCE_DATA *p;
if (HLSInitState != 1) {
return NULL;
}
if (!Thread) {
return NULL;
}
/* p = (struct TH_INSTANCE_DATA *)(((PKTHREAD)Thread)->private_data); */
p = (struct TH_INSTANCE_DATA *)HLS_DATA((PKTHREAD)Thread);
#ifdef HLS_DEBUG
if (p) {
HLS_ASSERT (p->ObjType == ThInstValue);
}
#endif
return p;
}
int hls_setparam_ascii(struct HLS_SCHED_INSTANCE *inst, char *param)
{
struct hls_message msg;
int res;
#ifdef HLS_DEBUG
msg.ObjType = RRMsgValue;
#endif
msg.type = MSG_SENDSETPARAM;
msg.body = param;
msg.Pri = 1;
res = inst->CB->B_Msg(inst, NULL, (MsgHandle)&msg);
if (res != HLS_SUCCESS) {
return -1;
}
return 0;
}
HLS_STATUS HLSSetPri(PRKTHREAD Thread, KPRIORITY Priority)
{
struct hls_message NewMsg;
struct TH_INSTANCE_DATA *Th = HLSFindThread (Thread);
HLS_STATUS status;
if (!Th) {
HLSDbgPrint (1, ("Hrm: hls doesn't know about thread %p that is being set to pri %d\n",
Thread, Priority));
return HLS_INVALID_PARAMETER;
}
#ifdef HLS_DEBUG
HLSChangeFlag = HLS_CNT;
NewMsg.ObjType = RRMsgValue;
#endif
NewMsg.type = MSG_SETPRI;
NewMsg.body = NULL;
NewMsg.Pri = (SCHAR) Priority;
if (NewMsg.Pri == 0) {
NewMsg.Pri = 1;
}
status = Th->vp->TopSched->CB->B_Msg(NULL, Th->vp, (MsgHandle)&NewMsg);
return status;
}
void SetDefPriForSched (char Pri, struct HLS_SCHED_INSTANCE *Inst)
{
struct hls_message NewMsg;
HLS_STATUS status;
#ifdef HLS_DEBUG
NewMsg.ObjType = RRMsgValue;
#endif
NewMsg.type = MSG_SETDEFPRI;
NewMsg.Pri = Pri;
NewMsg.body = NULL;
status = Inst->CB->B_Msg (Inst, NULL, (MsgHandle)&NewMsg);
HLS_ASSERT (status == HLS_SUCCESS);
}
Index: hls_debug.c
===================================================================
RCS file: /cvsroot/linux-hls/hls/hls/hls_debug.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** hls_debug.c 8 Nov 2003 10:34:31 -0000 1.5
--- hls_debug.c 13 Dec 2003 12:27:15 -0000 1.6
***************
*** 48,51 ****
--- 48,52 ----
#ifdef HLS_DEBUG
+ #if 0
void _hls_assertion_failed (const char *assertion, int line,
const char *file)
***************
*** 62,66 ****
#endif
}
!
char *StateName (KTHREAD_STATE s)
{
--- 63,67 ----
#endif
}
! #endif
char *StateName (KTHREAD_STATE s)
{
Index: hls_names.c
===================================================================
RCS file: /cvsroot/linux-hls/hls/hls/hls_names.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** hls_names.c 29 Nov 2003 09:11:34 -0000 1.1
--- hls_names.c 13 Dec 2003 12:27:15 -0000 1.2
***************
*** 31,39 ****
wasnull = 0;
if (HLSDefaultSched == NULL) {
! wasnull =1;
}
HLSDefaultSched = p;
! if (wasnull) {
! hls_convert_tasks();
}
}
--- 31,43 ----
wasnull = 0;
if (HLSDefaultSched == NULL) {
! wasnull = 1;
}
HLSDefaultSched = p;
! if (HLSDefaultSched == NULL) {
! hls_release_tasks();
! } else {
! if (wasnull) {
! hls_convert_tasks();
! }
}
}
--- hls_utils.c DELETED ---
|
|
From: <lu...@us...> - 2003-12-13 12:27:18
|
Update of /cvsroot/linux-hls/hls/hls/include
In directory sc8-pr-cvs1:/tmp/cvs-serv15989/hls/include
Modified Files:
hls_debug.h hls_internal.h
Log Message:
- Misc cleanups
- Unbreak modular compilation
- Provide a way to move all the tasks away from HLS (echo null > /proc/HLS/default)
Index: hls_debug.h
===================================================================
RCS file: /cvsroot/linux-hls/hls/hls/include/hls_debug.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** hls_debug.h 25 Feb 2003 09:18:54 -0000 1.2
--- hls_debug.h 13 Dec 2003 12:27:15 -0000 1.3
***************
*** 45,49 ****
#endif // HLS_DBG_PRINT_LEVEL
! extern void _hls_assertion_failed(const char *assertion, int line, const char *file);
#define HLS_ASSERT(x) do { \
--- 45,63 ----
#endif // HLS_DBG_PRINT_LEVEL
! //extern void _hls_assertion_failed(const char *assertion, int line, const char *file);
! static inline void _hls_assertion_failed (const char *assertion, int line,
! const char *file)
! {
! hls_hard_printk ("%s:%d: failed HLS assertion: \"%s\".\n",
! file, line, assertion);
! hls_printk ("%s:%d: failed HLS assertion: \"%s\".\n",
! file, line, assertion);
! #if __HARD_PANIC__
! hls_panic(assertion);
! #else
! hls_hard_printk("HLS ERROR: not panicing, but continuing...\n");
! hls_printk("HLS ERROR: not panicing, but continuing...\n");
! #endif
! }
#define HLS_ASSERT(x) do { \
Index: hls_internal.h
===================================================================
RCS file: /cvsroot/linux-hls/hls/hls/include/hls_internal.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** hls_internal.h 29 Nov 2003 09:11:35 -0000 1.4
--- hls_internal.h 13 Dec 2003 12:27:15 -0000 1.5
***************
*** 60,63 ****
--- 60,64 ----
void hls_setrt(void *p);
void hls_convert_tasks(void);
+ void hls_release_tasks(void);
/* These are needed by procfs.c */
|
|
From: <lu...@us...> - 2003-12-05 21:48:44
|
Update of /cvsroot/linux-hls/hls/simul/loads
In directory sc8-pr-cvs1:/tmp/cvs-serv5866/simul/loads
Added Files:
resps.c
Log Message:
- Some simulator work
- Unbreak the PS scheduler (share was 0 by default)
- Add a filter to convert the simulator output in a .fig file
--- NEW FILE: resps.c ---
/*
* Copyright (c) 2002 Luca Abeni
*
* Module Name: loads/continuous.c
* Abstract: Workload generator for the Simulator Backend.
* Task set composed of ``continuous tasks'', that
* are always backlogged (never block or unblock).
* After some time, some tasks are moved to res and ps1
* Author: Luca Abeni 2-Dec-2003
*
* This is free software; see GPL.txt
*/
#include <stdio.h>
#include <stdlib.h>
#include "interface-data.h"
#include "os.h"
#include "sim.h"
#include "event.h"
#define TH_FIXED_PRIO 3 /* FIXME: What do we want to do here??? */
int total_num_threads;
int rsv = 5;
int ps = 2;
extern long long int max_res_time;
extern long long int max_run_time_until_blocking;
extern long long int cpu_time_per_thread;
extern long long int max_blocking_time;
long long int execution_time(void)
{
return 10000;
}
long long int workload_generate(void)
{
int EndNumProcessors;
int threads;
int i;
struct sim_task_struct *t[100];
EndNumProcessors = 1;
threads = 10;
total_num_threads = 20;
sim_printf("simulating %d threads\n", threads);
#if 0
max_run_time_until_blocking = ((long long int)(sim_rand()%1000000))+500;
max_blocking_time = ((long long int)(sim_rand()%100000))+500;
max_res_time = 100000000;
cpu_time_per_thread = /*HLS_MsToNT * 500*/ /*1000000*/ 500000;
#endif
for(i = 0; i < threads; i++) {
t[i] = make_new_thread(100, 0, /*execution_time*/ NULL, NULL, TH_FIXED_PRIO);
}
{
struct sim_event *e;
long long int tt = 0;
for (i = 1; i < EndNumProcessors; i++) {
e = new_event(EVENT_TYPE_NEW_PROC, 0);
tt += sim_rand() % 500000;
insert_event (e, tt);
}
}
for (i = 0; i < rsv; i++) {
struct sim_event *e;
e = new_event(EVENT_TYPE_RES, 0);
e->u.res.t = t[i];
e->u.res.amount = 100000;
e->u.res.period = 2000000;
e->u.res.start = 1;
insert_event (e, 6000000);
}
for (i = 0; i < ps; i++) {
struct sim_event *e;
e = new_event(EVENT_TYPE_MOVETOPS, 0);
e->u.ps.t = t[i + rsv];
e->u.ps.share = (i + 1) * 10;
insert_event (e, 5000000);
}
#if 0
e = new_event (EVENT_TYPE_MOVETOPS, 0);
insert_event (e, (long long int)(sim_rand()%100000));
#endif
#if 0
e = new_event (EVENT_TYPE_LOADRES, 0);
insert_event (e, (long long int)(sim_rand()%10000000));
#endif
return 100000000;
}
|
|
From: <lu...@us...> - 2003-12-05 21:48:44
|
Update of /cvsroot/linux-hls/hls/simul
In directory sc8-pr-cvs1:/tmp/cvs-serv5866/simul
Modified Files:
sim.c sim_events.c sim_os.c workload.c
Log Message:
- Some simulator work
- Unbreak the PS scheduler (share was 0 by default)
- Add a filter to convert the simulator output in a .fig file
Index: sim.c
===================================================================
RCS file: /cvsroot/linux-hls/hls/simul/sim.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** sim.c 29 Nov 2003 09:11:35 -0000 1.10
--- sim.c 5 Dec 2003 21:48:39 -0000 1.11
***************
*** 11,14 ****
--- 11,15 ----
#include <stdio.h>
#include <stdlib.h>
+ #include <unistd.h>
#include <time.h>
***************
*** 34,38 ****
}
! static void sim_init(void)
{
--- 35,39 ----
}
! static void sim_init(char *name)
{
***************
*** 56,63 ****
#endif
! outfile = fopen (OUTFILE, "w");
if (!outfile) {
perror("Error");
! printf("while opening data file %s\n", OUTFILE);
sim_die();
}
--- 57,64 ----
#endif
! outfile = fopen(name, "w");
if (!outfile) {
perror("Error");
! printf("while opening data file %s\n", name);
sim_die();
}
***************
*** 94,110 ****
int seed;
int finished;
! printf("Blah!\n");
switch (argc) {
case 2:
! seed = atoi(argv[1]);
break;
default:
seed = (unsigned)time(NULL);
}
!
strcpy(CurrentDefaultSched, "rr2");
! sim_init();
event_init(seed);
--- 95,143 ----
int seed;
int finished;
+ char *fname;
+ int c, done;
! done = 0;
! seed = (unsigned)time(NULL);
! fname = OUTFILE;
! while(!done) {
! c = getopt(argc, argv, "hf:s:");
! if (c == -1) {
! done = 1;
! } else {
! switch(c) {
! case 'h':
! fprintf(stderr, "Usage: %s [-h] [-f <filename>] [-s <seed>]\n", argv[0]);
! exit(0);
! case 'f':
! fname = optarg;
! break;
! case 's':
! seed = atoi(optarg);
! break;
! default:
! fprintf(stderr, "Unknown option %c\n", c);
! exit(-1);
! }
! }
! }
! #if 0
switch (argc) {
+ case 3:
+ seed = atoi(argv[2]);
+ fname = argv[1];
+ break;
case 2:
! fname = argv[1];
! seed = (unsigned)time(NULL);
break;
default:
+ fname = OUTFILE;
seed = (unsigned)time(NULL);
}
! #endif
strcpy(CurrentDefaultSched, "rr2");
! sim_init(fname);
event_init(seed);
Index: sim_events.c
===================================================================
RCS file: /cvsroot/linux-hls/hls/simul/sim_events.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** sim_events.c 29 Nov 2003 09:11:35 -0000 1.14
--- sim_events.c 5 Dec 2003 21:48:39 -0000 1.15
***************
*** 453,473 ****
static int DoEventMoveToPS(struct sim_event *ev, long long int time)
{
- int r = sim_rand() % 100;
- char *mstr;
struct sim_event *e;
! if (r < 33) {
! mstr = "ps1";
! } else if (r < 66) {
! mstr = "rr1";
! } else {
! mstr = "foo";
! }
!
! scheduler_set_default(mstr);
!
! e = new_event(EVENT_TYPE_MOVETOPS, 0);
! insert_event(e, time + (long long int)(sim_rand() % 1000000));
return 0;
}
--- 453,467 ----
static int DoEventMoveToPS(struct sim_event *ev, long long int time)
{
struct sim_event *e;
+ struct sim_task_struct *t;
+ int start, status;
! start = 1;
! t = ev->u.ps.t;
! sim_printf("(nt) DoEventPS\n");
+ fprintf(stderr, "Share: %d\t Warp: %d\n", ev->u.ps.share, 0);
+ status = thread_move_to_ps(t, ev->u.ps.share, /*ev->u.ps.warp*/ 0, start);
+
return 0;
}
***************
*** 480,484 ****
}
- /* TODO: This!!! */
static int DoEventRes(struct sim_event *ev, long long int time)
--- 474,477 ----
***************
*** 492,534 ****
t = ev->u.res.t;
! start = ev->u.res.BeginRes;
sim_printf("(nt) DoEventRes\n");
! /*
! if (HLS_DATA(t)) {
! printf("(nt) Hmm: thread seems to have exited\n");
!
! return 0;
! }
! */
!
! if (sim_rand() % 100 < 50) {
! soft = 1;
! // res.Soft = HLS_FALSE;
! } else {
! soft = 0;
! }
!
! if (sim_rand() % 100 < 15) {
! start = 1;
! }
! if (sim_rand() % 100 < 15) {
! start = 0;
! }
!
! /* TODO: Fix these values... */
! res_period = sim_rand() % (200 * 10000);
! res_amount = sim_rand() % (10 * 10000);
status = thread_reserve(t, res_amount, res_period, start, soft);
/*
status = NtHLSCtl (HLS_CMD_RES, &res, sizeof (struct CPU_RESERVATION));
HLSDbgPrint (3, ("(nt) status of %s res is %ld\n",
! res.BeginRes ? "BEGIN" : "END", status));
*/
sim_printf("Res Number: %d\n", res_number);
if (res_number++ < NUM_RSV) {
sim_printf("Going to set...\n");
e = new_event(EVENT_TYPE_RES, sim_rand() % sim_nr_cpus());
e->u.res.t = t;
--- 485,509 ----
t = ev->u.res.t;
! res_period = ev->u.res.period;
! res_amount = ev->u.res.amount;
! start = ev->u.res.start;
sim_printf("(nt) DoEventRes\n");
! soft = 0;
status = thread_reserve(t, res_amount, res_period, start, soft);
+ /* TODO: Move back to RR after some time
+ * (EVENT_TYPE_RES withstart = 0)
+ */
/*
status = NtHLSCtl (HLS_CMD_RES, &res, sizeof (struct CPU_RESERVATION));
HLSDbgPrint (3, ("(nt) status of %s res is %ld\n",
! res.start ? "BEGIN" : "END", status));
*/
sim_printf("Res Number: %d\n", res_number);
if (res_number++ < NUM_RSV) {
sim_printf("Going to set...\n");
+ #if 0
e = new_event(EVENT_TYPE_RES, sim_rand() % sim_nr_cpus());
e->u.res.t = t;
***************
*** 536,552 ****
if (!start) {
// HLS_ASSERT (status == STATUS_SUCCESS);
! e->u.res.BeginRes = 1;
sim_printf("(nt) ending the res worked; next time we'll start one\n");
} else {
if (status == 0) {
if (sim_rand() % 100 < 50) {
! e->u.res.BeginRes = 0;
sim_printf("(nt) starting the res worked; next time we'll end one\n");
} else {
! e->u.res.BeginRes = 1;
sim_printf("(nt) starting the res worked; next time we'll start a new one\n");
}
} else {
! e->u.res.BeginRes = 1;
sim_printf("(nt) starting the res didn't work; next time we'll start one\n");
}
--- 511,527 ----
if (!start) {
// HLS_ASSERT (status == STATUS_SUCCESS);
! e->u.res.start = 1;
sim_printf("(nt) ending the res worked; next time we'll start one\n");
} else {
if (status == 0) {
if (sim_rand() % 100 < 50) {
! e->u.res.start = 0;
sim_printf("(nt) starting the res worked; next time we'll end one\n");
} else {
! e->u.res.start = 1;
sim_printf("(nt) starting the res worked; next time we'll start a new one\n");
}
} else {
! e->u.res.start = 1;
sim_printf("(nt) starting the res didn't work; next time we'll start one\n");
}
***************
*** 554,557 ****
--- 529,533 ----
insert_event (e, (long long int)time + max_res_time + (sim_rand() % max_res_time));
+ #endif
}
Index: sim_os.c
===================================================================
RCS file: /cvsroot/linux-hls/hls/simul/sim_os.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** sim_os.c 29 Nov 2003 09:11:35 -0000 1.9
--- sim_os.c 5 Dec 2003 21:48:40 -0000 1.10
***************
*** 18,21 ****
--- 18,22 ----
#include "thr.h"
#include "rsv.h"
+ #include "ps.h"
#include "sim.h"
***************
*** 134,138 ****
e = new_event(EVENT_TYPE_RES, sim_rand() % sim_nr_cpus()); /* TODO: Check this "NR_CPUS" thing */
e->u.res.t = t;
! e->u.res.BeginRes = TRUE;
insert_event(e, (long long int)((sim_rand() % (max_res_time / 100)) + create_time));
}
--- 135,139 ----
e = new_event(EVENT_TYPE_RES, sim_rand() % sim_nr_cpus()); /* TODO: Check this "NR_CPUS" thing */
e->u.res.t = t;
! e->u.res.start = TRUE;
insert_event(e, (long long int)((sim_rand() % (max_res_time / 100)) + create_time));
}
***************
*** 305,308 ****
--- 306,374 ----
}
+ int thread_move_to_ps(struct sim_task_struct *t, int share, int warp, int start)
+ {
+ char *schedname;
+ struct HLS_SCHED_INSTANCE *target_sched;
+ struct TH_INSTANCE_DATA *th;
+ int status;
+ int st;
+
+ if (start) {
+ schedname = "ps1";
+ } else {
+ schedname = "rr1";
+ }
+
+ target_sched = HLSFindInstByName(schedname);
+ if (target_sched == NULL) {
+ printf("Cannot find %s scheduler!!!\n", schedname);
+
+ exit(-1);
+ }
+ th = HLS_DATA(t);
+
+ if (th == NULL) {
+ printf("Cannot find TH_INSTANCE_DATA...\n");
+
+ exit(-1);
+ }
+
+ st = th->vp->State;
+
+ status = hls_thread_move(t, target_sched);
+ if (status != HLS_SUCCESS) {
+ printf("hls_thread_move() failed!!!\n");
+
+ exit(-1);
+ }
+
+ if (start == 0) {
+ HLSSetPri(th->Thread, HLS_DEFAULT_PRIORITY);
+ } else {
+ struct ps_msg_body body;
+ struct hls_message msg;
+
+ #ifdef HLS_DEBUG
+ msg.ObjType = RRMsgValue;
+ #endif
+ msg.type = MSG_SETPARAMS;
+ msg.body = &body;
+ body.warp = warp;
+ body.share = share;
+
+ /* Prepare s_p */
+ status = th->vp->TopSched->CB->B_Msg(NULL, th->vp, (MsgHandle)&msg);
+ sim_printf("status: %d\n", status);
+ if (status != HLS_SUCCESS) {
+ printf("hls_setparam() failed!!!\n");
+
+ exit(-1);
+ }
+ }
+
+ thread_set_state(th, st);
+
+ return 0;
+ }
int thread_reserve(struct sim_task_struct *t, long long int q, long long int p, int start, int soft)
Index: workload.c
===================================================================
RCS file: /cvsroot/linux-hls/hls/simul/workload.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** workload.c 25 Feb 2003 09:18:57 -0000 1.3
--- workload.c 5 Dec 2003 21:48:40 -0000 1.4
***************
*** 2,10 ****
* Copyright (c) 2002 Luca Abeni
*
! * Module Name: loads/periodic.c
* Abstract: Workload generator for the Simulator Backend.
! * Task set composed of ``periodic tasks'', that
! * execute for a fixed time C and then block until the
! * beginning of the next period.
* Author: Luca Abeni 2-Feb-2002
*
--- 2,9 ----
* Copyright (c) 2002 Luca Abeni
*
! * Module Name: loads/continuous.c
* Abstract: Workload generator for the Simulator Backend.
! * Task set composed of ``continuous tasks'', that
! * are always backlogged (never block or unblock).
* Author: Luca Abeni 2-Feb-2002
*
***************
*** 27,30 ****
--- 26,30 ----
extern long long int max_res_time;
+ extern long long int max_run_time_until_blocking;
extern long long int cpu_time_per_thread;
extern long long int max_blocking_time;
***************
*** 32,41 ****
long long int execution_time(void)
{
! return 2000000;
! }
!
! long long int period(void)
! {
! return 100000000;
}
--- 32,36 ----
long long int execution_time(void)
{
! return 10000;
}
***************
*** 54,57 ****
--- 49,53 ----
#if 0
+ max_run_time_until_blocking = ((long long int)(sim_rand()%1000000))+500;
max_blocking_time = ((long long int)(sim_rand()%100000))+500;
max_res_time = 100000000;
***************
*** 60,64 ****
for(i = 0; i < threads; i++) {
! make_new_thread(100, 0, execution_time, period, TH_FIXED_PRIO);
}
--- 56,60 ----
for(i = 0; i < threads; i++) {
! make_new_thread(100, 0, /*execution_time*/ NULL, NULL, TH_FIXED_PRIO);
}
***************
*** 85,88 ****
#endif
! return 1000000000;
}
--- 81,84 ----
#endif
! return 100000000;
}
|
|
From: <lu...@us...> - 2003-12-05 21:48:44
|
Update of /cvsroot/linux-hls/hls/hls
In directory sc8-pr-cvs1:/tmp/cvs-serv5866/hls
Modified Files:
hls_sched_ps.c hls_utils.c
Log Message:
- Some simulator work
- Unbreak the PS scheduler (share was 0 by default)
- Add a filter to convert the simulator output in a .fig file
Index: hls_sched_ps.c
===================================================================
RCS file: /cvsroot/linux-hls/hls/hls/hls_sched_ps.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** hls_sched_ps.c 8 Nov 2003 10:34:31 -0000 1.10
--- hls_sched_ps.c 5 Dec 2003 21:48:39 -0000 1.11
***************
*** 209,213 ****
ud->Warp = 0;
ud->AVT = 0;
! ud->Share = 0;
ud->StartTime = -1;
/*
--- 209,214 ----
ud->Warp = 0;
ud->AVT = 0;
! /* ud->Share = 10; */
! ud->Share = Inst->DefaultPri * 10;
ud->StartTime = -1;
/*
***************
*** 438,442 ****
HLS_ASSERT (Inst);
!
if (Inst->TVP.State != VP_Ready) {
Next = GetVPSmallestEVT (Inst);
--- 439,443 ----
HLS_ASSERT (Inst);
!
if (Inst->TVP.State != VP_Ready) {
Next = GetVPSmallestEVT (Inst);
***************
*** 612,616 ****
// HACK
if (ud->Share == 0) {
! ud->Share = 10;
}
status = HLS_SUCCESS;
--- 613,620 ----
// HACK
if (ud->Share == 0) {
! ud->Share = Inst->DefaultPri * 10;
! if (ud->Share == 0) {
! ud->Share = 10;
! }
}
status = HLS_SUCCESS;
Index: hls_utils.c
===================================================================
RCS file: /cvsroot/linux-hls/hls/hls/hls_utils.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** hls_utils.c 29 Nov 2003 09:11:34 -0000 1.16
--- hls_utils.c 5 Dec 2003 21:48:39 -0000 1.17
***************
*** 362,367 ****
HLSPS1 = HLSNewSchedInstance ("PS", "ps1", HLSFP1);
HLS_ASSERT (HLSPS1);
! SetDefPriForSched (9, HLSPS1);
! hls_setparam_ascii(HLSPS1, "9");
HLSRES = HLSNewSchedInstance ("RES", "res1", HLSFP1);
--- 362,367 ----
HLSPS1 = HLSNewSchedInstance ("PS", "ps1", HLSFP1);
HLS_ASSERT (HLSPS1);
! SetDefPriForSched (11, HLSPS1);
! hls_setparam_ascii(HLSPS1, "11");
HLSRES = HLSNewSchedInstance ("RES", "res1", HLSFP1);
|
|
From: <lu...@us...> - 2003-12-05 21:48:44
|
Update of /cvsroot/linux-hls/hls/simul/include
In directory sc8-pr-cvs1:/tmp/cvs-serv5866/simul/include
Modified Files:
event.h os.h
Log Message:
- Some simulator work
- Unbreak the PS scheduler (share was 0 by default)
- Add a filter to convert the simulator output in a .fig file
Index: event.h
===================================================================
RCS file: /cvsroot/linux-hls/hls/simul/include/event.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** event.h 29 Nov 2003 09:11:35 -0000 1.5
--- event.h 5 Dec 2003 21:48:40 -0000 1.6
***************
*** 44,48 ****
struct sim_event_res_event {
struct sim_task_struct *t;
! int BeginRes;
};
--- 44,56 ----
struct sim_event_res_event {
struct sim_task_struct *t;
! unsigned long long int amount;
! unsigned long long int period;
! int start;
! };
!
! struct sim_event_ps_event {
! struct sim_task_struct *t;
! int share;
! int warp;
};
***************
*** 55,58 ****
--- 63,67 ----
struct sim_event_thread_event event_thread;
struct sim_event_res_event res;
+ struct sim_event_ps_event ps;
} u;
};
Index: os.h
===================================================================
RCS file: /cvsroot/linux-hls/hls/simul/include/os.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** os.h 29 Nov 2003 09:11:35 -0000 1.5
--- os.h 5 Dec 2003 21:48:40 -0000 1.6
***************
*** 24,27 ****
--- 24,28 ----
void thread_set_priority(struct sim_task_struct *t, int new_priority);
int thread_reserve(struct sim_task_struct *t, long long int q, long long int p, int start, int soft);
+ int thread_move_to_ps(struct sim_task_struct *t, int share, int warp, int start);
void scheduler_set_default(char *mstr);
|
|
From: <lu...@us...> - 2003-12-05 21:48:44
|
Update of /cvsroot/linux-hls/hls/scripts
In directory sc8-pr-cvs1:/tmp/cvs-serv5866/scripts
Added Files:
filter.c
Log Message:
- Some simulator work
- Unbreak the PS scheduler (share was 0 by default)
- Add a filter to convert the simulator output in a .fig file
--- NEW FILE: filter.c ---
#include <stdio.h>
#include <unistd.h>
/* TODO: Allocate this dynamically!!! */
struct plot_data {
int num;
unsigned long long int s1[10000];
unsigned long long int s2[10000];
} data[10];
char dummy1[100], dummy2[100], dummy4[100];
int steps[] = {5, 10, 25, 50, 100, 200, 250, 500, 0};
#define MINSTEP 225
int maxt = 20000;
#define XBORDER 225
#define YBORDER 225
#define YSIZE 1350
#define YBOX 225
#define XOFF 450
#define YAX 1800
#define XAX XOFF + XBORDER
#define YSPACE 800
int data_read(char *filename, struct plot_data *p, int *n)
{
FILE *f;
int res, task, dummy, max, imax, done;
unsigned long long int start, end;
*n = 0;
f = fopen(filename, "r");
if (f == NULL) {
perror("Error opening input file");
exit(-1);
}
done = 0;
max = 0;
while (!done) {
res = fscanf(f, "%d\t\t%Lu %Lu\t%d", &task, &start, &end, &dummy);
if (res != 4) {
done = 1;
} else {
task -= 1000;
p[task].s1[p[task].num] = start / 10000;
p[task].s2[p[task].num] = end / 10000;
#ifdef __VERBOSE__
fprintf(stderr, "Task %d: %Lu - %Lu\n",
task, start / 10000, end / 10000);
#endif
p[task].num++;
if (p[task].num > max) {
max = p[task].num;
imax = task;
}
if (task > *n) {
*n = task;
}
}
}
return imax;
}
void task_plot(int i, unsigned long long int *s1, unsigned long long int *s2, int scale, int n)
{
int j;
for (j = 0; j < i; j++) {
/* 75% filled */
printf("2 2 0 1 0 7 50 0 15 0.000 0 0 -1 0 0 5\n");
printf("\t%d %d ", XAX + (int)s1[j] * scale, YSPACE * n + YAX);
printf("%d %d ", XAX + (int)s1[j] * scale, YSPACE * n + YAX - YBOX);
printf("%d %d ", XAX + (int)s2[j] * scale, YSPACE * n + YAX - YBOX);
printf("%d %d ", XAX + (int)s2[j] * scale, YSPACE * n + YAX);
printf("%d %d\n", XAX + (int)s1[j] * scale, YSPACE * n + YAX);
}
}
void ax_draw(int i, unsigned long long int *s2, int step, int scale, int n)
{
int max_scale, j;
max_scale = (s2[i - 1] + XBORDER) / step;
/* Draw the X ax... */
printf("2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 1 0 2\n");
printf("0 0 1.00 60.00 120.00\n");
printf("\t%d %d %d %d\n",
XOFF, YSPACE * n + YAX,
XAX + ((int)s2[i - 1] + XBORDER) * scale, YSPACE * n + YAX);
for (j = 1; j < max_scale; j++) {
printf("2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2\n");
printf("\t%d %d %d %d\n",
XAX + (j * step) * scale, YSPACE * n + YAX + YBORDER / 2,
XAX + (j * step) * scale, YSPACE * n + YAX);
printf("4 0 0 50 0 0 12 4.7124 4 135 345 ");
printf("%d %d ", XAX + (j * step) * scale - 60, YSPACE * n + YAX + YBORDER);
printf("%d\\001\n", j * step);
}
}
void values_shift(struct plot_data *data, int n)
{
unsigned long long int min;
int j, k;
min = data[0].s1[0];
for (j = 1; j < n; j++) {
if (data[j].s1[0] < min) {
min = data[j].s1[0];
}
}
for(j = 0; j < n; j++) {
for(k = 0; k < data[j].num; k++) {
data[j].s1[k] -= min;
data[j].s2[k] -= min;
}
}
}
void header_out(int n)
{
printf("#FIG 3.2\nLandscape\nCenter\nMetric\nA4\n100.00\nSingle\n-2\n1200 2\n");
/* Draw the Y ax... */
printf("2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 1 0 2\n");
printf("0 0 1.00 60.00 120.00\n");
printf("\t%d %d %d %d\n",
XAX, (n - 1) * YSPACE + YAX + YBORDER,
XAX, YAX - YSIZE);
}
int main(int argc, char *argv[])
{
int i, j, n;
int step, scale;
int c, done;
if (argc < 2) {
printf("Usage: %s <file1> <file2> ...\n", argv[0]);
exit(-1);
}
done = 0;
while(!done) {
c = getopt(argc, argv, "hs:");
if (c == -1) {
done = 1;
} else {
switch(c) {
case 'h':
fprintf(stderr, "Usage: %s [-s <scale>]\n", argv[0]);
exit(0);
case 's':
maxt = atoi(optarg);
break;
default:
fprintf(stderr, "Unknown option %c\n", c);
exit(-1);
}
}
}
i = data_read(argv[optind], data, &n);
if (i < 0) {
fprintf(stderr, "Cannot read file\n");
exit(-1);
}
#ifdef __VERBOSE__
fprintf(stderr, "Max: %d\n", n);
#endif
n = n + 1;
values_shift(data, n);
step = steps[0];
j = 1;
scale = maxt / (data[0].s2[i - 1] + XBORDER);
while ((step * scale < MINSTEP) && steps[j] != 0) {
step = steps[j++];
}
header_out(n);
for (j = 0; j < n; j++) {
ax_draw(data[j].num, data[j].s2, step, scale, j);
task_plot(data[j].num, data[j].s1, data[j].s2, scale, j);
}
return 0;
}
|
|
From: <lu...@us...> - 2003-11-29 11:59:04
|
Update of /cvsroot/linux-hls/hls/linux
In directory sc8-pr-cvs1:/tmp/cvs-serv4847/linux
Modified Files:
Makefile init.c
Log Message:
Fix problem when rmmoving hls_module...
Index: Makefile
===================================================================
RCS file: /cvsroot/linux-hls/hls/linux/Makefile,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** Makefile 29 Nov 2003 09:11:35 -0000 1.7
--- Makefile 29 Nov 2003 11:59:01 -0000 1.8
***************
*** 16,19 ****
--- 16,20 ----
#CPPFLAGS += -DVERBOSE
+ #CPPFLAGS += -D__HARD_PANIC__
SCHED_MOD = hls_sched_res.o hls_sched_ps.o hls_sched_rr.o
Index: init.c
===================================================================
RCS file: /cvsroot/linux-hls/hls/linux/init.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** init.c 29 Nov 2003 09:11:35 -0000 1.8
--- init.c 29 Nov 2003 11:59:01 -0000 1.9
***************
*** 180,186 ****
for_each_task(t) {
if (t->private_data != NULL) {
printk("Removing task %d from HLS\n", t->pid);
if (t->state == TASK_RUNNING) {
! HLSBlockThreadHook(t);
}
HLSExitThreadHook(t);
--- 180,189 ----
for_each_task(t) {
if (t->private_data != NULL) {
+ #ifdef VERBOSE
printk("Removing task %d from HLS\n", t->pid);
+ #endif
+
if (t->state == TASK_RUNNING) {
! hls_block_other_thread(t);
}
HLSExitThreadHook(t);
|
|
From: <lu...@us...> - 2003-11-29 11:59:04
|
Update of /cvsroot/linux-hls/hls/hls/include In directory sc8-pr-cvs1:/tmp/cvs-serv4847/hls/include Modified Files: hls_hooks.h Log Message: Fix problem when rmmoving hls_module... Index: hls_hooks.h =================================================================== RCS file: /cvsroot/linux-hls/hls/hls/include/hls_hooks.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** hls_hooks.h 8 Nov 2003 10:34:31 -0000 1.1 --- hls_hooks.h 29 Nov 2003 11:59:00 -0000 1.2 *************** *** 6,9 **** --- 6,10 ---- extern void HLSBlockThreadHook(PRKTHREAD Thread); extern void HLSUnblockThreadHook(PRKTHREAD Thread); + void hls_block_other_thread(PRKTHREAD Thread); #endif /* __HLS_HOOKS_H__ */ |