generate random numbers
Hi!
I am interested in writing a scheduler for Xen for academic purposes. I need to generate random numbers.
Is it possible to generate random numbers in xen hypervisor developement?If this is possible, how can I do it?
Michele
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Quoted 3 lines
Hi!
I am interested in writing a scheduler for Xen for academic purposes.
I need
Quoted 2 lines
to generate random numbers.
Is it possible to generate random numbers in xen hypervisor
developement?If
Quoted 2 lines
this is possible, how can I do it?
How many bits do you random numbers need to be?
At what rate do you need them? (10/second?, 1000000/second?)
Would pseudo-random numbers do? If so, what repeat interval is sufficient?
James
I need less than 10 bits at rate of 10 milliseconds. With a random number I will select the next VCPU to schedule.
Michele
On Fri, Feb 12, 2010 at 2:51 AM, James Harper <[email protected]
Quoted 12 lines
Quoted 3 lines · wrote:
Hi!
I am interested in writing a scheduler for Xen for academic purposes.I need
Quoted 2 lines
to generate random numbers.
Is it possible to generate random numbers in xen hypervisordevelopement?If
Quoted 2 lines
this is possible, how can I do it?
Quoted 9 lines
How many bits do you random numbers need to be?
At what rate do you need them? (10/second?, 1000000/second?)
Would pseudo-random numbers do? If so, what repeat interval is sufficient?
James
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
I think the short answer is, Xen does not have a mechanism to collect true randomness at the moment. I'm not an expert in random numbers, so the bitrate doesn't mean anything to me. A couple of possible solutions come to mind:
* Use pseudo-random numbers to start out with and test your theories, while working on getting truly random numbers in.
* Punt the problem to dom0: Have a daemon in dom0 to read /dev/urandom and "upload" values into a ring read by Xen. If the ring is empty, use pseudo-random numbers seeded by old values in the ring (?).
* Add entropy-collection to Xen.
* If interrupted by a timer that's longer than 1ms, just take a TSC and lop off the lower 10 bits. If you haven't been interrupted by a timer, use pseudorandom numbers seeded by the lower 10 bits of the last TSC.
As I said, I'm not an expert in collecting entropy, so some of these may be obviously brain-dead ideas. But it might give you enough to get started.
-George
Quoted 34 lines · michele.paolino
I need less than 10 bits at rate of 10 milliseconds. With a random number I will select the next VCPU to schedule.
Michele
Quoted 11 lines · James Harper
Quoted 4 lines
Hi!
I am interested in writing a scheduler for Xen for academic purposes.I need
Quoted 2 lines
to generate random numbers.
Is it possible to generate random numbers in xen hypervisordevelopement?If
Quoted 2 lines
this is possible, how can I do it?
Quoted 8 lines
How many bits do you random numbers need to be?
At what rate do you need them? (10/second?, 1000000/second?)
Would pseudo-random numbers do? If so, what repeat interval is sufficient?
James
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Ok, thanks! this is enought to get started.
but how can I read a random number from /dev/urandom? is Xend the deamon that you talk me about?
Thanks
Michele
Quoted 19 lines · George Dunlap
I think the short answer is, Xen does not have a mechanism to collect true randomness at the moment. I'm not an expert in random numbers, so the bitrate doesn't mean anything to me. A couple of possible solutions come to mind:
* Use pseudo-random numbers to start out with and test your theories, while working on getting truly random numbers in.
* Punt the problem to dom0: Have a daemon in dom0 to read/dev/urandomand "upload" values into a ring read by Xen. If the ring is empty, use pseudo-random numbers seeded by old values in the ring (?).
* Add entropy-collection to Xen.
* If interrupted by a timer that's longer than 1ms, just take a TSC and lop off the lower 10 bits. If you haven't been interrupted by a timer, use pseudorandom numbers seeded by the lower 10 bits of the last TSC.As I said, I'm not an expert in collecting entropy, so some of these may be obviously brain-dead ideas. But it might give you enough to get started.
Quoted 40 lines
-George
Quoted 1 line · michele.paolino
I need less than 10 bits at rate of 10 milliseconds. With a random number
I
Quoted 33 lines
will select the next VCPU to schedule.
Michele
Quoted 11 lines · James Harper
Quoted 4 lines
Hi!
I am interested in writing a scheduler for Xen for academic purposes.I need
Quoted 2 lines
to generate random numbers.
Is it possible to generate random numbers in xen hypervisordevelopement?If
Quoted 2 lines
this is possible, how can I do it?
Quoted 8 lines
How many bits do you random numbers need to be?
At what rate do you need them? (10/second?, 1000000/second?)
Would pseudo-random numbers do? If so, what repeat interval is sufficient?
James
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Quoted 2 lines · michele.paolino
Ok, thanks! this is enought to get started. but how can I read a random number from
/dev/urandom?
open(), read().
Just try a cat | hexdump on the cli, it's really that simple.
Quoted 1 line
is Xend the deamon that you talk me about?
I think George was rather suggesting a standalone daemon. It would be better done just writing a background task in dom0.
Establish a ring buffer on a page shared with xen. Xen consumes bits from the buffer and advances a consumer pointer. Your daemon reads bits from /dev/urandom and forwards them to the ring, advancing a producer pointer.
A lot of communications in Xen is shared memory in the exact same fashion. Copy xen/include/public/io/console.h and study some of the pointer offset and barrier stuff in ring.h.
If you're stuck, see related code for samples, about any PV driver deals with this kind of interface, the console code probably being the most simple one.
Advanced flow control: You will come across event channels anyway. But for the bandwith you're indicating, you will most likely find polling works okay.
It's just about the ideal project to get started with basic Xen hacking.
Daniel
Quoted 85 lines
Thanks
MicheleOn Fri, Feb 12, 2010 at 1:15 PM, George Dunlap <[email protected]> wrote:
I think the short answer is, Xen does not have a mechanism to collect
true randomness at the moment. I'm not an expert in random numbers,
so the bitrate doesn't mean anything to me. A couple of possible
solutions come to mind:
* Use pseudo-random numbers to start out with and test your theories,
while working on getting truly random numbers in.
* Punt the problem to dom0: Have a daemon in dom0 to read/dev/urandom
and "upload" values into a ring read by Xen. If the ring is empty,
use pseudo-random numbers seeded by old values in the ring (?).
* Add entropy-collection to Xen.
* If interrupted by a timer that's longer than 1ms, just take a TSC
and lop off the lower 10 bits. If you haven't been interrupted by a
timer, use pseudorandom numbers seeded by the lower 10 bits of the
last TSC.As I said, I'm not an expert in collecting entropy, so some of these
may be obviously brain-dead ideas. But it might give you enough to
get started.-George
On Fri, Feb 12, 2010 at 8:32 AM, michele.paolino <[email protected]> wrote:
> I need less than 10 bits at rate of 10 milliseconds. With a random number I
> will select the next VCPU to schedule.
>
> Michele
>
> On Fri, Feb 12, 2010 at 2:51 AM, James Harper
> <[email protected]> wrote:
>>
>> >
>> > Hi!
>> > I am interested in writing a scheduler for Xen for academic purposes.
>> I need
>> > to generate random numbers.
>> > Is it possible to generate random numbers in xen hypervisor
>> developement?If
>> > this is possible, how can I do it?
>> >
>>
>> How many bits do you random numbers need to be? >>
>> At what rate do you need them? (10/second?, 1000000/second?)
>>
>> Would pseudo-random numbers do? If so, what repeat interval is
>> sufficient?
>>
>> James
>
>> _______________________________________________ > Xen-devel mailing list
> [email protected]
> http://lists.xensource.com/xen-devel
>
>
Here's my random scheduler. It works until I start a virtual machine (error file attached is the serial console's log).
In xen call trace there isn't any of my functions.
To generate random numbers I'm using the hash (MD5) of NOW() function. I would also Know why at boot time there are two calls at vcpu_init function for vcpu with id = 0 ??
Thanks
Michele
#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>
#include <xen/randmd5.h>
int tot_vcpu=0;MD5_CTX mdContext;
struct random_vcpu_info{
struct list_head lista;
struct vcpu *vcpu;
}*runnable;void __init_runnable(void){
runnable=xmalloc(struct random_vcpu_info);
INIT_LIST_HEAD(&runnable->lista);
printk("\nINIT runnable list\n");
}static int random_vcpu_init(struct vcpu *v){
struct random_vcpu_info *inf;
inf= xmalloc(struct random_vcpu_info);
if ( inf == NULL ) return -1;
INIT_LIST_HEAD(&inf->lista);
inf->vcpu=v;
runnable->vcpu=v;
list_add(&inf->lista,&runnable->lista);
tot_vcpu++;
printk("\n\nadd VCPU %d\n\n", v->vcpu_id);
return 0;
}//destroy vcpu
struct task_slice random_schedule(s_time_t now){
struct task_slice ret;
struct random_vcpu_info *inf;
int next_vcpu;
printk("\n\nscheduling..\n");
//MD5Final returns a random integer
next_vcpu = (MD5Final (&mdContext)) % tot_vcpu;
printk("\n\n\nnext_vcpu = %d",next_vcpu);
inf = runnable;
while (next_vcpu!=0){
inf = list_entry(&runnable->lista, struct random_vcpu_info, lista );
printk("runnable->v =%d", runnable->vcpu->vcpu_id);
list_move_tail(&runnable->lista, &runnable->lista);
next_vcpu--;
printk("\nshifting list\n");
}
ret.task= inf->vcpu;
ret.time = MILLISECS(10);
printk("\n\nI'm scheduling.. vcpi_id=%d , tot_vcpu=%d",inf->vcpu->vcpu_id,tot_vcpu);
return ret;
}static void __random_init(void){
unsigned char digest[16];
int i;
long unsigned int mask= 0xFF;
long unsigned int string_now = NOW();
MD5Init (&mdContext);
for (i=0;i<8;i++){
digest[i]=(char) ((string_now & mask) >> 8*i);
mask <<=8;
}
printk("Init Random Number Generator with word %x", (unsigned int) digest);
MD5Update (&mdContext, (unsigned char*)prova, sizeof(s_time_t));
printk("\n\nUpdating Random Generator\n");}
static void random_vcpu_wake( struct vcpu *vc){
printk("\n\nwake up!!!!!!!!!!!!\n\n");
cpu_raise_softirq(smp_processor_id(),SCHEDULE_SOFTIRQ);
__random_init();
return;
}struct scheduler sched_random_def = {
.name = "my Random Scheduler",
.opt_name = "random",
.sched_id = 17,
.init_vcpu = random_vcpu_init,
.wake = random_vcpu_wake,
.destroy_vcpu = NULL,
.do_schedule = random_schedule,};
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
The problem is that you're choosing a random vcpu to run, without considering whether it *wants* to run or not. In this case, you're running a vcpu before it's even been completely set up yet (write_cr3 is failing because the guest *has* no cr3 ready yet).
The normal way schedulers deal with this is to keep one list of all vcpus (or all domains), and another list with "runnable" vcpus. You can keep track of which vcpus are runnable with the vcpu_wake() callback and by using vcpu_runnable() in schedule().
At very least, your loop in schedule should check vcpu_runnable() before selecting it.
-George
Quoted 7 lines · michele.paolino
Here's my random scheduler. It works until I start a virtual machine (error file attached is the serial console's log). In xen call trace there isn't any of my functions.
To generate random numbers I'm using the hash (MD5) ofNOW()function.
I would also Know why at boot time there are two calls atvcpu_initfunction for vcpu with id = 0 ??Thanks
Michele
Following George's advices I have rewrited my scheduler. But now serial console's log report me a bug in a function of timer.c
(XEN) ****************************************
(XEN) Panic on CPU 0:
(XEN) Xen BUG at timer.c:184
(XEN) ****************************************
This is caused by cpumask_raise_softirq() in my wake() function. What can I do?
Michele
On Thu, Feb 25, 2010 at 10:25 PM, George Dunlap <[email protected]
Quoted 12 lines
wrote:
The problem is that you're choosing a random vcpu to run, without considering whether it *wants* to run or not. In this case, you're running a vcpu before it's even been completely set up yet (
write_cr3is failing because the guest *has* no cr3 ready yet).The normal way schedulers deal with this is to keep one list of all vcpus (or all domains), and another list with "runnable" vcpus. You can keep track of which vcpus are runnable with the
vcpu_wake()callback and by usingvcpu_runnable()inschedule().
Quoted 20 lines
At very least, your loop in schedule should check
vcpu_runnable()before selecting it.-George
Quoted 10 lines · michele.paolino
Here's my random scheduler. It works until I start a virtual machine (error file attached is the serial console's log).
In xen call trace there isn't any of my functions.
To generate random numbers I'm using the hash (MD5) ofNOW()function. I would also Know why at boot time there are two calls atvcpu_initfunction for vcpu with id = 0 ??Thanks
Michele
#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>
#include <xen/randmd5.h>
int tot_vcpu=0;MD5_CTX mdContext;
#define RAND_PCPU(_c) ((struct random_pcpu *)per_cpu(schedule_data, _c).sched_priv) #define RAND_VCPU(_vcpu) ((struct random_vcpu *) (_vcpu)->sched_priv) #define RUNQ(_cpu) (&(RAND_PCPU(_cpu)->runq))
struct random_pcpu {
struct list_head runq;
};struct random_vcpu{
struct list_head active_vcpu_elem; //all
struct list_head runq_elem; //runnable
struct vcpu *vcpu;
};
static int random_pcpu_init(int cpu);
static inline void __runq_insert(unsigned int cpu, struct random_vcpu *svc);
static int random_vcpu_init(struct vcpu *vc){
struct random_vcpu *svc;
svc = xmalloc(struct random_vcpu);
if ( svc == NULL )
return -1;
memset(svc, 0, sizeof(*svc));
INIT_LIST_HEAD(&svc->active_vcpu_elem);
INIT_LIST_HEAD(&svc->runq_elem);
svc->vcpu = vc;
vc->sched_priv = svc; /* Allocate per-PCPU info */
if ( unlikely(!RAND_PCPU(vc->processor)) )
{
if ( random_pcpu_init(vc->processor) != 0 )
return -1;
} //check CSCHED_VCPU_CHECK
tot_vcpu++;
printk("\nadd VCPU %d\n", vc->vcpu_id);
return 0;
}static int random_pcpu_init(int cpu)
{
struct random_pcpu *spc;
/* Allocate per-PCPU info */
spc = xmalloc(struct random_pcpu);
if ( spc == NULL )
return -1;
memset(spc, 0, sizeof(*spc));
INIT_LIST_HEAD(&spc->runq);
per_cpu(schedule_data, cpu).sched_priv = spc;
return 0;
}static void random_vcpu_destroy(struct vcpu *v)
{
printk("\n\nDESTROYING VCPU %d\n\n",v->vcpu_id);
/*
struct csched_vcpu * const svc = CSCHED_VCPU(vc);
struct csched_dom * const sdom = svc->sdom;
unsigned long flags;
CSCHED_STAT_CRANK(vcpu_destroy);
BUG_ON( sdom == NULL );
BUG_ON( !list_empty(&svc->runq_elem) );
spin_lock_irqsave(&csched_priv.lock, flags);
if ( !list_empty(&svc->active_vcpu_elem) )
__csched_vcpu_acct_stop_locked(svc);
spin_unlock_irqrestore(&csched_priv.lock, flags);
xfree(svc);*/
}struct task_slice random_schedule(s_time_t now){
const unsigned int cpu = smp_processor_id();
struct list_head *runq = RUNQ(cpu);
struct random_vcpu * const scurr = RAND_VCPU(current);
struct random_vcpu *snext;
struct task_slice ret;
int next_vcpu=0;
next_vcpu = (MD5Final (&mdContext)) % tot_vcpu;
/*
* Select next runnable local VCPU (ie top of local runq)
*/
if ( vcpu_runnable(current) )
__runq_insert(cpu, scurr); // else
// BUG_ON( is_idle_vcpu(current) || list_empty(runq) );
while (next_vcpu==0){
next_vcpu--;
runq=runq->next;
}
snext = list_entry(runq->next, struct random_vcpu, runq_elem);
ret.time = MILLISECS(10);
ret.task = snext->vcpu;
return ret;
}static void __random_init(void){
unsigned char digest[16];
int i;
long unsigned int mask= 0xFF;
long unsigned int string_now = NOW();
MD5Init (&mdContext);
printk("\n\nInit Random Number Generator\n");
for (i=0;i<8;i++){
digest[i]=(char) ((string_now & mask) >> 8*i);
mask <<=8;
}
printk("Inizializzo il random con la parola %x", (unsigned int) digest);
MD5Update (&mdContext, (unsigned char*)digest, sizeof(s_time_t));
printk("\n\nUpdating Random Generator\n");}
static void random_vcpu_wake( struct vcpu *vc){
struct random_vcpu * const svc = RAND_VCPU(vc);
const unsigned int cpu = vc->processor;
cpumask_t mask;
cpus_clear(mask);
/* Put the VCPU on the runq and tickle CPUs */
__runq_insert(cpu, svc); //inserisce in coda la vcpu
// __runq_tickle(cpu, svc); // raise softirq
printk("\n\nWAKE UP!!!!!!!!!!!!\n\n");
if ( unlikely(!list_empty(&svc->runq_elem)) )
{
return;
}
if ( !is_idle_vcpu(vc) && likely(vcpu_runnable(vc)) )
{
cpu_set(cpu, mask);
printk("\nI'm setting the mask for the current vcpu\n");
}
if ( !cpus_empty(mask) )
cpumask_raise_softirq(mask, SCHEDULE_SOFTIRQ);
//cpu_raise_softirq(cpu,SCHEDULE_SOFTIRQ);
__random_init();
return;
}static inline void __runq_insert(unsigned int cpu, struct random_vcpu *svc)
{
const struct list_head * const runq = RUNQ(cpu);
struct list_head *iter;
list_for_each( iter, runq )
{
list_add_tail(&svc->runq_elem, iter);
}
return;
}struct scheduler sched_rand_def = {
.name = "my Random Scheduler",
.opt_name = "random",
.sched_id = 17,
.init_vcpu = random_vcpu_init,
.wake = random_vcpu_wake,
.destroy_vcpu = random_vcpu_destroy,
.do_schedule = random_schedule,};
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Did you look at timer.c, line 184, to find out what the BUG is? -George
Quoted 44 lines · michele.paolino
Following George's advices I have rewrited my scheduler. But now serial console's log report me a bug in a function of
timer.c(XEN) ****************************************
(XEN) Panic on CPU 0:
(XEN) Xen BUG at timer.c:184
(XEN) ****************************************This is caused by
cpumask_raise_softirq()in mywake()function. What can I do?Michele
On Thu, Feb 25, 2010 at 10:25 PM, George Dunlap <[email protected] <mailto:[email protected]>> wrote:
The problem is that you're choosing a random vcpu to run, without considering whether it *wants* to run or not. In this case, you're running a vcpu before it's even been completely set up yet (
write_cr3is failing because the guest *has* no cr3 ready yet).The normal way schedulers deal with this is to keep one list of all vcpus (or all domains), and another list with "runnable" vcpus. You can keep track of which vcpus are runnable with the
vcpu_wake()callback and by usingvcpu_runnable()inschedule().At very least, your loop in schedule should check
vcpu_runnable()before selecting it.-George
michele.paolino wrote:
Here's my random scheduler. It works until I start a virtual machine (error file attached is the serial console's log). In xen call trace there isn't any of my functions. To generate random numbers I'm using the hash (MD5) of
NOW()function.
I would also Know why at boot time there are two calls atvcpu_initfunction for vcpu with id = 0 ??Thanks
Michele
Line 184 correspond at rc = 0 (an int variable) of remove_entry() function. I don't have modified that file.
Michele
Quoted 54 lines · George Dunlap
Did you look at
timer.c, line 184, to find out what the BUG is? -GeorgeQuoted 48 lines · michele.paolino
Following George's advices I have rewrited my scheduler. But now serial console's log report me a bug in a function of
timer.c(XEN) ****************************************
(XEN) Panic on CPU 0:
(XEN) Xen BUG at timer.c:184
(XEN) ****************************************This is caused by
cpumask_raise_softirq()in mywake()function. What can I do?Michele
On Thu, Feb 25, 2010 at 10:25 PM, George Dunlap < [email protected] <mailto:[email protected]>> wrote:
The problem is that you're choosing a random vcpu to run, without considering whether it *wants* to run or not. In this case, you're running a vcpu before it's even been completely set up yet (
write_cr3is failing because the guest *has* no cr3 ready yet).The normal way schedulers deal with this is to keep one list of all vcpus (or all domains), and another list with "runnable" vcpus. You can keep track of which vcpus are runnable with the
vcpu_wake()callback and by usingvcpu_runnable()inschedule().At very least, your loop in schedule should check
vcpu_runnable()before selecting it.-George
michele.paolino wrote:
Here's my random scheduler. It works until I start a virtual machine (error file attached is the serial console's log). In xen call trace there isn't any of my functions. To generate random numbers I'm using the hash (MD5) of
NOW()function.
I would also Know why at boot time there are two calls atvcpu_initfunction for vcpu with id = 0 ??Thanks
Michele
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
If you want us to spend some of our time helping you, you need to demonstrate that you've tried to spend some time helping yourself. How might rc come to be 0 at that line? What is remove_entry() doing? How could this have come about because of something your code did?
An example mail that would get more help would be something like this:
"I've looked at the remove_entry() function, and it seems that the bug can be triggered if the input is {some condition}. I looked at where remove_entry() is being called, but I can't figure out how it can get that condition because of my code."
-George
Quoted 71 lines · michele.paolino
Line 184 correspond at rc = 0 (an int variable) of
remove_entry()function. I don't have modified that file.Michele
On Fri, Feb 26, 2010 at 6:44 PM, George Dunlap <[email protected] <mailto:[email protected]>> wrote:
Did you look at
timer.c, line 184, to find out what the BUG is? -Georgemichele.paolino wrote:
Following George's advices I have rewrited my scheduler. But now serial console's log report me a bug in a function of
timer.c(XEN) **************************************** (XEN) Panic on CPU 0:
(XEN) Xen BUG at timer.c:184
(XEN) ****************************************This is caused by
cpumask_raise_softirq()in mywake()function. What can I do?Michele
On Thu, Feb 25, 2010 at 10:25 PM, George Dunlap <[email protected] <mailto:[email protected]> <mailto:[email protected] <mailto:[email protected]>>> wrote:
The problem is that you're choosing a random vcpu to run,
without
considering whether it *wants* to run or not. In this case, you're running a vcpu before it's even been completely set
up yet
(write_cr3is failing because the guest *has* no cr3 ready
yet).The normal way schedulers deal with this is to keep one list of all vcpus (or all domains), and another list with "runnable" vcpus. You can keep track of which vcpus are runnable with the
vcpu_wake()callback and by usingvcpu_runnable()in
schedule().At very least, your loop in schedule should check
vcpu_runnable()
before selecting it.-George
michele.paolino wrote:
Here's my random scheduler. It works until I start a
virtual
machine (error file attached is the serial console's log). In xen call trace there isn't any of my functions. To generate random numbers I'm using the hash (MD5) of
NOW()
function.
I would also Know why at boot time there are two calls atvcpu_initfunction for vcpu with id = 0 ??Thanks
Michele
I'm really sorry, maybe I misunderstood your mail. I don't want anyone to
work for me.:-)
I looked at the functions listed in Xen call trace...I think my problem is the timer variable called periodic_timer of struct vcpu.
In function remove_entry() there is a switch/case construct that check if vcpu->periodic_timer->status is initialized at TIMER_STATUS_in_heap or TIMER_STATUS_in_list. Which one should I use?
Should Initialize it at one of timer status defined in timer.h file?
Thanks,
Michele
Quoted 7 lines · George Dunlap
If you want us to spend some of our time helping you, you need to demonstrate that you've tried to spend some time helping yourself. How might rc come to be 0 at that line? What is
remove_entry()doing? How could this have come about because of something your code did?An example mail that would get more help would be something like this:
Quoted 84 lines
"I've looked at the
remove_entry()function, and it seems that the bug can be triggered if the input is {some condition}. I looked at whereremove_entry()is being called, but I can't figure out how it can get that condition because of my code."-George
Quoted 74 lines · michele.paolino
Line 184 correspond at rc = 0 (an int variable) of
remove_entry()function. I don't have modified that file.Michele
On Fri, Feb 26, 2010 at 6:44 PM, George Dunlap < [email protected] <mailto:[email protected]>> wrote:
Did you look at
timer.c, line 184, to find out what the BUG is? -Georgemichele.paolino wrote:
Following George's advices I have rewrited my scheduler. But now serial console's log report me a bug in a function of
timer.c(XEN) **************************************** (XEN) Panic on CPU 0:
(XEN) Xen BUG at timer.c:184
(XEN) ****************************************This is caused by
cpumask_raise_softirq()in mywake()function. What can I do?Michele
On Thu, Feb 25, 2010 at 10:25 PM, George Dunlap <[email protected] <mailto:[email protected]> <mailto:[email protected] <mailto:[email protected]>>> wrote:
The problem is that you're choosing a random vcpu to run,
without
considering whether it *wants* to run or not. In this case, you're running a vcpu before it's even been completely set
up yet
(write_cr3is failing because the guest *has* no cr3 ready
yet).The normal way schedulers deal with this is to keep one list of all vcpus (or all domains), and another list with "runnable" vcpus. You can keep track of which vcpus are runnable with the
vcpu_wake()callback and by usingvcpu_runnable()in
schedule().At very least, your loop in schedule should check
vcpu_runnable()
before selecting it.-George
michele.paolino wrote:
Here's my random scheduler. It works until I start a
virtual
machine (error file attached is the serial console's log). In xen call trace there isn't any of my functions. To generate random numbers I'm using the hash (MD5) of
NOW()
function.
I would also Know why at boot time there are two calls atvcpu_initfunction for vcpu with id = 0 ??Thanks
Michele
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Quoted 1 line · michele.paolino
I'm really sorry, maybe I misunderstood your mail. I don't want anyone to work for me.:-)
Whenever you ask a question, you're asking someone to work for you, because it takes time and effort for someone to answer it. Even a short e-mail response may take 5 minutes of reading, understanding, thinking, and typing. To answer your question about the BUG() requires me to download the repository you're using, look at and trace around code I've never looked at before, and possibly to read and understand your code. That's probably at least a half-hour of my time.
And that's OK. I like helping people, I like solving problems. It's also an investment: if you become a good OS coder, the computer industry as a whole (and myself included in that) benefit; and if you become better at Xen, I benefit more directly.
However, I don't want to waste my time. How you can demonstrate to me that you are committed to learning this, and that you are capable of becoming an OS coder, is by demonstrating that you've spent effort and thought on something before answering a question.
I'll take a closer look and try to answer your question either later today or tomorrow.
-George
thanks,
I have solved the timer.c problem right now. I am able to start dom0.
Michele
Quoted 26 lines · George Dunlap
Quoted 2 lines · michele.paolino
I'm really sorry, maybe I misunderstood your mail. I don't want anyone to work for me.:-)
Whenever you ask a question, you're asking someone to work for you, because it takes time and effort for someone to answer it. Even a short e-mail response may take 5 minutes of reading, understanding, thinking, and typing. To answer your question about the
BUG()requires me to download the repository you're using, look at and trace around code I've never looked at before, and possibly to read and understand your code. That's probably at least a half-hour of my time.And that's OK. I like helping people, I like solving problems. It's also an investment: if you become a good OS coder, the computer industry as a whole (and myself included in that) benefit; and if you become better at Xen, I benefit more directly.
However, I don't want to waste my time. How you can demonstrate to me that you are committed to learning this, and that you are capable of becoming an OS coder, is by demonstrating that you've spent effort and thought on something before answering a question.
I'll take a closer look and try to answer your question either later today or tomorrow.
-George