Planned SMP Improvements
Sebastian Huber
sebastian.huber at embedded-brains.de
Tue Feb 2 09:53:19 UTC 2016
On 01/02/16 14:39, Darshit Shah wrote:
>> >Maybe we can implement
>> >
>> >Improve the SMP scheduler with arbitrary processor affinity support
>> >https://devel.rtems.org/ticket/2510
>> >
>> >as part of this years GSoC.
>> >
> I've already mentioned that I'd be interested in picking this up as a
> potential project. However, the entire implementation may not be
> possible in a single summer. It is rather complex, and while a naive
> implementation may be possible to write, we would want something more
> efficient. I'm hoping for some pointers on where I should start
> looking for a better understanding of the codebase.
In order to get familiar with the scheduler, do the following.
0. Use a Linux system for development (use a Linux VM on Windows)
1. Install the RTEMS 4.12 ARM tool chain via the RSB
2. Build the realview_pbx_a9_qemu_smp BSP with
configure --target=arm-rtems4.12 --prefix=/opt/rtems-4.12
--enable-rtemsbsp=realview_pbx_a9_qemu_smp --enable-maintainer-mode
--enable-tests --enable-smp
3. Install a recent Qemu
4. Open two shell windows and go the the following subdirectory in the
build tree
arm-rtems4.12/c/realview_pbx_a9_qemu_smp/testsuites/smptests/smp01
5. In one start Qemu via
qemu-system-arm -net none -nographic -M realview-pbx-a9 -m 256M -smp 2
-s -S -kernel *.exe
6. In the other start GDB via
arm-rtems4.12-gdb *.exe
7. Example GDB session, interesting functions are _Thread_Set_state()
and _Thread_Clear_state(). Just follow them in the debugger to figure
out how the scheduler works.
GNU gdb (GDB) 7.9
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=x86_64-linux-gnu --target=arm-rtems4.12".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from smpload01.exe...done.
(gdb) tar remote :1234
Remote debugging using :1234
bsp_start_vector_table_end () at
rtems-4.12/c/src/lib/libbsp/arm/realview-pbx-a9/../shared/start/start.S:142
142 mrc p15, 0, r0, c0, c0, 5
(gdb) monitor system_reset
(gdb) load
Loading section .start, size 0x800 lma 0x100000
Loading section .text, size 0x278e4 lma 0x100800
Loading section .init, size 0xc lma 0x1280e4
Loading section .fini, size 0xc lma 0x1280f0
Loading section .rodata, size 0x1121 lma 0x1280fc
Loading section .ARM.exidx, size 0x8 lma 0x129220
Loading section .eh_frame, size 0x4 lma 0x129228
Loading section .init_array, size 0x4 lma 0x12922c
Loading section .fini_array, size 0x4 lma 0x129230
Loading section .jcr, size 0x4 lma 0x129234
Loading section .rtemsroset, size 0x20 lma 0x129238
Loading section .data, size 0x97c lma 0x20a000
Start address 0x100040, load size 170961
Transfer rate: 18550 KB/sec, 1799 bytes/write.
(gdb) b _Thread_Set_state
Breakpoint 1 at 0x11bba6: file
rtems-4.12/c/src/../../cpukit/score/src/threadsetstate.c, line 39.
(gdb) b _Thread_Clear_state
Breakpoint 2 at 0x118092: file
rtems-4.12/c/src/../../cpukit/score/src/threadclearstate.c, line 35.
(gdb) c
Continuing.
Breakpoint 2, _Thread_Clear_state (the_thread=0x21a3e0,
state=4294967295) at
rtems-4.12/c/src/../../cpukit/score/src/threadclearstate.c:35
35 _Scheduler_Acquire( the_thread, &lock_context );
(gdb) bt
#0 _Thread_Clear_state (the_thread=0x21a3e0, state=4294967295) at
rtems-4.12/c/src/../../cpukit/score/src/threadclearstate.c:35
#1 0x0011bde0 in _Thread_Ready (the_thread=0x21a3e0) at
../../cpukit/../../../realview_pbx_a9_qemu_smp/lib/include/rtems/score/threadimpl.h:277
#2 0x0011be38 in _Thread_Start (the_thread=0x21a3e0, entry=0x200f64) at
rtems-4.12/c/src/../../cpukit/score/src/threadstart.c:34
#3 0x0010f9d6 in rtems_task_start (id=167837697, entry_point=0x10f63f
<_RTEMS_Global_construction>, argument=2150284) at
rtems-4.12/c/src/../../cpukit/rtems/src/taskstart.c:67
#4 0x0010f782 in _RTEMS_tasks_Initialize_user_tasks_body () at
rtems-4.12/c/src/../../cpukit/rtems/src/taskinitusers.c:110
#5 0x00120252 in _RTEMS_tasks_Initialize_user_tasks () at
rtems-4.12/c/src/../../cpukit/rtems/src/tasks.c:229
#6 0x00110728 in _API_extensions_Run_postdriver () at
rtems-4.12/c/src/../../cpukit/score/src/apiext.c:47
#7 0x001104ee in rtems_initialize_device_drivers () at
rtems-4.12/c/src/../../cpukit/sapi/src/exinit.c:246
#8 0x00110514 in rtems_initialize_executive () at
rtems-4.12/c/src/../../cpukit/sapi/src/exinit.c:276
#9 0x00101cfa in boot_card (cmdline=0x0) at
rtems-4.12/c/src/lib/libbsp/arm/realview-pbx-a9/../../shared/bootcard.c:90
#10 0x00100112 in bsp_vector_table_copy_done () at
rtems-4.12/c/src/lib/libbsp/arm/realview-pbx-a9/../shared/start/start.S:279
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
(gdb) del 2
(gdb) c
Continuing.
[Switching to Thread 2]
Breakpoint 1, _Thread_Set_state (the_thread=0x21a3e0, state=262144) at
rtems-4.12/c/src/../../cpukit/score/src/threadsetstate.c:39
39 _Scheduler_Acquire( the_thread, &lock_context );
(gdb) bt
#0 _Thread_Set_state (the_thread=0x21a3e0, state=262144) at
rtems-4.12/c/src/../../cpukit/score/src/threadsetstate.c:39
#1 0x0010c43e in _Event_Seize (event_in=2147483648, option_set=0,
ticks=0, event_out=0x24f96c, executing=0x21a3e0, event=0x21a5f8,
wait_class=512, block_state=262144, lock_context=0x24f944)
at rtems-4.12/c/src/../../cpukit/rtems/src/eventseize.c:101
#2 0x0010f080 in rtems_event_system_receive (event_in=2147483648,
option_set=0, ticks=0, event_out=0x24f96c) at
rtems-4.12/c/src/../../cpukit/rtems/src/systemeventreceive.c:52
#3 0x00100b58 in rtems_event_transient_receive (option_set=0, ticks=0)
at
../../../../../realview_pbx_a9_qemu_smp/lib/include/rtems/rtems/event.h:484
#4 0x00101568 in test () at
rtems-4.12/c/src/../../testsuites/smptests/smpload01/init.c:333
#5 0x0010177a in Init (arg=2150284) at
rtems-4.12/c/src/../../testsuites/smptests/smpload01/init.c:384
#6 0x00118efa in _Thread_Entry_adaptor_numeric (executing=0x21a3e0) at
rtems-4.12/c/src/../../cpukit/score/src/threadentryadaptornumeric.c:25
#7 0x00121524 in _Thread_Handler () at
rtems-4.12/c/src/../../cpukit/score/src/threadhandler.c:93
#8 0x001214ce in _User_extensions_Thread_exitted (executing=0x1214cf
<_Thread_Handler>) at
../../cpukit/../../../realview_pbx_a9_qemu_smp/lib/include/rtems/score/userextimpl.h:244
#9 0x00001008 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
(gdb)
If you are not familiar with the command line GDB, then I recommend to
do a GDB tutorial first.
--
Sebastian Huber, embedded brains GmbH
Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone : +49 89 189 47 41-16
Fax : +49 89 189 47 41-09
E-Mail : sebastian.huber at embedded-brains.de
PGP : Public key available on request.
Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
More information about the devel
mailing list