Skip to content
Snippets Groups Projects
  1. Oct 10, 2013
    • Avi Kivity's avatar
      build: define _KERNEL everywhere · 95ce17e3
      Avi Kivity authored
      We have _KERNEL defines scattered throughout the code, which makes
      understanding it difficult.
      
      Define it just once, and adjust the source to build.
      
      We define it in an overridable variable, so that non-kernel imported code
      can undo it.
      95ce17e3
  2. Oct 08, 2013
  3. Oct 07, 2013
  4. Oct 03, 2013
  5. Sep 29, 2013
    • Nadav Har'El's avatar
      Add kill() support - sort of · b9ed15c2
      Nadav Har'El authored
      
      This patch adds support for the Linux kill(2) function.
      The next patch will add alarm(2) support, which uses kill(2).
      
      To be honest, we sort-of implement kill(). This implementation is
      compatible with the API, but the semantics are somewhat different:
      While in Linux kill() causes the signal handler to run on one of the
      existing threads, in this implementation, the signal handler is run in a
      *new* thread.
      
      Implementing the exact Linux semantics in OSv would require tracking when
      OSv runs kernel code (i.e., code in the main executable, not a shared
      object) so we can delay running the signal handler until returning to the
      user code. Moreover, we'll need to be able to interrupt sleeping kernel
      code. This is complicated and adds overhead even if signals aren't used
      (and they aren't used in most modern code).
      
      I expect that this code will be "good enough" in many use cases.
      This code will *not* be good in enough in programs that expect one of the
      following:
      
      1. A program that by using Posix Thread's "signal masks" tried to ensure
         that the signal is delivered to one specific thread, and not to an
         arbitrary thread.
      
      2. A program that used kill() or alarm() not intending to run a signal
         handler, but rather intending to interrupt a sleeping system call
         like sleep() or read(). Our kill() does not interrupt sleeping OSv
         function calls, which will continue to sleep on the thread they run
         on.
      
      The support in this patch (and see next patch, for alarm()) is good
      enough for netperf's use of alarm().
      
      P.S. kill() can be used only to send a signal to the current process, the
      only process we have in OSv (you can also use pid=0 and pid=-1 to achieve
      the same results).
      
      This patch also adds a test for kill() and alarm(). The alarm() test
      will fail until the next patch :-)
      
      Signed-off-by: default avatarNadav Har'El <nyh@cloudius-systems.com>
      b9ed15c2
  6. Sep 26, 2013
  7. Sep 24, 2013
    • Nadav Har'El's avatar
      Move statement to appease Coverity · 7a6a3291
      Nadav Har'El authored
      
      Coverity thinks we have a use-before-assigned of r2 here, despite the
      join(), so let's just move the test inside the thread to make this
      warning go away.
      
      Signed-off-by: default avatarNadav Har'El <nyh@cloudius-systems.com>
      7a6a3291
    • Nadav Har'El's avatar
      Change pipe event from POLLRDHUP to POLLERR|POLLOUT · f6d134bc
      Nadav Har'El authored
      
      We used to return the POLLRDHUP event when polling a write-side of a pipe
      whose reader is closed, but Linux returns POLLERR|POLLOUT, so let's do
      the same.
      
      Linux's behavior can be explained in that when the reader is closed, a write
      will return immediately (and hence POLLOUT) but moreover, will return with
      an error (EPIPE). And since a read will also cause an error (EBADF when
      reading on the write side of the pipe), a POLLERR makes sense and says
      that any operation on this fd will now result in an error.
      
      This patch also adds a test for this case.
      
      Signed-off-by: default avatarNadav Har'El <nyh@cloudius-systems.com>
      f6d134bc
    • Nadav Har'El's avatar
      Fix POLLHUP in pipes · 35117245
      Nadav Har'El authored
      
      The code in pipe_buffer.cc had the meaning of POLLHUP and POLLRDHUP
      reversed, and as a result POLLHUP wasn't correctly returned when polling
      a read-end of the pipe whose write-end is closed.
      
      This fixes the mixup, and as a result the test added to tst-pipe.cc in
      the previous commit, and also another one added in this patch, all pass.
      
      We are still incompatible with Linux with what we do regarding POLLRDHUP.
      This will be a separate patch.
      
      Signed-off-by: default avatarNadav Har'El <nyh@cloudius-systems.com>
      35117245
    • Nadav Har'El's avatar
      Fix missing poll() wakeup on POLLHUP · 554e80f6
      Nadav Har'El authored
      
      Our poll_wake() code ignored calls with the POLLHUP event, because
      the user did not explicitly ask for this event. This causes a poll()
      waiting on read from a pipe whose write side closes not to wake up.
      
      This patch adds a test for this case in tst-pipe.cc, and fixes the
      bug by adding to the poll structure's _events also ~POLL_REQUESTABLE,
      i.e., any bits which do not have to be explicitly requested by the
      user (POLL_REQUESTABLE is a new macro defined in this patch).
      
      After this patch, poll() wakes as needed in the test (instead of just
      hang), but returns the wrong event because of another bug which will
      be fixed in a separate patch.
      
      Signed-off-by: default avatarNadav Har'El <nyh@cloudius-systems.com>
      554e80f6
  8. Sep 20, 2013
    • Nadav Har'El's avatar
      Tests: add trivial sleep test · ade5bc3e
      Nadav Har'El authored
      
      Add a trivial sleep() test, which sleep()s for 2 seconds, and verifies
      that this finishes and has slept for roughly 2 seconds.
      
      I used this for debugging issue #26 - the attempts there ruined timers,
      and in particular this trivial test hangs, as sleep() never returns.
      
      (A note to our future automatic testing implementor: We need to allow
      for the possibility that a test doesn't cleanly fail, but rather hangs,
      and consider this a failure too).
      
      Signed-off-by: default avatarNadav Har'El <nyh@cloudius-systems.com>
      ade5bc3e
  9. Sep 19, 2013
    • Benoît Canet's avatar
      Test: Add a DNS resolver test · 2a1064ce
      Benoît Canet authored
      
      This regression test trigger issue #8
      "Make Java InetAddress.getHostName() work" by exercising the DNS
      resolver on localhost and a dns root server.
      
      The test takes care of specifying NI_NOFQDN to resolve only the
      hostname part of localhost ip.
      
      It appears that the DNS ip is not communicated to the libc by
      core/dhcp.cci: /etc/resolv.conf is not filled.
      
      Test contributed while waiting for an fix idea to implement.
      
      Signed-off-by: default avatarBenoit Canet <benoit@irqsave.net>
      Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
      2a1064ce
  10. Sep 15, 2013
  11. Sep 12, 2013
    • Guy Zana's avatar
      improve tcp-hash cli/srv test · 3109fd93
      Guy Zana authored
      3109fd93
    • Nadav Har'El's avatar
      Test: cpu load balancing test · b255c259
      Nadav Har'El authored
      This is a test for the effectiveness of our scheduler's load balancing while
      running several threads on several cpus.
      
      A full description of the test and its expected results is included in
      comments in the beginning of the code. but briefly, the test runs multiple
      concurrent busy-loop threads, and an additional "intermittent" thread (one that
      busy-loops for a short duration, and then sleeps), and expects that all busy
      threads will get their fair share of the CPU, and the intermittent thread
      won't bother them too much.
      
      Testing the current code, this tests demonstrates the following problems
      we have:
      
      1. Two busy-loop threads on 2 cpus are 5%-10% slower than just one.
         This is not kernel overhead (profiling show 100% of the time in the
         test's inner loop), and I see exactly the slowdown when running this
         test on the Linux host, so it might be related to the host's multitasking?
         For now, let's not worry about that.
      
      2. Much more worrying is that the intermittent thread sometimes (in about half
         the tests) causes us to only fully use one CPU, and of course get bad
         performance.
      
      3. In many of the tests involving more than 2 threads (2 threads +
         intermittent, or 4 threads) load balancing wasn't fair and some
         threads got more CPU than the others.
      
      Later I'll send patches to fix issues 2 and 3, which appear to happen because
      the load balancer thread doesn't run as often as it should, because of vruntime
      problems.
      b255c259
  12. Sep 08, 2013
  13. Sep 02, 2013
    • Pekka Enberg's avatar
      Filed-backed mmap tests · 22c85933
      Pekka Enberg authored
      Add simple tests for munmap() for file-backed memory maps. This exposes
      a limitation in munmap() not writing out MAP_SHARED mappings.
      22c85933
  14. Aug 27, 2013
    • Nadav Har'El's avatar
      Test mincore() on stack and malloc()ed memory · 73cc470d
      Nadav Har'El authored
      Unlike msync(), mincore() should also work on non-mmapped memory,
      such as stack and malloc()ed memory. Currently it doesn't - it
      fails on malloc()ed memory and only sometimes works on stacks (works
      on pthread stacks which are mmapped, but not on sched::thread stacks
      which are malloced by default).
      
      This patch adds a test to tst-mmap.cc to demonstrate this problem.
      The test currently fails, will be fixed in a follow-up patch.
      73cc470d
  15. Aug 26, 2013
    • Nadav Har'El's avatar
      Avoid including elf.hh from sched.hh · 714d313a
      Nadav Har'El authored
      sched.hh included elf.hh, just so it can refer to the elf::tls_data
      type. But now that we have rcu.hh which includes sched.hh and therefore
      elf.hh, if we wish to use rcu in elf.hh (we'll do this in a later patch),
      we have an include loop mess.
      
      So better not include elf.hh from sched.hh, and just declare the one
      struct we need.
      
      After sched.hh no longer includes elf.hh and the dozen includes that
      it further included, we need to add missing includes to some of the
      code that included sched.hh and relied on its implict includes.
      714d313a
    • Pekka Enberg's avatar
      tst-zfs-disk: Drop broken ASSERT() · f43cdb68
      Pekka Enberg authored
      The ASSERT() doesn't compile if ZFS debugging is enabled:
      
        CC tests/tst-zfs-disk.o
      In file included from ../../bsd/sys/cddl/compat/opensolaris/sys/debug.h:35:0,
                       from ../../bsd/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_context.h:42,
                       from ../../tests/tst-zfs-disk.c:28:
      ../../tests/tst-zfs-disk.c: In function ‘make_vdev_root’:
      ../../tests/tst-zfs-disk.c:119:9: error: ‘t’ undeclared (first use in this function)
        ASSERT(t > 0);
               ^
      ../../bsd/sys/cddl/contrib/opensolaris/uts/common/sys/debug.h:56:29: note: in definition of macro ‘ASSERT’
       #define ASSERT(EX) ((void)((EX) || assfail(#EX, __FILE__, __LINE__)))
                                   ^
      ../../tests/tst-zfs-disk.c:119:9: note: each undeclared identifier is reported only once for each function it appears in
        ASSERT(t > 0);
               ^
      ../../bsd/sys/cddl/contrib/opensolaris/uts/common/sys/debug.h:56:29: note: in definition of macro ‘ASSERT’
       #define ASSERT(EX) ((void)((EX) || assfail(#EX, __FILE__, __LINE__)))
                                   ^
      f43cdb68
  16. Aug 16, 2013
  17. Aug 12, 2013
  18. Aug 06, 2013
    • Christoph Hellwig's avatar
      test O_SYNC and fsync · bcb54efc
      Christoph Hellwig authored
      bcb54efc
    • Nadav Har'El's avatar
      Test exceptions · 7d6f0aaf
      Nadav Har'El authored
      The previous commit (fix symbol resolution order) caused a regression -
      tst-pipe.so stopped working, aborting on segfault while handling an
      expected exception (one of the only places in OSV where we use an
      exception to signal an error - running out of file descriptors).
      
      However, it turns that commit just exposed an already existing bug
      in our exception unwinding support. The following trivial test of
      exceptions, throwing an integer and catching it, crashes both with
      the previous commit, and without it.
      7d6f0aaf
  19. Aug 05, 2013
    • Nadav Har'El's avatar
      Test for for dynamic linker order bug · e5b876a0
      Nadav Har'El authored
      Christoph discovered a bug in our dynamic linker, where symbols which
      exist in the kernel cannot be used in a shared object, which can
      cause nasty bugs when trying to run existing programs.
      
      This test demonstrates this bug, and verifies its fix (in the
      previous commit).
      e5b876a0
    • Christoph Hellwig's avatar
      HACK: rename the debug variable in fsx · 4089b7e4
      Christoph Hellwig authored
      Without this we somehow get a non-zero value in it while running under OSv.
      
      This needs to be investigated as it would have a bad effect on user workloads.
      4089b7e4
Loading