197 Commits

Author SHA1 Message Date
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
Travis Geiselbrecht
16d0a96dff [kernel] add preliminary SMP support to the kernel 2015-03-10 16:43:55 -07:00
Travis Geiselbrecht
8fb2c54304 [kernel] remove critical_section, move everything to spinlocks 2015-03-10 16:43:54 -07:00
Travis Geiselbrecht
45e146fc81 [kernel] fix bug in thread_detach that wakes up waiters on the wrong queue
Thanks to a bug report by Arnab Basu, fixed the incorrect waking up of
thread_join waiters on the calling thread, instead of the thread being detached.
2015-03-10 16:34:21 -07:00
Arve Hjønnevåg
d0c4833b3f [kernel][vm] Fix end address checks
If the end of a range is at the end of the virtual address space,
(base + size) is 0. Use (base + size - 1) instead.

Change-Id: I7d02250d765df0ab2bd23b60ee7a484951238c58
2015-03-08 19:05:14 -07:00
Arve Hjønnevåg
0eba11d485 [kernel][thread] Switch tls entries from uint32_t to uintptr_t
Allows storing a pointer in a tls slot on 64 bit systems.

Change-Id: I47f58e27c5625945c6aeca054eb463fd3c89ac45
2015-03-08 19:05:12 -07:00
Travis Geiselbrecht
ed08f12ab7 [kernel][vm] add mutex to the pmm 2015-02-16 20:41:37 -08:00
Michael Ryleev
ecca4f4aa0 [kernel][vm] Add vmm_free_region and kvaddr_to_paddr
Change-Id: Ieb7a11dcd6d7cd96bfef252b41cc7ccdd4892b8f
2014-11-04 15:30:32 -08:00
Travis Geiselbrecht
9daff06e90 [kernel] fix a warning that shows up with DEBUG=0 2014-10-23 13:23:56 -07:00
Travis Geiselbrecht
bba71af9ed [kernel] add real time flag for threads
Threads marked as real time do not have the preemption timer run against
them and will continue to run until they voluntarily yield or are
preempted by a higher priority thread from irq context.
2014-08-25 21:41:08 -07:00
Travis Geiselbrecht
e450ea7e72 [kernel] add thread_unblock() in case a thread needs to be directly put into ready state
Also tighten the critical section requirement for some of the deep thread
routines for efficiency purposes.
2014-08-20 17:06:55 -07:00
Travis Geiselbrecht
b0882ed618 [vmm] add support for allocating aligned contiguous regions
-new argument, align_pow2, will try to allocate physical and virtually
aligned pages.
2014-08-18 14:50:03 -07:00
Travis Geiselbrecht
e72c8bfede [vm] when marking boot physical pages used, make sure the address range is inclusive 2014-08-15 13:37:21 -07:00
Travis Geiselbrecht
ca20aac213 [kernel][vm] tweak the pmm_alloc_contiguous routine to take alignment in log2 2014-08-14 22:14:28 -07:00
Travis Geiselbrecht
cab6a749a8 [kernel][vm] remove extra pmm spew 2014-08-08 15:41:12 -07:00
Travis Geiselbrecht
5daec121e3 [kernel][vm] allow allocation of physical runs of memory aligned on arbitrary boundaries 2014-08-07 18:49:20 -07:00
Chris Anderson
5bc6f97090 [kernel] Add resched option to sem_post 2014-07-24 17:10:02 -07:00
Travis Geiselbrecht
cb41b90187 [vm] allow config space to set kernel address space size, ARM sets to top 3GB 2014-07-24 15:26:34 -07:00
Travis Geiselbrecht
e35c99d004 [kernel][vm] fix debug code to compile if console disabled 2014-07-24 02:59:24 -07:00
Travis Geiselbrecht
1ffc542896 [kernel][vm] Require pre-initialized lists for pmm routines, clean up docs in header 2014-07-17 18:30:36 -07:00
Travis Geiselbrecht
8637522be0 [kernel][vm] squelch the debug trace spew 2014-07-16 21:05:46 -07:00
Travis Geiselbrecht
986d1590cb [kernel][vm] first stab at a virtual memory manager
Add kernel/vm code to handle memory management in large page-aligned
regions of virtual space. This is composed via a pmm (physical
memory manager) and vmm (virtual memory manager) and the architecturally
specific code to manage the mmu.

Add ARMv7 paging code.
2014-07-11 18:06:37 -07:00
Travis Geiselbrecht
15090afe02 [kernel] add a few convenience routines 2014-06-26 19:17:28 -07:00
Travis Geiselbrecht
94920d35d1 [kernel] remove current_thread global, add get|set_current_thread() accessor
-Up to the architecture to implement the getter|setter
2014-05-03 23:58:44 -07:00
Dima Zavin
36c7735533 [libc][stdio] cleanup printf definition and clients
Move implementation to stdio.c to sit next to the other
stdio definitions that use the debug output functions. Keep
the declaration of it, though, in printf.h to sit next to
sprintf, etc.

Don't include printf.h directly in other places, rely on stdio.h
to properly pull in these functions.

Change-Id: I357cb04a5c78185b8fde908193b672326c2ee542
Signed-off-by: Dima Zavin <dima@android.com>
2013-08-05 10:04:29 -07:00
Dima Zavin
e8a9b4b7a4 [libc] move tracing out of debug into separate trace.h
Change-Id: I7476fc17b587a0ea2a42cbe3d49b72063e4c5dc8
Signed-off-by: Dima Zavin <dima@android.com>
2013-08-05 10:04:29 -07:00
Travis Geiselbrecht
a50d70b304 [kernel][timer] Fixup dynamic timer
Modify platform.h to add definitions of hooks required by
implementation of dynamic timer

Disable setting periodic timer if PLATFORM_HAS_DYNAMIC_TIMER
is chosen.

Fix a warning.
2013-07-15 21:35:59 -07:00