Neale,
I may be wrong, but it looks like you may have gotten confused by
parallel code-paths. cpu_disqalloc() is called by disp_setup().
disp_setup() is only called by dispinit(), at platform initialization
time, and by disp_add(), when you add a new scheduler class.
The code that allocates a dispq for a mp CPU (not cpu0) is called from
disp_cpu_init(). This function allocates a disp_t and assigns it to
cpu_disp. This is called from mp_startup_init() on x86 and
setup_cpu_common() on SPARC. mp_startup_init() is called from
start_cpu() which is called by start_other_cpus(). (start_other_cpus is
called from main()).
-j
On Tue, Jun 19, 2007 at 07:52:01AM -0700, Neale Ferguson wrote:
> As part of the startup of CPUs in mp_startup, struct cpu entries are
> created for CPUs (other than the boot cpu0). Each cpu area is zeroed
> and a call to disp_cpu_init() is made. It in turn calls
> cpu_dispqalloc() which has the following loop:
>
> cpup = cpu_list;
> do {
> disp_dq_alloc(&disp_mem[i], numpris, cpup->cpu_disp);
> i++;
> cpup = cpup->cpu_next;
> } while (cpup != cpu_list);
> num = i;
>
> Because the cpu structure has been zeroed the cpup->cpu_disp variable
> will be 0 (except for cpu0 which had been setup earlier to contain
> cpu0_dispq). In disp_dq_alloc() the pointer is used to set dptr->dp.
> Subsequently, a call to disp_dq_assign is made and the following code
> executed:
>
> dp = dptr->dp;
> dptr->olddispq = dp->disp_q;
> dptr->olddqactmap = dp->disp_qactmap;
> dptr->oldnglobpris = dp->disp_npri;
>
> ASSERT(dptr->oldnglobpris < numpris);
>
> if (dptr->olddispq != NULL) {
> /*
> * Use kcopy because bcopy is platform-specific
> * and could block while we might have paused the cpus.
> */
> (void) kcopy(dptr->olddispq, dptr->newdispq,
> dptr->oldnglobpris * sizeof (dispq_t));
>
> Because dptr->dp is 0 the value being loaded into dptr->olddispq is
> from location based off a zero pointer.
>
> Now considering this code is working for both x86 and sparc there must
> be something being setup that I haven't done for s390x. Can anyone
> give me a hint? I can't find anywhere where cpu_disp is being assigned
> except for cpu0.
>
> Neale
>
>
> This message posted from opensolaris.org
> _______________________________________________
> opensolaris-code mailing list
> [email protected]
> http://mail.opensolaris.org/mailman/listinfo/opensolaris-code
_______________________________________________
opensolaris-code mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code