Commit Graph

40 Commits

Author SHA1 Message Date
Bahadir Balban
403a038845 Changes between 16 March 2010 - 6 April 2010
Mutex system call fixed for multiple contenders
Userspace irq support extended to keyboard/mouse.
Scheduler modified for real-time irq tasks
2010-04-06 19:47:12 +03:00
Bahadir Balban
74b5963fcb Kernel updates since December 2009 2010-03-25 01:12:40 +02:00
Bahadir Balban
27c0c34e3d Irqs are working. Scheduler modified to come back from no tasks.
- Userspace irq handling for timer.
- If no runnable task is left. scheduler busy loops in user context
  of last runnable task until a new task becomes runnable.
2009-12-14 11:48:40 +02:00
Bahadir Balban
d85ccdb3fe Fixed few more anomalies with threaded irqs.
There is a bug that causes the sleeping irq
thread to never wake up. Investigating.
2009-12-13 20:35:04 +02:00
Bahadir Balban
32c0bb3a76 Converted all wait/wakeup runqueue lock/unlock paths to irq versions.
Irqs can now touch runqueues and do async wakeups. This necessitated
that we implement all wake up wait and runqueue locking work with irqs.

All this, assumes that in an SMP setup we may have cross-cpu wake ups,
runqueue manipulation. If we later decide that we only wake up threads
in the current container, (and lock containers to cpus) we won't really
need spinlocks, or irq disabling anymore. The current set up might be
trivially less responsive, but is more flexible.
2009-12-12 01:20:14 +02:00
Bahadir Balban
b1614191b3 Reverted all changes - userspace devices mapped at initialization.
This is much simpler, no device map/unmap maintenance at run-time,
no lazy device mapping etc.
2009-12-11 19:27:46 +02:00
Bahadir Balban
59af5d3794 Made changes to map devices dynamically upon irq registration.
All will be reverted since mapping devices statically is much simpler.
2009-12-11 19:02:10 +02:00
Bahadir Balban
c763679aaa Fixed a nasty spinlock issue with wake_up_all that didn't get caught. 2009-10-31 20:47:20 +02:00
Bahadir Balban
2839f46245 Cleanup on previous commits 2009-10-30 21:59:46 +02:00
Bahadir Balban
c3c6c10cf7 Reimplemented kill/suspend
It seems to work fine except an undefined instruction is generated
from posix userspace occasionally
2009-10-30 21:34:10 +02:00
Bahadir Balban
f3c0a38fa9 Some not-very-well working progress on grouply exit.
Going to start from scratch.
2009-10-30 19:52:52 +02:00
Bahadir Balban
ee7621b2df Some more progress with debugging pager exits 2009-10-30 18:28:45 +02:00
Bahadir Balban
c5d2bedc7f Remove memcache verbose print 2009-10-18 16:23:53 +03:00
Bahadir Balban
a3a90530df Fixed a few minor issues. 2009-10-18 16:16:32 +03:00
Bahadir Balban
942865e6fc Working compilation, but adding variant_dir = BUILD it doesn't work 2009-09-11 13:55:46 +03:00
Russel Winder
6ca0f2607a Switch to using a different strategy for building the kernel. 2009-08-27 16:43:47 +01:00
Bahadir Balban
5bee43ae99 Merge branch 'newBuild' of /opt/c0-trees/codezero-russel into devel
Conflicts:

	SConstruct
	src/api/SConscript
	src/arch/arm/SConscript
	src/generic/SConscript
	tasks/bootdesc/SConstruct
2009-08-14 17:09:58 +03:00
Bahadir Balban
e329a7c91a Removed kmalloc. Initialization path resolved, almost done. 2009-08-06 14:15:39 +03:00
Russel Winder
8b9b254f6c Make the coding style more consistent with PEP-8. 2009-08-05 11:15:26 +01:00
Bahadir Balban
519bfba8c7 Container/Pager/Capability initialization that works.
Need to safely free boot memory and jump to first task's stack.
Need to test scheduler and all syscall entries.
2009-08-04 13:56:11 +03:00
Bahadir Balban
7e8845abf8 Code that compiles until initialization of containers and pagers. 2009-08-02 23:43:14 +03:00
Russel Winder
9b2ff087d0 Add in all the amendments and new files needed to get the kernel building. 2009-08-01 17:50:59 +01:00
Bahadir Balban
723cf7bde9 Code that compiles and works up to initializing the first memcache. 2009-07-29 19:08:29 +03:00
Bahadir Balban
dd8f773f10 Some more progress on resource management and boot up. 2009-07-29 13:32:38 +03:00
Russel Winder
d40c76de84 Remove all the SCons files pending starting a new build system. 2009-07-28 14:47:00 +01:00
Bahadir Balban
4e43d09325 wait_on_prepare and wait_on_prepared_wait with preemption considered 2009-06-10 15:48:34 +03:00
Bahadir Balban
7ef479733f Fix to l4_mutex_control for the unexpected sleeping with mutex held
when preemption occurs after call to wait_on_prepare
2009-06-10 15:41:30 +03:00
Bahadir Balban
6b3ddadcf5 Cleaned up code for userspace mutexes.
- Issues: wait_on_prepare and wait_on_prepared_wait use cases
  are erroneous because they may sleep with mutex_control_lock
  taken if preemption occurs.
2009-06-10 14:37:23 +03:00
Bahadir Balban
49d47abe97 Evaluated license issues, made some other enhancements. 2009-06-08 17:00:21 +03:00
Bahadir Balban
276b4643c6 Removed linux linked list dependency. 2009-06-02 13:19:17 +03:00
Bahadir Balban
13d469f659 Removed all unecessary prints from the mutex test and the kernel
- removed (%d) Sleeping print from contended kernel mutexes.
- removed (%d) Waiting print from WAIT_EVENT used by the pager for suspending tasks.
- removed prints from the mutex_control syscall and user mutex test.
2009-06-01 16:02:10 +03:00
Bahadir Balban
33200c92df Mutex implementation almost working.
- Fixed a wrong instruction in mutex.S user library
- Added support for blocking lock/unlock
- Divided waiting into wait_on_prepare and wait_on_prepared_wait
  so that mutex_control lock is released after getting in the waitqueue.
- Declaring waitqueue on the stack should be done outside wait_on_prepare

Issues:
- Tests can be simplified for atomic data access instead of producer/consumer.
- kmalloc variable sized memory caches are not freed properly. Currently only the
  last slot can be freed, occupied correctly. it should be done in any slot, i.e.
  1, 2, 3, 4 instead of just 5.
- Need to add a mutex to kmalloc.
2009-06-01 14:11:40 +03:00
Bahadir Balban
aa2be891cd exit() almost there.
- Implemented reasonable way to suspend task.
  - A task that has a pending suspend would be interrupted
    from its sleep via the suspender task.
  - If suspend was raised and right after, task became about to sleep,
    then scheduler wakes it up.
  - If suspend was raised when task was in user mode, then an irq suspends it.
  - Also suspends are checked at the end of a syscall so that if suspend was
    raised because of a syscall from the task, the task is suspended before it
    goes back to user mode.

  - This mechanism is very similar to signals, and it may lead as a base for
    implementing signal handling.

- Implemented common vma dropping for shadow vm object dropping and task exiting.
2008-10-20 12:56:30 +03:00
Bahadir Balban
0db0f7e334 Multiple updates on sleeping, vma dropping and thread suspend.
- Updated sleeping paths such that a task is atomically put into
  a runqueue and made RUNNABLE, or removed from a runqueue and made SLEEPING.
- Modified vma dropping sources to handle both copy_on_write() and exit() cases
  in a common function.
- Added the first infrastructure to have a pager to suspend a task and wait for
  suspend completion from the scheduler.
2008-10-13 12:22:10 +03:00
Bahadir Balban
f6d0a79298 New scheduler and interruptible blocking.
A new scheduler replaces the old one.
  - There are no sched_xxx_notify() calls that ask scheduler to change task state.
  - Tasks now have priorities and different timeslices.
  - One second interval is distributed among processes.
  - There are just runnable and expired queues.
  - SCHED_GRANULARITY determines a maximum running boundary for tasks.
  - Scheduler can now detect a safe point and suspend a task.

Interruptible blocking is implemented.
  - Mutexes, waitqueues and ipc are modified to have an interruptible nature.
  - Sleep information is stored on the ktcb. (which waitqueue? etc.)
2008-10-01 12:43:44 +03:00
Bahadir Balban
c54d505709 Changes towards exit. Need to fix thread suspend first. 2008-09-27 22:15:34 +03:00
Bahadir Balban
4fb5277123 Towards finishing exchange_registers()
- Added mutex_trylock()
- Implemented most of exchange_registers()
- thread_control() now needs a lock for operations that can modify thread context.
- thread_start() does not initialise scheduler flags, now done in thread_create.

TODO:
- Fork/clone'ed threads should retain their context in tcb, not syscall stack.
- exchange_registers() calls in userspace need cleaning up.
2008-09-13 18:07:00 +03:00
Bahadir Balban
cc23568629 Added locking to id pool allocation and free. 2008-02-09 14:30:03 +00:00
Bahadir Balban
ba0e3ada21 Few more fixes.
Boot files and tasks are now initialised together. Theads can ask for particular
space and thread ids, if they're unused. This enables us to get predefined ids for
known tasks such as the VFS task.

Fixes to README
Other minor fixes.
2008-02-09 14:24:49 +00:00
Bahadir Balban
e2b791a3d8 Initial commit 2008-01-13 13:53:52 +00:00