Setting physical CPU for a task

Lluís Vilanova vilanova at ac.upc.edu
Tue Aug 6 13:55:33 CEST 2013


Adam Lackorzynski writes:

> On Mon Aug 05, 2013 at 21:50:55 +0300, Lluís Vilanova wrote:
>> I've been unable to see if moe's config files allow to start tasks pinned to a
>> specific CPU, and after running the "thread_migrate" example, looks like only
>> one CPU (CPU00) is always used:
>> 
>> $ make -C obj/l4/amd64/ qemu E=thread_migrate QEMU_OPTIONS="-serial stdio -vnc ::59000 -smp 2"
>> [...]
>> Not using serial hack in slow timer handler.
>> CPU[0]: AuthenticAMD (6:2:3:0)[00000623] Model: QEMU Virtual CPU version 1.5.1 at 3092MHz
>> 
>> 255/512 Entry I TLB (4K pages)    255 Entry I TLB (4M pages)
>> 255/512 Entry D TLB (4K pages)    255 Entry D TLB (4M pages)
>> 64 KB L1 I Cache (2-way associative, 64 bytes per line)
>> 64 KB L1 D Cache (2-way associative, 64 bytes per line)
>> 512 KB L2 U Cache (8-way associative, 64 bytes per line)
>> 
>> Freeing init code/data: 20480 bytes (5 pages)
>> [...]
>> Ned says: Hi World!
>> Ned: loading file: 'rom/thread_migrate.cfg'
>> migrate | Found 4 CPUs.
>> migrate | Created 12 threads.
>> migrate | Migrated Thread00 -> CPU00
>> migrate | Migrated Thread01 -> CPU00
>> 
>> I've modified "src/l4/conf/modules.list" to add the "thread_migrate" test, and
>> I'm using l4re-snapshot-2013060718, with multiprocessing (with a maximum of 4)
>> enabled on fiasco.
>> 
>> Looks like the benchmark always detects (L4::Scheduler::info) the number of
>> maximum CPUs configured in fiasco, but not the number of CPUs provided by QEMU
>> (only CPU 0 is online).

> That it finds 4 is on purpose because more CPUs could come up.
> Does it work giving Qemu '-cpu core2duo'?

Yes, looks like making QEMU look like a somewhat more realistic CPU does no
choke Fiasco's ability to detect the number of CPUs.

Still, L4::Scheduler::info says there's as many CPUs as the maximum number
configured into Fiasco (not the number offered by QEMU). I'm just not sure if
this should be considered a bug or a feature.


>> Am I missing some step to set all CPUs online? Is it possible to have MOE start
>> tasks pinned to a specific CPU?

> See the (commented out) "scheduler = ... " settings in, e.g., x86-fb.cfg
> and give a fourth parameter, which is a CPU mask. You can check in the
> kernel debugger on which CPU a thread is (via lp command).

Works like a charm, thanks.


Lluis

-- 
 "And it's much the same thing with knowledge, for whenever you learn
 something new, the whole world becomes that much richer."
 -- The Princess of Pure Reason, as told by Norton Juster in The Phantom
 Tollbooth




More information about the l4-hackers mailing list