- Nov 26, 2013
-
-
Nadav Har'El authored
The schedule() and cpu::schedule() functions had a "yield" parameter. This parameter was inconsistently used (it's not clear why specific places called it with "true" and other with "false"), but moreover, was always ignored! So this patch removes the parameter of schedule(). If you really want a yield, call yield(), not schedule(). Signed-off-by:
Nadav Har'El <nyh@cloudius-systems.com> Signed-off-by:
Avi Kivity <avi@cloudius-systems.com>
-
Raphael S. Carvalho authored
v2: Check limit of microseconds, among other minor changes (Nadav Har'El, Avi Kivity). v3: Get rid of goto & label by adding an else clause (Nadav Har'El). - This patch adds utimes support. - This patch addresses the issue #93 Signed-off-by:
Raphael S. Carvalho <raphaelsc@cloudius-systems.com> Tested-by:
Tomasz Grabiec <tgrabiec@gmail.com> Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
Raphael S. Carvalho authored
Attribute flags were moved from 'bsd/sys/cddl/compat/opensolaris/sys/vnode.h' to 'include/osv/vnode_attr.h' 'bsd/sys/cddl/compat/opensolaris/sys/vnode.h' now includes 'include/osv/vnode_attr.h' exactly at the place the flags were previously located. 'fs/vfs/vfs.h' includes 'include/osv/vnode_attr.h' as functions that rely on the setattr feature must specify the flags respective to the attr fields that are going to be changed. Approach sugested by Nadav Har'El Signed-off-by:
Raphael S. Carvalho <raphaelsc@cloudius-systems.com> Tested-by:
Tomasz Grabiec <tgrabiec@gmail.com> Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
Nadav Har'El authored
This patch causes incorrect usage of percpu<>/PERCPU() to cause compilation errors instead of silent runtime corruptions. Thanks to Dmitry for first noticing this issue in xen_intr.cc (see his separate patch), and to Avi for suggesting a compile-time fix. With this patch: 1. Using percpu<...> to *define* a per-cpu variable fails compilation. Instead, PERCPU(...) must be used for the definition, which is important because it places the variable in the ".percpu" section. 2. If a *declaration* is needed additionally (e.g., for a static class member), percpu<...> must be used, not PERCPU(). Trying to use PERCPU() for declaration will cause a compilation error. 3. PERCPU() only works on statically-constructed objects - global variables, static function-variables and static class-members. Trying to use it on a dynamically-constructed object - stack variable, class field, or operator new - will cause a compilation error. With this patch, the bug in xen_intr.cc would have been caught at compile time. Signed-off-by:
Nadav Har'El <nyh@cloudius-systems.com> Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
- Nov 25, 2013
-
-
Pekka Enberg authored
Reviewed-by:
Glauber Costa <glommer@cloudius-systems.com> Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
Pekka Enberg authored
Switch to demand paging for anonymous virtual memory. I used SPECjvm2008 to verify performance impact. The numbers are mostly the same with few exceptions, most visible in the 'serial' benchmark. However, there's quite a lot of variance between SPECjvm2008 runs so I wouldn't read too much into them. As we need the demand paging mechanism and the performance numbers suggest that the implementation is reasonable, I'd merge the patch as-is and see optimize it later. Before: Running specJVM2008 benchmarks on an OSV guest. Score on compiler.compiler: 331.23 ops/m Score on compiler.sunflow: 131.87 ops/m Score on compress: 118.33 ops/m Score on crypto.aes: 41.34 ops/m Score on crypto.rsa: 204.12 ops/m Score on crypto.signverify: 196.49 ops/m Score on derby: 170.12 ops/m Score on mpegaudio: 70.37 ops/m Score on scimark.fft.large: 36.68 ops/m Score on scimark.lu.large: 13.43 ops/m Score on scimark.sor.large: 22.29 ops/m Score on scimark.sparse.large: 29.35 ops/m Score on scimark.fft.small: 195.19 ops/m Score on scimark.lu.small: 233.95 ops/m Score on scimark.sor.small: 90.86 ops/m Score on scimark.sparse.small: 64.11 ops/m Score on scimark.monte_carlo: 145.44 ops/m Score on serial: 94.95 ops/m Score on sunflow: 73.24 ops/m Score on xml.transform: 207.82 ops/m Score on xml.validation: 343.59 ops/m After: Score on compiler.compiler: 346.78 ops/m Score on compiler.sunflow: 132.58 ops/m Score on compress: 116.05 ops/m Score on crypto.aes: 40.26 ops/m Score on crypto.rsa: 206.67 ops/m Score on crypto.signverify: 194.47 ops/m Score on derby: 175.22 ops/m Score on mpegaudio: 76.18 ops/m Score on scimark.fft.large: 34.34 ops/m Score on scimark.lu.large: 15.00 ops/m Score on scimark.sor.large: 24.80 ops/m Score on scimark.sparse.large: 33.10 ops/m Score on scimark.fft.small: 168.67 ops/m Score on scimark.lu.small: 236.14 ops/m Score on scimark.sor.small: 110.77 ops/m Score on scimark.sparse.small: 121.29 ops/m Score on scimark.monte_carlo: 146.03 ops/m Score on serial: 87.03 ops/m Score on sunflow: 77.33 ops/m Score on xml.transform: 205.73 ops/m Score on xml.validation: 351.97 ops/m Reviewed-by:
Glauber Costa <glommer@cloudius-systems.com> Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
Pekka Enberg authored
Add permission flags to VMAs. They will be used by mprotect() and the page fault handler. Reviewed-by:
Glauber Costa <glommer@cloudius-systems.com> Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
- Nov 22, 2013
-
-
Avi Kivity authored
To prevent leaks when a file is close()d without an EPOLL_CTL_DEL, record epoll registrations in the file structure and remove them when the file is destroyed. Signed-off-by:
Avi Kivity <avi@cloudius-systems.com> Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
Avi Kivity authored
use file::operator delete to ensure it is reclaimed via rcu, and let the rest of the cleanup happen via the destructor. This allows us to add other members to file, and let the standard construction/destruction sequence take place. Note the constructor is already used (falloc_noinstall()). Signed-off-by:
Avi Kivity <avi@cloudius-systems.com> Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
- Nov 21, 2013
-
-
Nadav Har'El authored
prio.hh defines various initialization priorities. The actual numbers don't matter, just the order between them. But when we add too many priorities between existing ones, we may hit a need to renumber. This is plain ugly, and reminds me of Basic programming ;-) So this patch switches to an enum (enum class, actually). We now just have a list of priority names in order, with no numbers. It would have been straightforward, if it weren't for a bug in GCC (see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59211 ) where the "init_priority" attribute doesn't accept the enum (while the "constructor" attribute does). Luckily, a simple workaround - explicitly casting to int - works. Signed-off-by:
Nadav Har'El <nyh@cloudius-systems.com> Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
Avi Kivity authored
With epoll(), the lifetime of an ongoing poll may be longer than the lifetime of a file descriptor; if an fd is close()d then we expect it to be silently removed from the epoll. With the current implementation of epoll(), which just calls poll(), this is impossible to do correctly since poll() is implemented in terms of file descriptor. Add an intermedite do_poll() that works on file pointers. This allows a refactored epoll() to convert file descriptors to file pointers just once, and then a close()d and re-open()ed descriptor can be added without a problem. As a side effect, a lot of atomic operations (fget() and fdrop()) are saved. Signed-off-by:
Avi Kivity <avi@cloudius-systems.com> Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
- Nov 20, 2013
-
-
Glauber Costa authored
We may have threads that were initialized and started very early, before sched::init() took place. We can easily identify such threads: they are all threads that are in the thread list so far with the exception of the main thread. For those, we finish their initialization so they are now in a safe state. Also, some of them may have been started already. Since we cannot really start anything before the main thread, they were put in as special state called "prestarted". Every thread found in this state is started at this moment. Note how this code needs to run in the main thread itself, since we depend on initialization that will only happen inside switch_to_first to properly function those procedures. Signed-off-by:
Glauber Costa <glommer@cloudius-systems.com> Reviewed-by:
Pekka Enberg <penberg@cloudius-systems.com> Signed-off-by:
Avi Kivity <avi@cloudius-systems.com>
-
Glauber Costa authored
It may be that a thread that is initialized early is also started early. We need to somehow mark that thread as already started, so we can start it for real later when the scheduler is ready to go. We will do this by adding an extra state, prestarted. Later on, we will take action to start those threads properly. Signed-off-by:
Glauber Costa <glommer@cloudius-systems.com> Reviewed-by:
Pekka Enberg <penberg@cloudius-systems.com> Signed-off-by:
Avi Kivity <avi@cloudius-systems.com>
-
Glauber Costa authored
Since the thread list does not depend on nothing but the memory allocator, allocate it as early as we can. Signed-off-by:
Glauber Costa <glommer@cloudius-systems.com> Reviewed-by:
Pekka Enberg <penberg@cloudius-systems.com> Signed-off-by:
Avi Kivity <avi@cloudius-systems.com>
-
Glauber Costa authored
No reason at all for page_size to be in mmu.hh but huge_page_size in mmu.cc. Move it, so we can also use huge_page_size outside the mmu.cc scope. Signed-off-by:
Glauber Costa <glommer@cloudius-systems.com> Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
- Nov 19, 2013
-
-
Raphael S. Carvalho authored
vop_eperm allows more code reuse (suggested by Glauber Costa) Signed-off-by:
Raphael S. Carvalho <raphaelsc@cloudius-systems.com> Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
- Nov 10, 2013
-
-
dleifker@gmail.com authored
Fixed the following abort when build was running mkzfs.py. Done! eth0: ethernet address: 52:54:0:12:34:56 [I/20 dhcp]: Waiting for IP... [I/26 dhcp]: Server acknowledged IP for interface eth0 [I/26 dhcp]: Configuring eth0: ip 192.168.122.15 subnet mask 255.255.255.0 gateway 192.168.122.1 Aborted Signed-off-by:
David Leifker <dlei...@gmail.com> Signed-off-by:
Avi Kivity <avi@cloudius-systems.com>
-
- Nov 07, 2013
-
-
Avi Kivity authored
Dead code, and boost::signals2::signal<> does the job better. Signed-off-by:
Avi Kivity <avi@cloudius-systems.com> Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
- Nov 04, 2013
-
-
Dmitry Fleytman authored
slop made page size by default because this is the most frequent case Signed-off-by:
Dmitry Fleytman <dmitry@daynix.com>
-
- Oct 31, 2013
-
-
Tomasz Grabiec authored
Signed-off-by:
Tomasz Grabiec <tgrabiec@cloudius-systems.com>
-
- Oct 30, 2013
-
-
Nadav Har'El authored
Add Doxygen comments to the condvar class. Only the C++ interface (condvar's methods) is documented, not the alternative C interface (condvar_* functions). A reminder: run "doxygen" and point your browser to doxyout/html/index.html to see the API documentation we have so far. A lot can still be added to this condvar documentation, including a good introduction to how to use condition variables, why they have a mutex, etc. But it's at least a start. Signed-off-by:
Nadav Har'El <nyh@cloudius-systems.com>
-
- Oct 28, 2013
-
-
Pekka Enberg authored
Spotted by Clang: In file included from ../../loader.cc:27: In file included from ../../drivers/virtio-net.hh:12: In file included from ../../bsd/sys/net/if_var.h:80: In file included from ../../bsd/sys/sys/mbuf.h:40: In file included from ../../bsd/porting/uma_stub.h:161: ../../include/osv/percpu.hh:35:42: error: arithmetic on a pointer to void return reinterpret_cast<T*>(base + offset); ~~~~ ^ Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
- Oct 25, 2013
-
-
Pekka Enberg authored
C++ does not allow reinterpret_cast in constant expressions: http://stackoverflow.com/questions/10369606/constexpr-pointer-value GCC doesn't enforce it but Clang does. Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
- Oct 24, 2013
-
-
Pekka Enberg authored
Spotted by Clang. Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
Pekka Enberg authored
Spotted by Clang. Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
Pekka Enberg authored
Spotted by Clang: ../../include/sched.hh:278:12: error: class 'arch_cpu' was previously declared as a struct [-Werror,-Wmismatched-tags] friend class arch_cpu; ^ ../../arch/x64/arch-cpu.hh:39:8: note: previous use is here struct arch_cpu { ^ ../../include/sched.hh:278:12: note: did you mean struct here? friend class arch_cpu; ^~~~~ struct Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
Pekka Enberg authored
Spotted by Clang: ../../include/osv/trace.hh:58:1: error: 'assigner_type' defined as a struct template here but previously declared as a class template [-Werror,-Wmismatched-tags] struct assigner_type<storage_args<s_args...>, runtime_args<r_args...>> { ^ ../../include/osv/trace.hh:45:1: note: did you mean struct here? class assigner_type; ^~~~~ struct Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
- Oct 23, 2013
-
-
Tomasz Grabiec authored
Signed-off-by:
Tomasz Grabiec <tgrabiec@cloudius-systems.com>
-
Tomasz Grabiec authored
Needed to link with boost_filesystem. Signed-off-by:
Tomasz Grabiec <tgrabiec@cloudius-systems.com>
-
- Oct 22, 2013
-
-
Pekka Enberg authored
Needed to make dump_registers() safe to call from fault handler. Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
- Oct 16, 2013
-
-
Avi Kivity authored
Signed-off-by:
Avi Kivity <avi@cloudius-systems.com>
-
Avi Kivity authored
std::streambuf<char> is defined as an "extern template", which means it is instantiated in the library, not at the point-of-use, in order to reduce object size and compilation time. One of its member functions, std::basic_streambuf::seekpos(...) has a parameter whose type depends on mbstate_t; this embeds the type name into the mangled function name. On Linux, mbstate_t is a typedef for __mbstate_t, so the latter type name is embedded into the mangled function name. On osv, there is no such typedef, so mbstate_t is embedded. This causes lookup to fail when loading a shared object that uses streambufs. Fix by defining mbstate_t in the same way as glibc. Signed-off-by:
Avi Kivity <avi@cloudius-systems.com>
-
- Oct 15, 2013
-
-
Avi Kivity authored
Much easier than constructing a traditional argc/argv. Signed-off-by:
Avi Kivity <avi@cloudius-systems.com>
-
Avi Kivity authored
Unlike tls for the main module, which simply offsets fs:0, shared object use an indirection scheme since each module gets its own tls base address, which needs to be found (and initialized) via __get_tls_addr() Implement __get_tls_addr() and the associated relocation and storage management. Signed-off-by:
Avi Kivity <avi@cloudius-systems.com>
-
Avi Kivity authored
Currently we search the entire vma list while looking for a range. This is less than optimal. Define a vma::addr_compare function object that can be used as comparator with boost::rbtree::equal_range(), and use that to search for both bounds simultaneously. Signed-off-by:
Avi Kivity <avi@cloudius-systems.com>
-
- Oct 14, 2013
-
-
Nadav Har'El authored
Add a convenience function, osv::run(), to run an ELF executable. The patch includes extensive Doxygen documentation for the new function, also detailing the how osv::run() differs from the familiar Linux functions like exec(2). Signed-off-by:
Nadav Har'El <nyh@cloudius-systems.com>
-
Pekka Enberg authored
Fix mincore() to follow Linux ABI and return ENOMEM only if (part of the) memory range is unmapped even if it's not resident. This is needed for mincore() to work with demand paged mmaps. Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
Nadav Har'El authored
This is patch v2, incorporating most of the comments from the previous round. Solves issue #47: elf::program's API - add_object() and remove_object() was problematic in two respects: 1. It did not do reference-counting on the loaded object, so if add_object() was done 5 times, a single remove_object() would unmap the object and its 4 other users will crash. 2. It is un-C++-like. This patch replaces these two functions by a single function get_library(): std::shared_ptr<elf::object> get_library(std::string lib, std::vector<std::string> extra_path = {}); get_library() returns a shared_ptr, which is reference counting and does proper C++-style RAII. For example in the code: auto lib = elf::get_program()->get_library(path); auto main = lib->lookup<int (int, char**)>("main"); int rc = main(argc, argv); once lib out of scope, the reference count of the elf::object automatically goes down, and if nobody else holds another shared-pointer to the same library, the object is destroyed (causing the shared library to be unloaded). This patch also documents, with Doxygen, all the functions it touches. IMPORTANT NOTE: This reference count is completely unrelated to the issue of concurrent use of dlopen()/dlclose()/dl_iterate_phdr(), which is still buggy and we need to fix (I have a patch for that, but it's too long to fit in the margin). Signed-off-by:
Nadav Har'El <nyh@cloudius-systems.com>
-
- Oct 13, 2013
-
-
Nadav Har'El authored
The new scheduling algorithm is based on floating point runtimes, and I'd like to be able to tracepoints to debug it. Adding floats and doubles is trivial - we just need to tell the C++ tracing code to use the character "f" for floats and "d" for doubles, and Python (run in gdb when we use "osv trace") already knows how to unpack values with these designations. Signed-off-by:
Nadav Har'El <nyh@cloudius-systems.com>
-
Avi Kivity authored
Signed-off-by:
Avi Kivity <avi@cloudius-systems.com>
-