Skip to content
Snippets Groups Projects
  1. Dec 01, 2013
  2. Nov 29, 2013
  3. Nov 28, 2013
  4. Nov 27, 2013
    • Nadav Har'El's avatar
      Fix boot-time stdout support · ad46be1b
      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: default avatarNadav Har'El <nyh@cloudius-systems.com>
      Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
      ad46be1b
    • Nadav Har'El's avatar
      Trivial: typos in core/lfmutex.cc · d2c488b7
      Nadav Har'El authored
      
      Fix a couple of spelling mistakes in core/lfmutex.cc
      
      Signed-off-by: default avatarNadav Har'El <nyh@cloudius-systems.com>
      Signed-off-by: default avatarAvi Kivity <avi@cloudius-systems.com>
      d2c488b7
    • Avi Kivity's avatar
      gdb: add 'osv info virtio' · 046e717f
      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: default avatarAvi Kivity <avi@cloudius-systems.com>
      046e717f
    • 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
    • Tomasz Grabiec's avatar
      Makefile: use abolute paths in generated variables · e54778d5
      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: default avatarTomasz Grabiec <tgrabiec@cloudius-systems.com>
      Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
      e54778d5
    • Nadav Har'El's avatar
      Test: Small bugfix for tst-loadbalance · 3f494068
      Nadav Har'El authored
      
      Add missing join() in tst-loadbalance, to avoid rare crashes during the
      test.
      
      Signed-off-by: default avatarNadav Har'El <nyh@cloudius-systems.com>
      Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
      3f494068
    • 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
    • Avi Kivity's avatar
      tst-tcp: set SO_REUSEADDR · 63a99d22
      Avi Kivity authored
      
      Allows longer tests to be run.
      
      Signed-off-by: default avatarAvi Kivity <avi@cloudius-systems.com>
      Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
      63a99d22
    • Avi Kivity's avatar
      net: adjust SO_REUSEADDR to match Linux semantics · 67219137
      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: default avatarAvi Kivity <avi@cloudius-systems.com>
      Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
      67219137
    • Pekka Enberg's avatar
      test.py: add tst-pipe.so · 8cf576ca
      Pekka Enberg authored
      
      Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
      8cf576ca
    • Pekka Enberg's avatar
      pthread: Populate mmap'd stack pages · 41efdc1c
      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: default avatarPekka Enberg <penberg@cloudius-systems.com>
      41efdc1c
    • Nadav Har'El's avatar
      gdb: Fix printout of runtime · 54ad72e4
      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: default avatarNadav Har'El <nyh@cloudius-systems.com>
      Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
      54ad72e4
Loading