Skip to content
Snippets Groups Projects
  1. Dec 19, 2013
  2. Dec 18, 2013
    • Tomasz Grabiec's avatar
      Make BSD code use hardware atomics · 2e0c30f4
      Tomasz Grabiec authored
      
      Currently we use implementation from
      bsd/sys/cddl/compat/opensolaris/kern/opensolaris_atomic.c
      which is using global mutex.
      
      This showes up on wait profile of ZFS writes:
      
      (...)
         \-- 469.96 us (0.00%, #250) arc_do_user_evicts
             \-- 469.96 us (0.00%, #250) dbuf_do_evict
                 |-- 355.93 us (0.00%, #154) dbuf_destroy
      (...)
                 |   \-- 76.60 us (0.00%, #53) zrl_add
                 |                             atomic_cas_32
                 |                             lockfree_mutex_lock
                 |                             sched::thread::wait()
                 |
                 |-- 66.14 us (0.00%, #56) dbuf_clear
                 |                         zrl_add
                 |                         atomic_cas_32
                 |                         lockfree_mutex_lock
                 |                         sched::thread::wait()
                 |
                 \-- 47.89 us (0.00%, #40) dbuf_rele_and_unlock
                                           atomic_add_64_nv
                                           lockfree_mutex_lock
                                           sched::thread::wait()
      
      This patch switches to amd64 implementation.
      
      Signed-off-by: default avatarTomasz Grabiec <tgrabiec@cloudius-systems.com>
      Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
      2e0c30f4
    • Asias He's avatar
      virtio-scsi: Initial support · c7e560f1
      Asias He authored
      
      This adds initial virtio-scsi support. We have no scsi layer in osv, in
      this implementation virtio-scsi works directly with the bio layer. It
      translates BIO_READ, BIO_WRITE and BIO_FLUSH to SCSI CMD.
      
      Signed-off-by: default avatarAsias He <asias@cloudius-systems.com>
      Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
      c7e560f1
  3. Dec 16, 2013
  4. Dec 15, 2013
  5. Dec 12, 2013
  6. Dec 11, 2013
    • Pekka Enberg's avatar
      x64: Make page fault handler arch specific · 43491705
      Pekka Enberg authored
      
      Simplify core/mmu.cc and make it more portable by moving the page fault
      handler to arch/x64/mmu.cc.  There's more arch specific code in
      core/mmu.cc that should be also moved.
      
      Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
      43491705
    • Amnon Heiman's avatar
      random: Separate device node from virtio-rng · 2752a285
      Amnon Heiman authored
      
      Separate /dev/random the virtio-rng driver and register virtio-rng as a
      HW RNG entropy source.
      
      Signed-off-by: default avatarAmnon Heiman <amnon@cloudius-systems.com>
      Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
      2752a285
    • Nadav Har'El's avatar
      Rename blacklisted tests · 4e4e191f
      Nadav Har'El authored
      
      Rename blacklisted tests, from tst-wake.cc et al. to misc-wake.cc.
      
      The different name will cause these tests not to be automatically run
      by "make check" - without needing the separate blacklist in test.py
      (which this patch deletes).
      After this patch, testrunner.so will also only run tests called tst-*,
      so will not run the misc-* tests.
      
      The misc-* tests can still be run manually, e.g.,
        run.py -e tests/misc-mutex.so
      
      In addition to the previously blacklisted tests, this patch "blacklists"
      (renames) a few additional tests which fail quickly, but test.py didn't
      know because they didn't use the word "fail". An example is tst-schedule.so,
      which existed immediately when not run on 1 vcpu. So this patch also
      renames it to misc-schedule.so, so "make check" or testrunner.so won't
      run this test.
      
      Note that after this patch, testrunner.so is a new way to run all tests,
      but it isn't working well yet because it still exposes new bugs that do not
      exist in the separate tests (depending on your view point, this might be
      considered a feature, not a bug, in testrunner.so...).
      
      Signed-off-by: default avatarNadav Har'El <nyh@cloudius-systems.com>
      Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
      4e4e191f
  7. Dec 10, 2013
    • Nadav Har'El's avatar
      Fix wrong error codes in unlink(), rmdir() and readdir() · 86b5374f
      Nadav Har'El authored
      
      This patch fixes the error codes in four error cases:
      
      1. unlink() of a directory used to return EPERM (as in Posix), and now
         returns EISDIR (as in Linux).
      
      2. rmdir() of a non-empty directory used to return EEXIST (as in Posix)
         and now returns ENOTEMPTY (as in Linux).
      
      3. rmdir() of a regular file (non-directory) used to return EBADF
         and now returns ENOTDIR (as in Linux).
      
      4. readdir() of a regular file (non-directory) used to return EBADF
         and now returns ENOTDIR (as in Linux).
      
      This patch also adds a test, tst-remove.cc, for the various unlink() and
      rmdir() success and failure modes.
      
      Fixes #123.
      
      Signed-off-by: default avatarNadav Har'El <nyh@cloudius-systems.com>
      Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
      86b5374f
  8. Dec 09, 2013
  9. Dec 08, 2013
  10. Dec 06, 2013
  11. Dec 04, 2013
    • Tomasz Grabiec's avatar
      modules: Add support for run configurations · ccc51b6f
      Tomasz Grabiec authored
      
          == Description of the problem ==
      
      Currently modules can only specify files which need to be
      copied. There is a need for a module to also declare ways it can be
      run, so that we can automatically prepare a runnable image. It
      should be easy to switch between run configurations.
      
      Currently it is enough for image configuration to happen at the
      time of image make process. In future this should be allowed
      on the already built image.
      
      We also need to be able to combine multiple modules in one
      image. For example in addition to the main application one might want
      to start various services like CLI, management API server, etc.
      
      Java apps should be able to specify JVM arguments, which must be
      passed to the JVM upon its creation, as well as regular run-java
      arguments (classpath, main classes, main arguments, etc.)
      
          == Solution ==
      
      This is not intended to be a permanent solution. The aim is to solve
      immediate need to have a fully modularized build in a scalable way.
      
      Every module has a new kind of file in its root directory which
      holds its configuration. The file is named 'module.py' and is
      a python script which uses osv's api for declaring run configurations.
      
      Using python as config language has several advantages:
       - more expresiveness, unlike json it allows for expression reuse
       - it's easier to extend the config language
       - we don't need as much parsing, gluing, error checking, error
         reporting code because we have it already
      
      There are currently two kinds of applications which can be declared:
      
         run(cmdline)  <- basic .so application
         run_java(jvm_args=[], classpath=[], args=[])  <- java applications
      
      Run configurations can be declared as simple module attributes
      which can be referenced from the image configuration file.
      
      Image configuration
      
      There is a new configuration file kind, which defines which modules
      and which run configurations should be included in the image. Files
      are located using path: ${OSV_BASE}/images/$(image-name).py
      
      Syntax:
      
        require(module) <-- declares that module should be included in the image
        		      and returns an object which allows to access module's
      		      attributes.
      
        run = []  <-- list of run configurations
      
      Example:
      
        _mgmt = require('mgmt')
        run = [ _mgmt.shell ]
      
      To use a particular image configuration run make like this:
      
        make image=fancy-tomcat
      
      The default configuration is named 'default'.
      
      This patch extracts mgmt into a module, which is embedded under
      ${OSV_BASE}/modules/mgmt
      
      The purpose of ${OSV_BASE}/config.json has been changed. It does not
      list modules which should be included anymore, image config file does
      that. It's a module look-up configuration which tells the build where
      to look for modules.
      
      Signed-off-by: default avatarTomasz Grabiec <tgrabiec@cloudius-systems.com>
      Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
      ccc51b6f
    • Asias He's avatar
      build.mk: Rename usr.raw to bare.raw · 8197a553
      Asias He authored
      
      We have an intermediate bare.img now. Rename usr.raw to bare.raw to make the
      naming more consistent: bare.raw -> bare.img -> usr.img.
      
      Signed-off-by: default avatarAsias He <asias@cloudius-systems.com>
      Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
      8197a553
  12. Dec 03, 2013
  13. Dec 01, 2013
    • Pekka Enberg's avatar
      tests: tst-random.so · 5eb1522d
      Pekka Enberg authored
      
      Add a simple test case for "/dev/random" which just reads from the file
      and prints out the random bytes.
      
      Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
      5eb1522d
    • Pekka Enberg's avatar
      virtio: Add virtio-rng driver · fd1be662
      Pekka Enberg authored
      
      This adds the virtio-rng driver to OSv.  The implementation is simple:
      
        - Start a thread that keeps 64 byte of entropy cached in internal
          buffer.  Entropy is gathered from the host with virtio-rng.
      
        - Create device nodes for "/dev/random" and "/dev/urandom" that both
          use the same virtio_rng_read() hook.
      
        - Use the entropy buffer for virtio_rng_read().  If we exhaust the
          buffer, wake up the thread and wait for more entropy to appear.
      
      We eventually should move device node creation to separate
      drivers/random.c that multiplexes between different hardware RNG
      implementations.  However, as we only support virtio-rng, I'm leaving
      that to whomever implements support for the next RNG.
      
      Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
      fd1be662
  14. Nov 29, 2013
  15. Nov 27, 2013
    • Tomasz Grabiec's avatar
      build.mk: process modules in one rule · c3f1f15c
      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: default avatarTomasz Grabiec <tgrabiec@cloudius-systems.com>
      Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
      c3f1f15c
    • Nadav Har'El's avatar
      Test for scheduler's single-CPU fairness. · a8c2fea7
      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: default avatarNadav Har'El <nyh@cloudius-systems.com>
      Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
      a8c2fea7
  16. Nov 26, 2013
  17. Nov 25, 2013
    • Amnon Heiman's avatar
      Start up shell and management web in parallel · c29222c6
      Amnon Heiman authored
      
      Start up shell and management web in parallel to make boot faster.  Note
      that we also switch to latest mgmt.git which decouples JRuby and CRaSH
      startup.
      
      Signed-off-by: default avatarAmnon Heiman <amnon@cloudius-systems.com>
      Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
      c29222c6
    • Pekka Enberg's avatar
      tests: Anonymous demand paging microbenchmark · d4bcf559
      Pekka Enberg authored
      
      This adds a simple mmap microbenchmark that can be run on both OSv and
      Linux.  The benchmark mmaps memory for various sizes and touches the
      mmap'd memory in 4K increments to fault in memory.  The benchmark also
      repeats the same tests using MAP_POPULATE for reference.
      
      OSv page faults are slightly slower than Linux on first iteration but
      faster on subsequent iterations after host operating system has faulted
      in memory for the guest.
      
      I've included full numbers on 2-core Sandy Bridge i7 for a OSv guest,
      Linux guest, and Linux host below:
      
        OSv guest
        ---------
      
        Iteration 1
      
             time (seconds)
         MiB demand populate
           1 0.004  0.000
           2 0.000  0.000
           4 0.000  0.000
           8 0.001  0.000
          16 0.003  0.000
          32 0.007  0.000
          64 0.013  0.000
         128 0.024  0.000
         256 0.052  0.001
         512 0.229  0.002
        1024 0.587  0.005
      
        Iteration 2
      
             time (seconds)
         MiB demand populate
           1 0.001  0.000
           2 0.000  0.000
           4 0.000  0.000
           8 0.001  0.000
          16 0.002  0.000
          32 0.004  0.000
          64 0.010  0.000
         128 0.019  0.001
         256 0.036  0.001
         512 0.069  0.002
        1024 0.137  0.005
      
        Iteration 3
      
             time (seconds)
         MiB demand populate
           1 0.001  0.000
           2 0.000  0.000
           4 0.000  0.000
           8 0.001  0.000
          16 0.002  0.000
          32 0.005  0.000
          64 0.010  0.000
         128 0.020  0.000
         256 0.039  0.001
         512 0.087  0.002
        1024 0.138  0.005
      
        Iteration 4
      
             time (seconds)
         MiB demand populate
           1 0.001  0.000
           2 0.000  0.000
           4 0.000  0.000
           8 0.001  0.000
          16 0.002  0.000
          32 0.004  0.000
          64 0.012  0.000
         128 0.025  0.001
         256 0.040  0.001
         512 0.082  0.002
        1024 0.138  0.005
      
        Iteration 5
      
             time (seconds)
         MiB demand populate
           1 0.001  0.000
           2 0.000  0.000
           4 0.000  0.000
           8 0.001  0.000
          16 0.002  0.000
          32 0.004  0.000
          64 0.012  0.000
         128 0.028  0.001
         256 0.040  0.001
         512 0.082  0.002
        1024 0.166  0.005
      
        Linux guest
        -----------
      
        Iteration 1
      
             time (seconds)
         MiB demand populate
           1 0.001  0.000
           2 0.001  0.000
           4 0.002  0.000
           8 0.003  0.000
          16 0.005  0.000
          32 0.008  0.000
          64 0.015  0.000
         128 0.151  0.001
         256 0.090  0.001
         512 0.266  0.003
        1024 0.401  0.006
      
        Iteration 2
      
             time (seconds)
         MiB demand populate
           1 0.000  0.000
           2 0.000  0.000
           4 0.001  0.000
           8 0.001  0.000
          16 0.002  0.000
          32 0.005  0.000
          64 0.009  0.000
         128 0.019  0.001
         256 0.037  0.001
         512 0.072  0.003
        1024 0.144  0.006
      
        Iteration 3
      
             time (seconds)
         MiB demand populate
           1 0.000  0.000
           2 0.001  0.000
           4 0.001  0.000
           8 0.001  0.000
          16 0.002  0.000
          32 0.005  0.000
          64 0.010  0.000
         128 0.019  0.001
         256 0.037  0.001
         512 0.072  0.003
        1024 0.143  0.006
      
        Iteration 4
      
             time (seconds)
         MiB demand populate
           1 0.000  0.000
           2 0.001  0.000
           4 0.001  0.000
           8 0.001  0.000
          16 0.003  0.000
          32 0.005  0.000
          64 0.010  0.000
         128 0.020  0.001
         256 0.038  0.001
         512 0.073  0.003
        1024 0.143  0.006
      
        Iteration 5
      
             time (seconds)
         MiB demand populate
           1 0.000  0.000
           2 0.001  0.000
           4 0.001  0.000
           8 0.001  0.000
          16 0.003  0.000
          32 0.005  0.000
          64 0.010  0.000
         128 0.020  0.001
         256 0.037  0.001
         512 0.072  0.003
        1024 0.144  0.006
      
        Linux host
        ----------
      
        Iteration 1
      
             time (seconds)
         MiB demand populate
           1 0.000  0.000
           2 0.001  0.000
           4 0.001  0.000
           8 0.001  0.000
          16 0.002  0.000
          32 0.005  0.000
          64 0.009  0.000
         128 0.019  0.001
         256 0.035  0.001
         512 0.152  0.003
        1024 0.286  0.011
      
        Iteration 2
      
             time (seconds)
         MiB demand populate
           1 0.000  0.000
           2 0.000  0.000
           4 0.001  0.000
           8 0.001  0.000
          16 0.002  0.000
          32 0.004  0.000
          64 0.010  0.000
         128 0.018  0.001
         256 0.035  0.001
         512 0.192  0.003
        1024 0.334  0.011
      
        Iteration 3
      
             time (seconds)
         MiB demand populate
           1 0.000  0.000
           2 0.000  0.000
           4 0.001  0.000
           8 0.001  0.000
          16 0.002  0.000
          32 0.004  0.000
          64 0.010  0.000
         128 0.018  0.001
         256 0.035  0.001
         512 0.194  0.003
        1024 0.329  0.011
      
        Iteration 4
      
             time (seconds)
         MiB demand populate
           1 0.000  0.000
           2 0.000  0.000
           4 0.001  0.000
           8 0.001  0.000
          16 0.002  0.000
          32 0.004  0.000
          64 0.010  0.000
         128 0.018  0.001
         256 0.036  0.001
         512 0.138  0.003
        1024 0.341  0.011
      
        Iteration 5
      
             time (seconds)
         MiB demand populate
           1 0.000  0.000
           2 0.000  0.000
           4 0.001  0.000
           8 0.001  0.000
          16 0.002  0.000
          32 0.004  0.000
          64 0.010  0.000
         128 0.018  0.001
         256 0.035  0.001
         512 0.135  0.002
        1024 0.324  0.011
      
      Reviewed-by: default avatarGlauber Costa <glommer@cloudius-systems.com>
      Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
      d4bcf559
  18. Nov 21, 2013
  19. Nov 14, 2013
  20. Nov 13, 2013
  21. Nov 11, 2013
  22. Nov 07, 2013
  23. Nov 05, 2013
  24. Nov 04, 2013
Loading