All of lore.kernel.org
 help / color / mirror / Atom feed
* generate random numbers
@ 2010-02-11 20:31 michele.paolino
  2010-02-12  1:51 ` James Harper
  0 siblings, 1 reply; 15+ messages in thread
From: michele.paolino @ 2010-02-11 20:31 UTC (permalink / raw)
  To: Xen-devel; +Cc: George Dunlap


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

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

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

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

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

^ permalink raw reply	[flat|nested] 15+ messages in thread

* RE: generate random numbers
  2010-02-11 20:31 generate random numbers michele.paolino
@ 2010-02-12  1:51 ` James Harper
  2010-02-12  8:32   ` michele.paolino
  0 siblings, 1 reply; 15+ messages in thread
From: James Harper @ 2010-02-12  1:51 UTC (permalink / raw)
  To: michele.paolino, Xen-devel; +Cc: George Dunlap

> 
> 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

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: generate random numbers
  2010-02-12  1:51 ` James Harper
@ 2010-02-12  8:32   ` michele.paolino
  2010-02-12 12:15     ` George Dunlap
  0 siblings, 1 reply; 15+ messages in thread
From: michele.paolino @ 2010-02-12  8:32 UTC (permalink / raw)
  To: James Harper; +Cc: George Dunlap, Xen-devel


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

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 <james.harper@bendigoit.com.au
> 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
>

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

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

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

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: generate random numbers
  2010-02-12  8:32   ` michele.paolino
@ 2010-02-12 12:15     ` George Dunlap
  2010-02-12 22:42       ` michele.paolino
  0 siblings, 1 reply; 15+ messages in thread
From: George Dunlap @ 2010-02-12 12:15 UTC (permalink / raw)
  To: michele.paolino; +Cc: Xen-devel, James Harper

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
<michele.paolino@studio.unibo.it> 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
> <james.harper@bendigoit.com.au> 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
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel
>
>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: generate random numbers
  2010-02-12 12:15     ` George Dunlap
@ 2010-02-12 22:42       ` michele.paolino
  2010-02-12 23:12         ` Daniel Stodden
  0 siblings, 1 reply; 15+ messages in thread
From: michele.paolino @ 2010-02-12 22:42 UTC (permalink / raw)
  To: George Dunlap; +Cc: Xen-devel, James Harper


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

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


On Fri, Feb 12, 2010 at 1:15 PM, George Dunlap
<George.Dunlap@eu.citrix.com>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
> <michele.paolino@studio.unibo.it> 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
> > <james.harper@bendigoit.com.au> 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
> > Xen-devel@lists.xensource.com
> > http://lists.xensource.com/xen-devel
> >
> >
>

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

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

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

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: generate random numbers
  2010-02-12 22:42       ` michele.paolino
@ 2010-02-12 23:12         ` Daniel Stodden
  2010-02-25 18:31           ` michele.paolino
  0 siblings, 1 reply; 15+ messages in thread
From: Daniel Stodden @ 2010-02-12 23:12 UTC (permalink / raw)
  To: michele.paolino; +Cc: George Dunlap, Xen-devel, James Harper

On Fri, 2010-02-12 at 17:42 -0500, michele.paolino wrote:
> 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.

> 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 


> Thanks
> Michele
> 
> 
> On Fri, Feb 12, 2010 at 1:15 PM, George Dunlap
> <George.Dunlap@eu.citrix.com> 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
>         <michele.paolino@studio.unibo.it> 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
>         > <james.harper@bendigoit.com.au> 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
>         > Xen-devel@lists.xensource.com
>         > http://lists.xensource.com/xen-devel
>         >
>         >
>         
> 

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: generate random numbers
  2010-02-12 23:12         ` Daniel Stodden
@ 2010-02-25 18:31           ` michele.paolino
  2010-02-25 21:25             ` George Dunlap
  0 siblings, 1 reply; 15+ messages in thread
From: michele.paolino @ 2010-02-25 18:31 UTC (permalink / raw)
  To: Xen-devel, George Dunlap


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

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

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

[-- Attachment #2: error --]
[-- Type: application/octet-stream, Size: 1992 bytes --]

(XEN) ----[ Xen-3.4.2  x86_32p  debug=n  Not tainted ]----
(XEN) CPU:    0
(XEN) EIP:    e008:[<ff1380ff>] write_cr3+0x2f/0x50
(XEN) EFLAGS: 00000046   CONTEXT: hypervisor
(XEN) eax: 0000e39c   ebx: 0000e39c   ecx: 0000e39c   edx: 00000000
(XEN) esi: 00000096   edi: 00000000   ebp: ffbe6000   esp: ff227eb4
(XEN) cr0: 8005003b   cr4: 000006f0   cr3: 325a5000   cr2: 08492c54
(XEN) ds: e010   es: e010   fs: 0000   gs: 0000   ss: e010   cs: e008
(XEN) Xen stack trace from esp=ff227eb4:
(XEN)    00000000 00000000 ffbe8000 ff135f1b 00000000 ff204220 00000000 00000000
(XEN)    ff274000 ff101000 ffbe6384 ff204100 ff204100 129e2718 ffbe6000 00000000
(XEN)    ff227fb4 ffbe6000 ff274000 ff1371d1 ffbe6024 135d0eb8 00000016 0042297c
(XEN)    ff204100 ff204100 00000000 ffbe6000 129e2718 00000000 ff274000 ff116b4d
(XEN)    ff274000 ffbe6000 00000016 134f7b4e ff274000 ff116565 ff204024 ff204090
(XEN)    00989680 00000000 134f7b4e 00000016 ff204080 00000002 ff204024 c03e9e2c
(XEN)    00000020 0000007b ff227fb4 ffbe6000 00989680 00000000 0000007b 00000000
(XEN)    ff227fb4 0000007b c041c180 ff117b45 00000000 ff274000 0000007b ff1b63a6
(XEN)    00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
(XEN)    00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
(XEN)    00000000 00000000 ffbe6000
(XEN) Xen call trace:
(XEN)    [<ff1380ff>] write_cr3+0x2f/0x50
(XEN)    [<ff135f1b>] __context_switch+0x18b/0x270
(XEN)    [<ff101000>] boot_cpu_gdt_table+0x0/0x1000
(XEN)    [<ff1371d1>] context_switch+0xa1/0x190
(XEN)    [<ff116b4d>] schedule+0x1bd/0x410
(XEN)    [<ff116565>] do_sched_op+0x95/0x4c0
(XEN)    [<ff117b45>] do_softirq+0x35/0x70
(XEN)    [<ff1b63a6>] process_softirqs+0x6/0x10
(XEN)    
(XEN) 
(XEN) ****************************************
(XEN) Panic on CPU 0:
(XEN) GENERAL PROTECTION FAULT
(XEN) [error_code=0000]
(XEN) ****************************************
(XEN) 
(XEN) Reboot in five seconds...

[-- Attachment #3: sched_random.c --]
[-- Type: text/x-csrc, Size: 2620 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>
#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,

};




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

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

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: generate random numbers
  2010-02-25 18:31           ` michele.paolino
@ 2010-02-25 21:25             ` George Dunlap
  2010-02-26 17:43               ` michele.paolino
  0 siblings, 1 reply; 15+ messages in thread
From: George Dunlap @ 2010-02-25 21:25 UTC (permalink / raw)
  To: michele.paolino; +Cc: 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

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 at vcpu_init 
> function for vcpu with id = 0 ??
>
> Thanks
> Michele

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: generate random numbers
  2010-02-25 21:25             ` George Dunlap
@ 2010-02-26 17:43               ` michele.paolino
  2010-02-26 17:44                 ` George Dunlap
  0 siblings, 1 reply; 15+ messages in thread
From: michele.paolino @ 2010-02-26 17:43 UTC (permalink / raw)
  To: George Dunlap; +Cc: Xen-devel


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

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 <george.dunlap@eu.citrix.com
> 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_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
>
>
> 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 at vcpu_init
>> function for vcpu with id = 0 ??
>>
>> Thanks
>> Michele
>>
>
>

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

[-- Attachment #2: log --]
[-- Type: application/octet-stream, Size: 7850 bytes --]

 __  __            _____ _  _    ____  
 \ \/ /___ _ __   |___ /| || |  |___ \ 
  \  // _ \ '_ \    |_ \| || |_   __) |
  /  \  __/ | | |  ___) |__   _| / __/ 
 /_/\_\___|_| |_| |____(_) |_|(_)_____|
                                       
(XEN) Xen version 3.4.2 (root@) (gcc version 4.2.4 (Ubuntu 4.2.4-1ubuntu4)) Fri Feb 26 18:04:47 CET 2010
(XEN) Latest ChangeSet: unavailable
(XEN) Command line: dom0_mem=262144 loglvl=all guest_loglvl=all com1=115200,8n1 console=com1 sched=random
(XEN) Video information:
(XEN)  VGA is text mode 80x25, font 8x16
(XEN) Disc information:
(XEN)  Found 1 MBR signatures
(XEN)  Found 1 EDD information structures
(XEN) Xen-e820 RAM map:
(XEN)  0000000000000000 - 000000000009f000 (usable)
(XEN)  000000000009f000 - 00000000000a0000 (reserved)
(XEN)  00000000000e8000 - 0000000000100000 (reserved)
(XEN)  0000000000100000 - 000000003fff0000 (usable)
(XEN)  000000003fff0000 - 0000000040000000 (ACPI data)
(XEN)  00000000fffbc000 - 0000000100000000 (reserved)
(XEN) System RAM: 1023MB (1048124kB)
(XEN) ACPI: RSDP 000FBDB0, 0014 (r0 QEMU  )
(XEN) ACPI: RSDT 3FFF0000, 0034 (r1 QEMU   QEMURSDT        1 QEMU        1)
(XEN) ACPI: FACP 3FFF01B4, 0074 (r1 QEMU   QEMUFACP        1 QEMU        1)
(XEN) ACPI: DSDT 3FFF0280, 1DD4 (r1   BXPC   BXDSDT        1 INTL 20090521)
(XEN) ACPI: FACS 3FFF0240, 0040
(XEN) ACPI: SSDT 3FFF2054, 09E3 (r1   BXPC   BXSSDT        1 INTL 20090521)
(XEN) ACPI: APIC 3FFF2A38, 00EA (r1 QEMU   QEMUAPIC        1 QEMU        1)
(XEN) ACPI: HPET 3FFF2B90, 0038 (r1 QEMU   QEMUHPET        1 QEMU        1)
(XEN) NUMA turned off
(XEN) Faking a node at 0000000000000000-000000003fff0000
(XEN) Xen heap: 9MB (9808kB)
(XEN) Domain heap initialised
(XEN) found SMP MP-table at 000fbc90
(XEN) DMI 2.4 present.
(XEN) Using APIC driver default
(XEN) ACPI: PM-Timer IO Port: 0xb008
(XEN) ACPI: ACPI SLEEP INFO: pm1x_cnt[b004,0], pm1x_evt[b000,0]
(XEN) ACPI:                  wakeup_vec[3fff024c], vec_size[20]
(XEN) ACPI: Local APIC address 0xfee00000
(XEN) ACPI: LAPIC (acpi_id[0x00] lapic_id[0x00] enabled)
(XEN) Processor #0 6:2 APIC version 20
(XEN) ACPI: LAPIC (acpi_id[0x01] lapic_id[0x01] disabled)
(XEN) ACPI: LAPIC (acpi_id[0x02] lapic_id[0x02] disabled)
(XEN) ACPI: LAPIC (acpi_id[0x03] lapic_id[0x03] disabled)
(XEN) ACPI: LAPIC (acpi_id[0x04] lapic_id[0x04] disabled)
(XEN) ACPI: LAPIC (acpi_id[0x05] lapic_id[0x05] disabled)
(XEN) ACPI: LAPIC (acpi_id[0x06] lapic_id[0x06] disabled)
(XEN) ACPI: LAPIC (acpi_id[0x07] lapic_id[0x07] disabled)
(XEN) ACPI: LAPIC (acpi_id[0x08] lapic_id[0x08] disabled)
(XEN) ACPI: LAPIC (acpi_id[0x09] lapic_id[0x09] disabled)
(XEN) ACPI: LAPIC (acpi_id[0x0a] lapic_id[0x0a] disabled)
(XEN) ACPI: LAPIC (acpi_id[0x0b] lapic_id[0x0b] disabled)
(XEN) ACPI: LAPIC (acpi_id[0x0c] lapic_id[0x0c] disabled)
(XEN) ACPI: LAPIC (acpi_id[0x0d] lapic_id[0x0d] disabled)
(XEN) ACPI: LAPIC (acpi_id[0x0e] lapic_id[0x0e] disabled)
(XEN) ACPI: LAPIC (acpi_id[0x0f] lapic_id[0x0f] disabled)
(XEN) ACPI: IOAPIC (id[0x01] address[0xfec00000] gsi_base[0])
(XEN) IOAPIC[0]: apic_id 1, version 17, address 0xfec00000, GSI 0-23
(XEN) ACPI: INT_SRC_OVR (bus 0 bus_irq 0 global_irq 2 dfl dfl)
(XEN) ACPI: INT_SRC_OVR (bus 0 bus_irq 5 global_irq 5 high level)
(XEN) ACPI: INT_SRC_OVR (bus 0 bus_irq 9 global_irq 9 high level)
(XEN) ACPI: INT_SRC_OVR (bus 0 bus_irq 10 global_irq 10 high level)
(XEN) ACPI: INT_SRC_OVR (bus 0 bus_irq 11 global_irq 11 high level)
(XEN) ACPI: IRQ0 used by override.
(XEN) ACPI: IRQ2 used by override.
(XEN) ACPI: IRQ5 used by override.
(XEN) ACPI: IRQ9 used by override.
(XEN) ACPI: IRQ10 used by override.
(XEN) ACPI: IRQ11 used by override.
(XEN) Enabling APIC mode:  Flat.  Using 1 I/O APICs
(XEN) ACPI: HPET id: 0x8086a201 base: 0xfed00000
(XEN) Using ACPI (MADT) for SMP configuration information
(XEN) Using scheduler: my Random Scheduler (random)
(XEN) 
(XEN) 
(XEN) add VCPU 0
(XEN) 
(XEN) Initializing CPU#0
(XEN) Detected 2533.340 MHz processor.
(XEN) CPU: L1 I cache: 32K, L1 D cache: 32K
(XEN) CPU: L2 cache: 2048K
(XEN) Intel machine check reporting enabled on CPU#0.
(XEN) CMCI: CPU0 has no CMCI support
(XEN) CPU0: Intel QEMU Virtual CPU version 0.11.0 stepping 03
(XEN) Total of 1 processors activated.
(XEN) ENABLING IO-APIC IRQs
(XEN)  -> Using new ACK method
(XEN) ..TIMER: vector=0xF0 apic1=0 pin1=2 apic2=-1 pin2=-1
(XEN) BAD HPET revision id.
(XEN) Platform timer is 3.579MHz ACPI PM Timer
(XEN) Brought up 1 CPUs
(XEN) I/O virtualisation disabled
(XEN) CPUIDLE: disabled due to no HPET. Force enable with 'cpuidle'.
(XEN) ACPI sleep modes: S3
(XEN) mcheck_poll: Machine check polling timer started.
(XEN) 
(XEN) 
(XEN) add VCPU 0
(XEN) 
(XEN) *** LOADING DOMAIN 0 ***
(XEN)  Xen  kernel: 32-bit, PAE, lsb
(XEN)  Dom0 kernel: 32-bit, PAE, lsb, paddr 0xc0100000 -> 0xc048d33c
(XEN) PHYSICAL MEMORY ARRANGEMENT:
(XEN)  Dom0 alloc.:   000000003c000000->000000003e000000 (57344 pages to be allocated)
(XEN) VIRTUAL MEMORY ARRANGEMENT:
(XEN)  Loaded kernel: c0100000->c048d33c
(XEN)  Init. ramdisk: c048e000->c12ec200
(XEN)  Phys-Mach map: c12ed000->c132d000
(XEN)  Start info:    c132d000->c132d47c
(XEN)  Page tables:   c132e000->c133d000
(XEN)  Boot stack:    c133d000->c133e000
(XEN)  TOTAL:         c0000000->c1400000
(XEN)  ENTRY ADDRESS: c0100000
(XEN) Dom0 has maximum 1 VCPUs
(XEN) Scrubbing Free RAM: .......done.
(XEN) Xen trace buffers: disabled
(XEN) Std. Loglevel: All
(XEN) Guest Loglevel: All
(XEN) *** Serial input -> DOM0 (type 'CTRL-a' three times to switch input to Xen)
(XEN) 
(XEN) 
(XEN) WAKE UP!!!!!!!!!!!!
(XEN) 
(XEN) 
(XEN) I'm setting the mask for the current vcpu
(XEN) 
(XEN) 
(XEN) Init Random Number Generator
(XEN) Inizializzo il random con la parola ff227e48
(XEN) 
(XEN) Updating Random Generator
(XEN) Freed 116kB init memory.
(XEN) Xen BUG at timer.c:184
(XEN) ----[ Xen-3.4.2  x86_32p  debug=n  Not tainted ]----
(XEN) CPU:    0
(XEN) EIP:    e008:[<ff1198c5>] remove_entry+0x15/0x80
(XEN) EFLAGS: 00010006   CONTEXT: hypervisor
(XEN) eax: ff204100   ebx: ffbfc2d4   ecx: 00000000   edx: 0000001a
(XEN) esi: 00000260   edi: 00000011   ebp: ff204100   esp: ff227eb8
(XEN) cr0: 8005003b   cr4: 000006f0   cr3: 00100120   cr2: 00000000
(XEN) ds: e010   es: e010   fs: e010   gs: e010   ss: e010   cs: e008
(XEN) Xen stack trace from esp=ff227eb8:
(XEN)    ff27c410 0000001a 00000260 ff119e69 ff204100 ff204100 00000000 ff204100
(XEN)    ff204100 00000000 00000292 72c15df2 00000000 ffbfc2b0 ffbfa000 ff11610f
(XEN)    ffbfc2d4 00000260 00000011 ff204100 ff204100 ff204100 72c09aa2 00000000
(XEN)    ffbfc2b0 72c0866b 00000000 ff116be3 ffbfc2b0 73591ceb 00000000 ff138db2
(XEN)    ff24e214 00000000 00000000 ff204090 00989680 00000000 00000000 ff1d6b40
(XEN)    ff204080 00000001 0000e008 00000282 ff1d6b40 0000000a ff1ca378 ffbfc2b0
(XEN)    00989680 00000000 ff239ff9 00000000 ff227fb4 ff2044b0 00000000 ff117bf5
(XEN)    00000000 ff227fb4 ff227fb4 ff1369b3 ffbfa000 ff08bf30 00000000 00000000
(XEN)    00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
(XEN)    00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
(XEN)    00000000 ffbfa000
(XEN) Xen call trace:
(XEN)    [<ff1198c5>] remove_entry+0x15/0x80
(XEN)    [<ff119e69>] set_timer+0x129/0x190
(XEN)    [<ff11610f>] vcpu_periodic_timer_work+0x6f/0xb0
(XEN)    [<ff116be3>] schedule+0x1a3/0x410
(XEN)    [<ff138db2>] common_interrupt+0x52/0x60
(XEN)    [<ff117bf5>] do_softirq+0x35/0x70
(XEN)    [<ff1369b3>] idle_loop+0x43/0x90
(XEN)    
(XEN) 
(XEN) ****************************************
(XEN) Panic on CPU 0:
(XEN) Xen BUG at timer.c:184
(XEN) ****************************************
(XEN) 
(XEN) Reboot in five seconds...

[-- Attachment #3: sched_random.c --]
[-- Type: text/x-csrc, Size: 4939 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>
#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,

};




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

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

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: generate random numbers
  2010-02-26 17:43               ` michele.paolino
@ 2010-02-26 17:44                 ` George Dunlap
  2010-02-26 18:54                   ` michele.paolino
  0 siblings, 1 reply; 15+ messages in thread
From: George Dunlap @ 2010-02-26 17:44 UTC (permalink / raw)
  To: michele.paolino; +Cc: Xen-devel

Did you look at timer.c, line 184, to find out what the BUG is?
 -George

michele.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 my wake() function. What 
> can I do?
>
> Michele
>
> On Thu, Feb 25, 2010 at 10:25 PM, George Dunlap 
> <george.dunlap@eu.citrix.com <mailto:george.dunlap@eu.citrix.com>> 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_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
>
>
>     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 at
>         vcpu_init function for vcpu with id = 0 ??
>
>         Thanks
>         Michele
>
>
>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: generate random numbers
  2010-02-26 17:44                 ` George Dunlap
@ 2010-02-26 18:54                   ` michele.paolino
  2010-03-01 11:41                     ` George Dunlap
  0 siblings, 1 reply; 15+ messages in thread
From: michele.paolino @ 2010-02-26 18:54 UTC (permalink / raw)
  To: George Dunlap; +Cc: Xen-devel


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

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
<george.dunlap@eu.citrix.com>wrote:

> Did you look at timer.c, line 184, to find out what the BUG is?
> -George
>
> michele.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 my wake() function. What can
>> I do?
>>
>> Michele
>>
>> On Thu, Feb 25, 2010 at 10:25 PM, George Dunlap <
>> george.dunlap@eu.citrix.com <mailto:george.dunlap@eu.citrix.com>> 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_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
>>
>>
>>    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 at
>>        vcpu_init function for vcpu with id = 0 ??
>>
>>        Thanks
>>        Michele
>>
>>
>>
>>
>

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

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

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

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: generate random numbers
  2010-02-26 18:54                   ` michele.paolino
@ 2010-03-01 11:41                     ` George Dunlap
  2010-03-01 16:56                       ` michele.paolino
  0 siblings, 1 reply; 15+ messages in thread
From: George Dunlap @ 2010-03-01 11:41 UTC (permalink / raw)
  To: michele.paolino; +Cc: 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

michele.paolino wrote:
> 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 
> <george.dunlap@eu.citrix.com <mailto:george.dunlap@eu.citrix.com>> wrote:
>
>     Did you look at timer.c, line 184, to find out what the BUG is?
>     -George
>
>     michele.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 my wake()
>         function. What can I do?
>
>         Michele
>
>         On Thu, Feb 25, 2010 at 10:25 PM, George Dunlap
>         <george.dunlap@eu.citrix.com
>         <mailto:george.dunlap@eu.citrix.com>
>         <mailto:george.dunlap@eu.citrix.com
>         <mailto:george.dunlap@eu.citrix.com>>> 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_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
>
>
>            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 at
>                vcpu_init function for vcpu with id = 0 ??
>
>                Thanks
>                Michele
>
>
>
>
>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: generate random numbers
  2010-03-01 11:41                     ` George Dunlap
@ 2010-03-01 16:56                       ` michele.paolino
  2010-03-02 12:58                         ` George Dunlap
  0 siblings, 1 reply; 15+ messages in thread
From: michele.paolino @ 2010-03-01 16:56 UTC (permalink / raw)
  To: George Dunlap; +Cc: Xen-devel


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

 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


On Mon, Mar 1, 2010 at 12:41 PM, George Dunlap
<george.dunlap@eu.citrix.com>wrote:

> 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
>
> michele.paolino wrote:
>
>> 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 <
>> george.dunlap@eu.citrix.com <mailto:george.dunlap@eu.citrix.com>> wrote:
>>
>>    Did you look at timer.c, line 184, to find out what the BUG is?
>>    -George
>>
>>    michele.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 my wake()
>>        function. What can I do?
>>
>>        Michele
>>
>>        On Thu, Feb 25, 2010 at 10:25 PM, George Dunlap
>>        <george.dunlap@eu.citrix.com
>>        <mailto:george.dunlap@eu.citrix.com>
>>        <mailto:george.dunlap@eu.citrix.com
>>        <mailto:george.dunlap@eu.citrix.com>>> 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_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
>>
>>
>>           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 at
>>               vcpu_init function for vcpu with id = 0 ??
>>
>>               Thanks
>>               Michele
>>
>>
>>
>>
>>
>>
>

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

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

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

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: generate random numbers
  2010-03-01 16:56                       ` michele.paolino
@ 2010-03-02 12:58                         ` George Dunlap
  2010-03-03  7:52                           ` michele.paolino
  0 siblings, 1 reply; 15+ messages in thread
From: George Dunlap @ 2010-03-02 12:58 UTC (permalink / raw)
  To: michele.paolino; +Cc: Xen-devel

michele.paolino wrote:
> 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

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: generate random numbers
  2010-03-02 12:58                         ` George Dunlap
@ 2010-03-03  7:52                           ` michele.paolino
  0 siblings, 0 replies; 15+ messages in thread
From: michele.paolino @ 2010-03-03  7:52 UTC (permalink / raw)
  To: George Dunlap; +Cc: Xen-devel

thanks,
I have solved the timer.c problem right now. I am able to start dom0.

Michele

On 3/2/10, George Dunlap <george.dunlap@eu.citrix.com> wrote:
> michele.paolino wrote:
>> 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
>

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2010-03-03  7:52 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-11 20:31 generate random numbers michele.paolino
2010-02-12  1:51 ` James Harper
2010-02-12  8:32   ` michele.paolino
2010-02-12 12:15     ` George Dunlap
2010-02-12 22:42       ` michele.paolino
2010-02-12 23:12         ` Daniel Stodden
2010-02-25 18:31           ` michele.paolino
2010-02-25 21:25             ` George Dunlap
2010-02-26 17:43               ` michele.paolino
2010-02-26 17:44                 ` George Dunlap
2010-02-26 18:54                   ` michele.paolino
2010-03-01 11:41                     ` George Dunlap
2010-03-01 16:56                       ` michele.paolino
2010-03-02 12:58                         ` George Dunlap
2010-03-03  7:52                           ` michele.paolino

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.