From mboxrd@z Thu Jan 1 00:00:00 1970 From: Juergen Gross Subject: Re: Cpupools and pdata_alloc Date: Wed, 12 May 2010 06:52:49 +0200 Message-ID: <4BEA3421.6040300@ts.fujitsu.com> References: <4BE8E1B1.2030305@ts.fujitsu.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: George Dunlap Cc: xen-devel@lists.xensource.com, Keir Fraser List-Id: xen-devel@lists.xenproject.org On 05/11/2010 07:25 PM, George Dunlap wrote: > On Mon, May 10, 2010 at 11:48 PM, Juergen Gross > wrote: >> No. It happens when idle vcpus are allocated. At this time there is no >> cpupool >> existing, all physical cpus are marked as "free", e.g. they are in no pool >> at >> all. >> Dom0 vcpus are allocated in Pool-0. This pool is created after allocation of >> the idle vcpus. > > Yeah, I spent some time tracing through the init code yesterday and > figured that out. So it appears that at init time, regarding cpupools > and schedulers: > * init_idle_domain() calls schedule_init(), which calls ops->init() > with a sort of "default" ops pointer. It also calls sched_init_vcpu() > for idle domain's vcpu 0, which will call ops->alloc_pdata for cpu 0. > * smp_prepare_cpus will eventually call do_boot_cpu for each online > cpu. do_boot_cpu will initialize the idle_domain vcpu for that cpu, > which will call ops->alloc_pdata for that cpu (again, with cpu 0 > - At this point, all online cpus have had alloc_pdata called, albeit > for the "default" ops structure in the scheduler > * cpupool_create will create cpupool 0, calling sched_init(), which > calls ops->init with the cpupool0 ops structure. > * cpupool0_cpu_assign will then un-assign all online cpus from the > "default" ops structure and re-assign them into cpupool 0. > Re-assigning looks like this: > - First call alloc_pdata and then alloc_vdata for the new cpupool ops > structure, for the physical cpu and idle vcpu respectively. > - Ticks will be disabled on the old ops structure, then resumed on > the new ops structure > - The idle vcpu is added to the new pool > - Calls free_vdata and free_pdata on the old cpupool ops structure > for the idle vcpu and physical cpu, respectively. > > Now all online cpus have idle vcpus and pdatas initialized, and set up > for cpupool 0. > > Is that a pretty accurate picture? Yes, this sounds correct. Juergen -- Juergen Gross Principal Developer Operating Systems TSP ES&S SWE OS6 Telephone: +49 (0) 89 3222 2967 Fujitsu Technology Solutions e-mail: juergen.gross@ts.fujitsu.com Domagkstr. 28 Internet: ts.fujitsu.com D-80807 Muenchen Company details: ts.fujitsu.com/imprint.html