You don't have to change the source code for that.
You can just offline all processors other than CPU0
with "psradm -f <cpuid>".

Hope this helps,
-Andrei

On 9/27/07, Abu Saad <abu_saad_papa at yahoo.co.in> wrote:
> Hi,
>  I am doing academic research on Process Variations in
> Multi-Core systems. As part of my  project I want to
> schedule all my threads to a single core to get a feel
> of developing opensolaris. I am using a Dual Core
> Sytem and have installed opensolaris on a Virtual
> Machine. I tried dispatching all threads to a single
> core but am not getting the desired results.
>  The changes I have made to the source code is as
> follows:
>
> 1)In the usr/src/uts/common/disp/disp.c , I have
> replaced the function disp_lowpri_cpu with my own
> function shown below
>
> /*
>  * disp_lowpower_cpu - schedule all threads to CPU0
>  */
> cpu_t *disp_lowpower_cpu(cpu_t *hint)
> {
>         cpu_t   *bestcpu;
>         cpu_t   *cp;
>
>
>         ASSERT(hint != NULL);
>
>         /*
>          * Select CPU0
>          */
>         bestcpu = hint;
>
>         cp = hint;
>         do {
>           if (cp->cpu_seqid == 0){
>            ASSERT((cp->cpu_flags & CPU_QUIESCED) == 0);
>                         return(cp);
>                 }
>                 cp = cp->cpu_next;
>         } while (cp != hint);
>
>
>         /*
>          * Return the best CPU .
>          */
>         ASSERT((bestcpu->cpu_flags & CPU_QUIESCED) == 0);
>         return (bestcpu);
> }
>
> 2) In lines 1307, 1460, 1613 and in the function
> cpu_choose (of disp.c) I have replaced the call from
> disp_lowpri_cpu to my function namely
> disp_lowpower_cpu.
>
> 3) In the file usr/src/uts/common/sys/disp.h I have
> added my function as
> extern struct cpu *disp_lowpower_cpu(struct cpu *);
>
>   Now after these changes I ran the command
>   nightly -i ./opensolaris.sh
> and finally did a BFU.
>
>  I am expecting to see all the threads dispatched to
> cpu0 but i can see a few of them are still running in
> cpu1. I think I have missed out something very simple
> but am not able to figure it out. Can anyone help me
> in disptaching all the threads to a single core so
> that I get some confidence in building my own
> opensolaris.
>
> Thank You,
>  Abu Saad Papa
>
>
>       Forgot the famous last words? Access your message archive online at 
> http://in.messenger.yahoo.com/webmessengerpromo.php
> _______________________________________________
> tesla-dev mailing list
> tesla-dev at opensolaris.org
> http://mail.opensolaris.org/mailman/listinfo/tesla-dev
>

Reply via email to