- Dec 18, 2013
-
-
Asias He authored
Signed-off-by:
Asias He <asias@cloudius-systems.com> Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
Asias He authored
Signed-off-by:
Asias He <asias@cloudius-systems.com> Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
Asias He authored
The lock used to protect _waiting_request_thread can go away. Signed-off-by:
Asias He <asias@cloudius-systems.com> Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
- Dec 17, 2013
-
-
Avi Kivity authored
With net channels, poll() needs to wait not only on poll wakeups and the timeout, but also requests from network interfaces to flush net channels for polled sockets. In preparation for that, switch from bsd msleep() to native wait_until(). Signed-off-by:
Avi Kivity <avi@cloudius-systems.com>
-
Nadav Har'El authored
While booting with many cpus (e.g., run.py -c 20, but I sometimes saw this with as few as 7), we crashed while trying to sleep with preemption disabled: Assertion failed: preemptable() (/home/nyh/osv/include/sched.hh: do_wait_until: 605) Aborted Turns out that since commit 223b2252 (half a year ago), main_cont() ran smp_launch() with preemption disabled. But smp_launch creates threads, and thread's constructor may sleep (e.g., on the thread_list_mutex), and we cannot do this with preemption disabled... So dropped the preempt_disable()/enable() from main_cont(). The reasoning for it as expressed in 223b2252 appears to be no longer relevant. Fixes #130. Signed-off-by:
Nadav Har'El <nyh@cloudius-systems.com> Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
Tomasz Grabiec authored
Printing asynchronously is not affected by write() stalls and hence the period for partial amount can be more or less constant. Signed-off-by:
Tomasz Grabiec <tgrabiec@cloudius-systems.com> Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
Raphael S. Carvalho authored
Reviewed-by:
Dor Laor <dor@cloudius-systems.com> Signed-off-by:
Raphael S. Carvalho <raphaelsc@cloudius-systems.com> Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
Asias He authored
Signed-off-by:
Asias He <asias@cloudius-systems.com> Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
Asias He authored
Signed-off-by:
Asias He <asias@cloudius-systems.com> Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
Asias He authored
We can skip to construct a vring::sg_node. Signed-off-by:
Asias He <asias@cloudius-systems.com> Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
- Dec 16, 2013
-
-
Avi Kivity authored
bsd defines some m_ macros, for example m_flags, to save some typing. However if you have a variable of the same name in another header, for example m_flags, have fun trying to compile your code. Expand the code in place and eliminate the macros. Signed-off-by:
Avi Kivity <avi@cloudius-systems.com> Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
Tomasz Grabiec authored
This code seems obviously broken to me: tls_data().size there is no tls_data function, it is a struct. So this is creating temporary uninitialized struct and reads size field from it. What it meant instead is probably the TLS size, which is calculated by tls() function and returned in a tls_data structure. I am not able to actually test this change because I don't have any DSO which has R_X86_64_TPOFF64 relocations. Any idea how to test it? tls() is also broken, because it initializes file_size field instead of the size field. The file_size field was added at some point but this place wasn't updated. As it appears that tls() is not actually used anywhere, this patch gets rid of it. Signed-off-by:
Tomasz Grabiec <tgrabiec@cloudius-systems.com> Signed-off-by:
Avi Kivity <avi@cloudius-systems.com>
-
Tomasz Grabiec authored
Signed-off-by:
Tomasz Grabiec <tgrabiec@cloudius-systems.com> Signed-off-by:
Avi Kivity <avi@cloudius-systems.com>
-
Tomasz Grabiec authored
Dynamically loaded modules use __tls_get_addr() to locate thread local symbols. Symbol is identified by module index and offset in module's TLS area. Module index and offset are filled in by dynamic linker when DSO is loaded. TLS area for given DSO is allocated dynamically, on-demand. OSv keeps TLS areas in a vector indexed by module index, inside per-thread vector. TLS area of core module should be handled differently than that of dynamically loaded modules. The TLS offsets for thread local symbols defined in core module are known at link time and code inside core module can use these offsets directly. The offsets are relative to TCB pointer (fs register on x86). The problem was that __tls_get_addr() was treating core module as a dynamically loaded module and returned pointer inside dynamically allocated TLS area instead of a pointer inside core module's TLS. As a result code inside core module was reading value from different location than code inside DSO has written value to. The offending thread local varaible was __once_call. It was set by call_once() defined in DSO (inlined from a definition inside header) and read by __once_proxy() defined in core module. Fixes #125. Signed-off-by:
Tomasz Grabiec <tgrabiec@cloudius-systems.com> Signed-off-by:
Avi Kivity <avi@cloudius-systems.com>
-
Tomasz Grabiec authored
In order to have unform naming, ulong is used in several places. Signed-off-by:
Tomasz Grabiec <tgrabiec@cloudius-systems.com> Signed-off-by:
Avi Kivity <avi@cloudius-systems.com>
-
Tomasz Grabiec authored
Signed-off-by:
Tomasz Grabiec <tgrabiec@cloudius-systems.com> Signed-off-by:
Avi Kivity <avi@cloudius-systems.com>
-
Pekka Enberg authored
Clean up virtio-blk.cc by using 'auto' type specifier where possible. Reviewed-by:
Dor Laor <dor@cloudius-systems.com> Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
Pekka Enberg authored
Move the x86-64 PTE definitions to a new arch specific arch-mmu.hh header file to make core/mmu.cc smaller and more portable. Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
Asias He authored
If iov->iov_len == 0, it will loop forever. uiomove() will take care of the zero iov len case. Signed-off-by:
Asias He <asias@cloudius-systems.com> Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
Avi Kivity authored
Signed-off-by:
Avi Kivity <avi@cloudius-systems.com> Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
Avi Kivity authored
Signed-off-by:
Avi Kivity <avi@cloudius-systems.com> Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
Avi Kivity authored
The bsd specific ones are nenumbered to avoid clashes. Signed-off-by:
Avi Kivity <avi@cloudius-systems.com> Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
Avi Kivity authored
Signed-off-by:
Avi Kivity <avi@cloudius-systems.com> Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
Avi Kivity authored
Since most SOL_* macros are equivalent to the IPPROTO_* defines, only one define needs to be changed. Signed-off-by:
Avi Kivity <avi@cloudius-systems.com> Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
Avi Kivity authored
Move them to a common include file. Since they're defined externally, there is no real conflict. Signed-off-by:
Avi Kivity <avi@cloudius-systems.com> Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
Avi Kivity authored
Unused. Signed-off-by:
Avi Kivity <avi@cloudius-systems.com> Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
Vlad authored
Switched the virtio-net driver to use if_transmit() instead of legacy if_start(). This saves us at least 2 additional lock/unlock sequences per-each mbuf since IF_ENQUEUE() and IF_DEQUEUE() take lock when pushing/removing the mbuf from the queue if ifnet in a legacy mode. Signed-off-by:
Vlad Zolotarov <vladz@cloudius-systems.com> Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
- Dec 15, 2013
-
-
Avi Kivity authored
Now that backtrace() doesn't use libunwind, we can remove it. Signed-off-by:
Avi Kivity <avi@cloudius-systems.com>
-
Nadav Har'El authored
This patch changes backtrace() to use the _Unwind_* facilities provided by the GCC runtime (libgcc_eh.a), instead of the separate libunwind.a. After this patch, we don't use libunwind.a in OSv any more, and it can be removed (see issue #83). Signed-off-by:
Nadav Har'El <nyh@cloudius-systems.com> Signed-off-by:
Avi Kivity <avi@cloudius-systems.com>
-
Nadav Har'El authored
thread::destroy() had a "FIXME" comment: // FIXME: we have a problem in case of a race between join() and the // thread's completion. Here we can see _joiner==0 and not notify // anyone, but at the same time join() decided to go to sleep (because // status is not yet status::terminated) and we'll never wake it. This is indeed a bug, which Glauber discovered was hanging the tst-threadcomplete.so test once in a while - the test sometimes hangs with one thread in the "terminated" state (waiting for someone to join it), and a second thread waiting in join() but missed the other thread's termination event. The solution works like this: join() uses a CAS to set itself as the _joiner. If it succeeded, it waits like before for the status to become "terminated". But if the CAS failed, it means a concurrent destroy() call beat us at the race, and we can just return from join(). destroy() checks (with a CAS) if _joiner was already set - if so we need to wake this thread just like in the original code. But if _joiner was not yet set, either there is no-one doing join(), or there's a concurrent join() call that will soon return (this is what the joiner does when it loses the CAS race). In this case, all we need to do is to set the status to "terminated" - and we must do it through a _detached_state we saved earlier, because if join() already returned the thread may already be deleted). Signed-off-by:
Nadav Har'El <nyh@cloudius-systems.com> Signed-off-by:
Avi Kivity <avi@cloudius-systems.com>
-
Nadav Har'El authored
wake_with(action) was implemented using thread_handle, as the following: thread_handle h(handle()); action(); h.wake(); This implementation is wrong: It only takes the RCU lock (which prevents the destruction of _detached_state) during h.wake(), meaning that if the thread is not sleeping, and action() causes it to exit, _detached_state may also be destructed, and h.wake() will crash. thread_handle is simply not needed for wake_with(), and was designed with a completely different use case in mind (long-term holding of a thread handler). We just need to use, in-line, the appropriate rcu lock which keeps _detached_state alive. The resulting code is even simpler, and nicely parallels the existing code of wake(). This patch fixes a real bug, but unfortunately we don't have a concrete test-case which it is known to fix. Signed-off-by:
Nadav Har'El <nyh@cloudius-systems.com> Signed-off-by:
Avi Kivity <avi@cloudius-systems.com>
-
Nadav Har'El authored
Add a new lock, "rcu_read_lock_in_preempt_disabled", which is exactly like rcu_read_lock but assuming that preemption is already disabled. Because all our rcu_read_lock does is to disable preemption, the new lock type currently does absolutely nothing - but in some future implementation of RCU it might need to do something. We'll use the new lock type in the following patch, as an optimization over the regular rcu_read_lock. Signed-off-by:
Nadav Har'El <nyh@cloudius-systems.com> Signed-off-by:
Avi Kivity <avi@cloudius-systems.com>
-
Glauber Costa authored
Context: going to wait with irqs_disabled is a call for disaster. While it is true that not every time we call wait we actually end up waiting, that should be an invalid call, due to the times we may wait. Because of that, it would be good to express that nonsense in an assertion. There is however, places we sleep with irqs disabled currently. Although they are technically safe, because we implicitly enable interrupts, they end up reaching wait() in a non-safe state. That happens in the page fault handler. Explicitly enabling interrupts will allow us to test for valid / invalid wait status. With this test applied, all tests in our whitelist still passes. Signed-off-by:
Glauber Costa <glommer@cloudius-systems.com> Signed-off-by:
Avi Kivity <avi@cloudius-systems.com>
-
- Dec 13, 2013
-
-
Raphael S. Carvalho authored
Signed-off-by:
Raphael S. Carvalho <raphaelsc@cloudius-systems.com> Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
Raphael S. Carvalho authored
Signed-off-by:
Raphael S. Carvalho <raphaelsc@cloudius-systems.com> Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
Raphael S. Carvalho authored
Signed-off-by:
Raphael S. Carvalho <raphaelsc@cloudius-systems.com> Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
- Dec 12, 2013
-
-
Avi Kivity authored
Fix a unicode character in the author's name. Signed-off-by:
Avi Kivity <avi@cloudius-systems.com>
-
Pekka Enberg authored
Make sure that the address range passed to munmap() is actually mapped. Reviewed-by:
Raphael S. Carvalho <raphaelsc@cloudius-systems.com> Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
Pekka Enberg authored
Simplify mmap() by converting flags and permissions in one place. Reviewed-by:
Raphael S. Carvalho <raphaelsc@cloudius-systems.com> Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
Pekka Enberg authored
Move mincore() to libc/mman.cc where all other memory mapping libc functions are. Reviewed-by:
Raphael S. Carvalho <raphaelsc@cloudius-systems.com> Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-