Commit Graph

123 Commits

Author SHA1 Message Date
Travis Geiselbrecht
ec69e5f881 [kernel] properly set the target debug led when inside non-idle thread context 2015-12-14 15:20:25 -08:00
Travis Geiselbrecht
4ab14424bd [cppcheck] clean up a few suggestions from cppcheck 2015-11-24 15:08:38 -08:00
Carlos Pizano
6cdc5cd1da [kernel][port] Fix memory leak on port_open() 2015-11-23 12:38:40 -08:00
Carlos Pizano
614eaf166a [kernel][ports] Add basic ports functionality
Missing mostly more tests, specifically group tests.

BUG=none
R=travisg@google.com

Review URL: https://codereview.chromium.org/1437453002 .
2015-11-20 14:43:27 -08:00
Travis Geiselbrecht
7c1b8a0b66 [kernel] add a #define to set to enable tracing 2015-11-06 15:51:29 -08:00
Travis Geiselbrecht
814ca4e8a5 [kernel] add code to check some overrun padding placed on the bottom of each threads' stack
-Should impact context switch performance a bit
-Only enabled at LK_DEBUGLEVEL > 1
2015-11-04 18:35:20 -08:00
Travis Geiselbrecht
2d1e01cdd4 [kernel] remove THREAD_CHECKS which was always just the equivalent of DEBUG_ASSERT 2015-11-04 18:35:20 -08:00
Travis Geiselbrecht
c8c923ecbf [kernel][novm] change the novm alloc routine to take a bitmap instead of arena index 2015-10-23 09:48:28 -07:00
Travis Geiselbrecht
35ebee0e40 [merge] branch 'heapswitch'
This picks up the major work of allowing multiple heap implementations
and enable dlmalloc as an alternate heap to the simple existing one
(now called 'miniheap').

Also added a novm page allocator for memory management on systems too small
or missing an mmu to have a vm. Not much more than a simple bitmap allocator
that the heap pulls from. Allows for other heaps and/or users of physical
memory to coexist and span multiple banks of memory.
2015-10-20 16:53:00 -07:00
Travis Geiselbrecht
8d49a21989 [kernel][novm] refactor the novm code to handle multiple installable arenas
Only initialize the first arena, and allow installing more from platform code
as more memory banks are brought up.
Move novm into a separate module.
2015-10-20 16:18:57 -07:00
Travis Geiselbrecht
35b2f85f6a [kernel][novm] fix bug in big block allocs, add some prettier debug
Patch courtesy Erik Corry
2015-10-19 12:49:35 -07:00
Travis Geiselbrecht
16b1b594f4 [kernel][vm] fix error handling in vmm_alloc in case it can't allocate enough physical memory 2015-10-16 16:09:08 -07:00
Travis Geiselbrecht
fab92f3179 [lib][heap] have novm initialize itself, rename novm 'heap' to 'arena' to be less confusing 2015-10-15 18:15:45 -07:00
Travis Geiselbrecht
e9a6bd0ea1 WIP get the heap code pointing at the new page allocator 2015-10-15 16:52:02 -07:00
Travis Geiselbrecht
80bf0a48b4 [lib][heap] fix some formatting and a bug or two in the novm and page alloc stuff 2015-10-15 15:46:35 -07:00
Travis Geiselbrecht
3bbc7ac101 WIP patch from erik 2015-10-15 15:30:49 -07:00
Travis Geiselbrecht
1193213dfd WIP get dlmalloc working with a mmap() style allocator out of the heap wrapper 2015-10-14 19:56:24 -07:00
Travis Geiselbrecht
742876db0c [kernel][debug] add the threads and evlog commands to crash time shell 2015-10-14 14:13:26 -07:00
Gurjant Kalsi
dc079d7327 [console][uart][shell] Created a crash-time shell and a polling based UART driver to use on panic. 2015-10-12 16:38:51 -07:00
Travis Geiselbrecht
6df1116275 [kernel][vmm] fix logic bug in vmm_free_aspace() 2015-09-23 18:03:29 -07:00
Travis Geiselbrecht
294ded0d57 [kernel][vmm] add support for user address spaces
Still doesn't switch between them, but allows for a separate container
of regions to be created and destroyed.
2015-09-23 17:43:37 -07:00
Travis Geiselbrecht
1baadec12a [kernel] thread_create_etc() needs to actually save the custom stack 2015-09-21 14:19:42 -07:00
Travis Geiselbrecht
25cf30637f [vm] have the pmm routines return a size_t instead of uint for 64bit compatibility 2015-09-20 12:13:07 -07:00
Michael Ryleev
18192509eb [kernel][vm] Fix a bug in vm address allocator
Pass arch_mmu_flags (instead of flags) to arch_mmu_pick_spot routine.
This bug would mostly affect ARMv7 platforms with enabled support
for non-secure memory.

Change-Id: Ic97ee6d3f05528170d66ab5033b24adf1d0c514e
2015-08-24 15:47:29 -07:00
Brian Swetland
e21e81f24d [arch][arm-m] debugger info
Use the reserved cortex-m vectors 8 and 9 for a magic cookie and
pointer to a debugger info structure.  This structure contains
pointers to the threadlist, the current thread pointer, and
offsets to important members of the thread structure.  With
this information, an attached debugger can walk the threadlist
and obtain state, name, registers, etc for each thread.

Use global define WITH_DEBUGGER_INFO to enable this.
2015-07-09 17:39:25 -07:00
Brian Swetland
56d269dc68 [kernel] don't print tls entries on platforms with no tls slots
Avoids wasting a line on this in the thread list.
2015-06-28 13:56:24 -07:00
Travis Geiselbrecht
842cb7a7ae [warnings] fix warnings post-smp
Most of the warnings are printf related due to lk_time_t now being defined as an
unsigned int instead of unsigned long.
2015-06-02 21:03:05 -07:00
Arve Hjønnevåg
2c9c5959e7 Merge branch 'master' of https://github.com/travisg/lk into smp
Change-Id: Iecb11d57b6f089234c0826932bdb229588939750
2015-05-18 16:49:37 -07:00
Arve Hjønnevåg
e07de0831a [kernel][thread] Fixup conflict resolution of "Allow pinning threads to a specific cpu"
Change-Id: I8b2cab8b60e5a25ab5270db55bbe6b59eecf88c6
2015-05-13 20:21:07 -07:00
Arve Hjønnevåg
be2ba93d69 [kernel][thread] Fix startup problem
Change-Id: I4b0f70a5951d641a6dbb477c6f48600aaef8e219
2015-05-13 20:20:39 -07:00
Arve Hjønnevåg
071878c104 [kernel][thread] Hack thread_is_realtime to ignore thread that don't have a high priority
Allow setting the realtime flag on low priority threads to disable the
tick without also loosing ipi interrupts.

Change-Id: Ia30e4d20105a65945918fc996c3114c3852963a9
2015-05-13 20:20:39 -07:00
Travis Geiselbrecht
53299217d5 [kernel][evlog] dump unknown evlog entries 2015-05-06 14:47:19 -07:00
Travis Geiselbrecht
f536b1fc15 [kernel][sem] have sem_post return the number of threads woken up
Change-Id: I69dca1de1bcf211eb2a5a5a861d47ff84e731d78
2015-04-29 15:48:21 -07:00
Travis Geiselbrecht
80fbfef0e1 [merge] merge branch 'master' into smp
Conflicts:
	kernel/vm/pmm.c
	platform/zynq/debug.c
	platform/zynq/platform.c
2015-03-31 15:35:13 -07:00
Michael Ryleev
210fbbde75 [kernel][vm] Add support for arch_mmu_pick_spot routine
Some architectures might have resrictions on selecting
virtual address depending on properties of particular
VM allocation. This CL allows arch to provide a hook into
virtual address allocator to handle such restictions.

Change-Id: I28e912dcf2cf260b7e6666b6a9384178e41bfa73
2015-03-19 18:01:13 -07:00
Michael Ryleev
f2eb7c75b0 [kernel][vm] Add alignment parameter to vmm_alloc_physical
Change-Id: I516402908e05b5f4b455f79c18fafd795f1f8455
2015-03-19 18:01:13 -07:00
Michael Ryleev
0071fc66eb [kernel][vm] Fixup few end of address space conditions
Change-Id: Ie105016f44d0d8579282713ce901f9c5e75ad408
Signed-off-by: Michael Ryleev <gmar@google.com>
2015-03-19 18:01:13 -07:00
Michael Ryleev
0eb6b97baf [kernel][vm] Add lock around public VMM operations
Change-Id: I873f1dc0ecf49afc790c5012b53a3679048c2a80
2015-03-19 18:01:13 -07:00
Michael Ryleev
acc1a59a07 [kernel][pmm] Add proper end of arena segment check
Change-Id: I25ac3b9bd099b51c95e138a204dc625964d97913
2015-03-19 18:01:12 -07:00
Arve Hjønnevåg
c593fc51a1 [kernel][vm] panic if mark_pages_in_use fails to find the paddr
If mark_pages_in_use fails to mark the kernel code (or data) as used,
it will get corrupted as the heap starts reusing using it.

Change-Id: I48f62bb68dcbad3268304aa2a1e63e9956128064
2015-03-19 18:01:11 -07:00
Satya Popuri
19c2ea6dc8 [kernel][thread] Hook uthread context switch
thread_resched() calls into libuthread to switch userspace.

Change-Id: Iad8e5ade175316eb784410c369c6473b68b6f5d6
Signed-off-by: Satya Popuri <popuri@google.com>
2015-03-19 18:01:09 -07:00
Travis Geiselbrecht
29b9061f2a [kernel][pmm] fix bug with pmm_alloc_contig when arena is exhausted
-Fixes bug where the code would walk off the end of an arena, not
detecting the case where there is no way to satisfy the request.

Change-Id: I16434f13faa6d5d76aaba5bf3c458d230e4db888
2015-03-17 17:45:57 -07:00
Arve Hjønnevåg
8a7acf34f6 [kernel][thread] Add thread_secondary_cpu_init_early
Allows use of bootstrap thread to initialize secondary cpus.

Change-Id: I09a5e8ab446a8f422f72599631269df83865d966
2015-03-12 14:51:49 -07:00
Arve Hjønnevåg
63000f0cb3 [kernel][thread] Add some tracing when DEBUG_THREAD_CONTEXT_SWITCH is set
Change-Id: I65118c52155a6ef55dfdbf2c43107c7439fae38b

Conflicts:
	kernel/thread.c
2015-03-10 17:49:32 -07:00
Arve Hjønnevåg
794d304599 [kernel][thread] Allow pinning threads to a specific cpu
The existing runqueues are scanned on resched until a thread that is
not pinned to another cpu is found.

Per-pu runqueues can be added later to avoid this scan.

Change-Id: Idd7dbddb4b79ef38a0ccd0c42b53f8867020e6cd

Conflicts:
	kernel/thread.c
2015-03-10 17:49:32 -07:00
Arve Hjønnevåg
1d7d5c5e60 [kernel][thread] Move thread to new run queue and call thread_resched in thread_set_priority
The new priority of the thread may mean that a different thread should run.

Change-Id: Ia683613bb825929b506ea885c6ef303d9748c6a0
Signed-off-by: Arve Hjønnevåg <arve@android.com>
2015-03-10 17:49:32 -07:00
Travis Geiselbrecht
d0225dd262 [kernel][debug] fix threadload to display idle time properly in SMP world
The post SMP algorithm wasn't taking into account time on any given core
if the core was currently idle at the time the load interrupt fired.
Also track rescheduling ipis and condense the output slightly.
2015-03-10 16:43:55 -07:00
Travis Geiselbrecht
ac53b59ca7 [kernel][smp] move idle threads out of the run queue, fix some mp code
-Each cpu's idle thread now doesn't sit in the run queue and is only
selected when no other threads are ready to run. This means there is
now an implicit affinity for the idle threads for each cpu, and reduces
the amount of idle thread thrashing without real affinity (or per cpu
run queues).
-Fix some bitmap logic in the mp_reschedule and mp_mbx_reschedule_irq
code path that probably resulted in not enough reschedules.
-Change a few spots for mp reschedule ipis in general thread path. Add
ipi to thread_resume, remove one from thread_create_etc.
2015-03-10 16:43:55 -07:00
Travis Geiselbrecht
f55d8edd74 [kerne] a few smp tweaks
-fix a couple of mp accessor routines
-make sure the cpu number is read inside a spinlock in timer code
-add a few debug asserts
2015-03-10 16:43:55 -07:00
Travis Geiselbrecht
adc07c0b69 [kernel] fix some smp code in particular build configurations 2015-03-10 16:43:55 -07:00