From mboxrd@z Thu Jan 1 00:00:00 1970 From: George Dunlap Subject: Re: generate random numbers Date: Thu, 25 Feb 2010 21:25:48 +0000 Message-ID: <4B86EADC.70301@eu.citrix.com> References: <14f366f91002111231reae2e41vc8f823b38e16a76b@mail.gmail.com> <14f366f91002120032uc08b7d6sb2283e10c9444bbf@mail.gmail.com> <14f366f91002121442h536a2d03if7d9bdee416a4a23@mail.gmail.com> <1266016370.15135.2942.camel@agari.van.xensource.com> <14f366f91002251031g538dcffan9fe5208b5d981444@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <14f366f91002251031g538dcffan9fe5208b5d981444@mail.gmail.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: "michele.paolino" Cc: "Xen-devel@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org 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