- Jan 27, 2014
-
-
Nadav Har'El authored
Drop the nanotime() function. Change the few remaining callers to use the appropriate osv::clock or std::chrono replacements. We already got rid in previous patches of most references to nanotime() by switching from absolute times to relative times. The direct equivalent of the old nanotime() function, where we actually need the number of nanoseconds since the UNIX epoch, is the rather verbose expression osv::clock::wall::now().time_since_epoch().count(), or the shorter clock::get()->time(). Reviewed-by:
Glauber Costa <glommer@cloudius-systems.com> Signed-off-by:
Nadav Har'El <nyh@cloudius-systems.com> Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
Nadav Har'El authored
Drop the s64 literals _ms, _ns, etc., from <drivers/clock.hh>. Fix a few places which still use the old literals. The std:chrono::duration version from <osv/clock.hh> remains - but remember you need to "using namespace osv::clock::literals" to use them. Reviewed-by:
Glauber Costa <glommer@cloudius-systems.com> Signed-off-by:
Nadav Har'El <nyh@cloudius-systems.com> Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
Nadav Har'El authored
Delete the sched::thread::sleep_until() function. All users of this function actually wanted a relative time, not absolute time, and can use the simpler new sched::thread::sleep() instead. Reviewed-by:
Glauber Costa <glommer@cloudius-systems.com> Signed-off-by:
Nadav Har'El <nyh@cloudius-systems.com> Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
Nadav Har'El authored
Currently, OSv's sched::timer mechanism supports only the wall clock clock::get()->time(). In the following patches, we intend to support both wall-clock and monotonic clock in timers, but only keep a single list of timers (using the monotonic clock). For this, we need a way to convert wall-clock time to monotonic uptime. This patch adds to the clock driver a function clock::boot_time() which returns the current offset between the wall time and the uptime, i.e., the current estimate of the wall time at boot. Note that this estimate can change if the wall time is adjusted (in the host, since OSv currently has no mechanism for adjusting the clock from within). Reviewed-by:
Glauber Costa <glommer@cloudius-systems.com> Signed-off-by:
Nadav Har'El <nyh@cloudius-systems.com> Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
Nadav Har'El authored
In the previous patch we built clock_event::set(s64) on top of set(duration). In this patch we add set(timepoint), for absolute time in any clock supporting the now() static method. In the following patches, we'll convert our timers to using the monotonic clock osv::clock::uptime, and use timepoints of that clock in calls to clock_event::set(). By temporarily having both s64 and std::chrono:time_point versions of set(), we make this patch series bisectable. At the end of this series, the s64 variant will be removed. Reviewed-by:
Glauber Costa <glommer@cloudius-systems.com> Signed-off-by:
Nadav Har'El <nyh@cloudius-systems.com> Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
Nadav Har'El authored
OSv's timer mechanism hinges on the Local APIC's (per-cpu) one-shot timer, which delivers an interrupt after the requested number of nanoseconds. The API to set this timer, clock_event::set(), took the absolute time of the next interrupt. However, what it really needs is the duration in nanoseconds until the next interrupt. So this patch we change the basic clock_event::set() API to take a duration, and implement the original clock_event::set(s64) - taking an s64 absolute wall-clock time - as a simple wrapper. The next patch will add more wrappers for set() taking absolute times from different clocks. Later patches in this series will stop using the old set(s64) version, until it is dropped in the end of the series. Reviewed-by:
Glauber Costa <glommer@cloudius-systems.com> Signed-off-by:
Nadav Har'El <nyh@cloudius-systems.com> Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
Nadav Har'El authored
Several source files include <drivers/clockevent.hh>, though this is a very low-level feature which they don't actually use. sched.cc does use <drivers/clockevent.hh>, but already gets it through sched.hh, so also doesn't need to include it explicitly. This patch removes the unnecessary includes. Reviewed-by:
Glauber Costa <glommer@cloudius-systems.com> Signed-off-by:
Nadav Har'El <nyh@cloudius-systems.com> Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
- Jan 22, 2014
-
-
Pekka Enberg authored
Move definitions from <debug.h> to <osv/debug.h> and update includes to use the latter. Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
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
Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
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
Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
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
Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
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
Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
- Jan 20, 2014
-
-
Asias He authored
The check is moved to bdev_read and bdev_write. Signed-off-by:
Asias He <asias@cloudius-systems.com> Signed-off-by:
Avi Kivity <avi@cloudius-systems.com>
-
Asias He authored
setup_features() is called twice, once in virtio_driver constructor and once in virtio device driver constructor. Doing it in driver constructor is enough. Signed-off-by:
Asias He <asias@cloudius-systems.com> Signed-off-by:
Avi Kivity <avi@cloudius-systems.com>
-
Asias He authored
This would be useful for device with mmio bar, e.g. AHCI controller. Signed-off-by:
Asias He <asias@cloudius-systems.com> Signed-off-by:
Avi Kivity <avi@cloudius-systems.com>
-
- Jan 16, 2014
-
-
Takuya ASADA authored
isa-serial.hh don't need to include vga.hh, but it's required on console.cc, so move it. Signed-off-by:
Takuya ASADA <syuu@cloudius-systems.com> Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
- Jan 15, 2014
-
-
Eduardo Piva authored
Change some printf calls on boot messages, so it will call the apropriate debug function. This will enable OSv to operate on silent mode. Added debug.h header so we can link debug functions to C files. Fixes #118 Signed-off-by:
Eduardo Piva <efpiva@gmail.com> Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
Nadav Har'El authored
Our clock::time() function returns the current wall-clock time (number of nanoseconds since the Unix epoch). We never clearly documented this, so this patch adds this documentation. Moreover, in kvmclock, we assumed that the host never adjusts its wall-clock time, which is not a good assumption because it prevents us from benefiting from NTP running on the host. As Avi Kivity explains: "For the wall clock, you need to sample the wall clock base every time, since it can be changed by the host." So this patch changes kvmclock::time() to sample the wall-clock-at-boot reported by the paravirtual clock, on every time() call, and not just once. The downsite of this patch is that clock::get::time(), and therefore nanotime(), become a bit slower on kvmclock, as they need to sample the wall_clock_boot() every time, require a couple of barriers and arithmetic operations. But note that we shouldn't even be using the non-monotonic clock::get::time() for our timers - we should be using the monotonic clock::get::uptime() - and when we switch to using that we'll get back the bit of performance lost in this patch. Signed-off-by:
Nadav Har'El <nyh@cloudius-systems.com> Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
- Jan 10, 2014
-
-
Pekka Enberg authored
I messed up in commit cc6b3a3c ("vga: Handle line feed"). Clean it up. Reported-by:
Nadav Har'El <nyh@cloudius-systems.com> Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
Takuya ASADA authored
Add --vga on cmdline, to switch vga console. Reviewed-by:
Nadav Har'El <nyh@cloudius-systems.com> Signed-off-by:
Takuya ASADA <syuu@cloudius-systems.com> Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
Takuya ASADA authored
To use VGAConsole class, add empty input_ready() and readch(). Signed-off-by:
Takuya ASADA <syuu@cloudius-systems.com> Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
Takuya ASADA authored
Handle line feed in the VGA. To access termios flag, add a constructor. Signed-off-by:
Takuya ASADA <syuu@cloudius-systems.com> Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
Takuya ASADA authored
Physical memory base address is 0xffffc00000000000, so VGA base address should be 0xffffc000000b8000. Reviewed-by:
Nadav Har'El <nyh@cloudius-systems.com> Signed-off-by:
Takuya ASADA <syuu@cloudius-systems.com> Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
Takuya ASADA authored
On VMware, pci_readw(PCI_CFG_DEVICE_ID) returns the *vendor ID*. pci_readw(PCI_CFG_VENDOR_ID) returns vendor ID as well. Compare to FreeBSD implementation of read/write PCI config space, FreeBSD masks lower bit of offset when write to PCI_CONFIG_ADDRESS, and adds lower bit of offset to PCI_CONFIG_DATA. http://fxr.watson.org/fxr/source/amd64/pci/pci_cfgreg.c#L206 This patch changes accessing method in OSv to the FreeBSD way. Tested on QEMU/KVM and VMware. Reviewed-by:
Glauber Costa <glommer@cloudius-systems.com> Signed-off-by:
Takuya ASADA <syuu@cloudius-systems.com> Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
Nadav Har'El authored
This patch starts to solve both issue #142 ("Support MONOTONIC_CLOCK") and issue #81 (use <chrono> for time). First, it adds an uptime() function to the "clock" interface, and implements it for kvm/xen/hpet by returning the system time from which we subtract the system time at boot (but not adding any correction for wallclock). Second, it adds a new std::chrono-based interface to this clock, in a new header file <osv/clock.hh>. Instead of the old-style clock::get()->uptime(), one should prefer osv::clock::uptime::now(). This returns a std::chrono::time_point which is type-safe, in the sense that: 1. It knows what its epoch is (i.e., that it belongs to osv::clock::uptime), and 2. It knows what its units are (nanoseconds). This allows the compiler to prevent a user from confusing measurements from this clock with those from other clocks, or making mistakes in its units. Third, this patch implements clock_gettime(MONOTONIC_CLOCK), using the new osv::clock::uptime::now(). Note that though the new osv::clock::uptime is almost identical to std::chrono::steady_clock, they should not be confused. The former is actually OSv's implementation of the latter: steady_clock is implemented by the C++11 standard library using the Posix clock_gettime, and that is implemented (in this patch) using osv::clock::uptime. With this patch, we're *not* done with either issues #142 or #81. For issue #142, i.e., for supporting MONOTONIC_CLOCK in timerfd, we need OSv's timers to work on uptime(), not on clock::get()->time(). For issue #81, we should add a osv::clock::wall type too (similar to what clock::get()->time() does today, but more correctly), and use either osv::clock::wall or osv::clock::uptime everywhere that clock::get()->time() is currently used in the code. clock::get()->time() should be removed. Reviewed-by:
Glauber Costa <glommer@cloudius-systems.com> Signed-off-by:
Nadav Har'El <nyh@cloudius-systems.com> Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
- Jan 07, 2014
-
-
Nadav Har'El authored
In very early OSv history, the spinlock was used in the mutex's implementation so it made sense to put it in mutex.cc and mutex.h. But now that the spinlock is all that's left in mutex.cc (the real mutex is in lfmutex.cc), rename this file spinlock.cc. Also, move the spinlock definitions from <osv/mutex.h> to a new <osv/spinlock.h>, so if someone wants to make the grave mistake of using a spinlock - they will at least need to explicitly include this header file. Currently, the only remaining user of the spinlock is the console. Using a spinlock (and not a mutex) in the console allows printing debug messages while preemption is disabled. Arguably, this use-case is no longer important (we have tracepoints), so in the future we can consider dropping the spinlock completely. Signed-off-by:
Nadav Har'El <nyh@cloudius-systems.com> Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
- Jan 01, 2014
-
-
Nadav Har'El authored
Each implementation of "struct file" needs to implement 8 different file operations. Most special file implementations, such as pipe, socketpair, epoll and timerfd, don't support many of these operations. We had in unsupported.h functions that can be reused for the unsupported operation, but this resulted in a lot of ugly boiler-plate code. Instead, this patch switches to a cleaner, more C++-like, method: It defines a new "file" subclass, called "special_file", which implements all file operations except close(), with a default implementation identical to the old unsupported.h implementations. The files of pipe(), socketpair(), timerfd() and epoll_create() now inherit from special_file, and only override the file operations they really want to implement. Signed-off-by:
Nadav Har'El <nyh@cloudius-systems.com> Signed-off-by:
Avi Kivity <avi@cloudius-systems.com>
-
- Dec 31, 2013
-
-
Tomasz Grabiec authored
Useful for tracing virtio queue utilization issues. To get plottable data: 1. Save traces to gdb.txt 2. grep virtio_add_buf gdb.txt | grep "queue=0" \ | awk '{print $3 " " $6}' | sed -r 's/avail=(.*)/\1/' Signed-off-by:
Tomasz Grabiec <tgrabiec@cloudius-systems.com> Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
Tomasz Grabiec authored
Clean up virtio-vring.hh and move add_buf_wait() out of line. Benefits: - Plays well with tracepoints - Less recompilation when code is changed Signed-off-by:
Tomasz Grabiec <tgrabiec@cloudius-systems.com> Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
- Dec 30, 2013
-
-
Avi Kivity authored
The current initialization is to something like 5 bit words, which truncates everything to control characters on VMware. QEMU somehow ignores the word size. Fix to initialize the serial port to 8N1, yielding useful output. Signed-off-by:
Avi Kivity <avi@cloudius-systems.com>
-
- Dec 27, 2013
-
-
Pekka Enberg authored
Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-
Pekka Enberg authored
Start using tprintf as in drivers/pci.cc, for example, and switch to 'error' severity to disable early boot ACPI messages. Eventually, core/debug.cc needs to be more dynamically configured but for now it's good enough to use a standardized API and make the output silent by default. Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
-