Commit graph

37 commits

Author SHA1 Message Date
Adrian Danis
d43b717ef1 Move PAD_TO_NEXT_CACHE_LN to util.h
This utility macro is useful beyond just SMP code
2018-01-09 10:10:16 +11:00
Adrian Danis
570c1a65b0 Compile time abstraction for calling getCurrentCPUIndex
This defines a CURRENT_CPU_INDEX() macro that resolves to a constant 0 in the absence of
SMP, or a call to getCurrentCPUIndex in the presence of SMP. This provides a way to use
per-core data structures, without additional guards, in a way that is nearly invisible
to verification
2018-01-08 10:30:06 +11:00
Anna Lyons
8576758abf Define SchedulerAction_ChooseNewThread as 1
1 is never a valid tcb, and ~0 on x64 results in 0x00000000FFFFFFFF,
which could be a valid tcb.
2017-12-13 11:47:56 +11:00
Adrian Danis
c6e4cc3ea1 Correct L2 bitmap size calculation and put it in one place
This corrects the calculation of the L2 bitmap size to correctly handle cases where the
requested num priorities is not a clean multiple of the wordBits
2017-11-28 10:18:35 +11:00
Anna Lyons
5627c275ce SMP: add top level migrateTCB
On the MCS kernel, Arch_migrateTCB is called in multiple places.
This commit moves the common code that is required when migrating a TCB
to a top level function to reduce boiler plate.
2017-08-23 11:19:27 +10:00
Hesham Almatary
ee28936d48 SMP: Introduce ENABLE_SMP_SUPPORT
- Make it more readable and less confusing compared to the 'CONFIG_MAX_NUM_NODES > 1' check
2017-06-29 16:23:39 +10:00
Anna Lyons
40c61e5c18 Fix licenses (the rest) 2017-06-22 15:29:12 +10:00
Anna Lyons
bb5ecb1b3e SELFOUR-880: add seL4_DebugDumpScheduler
- when CONFIG_DEBUG is enabled, track all threads
- when CONFIG_PRINTING is enabled, provide seL4_DebugDumpScheduler which
allows the user to dump the state of the kernel scheduler.
2017-05-30 15:22:23 +10:00
amrzar
0707ae874b Move arch independent functions to generic files and HAVE_FPU config 2017-02-27 12:52:18 +11:00
amrzar
ae8f2c99d7 x86: move current active FPU owner to node state 2017-02-27 12:52:18 +11:00
amrzar
323e60a749 x86: define number of restore since switch as node state 2017-02-27 12:52:18 +11:00
Adrian Danis
eccaae51dc s/D61/DATA61/ in license headers for consistency 2017-02-21 16:38:51 +11:00
Hesham Almatary
0ef7c693ce x86: define L1_CACHE_LINE_SIZE_BITS as with ARM 2017-02-16 15:28:05 +11:00
Hesham Almatary
48d17e1f58 ARM/SMP: Prepare for ARM SMP adding stubs
Currently building ARM/SMP is broken. This commit:
1- Makes it possible to build ARM/SMP with stubs. Run-time SMP for ARM
DOES NOT WORK.
2- Can be a reference for future SMP targets to follow in order to
layout/add the minimal required files and functions needed to support SMP.
3- Builds for Sabre only. In order to support other platforms, ipi
interrupt ID should be defined in machine.h
2017-02-16 15:28:00 +11:00
Hesham Almatary
53c6b52438 SMP: Abstract architecture/platform independent parts of smp.h and ipi.h
This commit is a re-arrangement of SMP directory structure to make it
easier for other architectures/platforms (in general) and ARM (in
particular) to add SMP support.

* new include/smp directory to act as a centralised container of
"shared" architecture-independent SMP headers.
This makes it clearer what's needed for other architecture/platform to
support SMP.
* Each platform can define its own unique ipi.[h|c] that make sense,
since ipi implementation is SoC/platform dependent.
2017-01-13 15:35:41 +11:00
Adrian Danis
cc6853017d Remove unneeded usages of VISIBLE
Using `VISIBLE` where it is not needed limits the ability for the
compiler to optimize, especially when using whole program optimizations
2016-11-24 14:46:01 +11:00
Adrian Danis
7f76749448 Revert SELFOUR-242
This reverts commits
3aee0ab7b3
6b6b965528
a1421832ac
2016-11-16 14:02:11 +11:00
Anna Lyons
a1421832ac SELFOUR-242: invert bitfield scheduler & optimise
This commit does the following:

* invert the bit field scheduler for better cache performance for high priority threads
* peeks into the bitfield scheduler to allow fastpath to be leveraged when IPC occurs from lo --> hi priority threads if correct
2016-11-15 09:45:48 +11:00
amrzar
25bb94372f SELFOUR-635: support for TCB operations
This will update TCB invocations to consider multicore environment, this may include:
- adds the affinity invocation to transfer TCB between different cores and update TCB structure for core ID
- checking the thread/core state before performing TCB operation, e.g. deleting the runnable TCB, etc
2016-10-30 08:59:32 +11:00
Adrian Danis
63649f2636 Remove arch/machine.h include from statedata.h
statedata.h gets included from arch/machine.h, and statedata
does not require any of the machine.h definitions.

As a result of removing this various other, previously missing,
includes need to be added
2016-10-21 12:05:02 +11:00
Adrian Danis
b90238d089 Replace #pragma once with include guards 2016-10-21 12:05:02 +11:00
Bamboo
e1d4ffd13e [STYLE_FIX] 2016-10-12 00:17:10 +00:00
amrzar
f80be7055b Add VISIBLE attrubute to UP states 2016-10-12 10:11:51 +11:00
amrzar
3f9eb7c873 SELFOUR-632: implement cores non-architecture dependent structres 2016-10-10 16:33:48 +11:00
amrzar
2cbc7123b6 SELFOUR-630:preliminary booting application processors
- update core detection code and Kconfig file
    - update kernel stack managment so that BSP does not use boot stack before IPI APs
    - move arch dependant data to a single structure
    - add cache line size to Kconfig
    - add cpu indexing and apic id mapping
    - boot APs to halting state
    - add guard for kernel stack if there is only one core
2016-09-28 16:10:25 +10:00
Adrian Danis
4044e20412 Revert "Merge pull request #358 in SEL4/sel4 from ~AZARRABI/sel4:multicore to master"
This reverts commit ce2f666bb8, reversing
changes made to dc183f96b8.
2016-09-22 14:22:18 +10:00
Adrian Danis
8ffc353172 Revert "[STYLE_FIX]"
This reverts commit d29f743bbc.
2016-09-22 14:22:08 +10:00
Bamboo
d29f743bbc [STYLE_FIX] 2016-09-22 04:01:23 +00:00
amrzar
fbc071b4f1 SELFOUR-630:preliminary booting application processors
- update core detection code and Kconfig file
- update kernel stack managment so that BSP does not use boot stack before IPI APs
- move arch dependant data to a single structure
- add cache line size to Kconfig
- add cpu indexing and apic id mapping
- boot APs to halting state
- add guard for kernel stack if there is only one core
2016-09-21 12:14:10 +10:00
Hesham Almatary
16c3481109 SELFOUR-518: User-level log buffer
Remove global ksLog and use KS_LOG_PPTR instead

Benchmark - Log buffer: use global page table
2016-08-15 15:06:38 +10:00
Anna Lyons
c5b6a6a58a Refactor duplicated code in hardware.h
One copy to rule them all.
2016-06-07 12:01:14 +10:00
Adrian Danis
bbdf7a89a7 Mark tlbLockCount as visible so it is not discarded
This variable is referenced in assembler and needs to not get discarded
by the optimizer prior to linking.
2016-05-24 08:46:54 +10:00
Felix Kam
b9a7f3c9a1 Make lockTLBEntry comply with the decompiler
lockTLBEntry, an assembly function, had tlb_lock_count as a symbol that
needed to be placed sufficiently close to be loaded and stored with
offset-from-pc addressing. When assembled, the symbol would turn up
between functions, as opposed to within a literal pool (it's a variable,
not a constant) or the .bss / data sections. The decompiler doesn't
handle that use case, and likely won't.  This change turns
tlb_lock_count into a C global variable (so that it will be placed in
the .bss / data sections), and splits lockTLBEntry into two parts so the
critical section will still fit in a 64-byte aligned region, and
therefore be guaranteed to live within a single page.
2016-05-18 16:53:13 +10:00
Adrian Danis
0ecff9f393 unsigned int -> word_t 2015-12-10 10:45:21 +11:00
Adrian Danis
2d61910e0f Rename uint32_t -> word_t in any relevant places 2015-12-10 10:45:20 +11:00
Stephen Sherratt
62727e30a2 Using bitfields to track for which priorities there exist non-empty ready queues.
Background
seL4 organizes threads into ready queues, of which there is one for each
domain, for each priority level. The ready queue for a given
domain/priority combination can be found by indexing the array
`ksReadyQueues` with "domain*num_priorities + priority".

Current scheduler implementation
To find the non-empty ready queue with the maximum priority for the current domain,
seL4 iterates through `ksReadyQueues`, starting with the element
corresponding to the current domain and maximum possible priority, and
decrementing the priority until a non-empty queue is found. This is
problematic in cases where the only ready threads have low priorities,
as iterating through many elements of an array effectively flushes the
cache.

Changes in this patch
This patch replaces the iteration with a lookup into a table of
bitfields per domain. Using bitfields allows the kernel to determine the
highest priority level with a non-empty ready queue for the current
domain by counting the leading zeroes in bitfields. This removes the
negative cache effects of iterating through an array.

Implementation details
For each domain, a multilevel table of bitfields is maintained which
stores the priority levels within that domain for which there exist
ready threads. On a 32-bit architecture, the top level of the table is a 32-bit bitfield where if
the ith bit is set, there is at least 1 priority level in
[i*32..i*32+31] with a non-empty ready queue. The positions of bits in
this bitfield are used as indices into the second level table, which is
an array of 32-bit bitfields. The ith bit of the jth bitfield in this
array set to 1, indicates that priority level j*32+i has a non-empty
ready queue.
2015-10-21 18:52:44 +11:00
TrusthworthySystems
91b7da8625 Release snapshot 2014-07-18 05:03:59 +10:00