xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: "michele.paolino" <michele.paolino@studio.unibo.it>
To: Xen-devel@lists.xensource.com,
	George Dunlap <george.dunlap@eu.citrix.com>
Subject: simple scheduler
Date: Mon, 15 Feb 2010 14:19:15 +0100	[thread overview]
Message-ID: <14f366f91002150519y1a27774h6f5d6628734f8849@mail.gmail.com> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 392 bytes --]

Hi! I'm writing a simple scheduler to study the xen scheduler interfaces.
I am able to compile and install it. After reboot when I try to select
sched=simple, the system gets ready to boot and then everything goes blank.
I think that dom0 don't start. I can't be able to solve this problem, can
anybody help me?
I have attached my simple scheduler code along with this mail.

Thanks,
Michele

[-- Attachment #1.2: Type: text/html, Size: 425 bytes --]

[-- Attachment #2: sched_simple.c --]
[-- Type: text/x-csrc, Size: 1553 bytes --]

#include <xen/lib.h>
#include <xen/sched.h>
#include <xen/time.h>
#include <xen/sched-if.h>
#include <xen/softirq.h>
#include <xen/errno.h>
#include <xen/list.h>
#include <xen/timer.h>

#define MAX 100

struct vcpu *Vcpu[MAX];
int next_vcpu=0;

/* Add a VCPU */
static int simple_vcpu_init(struct vcpu *v){
    int t=0;
    /*find the first position of array available*/
    while(t<MAX){
        if (Vcpu[t]==NULL) {
            Vcpu[t]=v;
            printk("\n\nadd VCPU %d\n\n", t);
        }
        t++;
        break;
    }
    return 0;
}

static void simple_vcpu_destroy(struct vcpu *v)
{
    int t=MAX;
    int max_index=MAX;
    /*find the struct vcpu in Vcpu[] and destroy it*/
    while(t!=0 && v!=Vcpu[t]){
        t--;
    }
    printk("\n\ndestroy VCPU %d\n\n",t);

    while(t!=0 && Vcpu[t]==NULL){
        max_index--;
    }
    Vcpu[t]=Vcpu[max_index];
    Vcpu[max_index]=NULL;
    Vcpu[t]=NULL;
    xfree(v->sched_priv);
}


struct task_slice simple_schedule(s_time_t now){
    struct task_slice ret;
    ret.time = MILLISECS(100); 
    /*if next array position == NULL than restart to 0*/
    if (Vcpu[next_vcpu+1]==NULL){ 
        ret.task = Vcpu[0];
        next_vcpu=0;
    }
    else ret.task = Vcpu[next_vcpu+1];
    
    next_vcpu++;
    return ret;
}

struct scheduler sched_simple_def = {
    .name           = "Very simple Scheduler",
    .opt_name       = "simple",
    .sched_id       = 13,
    .init_vcpu      = simple_vcpu_init,
    .destroy_vcpu   = simple_vcpu_destroy,
    .do_schedule    = simple_schedule,

};




[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

             reply	other threads:[~2010-02-15 13:19 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-15 13:19 michele.paolino [this message]
2010-02-15 13:59 ` simple scheduler George Dunlap
2010-02-15 18:54   ` Pasi Kärkkäinen
2010-02-16 18:18     ` michele.paolino
2010-02-16 18:29       ` Pasi Kärkkäinen
2010-02-17 11:43         ` George Dunlap
2010-02-18 16:51           ` michele.paolino
2010-02-18 16:55             ` George Dunlap
2010-02-18 17:34         ` michele.paolino
2010-02-19 14:17           ` Konrad Rzeszutek Wilk
2010-02-19 14:40             ` Pasi Kärkkäinen
2010-02-20  9:06             ` michele.paolino

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=14f366f91002150519y1a27774h6f5d6628734f8849@mail.gmail.com \
    --to=michele.paolino@studio.unibo.it \
    --cc=Xen-devel@lists.xensource.com \
    --cc=george.dunlap@eu.citrix.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).