Skip to content
Snippets Groups Projects
  1. Aug 13, 2013
  2. Aug 11, 2013
    • Avi Kivity's avatar
      rcu: add basic read-copy-update implementation · 94b69794
      Avi Kivity authored
      This adds fairly basic support for rcu.
      
      Declaring:
      
         mutex mtx;
         rcu_ptr<my_object> my_ptr;
      
      Read-side:
      
         WITH_LOCK(rcu_read_lock) {
            const my_object* p = my_ptr.read();
            // do things with *p
            // but don't block!
         }
      
      Write-side:
      
        WITH_LOCK(mtx) {
          my_object* old = my_ptr.read_by_owner();
          my_object* p = new my_object;
          // ...
          my_ptr.assign(p);
          rcu_dispose(old);  // or rcu_defer(some_func, old);
        }
      94b69794
  3. Jul 18, 2013
  4. Jul 08, 2013
  5. Jul 02, 2013
  6. Jun 17, 2013
  7. Jun 12, 2013
    • Glauber Costa's avatar
      update loader Copyright. · f6e4bfb7
      Glauber Costa authored
      
      Now that we can actually see the debug message, print our name on it.
      
      Signed-off-by: default avatarGlauber Costa <glommer@cloudius-systems.com>
      f6e4bfb7
    • Glauber Costa's avatar
      run console earlier · 4b5afd0f
      Glauber Costa authored
      
      We could benefit from the console being ready a bit earlier. The only
      dependency that I see to it are the interrupts that need to be working.  So as
      soon as we initialize the ioapic, we should be able to initialize the console.
      
      This is not the end of story: we still need an even earlier console to debug the
      driver initialization functions, and I was inclined to just leave console_init
      where it is, for now.
      
      But additionally, I felt that loader is really a more appropriate place for
      that than vfs_init... So I propose we switch. In the mean time, it might help
      debug things that happen between ioapic init and the old vfs_init (mem
      initialization, smp bring up, etc)
      
      Signed-off-by: default avatarGlauber Costa <glommer@cloudius-systems.com>
      4b5afd0f
  8. Jun 04, 2013
  9. Jun 03, 2013
    • Nadav Har'El's avatar
      Implement __libc_stack_end · 60655973
      Nadav Har'El authored
      Java doesn't trust pthread_getattr_np() to work for the main thread in
      Linux, so instead it relies on a global variable __libc_stack_end, which
      we didn't implement and therefore causing an annoying message.
      
      This patch implements __libc_stack_end. Pardoxically, this shouldn't point
      to the real stack end (we can easily find this our sched::thread interfaces)
      but a little below it, because Java expects the address to be in the
      stack, not one byte above it. So we use __builtin_frame_address(0) to
      find the current frame's address.
      
      Unfortunately, while this elliminates one warning message, another one
      remains - because Java later expects to read /proc/self/maps and doesn't
      find it.
      60655973
  10. May 23, 2013
    • Nadav Har'El's avatar
      Add "--noshutdown" option to loader · ad6a0466
      Nadav Har'El authored
      Added a "--noshutdown" option to loader which prevents a shutdown
      (and a poweroff), after main() returns.
      
      Note that this doesn't just replace poweroff() by halt() - with this
      option, the system *isn't* halted after main() returns, but rather
      continues as usual - possibly still running other threads that main()
      didn't wait for, running various system threads and services, and so on.
      ad6a0466
  11. May 22, 2013
    • Nadav Har'El's avatar
      Power off the guest after it finishes its work. · a333d85d
      Nadav Har'El authored
      Call the new poweroff() function after the payload finishes running.
      Makes sense on a cloud (why would you want to pay the provider after
      your workload is done?) as well as for our benchmarking, where we want
      qemu to exit after running the benchmark.
      
      When the "--leak" option is used, instead of calling poweroff(), we
      call hang(), so that QEMU continues to run and we can attach the
      debugger to run "osv leak show".
      
      Note that before this patch, if the payload spawned threads, they could
      continue running after the payload's main() return. This is no longer
      the case - after main() returns, the entire virtual machine is shut down
      (or just hung). This is reasonable behavior, though: If the payload needs
      some threads to continue running, it should join() them before returning.
      The behavior on Linux (and Posix threads in general) is identical to our
      new behavior: When main() of a multithreaded program returns, all threads
      are killed.
      a333d85d
  12. May 20, 2013
  13. May 06, 2013
  14. May 02, 2013
  15. Apr 25, 2013
    • Nadav Har'El's avatar
      Added "--leak" command line option · 600f960b
      Nadav Har'El authored
      Added to the loader a command-line option "--leak" to enable the leak
      detector immediately before running the payload's main(). For example, to
      look for leaks in tst-fpu.so (there are none, by the way ;-)), do
      
      	scripts/imgedit.py setargs build/release/loader.img --leak tests/tst-fpu.so
      
      and when it ends, look at the leak detection results:
      	$ gdb build/release/loader.elf
      	(gdb) connect
      	(gdb) osv leak show
      
      Unfortunately, this doesn't work when the payload is Java - I'm still trying
      to figure out why.
      600f960b
  16. Apr 24, 2013
    • Nadav Har'El's avatar
      Fix leak of PTHREAD_CREATE_DETACHED pthreads · ebce9887
      Nadav Har'El authored
      A pthread created with the attribute
      	pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
      Does not need to be pthread_join()ed - and its resources, most importantly
      its stack, should be deleted as soon as it is done.
      
      Previously, we ignored this mode, causing its users (Java uses it for all
      its threads!) which do not ever pthread_join() on these threads, to leak
      the threads' stacks.
      
      This patch adds support for this mode, and adds a test to tst_leak.cc
      which verifies that before the patch, we had a leak, and now we don't.
      
      Unfortunately, this patch is a bit ugly, and I was surprised how much time
      it took me to actually get it to work :( Because of the convoluted
      relationships between pthread_*, pthread_private::pthread, sched::thread
      and sched::detached_thread, I ended up, after many rewrites (!) duplicating
      the "reaper" code from sched::detached_thread to do something very similar
      for detached pthreads. I.e., when a detached pthread finishes, it can't
      pthread_join() itself (which would cause a mess as it destroys its own
      stack) so instead it tells a different thread, the "reaper" thread, to
      run this pthread_join().
      
      In the future it would be nice to create one generic "reaper" which
      is used by both detached sched::threads and pthreads, or even find
      a way to allow a thread to pthread_join itself as its last action.
      ebce9887
    • Avi Kivity's avatar
      memory: debug allocator · 56b1f6b2
      Avi Kivity authored
      This allocator works by giving each allocation its own virtual address
      range which is not reused for later allocations.  After a free(), the
      range is made inaccessible, forever, so use-after-free will result in a
      page fault.
      
      Sub-page overruns are also detected by filling unallocated space with a
      pattern, and checking whether the pattern has been altered during free().
      56b1f6b2
    • Avi Kivity's avatar
      main: disable the PIC earlier · ecf5f794
      Avi Kivity authored
      Early code may enable interrupts and get hit by a spurious interrupt.
      ecf5f794
  17. Apr 17, 2013
    • Nadav Har'El's avatar
      Abort when loader can't load the given object · de49d7a7
      Nadav Har'El authored
      Without adding this check, if you change the command line with to run
      file.so which doesn't exist, it would start using random garbage in
      memory and fail in mysterious ways. Better just let the user know we can't
      open the specified program.
      de49d7a7
  18. Apr 15, 2013
  19. Apr 14, 2013
  20. Apr 11, 2013
  21. Apr 09, 2013
  22. Feb 28, 2013
    • Avi Kivity's avatar
      drivers: switch back to device enumeration, rather than driver enumeration · c86b2969
      Avi Kivity authored
      Driver enumeration requires instantiating a driver even for devices which
      are not present; and if a device is present multiple times, we need to
      pre-create multiple driver instances, which is awkward.  Further, driver
      life-cycle is complicated, with separation between instantiation and binding
      to a device.
      
      Switch (back) to the traditional device-driven model, where we iterate over
      all devices, try to find a matching driver factory, and when found, call it
      to instantiate the driver and bind to the device.
      c86b2969
    • Avi Kivity's avatar
      loader: drop bogus wait_for_interrupts() · 57006f89
      Avi Kivity authored
      The main thread has a bogus wait_for_interrupts() which consumed wakeups,
      so the scheduler on the cpu running it could not schedule stuff.  This
      manifested itself in lots of zombies from bsd callouts not getting reaped.
      
      Drop.
      57006f89
  23. Feb 26, 2013
  24. Feb 25, 2013
  25. Feb 19, 2013
  26. Feb 13, 2013
Loading