- Dec 01, 2013
-
-
Nadav Har'El authored
Before this patch, OSv crashes or continuously reboots when given unknown command line paramters, e.g., scripts/run.py -c1 -e "--help --z a" With this patch, it says, as expected that the "--z" option is not recognized, and displays the list of known options: unrecognised option '--z' OSv options: --help show help text --trace arg tracepoints to enable --trace-backtrace log backtraces in the tracepoint log --leak start leak detector after boot --nomount don't mount the file system --noshutdown continue running after main() returns --env arg set Unix-like environment variable (putenv()) --cwd arg set current working directory Aborted The problem was that to parse the command line options, we used Boost, which throws an exception when an unrecognized option is seen. We need to catch this exception, and show a message accordingly. But before this patch, C++ exceptions did not work correctly during this stage of the boot process, because exceptions use elf::program(), and we only set it up later. So this patch moves the setup of the elf::program() object earlier in the boot, to the beginning of main_cont(). Now we'll be able to use C++ exceptions throughout main_cont(), not just in command line parsing. This patch also removes the unused "filesystem" paramter of elf::program(), rather than move the initializion of this empty object as well. Fixes #103. Signed-off-by:
Nadav Har'El <nyh@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
Needed for C++ conversion. Signed-off-by:
Avi Kivity <avi@cloudius-systems.com> Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
Avi Kivity authored
socketpair() stores temporary data in the field they're going to be copied into. Use a local instead. Signed-off-by:
Avi Kivity <avi@cloudius-systems.com> Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
Avi Kivity authored
In preparation for making 'file' a C++ type. 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
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
Unfortunately, C++ does not support designated initializers. Add a function that helps fill their place. Use example: -static struct netisr_handler ether_nh = { - .nh_name = "ether", - .nh_handler = ether_nh_input, - .nh_proto = NETISR_ETHER, - .nh_policy = NETISR_POLICY_SOURCE, - .nh_dispatch = NETISR_DISPATCH_DIRECT, -}; +static netisr_handler ether_nh = initialize_with([] (netisr_handler& x) { + x.nh_name = "ether"; + x.nh_handler = ether_nh_input; + x.nh_proto = NETISR_ETHER; + x.nh_policy = NETISR_POLICY_SOURCE; + x.nh_dispatch = NETISR_DISPATCH_DIRECT; +}); 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
We have an strange and incorrect 'struct file' definition for zfs, but a forward declaration is all that is needed. Remove the unsafe definition. Signed-off-by:
Avi Kivity <avi@cloudius-systems.com> Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
Nadav Har'El authored
During boot, between the time main() set the IDT and when later smp_launch() is called, the IDT doesn't actually work correctly. The problem is that we use the separate stacks feature (IST), and that doesn't work without also setting the GDT, not only the IDT. So use init_on_cpu() to initialize not only the IDT, but other stuff as well. Fix smp_launch() not to repeat this initialization on the boot CPU, as it was already done. Signed-off-by:
Nadav Har'El <nyh@cloudius-systems.com> Signed-off-by:
Avi Kivity <avi@cloudius-systems.com>
-
Tomasz Grabiec authored
Shell command line should be passed as one argument. Additional arguments are passed to the shell itself. Reported-by: Nadav Signed-off-by:
Tomasz Grabiec <tgrabiec@cloudius-systems.com> Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
Nadav Har'El authored
When KVM paravirtual clock isn't available (e.g., on Xen or on plain Qemu), we used the HPET clock. Our HPET clock driver rolled back the clock (clock::get()->time()) once every 42 seconds, causing strange things like a scheduler assertion when the clock jumps back. The problem is that we read just 32 bits out of the 64 bits of the HPET counter. This means that we roll back the clock once every 2^32 ticks, and with the 10ns tick (which seems to be case in Qemu), this means about 42 seconds. Douglas Adams would have liked this bug ;-) Fixed the code, and removed overly-optimistic comment which stated the rollback should take years. Added an assertion that the HPET really has a 64-bit counter; Intel's HPET specification from 2004 already specify that a 64-bit counter is recommended, and both Qemu and Xen do implement a 64-bit counter. If we had to deal with a 32-bit counter, we would need to write a handler for the interrupt that the HPET sends every time the counter wraps around. Signed-off-by:
Nadav Har'El <nyh@cloudius-systems.com> Signed-off-by:
Avi Kivity <avi@cloudius-systems.com>
-
- Nov 29, 2013
-
-
Dmitry Fleytman authored
tput is more portable than raw colors specification Signed-off-by:
Dmitry Fleytman <dmitry@daynix.com> Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
Dmitry Fleytman authored
There is a bug in AWS engine making copied public AMIs invisible. This patch implements a work-around for this problem as described at https://forums.aws.amazon.com/thread.jspa?messageID=454676񯀔 Signed-off-by:
Dmitry Fleytman <dmitry@daynix.com> Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
Tomasz Grabiec authored
When this line is absent in usr.manifest: /tmp/index.rb: ../../mgmt/web/views/index.rb ... tst-rename.so test fails with: Assertion failed: c_str (<...>/osv/external/misc.bin/usr/ include/boost/filesystem/path_traits.hpp: dispatch: 214) The reason for failure is missing /tmp. It is supposed to be created in unpack_bootfs() but it is later masked by zfs root pivot. The line in the manifest recreated it, but since mgmt can be a separate module it may not always be there. This patch fixes that by adding an explicit entry for /tmp to usr.manifest, same as we do for /dev. Signed-off-by:
Tomasz Grabiec <tgrabiec@cloudius-systems.com> Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
Tomasz Grabiec authored
This patch changes module.py so that it generates both manifests at once. We do not need to have it split. Doing it in one step makes we also need to resolve modules once. Signed-off-by:
Tomasz Grabiec <tgrabiec@cloudius-systems.com> Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
Tomasz Grabiec authored
This is a refactoring before further modifications. Should not have any semantic changes. Items: - file.readlines() is not necessary, file is line-iterable - use "cwd" named parameter in subprocess.call() instead of explicit "cd" - auto close using scope manager: "with xxx as yyy:" - os.path.exists() instead of os.access(mmod_path, os.F_OK) == False - extract paths containing ".." to variables Signed-off-by:
Tomasz Grabiec <tgrabiec@cloudius-systems.com> Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
Pekka Enberg authored
Move runtime creation of '/dev' to image creation to avoid bogus "unable to create /dev directory" error messages during boot. Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
Tomasz Grabiec authored
Looks like the serial console doesn't display anything until new line character is received. Looks like only when '\n' is written to the serial console QEMU displays the line. Signed-off-by:
Tomasz Grabiec <tgrabiec@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
The link system call currently keeps the dentry in the cache by avoiding calling drele on success. However, it's not the right thing as link creates the entry, not references it (much the same as create). Currently, link works ok, but subsequent calls on the same dentry would fail as its refcount would be wrong. Strangely, this problem didn't come up at the time the link syscall was implemented. Something that has been changed recently made this bug manifest. This patch fixes it. Signed-off-by:
Raphael S. Carvalho <raphaelsc@cloudius-systems.com> Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
- Nov 28, 2013
-
-
Pekka Enberg authored
Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
Pekka Enberg authored
Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
Pekka Enberg authored
Add a new virtio::probe() helper function to simplify virtio driver probing. Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
Nadav Har'El authored
Due to an unknown bug (bug in our HPET driver?), OSv crashed on our build machine with an assertion that the clock only goes foward. The clock jumping backward is a bad sign, but it's not really necessary to crash the VM when it happens, assuming it only happens rarely. This patch makes the scheduler handle time<0 just like time==0. Signed-off-by:
Nadav Har'El <nyh@cloudius-systems.com> Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
Raphael S. Carvalho authored
The undefined reference error only shows up when building OSv on debug mode (mode=debug): bsd/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.o: In function `zfs_setattr': bsd/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c:2529: undefined reference to `zfs_xvattr_set Signed-off-by:
Raphael S. Carvalho <raphaelsc@cloudius-systems.com> Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
- Nov 27, 2013
-
-
Nadav Har'El authored
We only open file descriptor 1 relatively late in our boot process (see vfs_init() in fs/vfs/main.cc). We would like to be able to use stdout (and C++'s std::cout) much earlier than that - examples include ACPI's information messages (before c9dadf2d) and our "--help" command line parameter. Before this patch, early writes to stdout almost work, but with a strange twist: They only write the string up to the last newline, and whatever is left is buffered until much later - when all those "string ends" are lumped together. The basis of Musl's stdio write mechanism is the "f->write()" method. It needs to write *two* things: Whatever we have buffered previously, and the new string given to it. __stdio_write() is the default implementation, which does this correctly using writev(). But our early implementation, __stdout_write only write the new string, and the buffered part remained buffered, collecting various string parts until it was finally flushed when we switched to the correct __stdio_write. This patch fixes __stdout_write(), to write both strings as expected. Fixes #104. Signed-off-by:
Nadav Har'El <nyh@cloudius-systems.com> Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
Nadav Har'El authored
Fix a couple of spelling mistakes in core/lfmutex.cc Signed-off-by:
Nadav Har'El <nyh@cloudius-systems.com> Signed-off-by:
Avi Kivity <avi@cloudius-systems.com>
-
Avi Kivity authored
Dumps virtio drivers and the state of their queues. Sample output: (gdb) osv info virtio virtio::virtio_net at 0xffffc0003ff0ec00 queue 0 at 0xffffc0003ff2ba00 avail g=0xbe09 h=0xbe09 (0) used h=0xbe09 g=0xbd11 (248) used notifications: enabled queue 1 at 0xffffc0003ff2bc00 avail g=0xc951 h=0xc951 (0) used h=0xc951 g=0xc8fd (84) used notifications: enabled queue 2 at 0xffffc0003ff2bd00 avail g=0x0 h=0x0 (0) used h=0x0 g=0x0 (0) used notifications: enabled virtio::virtio_blk at 0xffffc0003fefd400 queue 0 at 0xffffc0003fee5100 avail g=0x15f h=0x15f (0) used h=0x15f g=0x15f (0) used notifications: enabled Signed-off-by:
Avi Kivity <avi@cloudius-systems.com>
-
Tomasz Grabiec authored
There is a race between "usr.manifest" and "bootfs.manifest" rules which both call module.py. The script does complex stuff wrt module preparation like fetching module files, calling make, etc. and should not be run concurrently. This change fixes the problem by moving the calls into one rule. This is not the end of the story, more refactoring will follow. The module.py script should be split into parts, one that fetches modules and one that generates manifests. This way the dependencies could be made more fine grained and jobs paralellized. This fixes issue #100. Signed-off-by:
Tomasz Grabiec <tgrabiec@cloudius-systems.com> Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
Tomasz Grabiec authored
This allows to use these variables inside build.mk regardless of CWD and is more clear than a cascade of ".."s This change also unifies $(submake) and $(modulemk) generation to reduce duplication. Signed-off-by:
Tomasz Grabiec <tgrabiec@cloudius-systems.com> Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
Nadav Har'El authored
Add missing join() in tst-loadbalance, to avoid rare crashes during the test. Signed-off-by:
Nadav Har'El <nyh@cloudius-systems.com> Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
Nadav Har'El authored
This patch adds tst-scheduler.cc, containing a few tests for the fairness of scheduling of several threads on one CPU (for scheduling issues involving load-balancing across multiple CPUs, check out the existing tst-loadbalance). The test is written in standard C++11, so it can be compiled and run on both Linux and OSv, to compare their scheduler behaviors. It is actually more a benchmark then a test (it doesn't "succeed" or "fail"). The test begins with several tests of the long-term fairness of the schduler when threads of different or identical priorities are run for 10 seconds, and we look at how much work each thread got done in those 10 seconds. This test only works on OSv (which supports float priorities). The second part of the test again tests long-term fairness of the scheduler when all threads have the default priority (so this test is standard C++11): We run a loop which takes (when run alone) 10 seconds, on 2 or 3 threads in parallel. We expect to see that all 2 or 3 threads finish at (more-or-less) exactly the same time - after 20 or 30 seconds. Both OSv and Linux pass this test with flying colors. The third part of the test runs two different threads concurrently: 1. One thread wants to use all available CPU to loop for 10 seconds. 2. The second thread wants to loop in an amount that takes N milliseconds, and then sleep for N milliseconds, and so on, until completing the same number of loop iterations that (when run alone) takes 10 seconds. The "fair" behavior of the this test is that both threads get equal CPU time and finish together: Thread 2 runs for N milliseconds, then while it is sleeping for N more, Thread 1 gets to run. This measure this for N=1 through 32ms. In OSv's new scheduler, indeed both threads get an almost fair share (with N=32ms, one thread finishes in 19 seconds, the second in 21.4 seconds; we don't expect total fairness because of the runtime decay). Signed-off-by:
Nadav Har'El <nyh@cloudius-systems.com> Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
Avi Kivity authored
Allows longer tests to be run. Signed-off-by:
Avi Kivity <avi@cloudius-systems.com> Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
Avi Kivity authored
As detailed in [1], SO_REUSEADDR means slightly different things on BSD and Linux. One of the differences is in the treatment of sockets that are bound to addresses already occupied by existing sockets in the TIME_WAIT state; Linux allows the new socket if SO_REUSEADDR is set on it, while BSD refuses. Adjust the code to match the Linux behaviour. This allows multiple connection tests to pass, and will likely be required by other network intensive applications. [1] http://stackoverflow.com/questions/14388706/socket-options-so-reuseaddr-and-so-reuseport-how-do-they-differ-do-they-mean-t Signed-off-by:
Avi Kivity <avi@cloudius-systems.com> Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
Pekka Enberg authored
Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
Pekka Enberg authored
Nadav Har'El reports that tst-pipe.so starts to hang some of the time after commit c1d5fccb ("mmu: Anonymous memory demand paging"). Tracing page faults points to pthread stacks which are now demand faulted. Avi Kivity explains: It's a logical bug in our design. User code runs on mmap()ed stacks, then calls "kernel" code, which doesn't tolerate page faults (interrupts disabled, preemption disabled, already in the page fault path, whatever). Possible solutions: - insert "thunk code" between user and kernel code that switches the stacks to known resident stacks. We could abuse the elf linker code to do that for us, at run time. - use -fsplit-stack to allow a dynamically allocated, discontiguous stack on physical memory - use map_populate and live with the memory wastage Switch to map_populate as a stop-gap measure until OSv "kernel" code is able to deal with page faults. Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
Nadav Har'El authored
Fix the printout of runtime by "osv info threads" and "osv runqueue" debugger commands, to fit the new scheduler (different variable name, and it is float, not integer). Signed-off-by:
Nadav Har'El <nyh@cloudius-systems.com> Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-