Subversion Repositories HelenOS

Rev

Go to most recent revision | Show changed files | Details | Compare with Previous | Blame | RSS feed

Filtering Options

Rev Age Author Path Log message Diff
2446 6198 d 1 h jermar /trunk/kernel/generic/ More efficient and simpler task termination.

Based on the assumption, that after its creation, only the task itself can create more threads for itself,
the last thread with userspace context to execute thread_exit() will perform futex and IPC cleanup. When
the task has no threads, it is destroyed. Both the cleanup and destruction is controlled by reference
counting.

As for userspace threads, even though there could be a global garbage collector for joining threads, it is
much simpler if the uinit thread detaches itself before switching to userspace.

task_kill() is now an idempotent operation. It just instructs the threads within a task to exit.

Change in the name of a thread state: Undead -> JoinMe.
 
2440 6198 d 20 h jermar /trunk/kernel/generic/ Fix the problem with sys_thread_create() by splitting the create and attach functionality of
thread_create(). Now it is possible to specify a flag that will cause thread_create() to only allocate and
initialize the thread structure. A call to thread_attach() will make the thread visible to the system.
This arrangement makes it easier to undo creation of a thread in case of a failure in sys_thread_create().
 
2436 6199 d 21 h jermar /trunk/ Fix two memory leaks.

In kernel, kernel_uarg structure needs to be deallocated when a thread
with userspace context is destroyed.

In userspace, the return value of the SYS_THREAD_CREATE must be checked
for error conditions and in case of error, uarg and stack must be freed
up.
 
2268 6241 d 22 h jermar /trunk/kernel/generic/ Document and assert proper usage of THREAD_FLAG_WIRED.
Original patch by Jan Hudecek.
 
2229 6251 d 3 h jermar /trunk/ Revert some of the changes introduced in revision 2209.
I think it is not correct to remove serialization of pseudo threads in printf_core.c.
With thread-level futex serialization, several pseudo threads running in one thread could easily deadlock
the task.

Add a dedicated futex serialization to thread1.c test only.
 
2216 6252 d 21 h decky /trunk/ make thread ID 64 bit (task ID is 64 bit already)
cleanup thread syscalls
 
2187 6254 d 4 h decky /trunk/kernel/generic/ add syscall for getting current thread ID  
2183 6255 d 1 h jermar /trunk/kernel/generic/ Continue to de-oversynchronize the kernel.
- replace as->refcount with an atomic counter; accesses to this
reference counter are not to be done when the as->lock mutex is held;
this gets us rid of mutex_lock_active();

Remove the possibility of a deadlock between TLB shootdown and asidlock.
- get rid of mutex_lock_active() on as->lock
- when locking the asidlock spinlock, always do it conditionally and with
preemption disabled; in the unsuccessful case, enable interrupts and try again
- there should be no deadlock between TLB shootdown and the as->lock mutexes
- PLEASE REVIEW !!!

Add DEADLOCK_PROBE's to places where we have spinlock_trylock() loops.
 
2118 6314 d 2 h decky /trunk/kernel/generic/src/ explicit typecast, fix signed/unsigned comparison  
2109 6315 d 5 h jermar /trunk/kernel/generic/ Revert thread_interrupt_sleep() to waitq_interrupt_sleep().
I'd prefer that this, IMO, waitq related stuff stays together.
 
2089 6322 d 4 h decky /trunk/ huge type system cleanup
remove cyclical type dependencies across multiple header files
many minor coding style fixes
 
2087 6323 d 0 h jermar /trunk/kernel/ Indentaion and formatting changes even Martin will like :-)  
2071 6332 d 21 h jermar /trunk/ (c) versus (C)  
2067 6343 d 2 h jermar /trunk/kernel/ More formatting changes.  
2050 6362 d 7 h decky /trunk/kernel/ benchmarking with statistics (initial)  
2042 6367 d 0 h decky /trunk/kernel/ introduce uncounted threads, whose accounting doesn't affect accumulated task accounting
run tests in kconsole thread again
 
2039 6367 d 5 h decky /trunk/kernel/generic/ accumulate task accounting, run tests as separate kernel task  
2032 6368 d 3 h decky /trunk/kernel/generic/src/proc/ proper initialization of last_cycle  
2030 6368 d 5 h decky /trunk/kernel/ thread CPU cycles accounting  
1854 6474 d 6 h jermar /trunk/kernel/ Define architecture-specific thread sub-constructors and sub-destructors on all architectures.
Define the THREAD_FLAG_USPACE which means that the thread runs in user space.
The forementioned changes allow for allocating of user window buffer on sparc64
threads that execute in userspace.

A lot of formatting and indentation fixes.
 
1839 6498 d 1 h decky /trunk/kernel/generic/ finish security context isolation  
1820 6505 d 18 h decky /trunk/kernel/generic/ initial security context support  
1787 6522 d 23 h decky / move kernel/trunk, uspace/trunk and boot/trunk to trunk/kernel, trunk/uspace and trunk/boot  
1780 6530 d 0 h jermar /kernel/trunk/ Replace old __u?? types with respective C99 variants (e.g. uint32_t, int64_t, uintptr_t etc.).  
1766 6538 d 7 h palkovsky /kernel/trunk/ Changed frame_alloc call, cleaned a lot of stuff, fixed some not-perfectly-correct error handling.  
1760 6541 d 1 h palkovsky /kernel/trunk/ Changed interface of frame_alloc/free to use address of frame instead of the pfn.
This makes it impossible to use >4GB of memory on 32-bit machines, but who cares...
 
1757 6544 d 5 h jermar /kernel/trunk/ Cleanup of comments.  
1735 6546 d 6 h decky /kernel/trunk/ make kernel prints case consistent  
1702 6551 d 3 h cejka /kernel/trunk/ Kernel doxygen comments updated.  
1687 6554 d 4 h jermar /kernel/trunk/generic/src/proc/ Fix double thread_join() in ktaskgc.
In thread_create(), lock TASK with interrupts disabled again.
thread_join_timeout() can use ordinary waitq_sleep_timeout().
 
1680 6554 d 17 h jermar /kernel/trunk/generic/src/proc/ Add interrupts_restore() to thread_join_timeout(). Note that this is not necessary, because
waitq_sleep_finish() does the job for thread_join_timeout(). However, the code looks more
correct in the form with interrupts_restore().
 
1661 6556 d 8 h jermar /kernel/trunk/generic/ Collect Undead threads while waiting to join uinit.
Rename ktaskkill to ktaskgc.
 
1636 6557 d 17 h jermar /kernel/trunk/ Move comment.

Do TLB shootdown also when allocating new ASID.
 
1595 6558 d 10 h palkovsky /kernel/trunk/ Added kernel circular buffer klog.
Added automatic killing of tasks raising inappropriate exceptions.
TODO: Fix vsnprintf return value(and behaviour according to specs) and remove workaround in klog.
 
1589 6558 d 23 h jermar /kernel/trunk/generic/src/ Improve comments regarding liveliness of threads and tasks.  
1585 6559 d 3 h jermar /kernel/trunk/generic/ Kill task when its main thread exits.  
1581 6559 d 9 h jermar /kernel/trunk/generic/src/ Detach kmp thread after joining it.
Extend assertion in thread_destroy() to not panic when threads are destroyed in their Unded state.
 
1579 6559 d 19 h jermar /kernel/trunk/generic/ Framework for task_kill().
Some pieces (e.g. implementation of ktask_cleanup() kernel thread and
task_destroy() function) are missing.
Changed locking order for task lock, threads_lock and thread lock from
threads_lock, thread lock, task lock to task lock, threads_lock, thread lock.
 
1571 6560 d 0 h jermar /kernel/trunk/generic/ thread_join_timeout() and thread_detach() implementation.
Needs more thorough testing.
 
1502 6562 d 5 h jermar /kernel/trunk/ Replace nonblocking argument of waitq_sleep_timeout with flags that specify mode of operation.
Now a flag can be used to specify interruptible sleep.
Modify waitq_interrupt_sleep() to only interrupt threads that used this flag.
O