Skip to content
Snippets Groups Projects
  1. Aug 13, 2013
    • Glauber Costa's avatar
      BSD: fill header files for blkfront and netfront · 1e38861f
      Glauber Costa authored
      Those headers are needed from blkfront and netfront. Some of them are empty stubs
      are usual but some are import from BSD. I am bringing them separately so it is
      obvious what they are here for.
      1e38861f
    • Glauber Costa's avatar
      BSDEDIT/netfront: statically determine ring size · 0bcc9395
      Glauber Costa authored
      The macro to calculate ring size are really gigantic and nested. Somewhere,
      somehow, gcc believes that one of the size calculations yields a variadic size.
      It doesn't seem to be the case to me, but maybe we are using (or lacking) some
      compiler flag that can explain this.
      
      Although this is clearly suboptimal, let us set with this for now. It should not
      be a huge problem unless we update xen headers.
      0bcc9395
    • Glauber Costa's avatar
      netfront: method to derive a blkfront from its softc · db09902b
      Glauber Costa authored
      Because softc is private - only a void pointer outside blkfront, we need
      a helper here to return the correct device from its softc representation.
      This will be used by the osv side to determine where to trigger IO to
      db09902b
    • Glauber Costa's avatar
      BSDEDIT/xenfront: standardize device names · 297ebbdf
      Glauber Costa authored
      BSD uses non-standard device names (standard here meaning us) for the network
      and block interfaces. There is no reason for us to play the complexity to deal
      with different names, so change it.
      297ebbdf
    • Glauber Costa's avatar
      BSDEDIT/netfront: trivial netfront adjustments · 92975a18
      Glauber Costa authored
      This patch contains the trivial osv adjustments for osv, like type fixing,
      header conciliation, sysctl removal, etc.
      92975a18
    • Glauber Costa's avatar
      netport: empty ifmedia functions · 69ba5c7b
      Glauber Costa authored
      We won't implement interface media change routines - at least for now, so stub
      them.
      69ba5c7b
    • Glauber Costa's avatar
      BSDEDIT/blkfront: trivial adjustments for osv · 38e51488
      Glauber Costa authored
      Those are: type conciliation, osv porting header inclusion and deleting unused
      statements.
      38e51488
    • Glauber Costa's avatar
      bio.h: augment bio structures for xen blkfront · 797e97f7
      Glauber Costa authored
      There are many other bio fields and functions that blkfront uses that are
      not provided by our simplified bio. I am adding them here. One of the things we need is
      a type definition of daddr_t. This already exists in fatfs.h, but it makes more sense to
      live in the lower level code. So instead of including fatfs in bio.h, I am including
      bio.h in fatfs and moving the daddr_t definition here.
      797e97f7
    • Glauber Costa's avatar
      if_var: don't check interface queue drive size in empty checks · 7357d75d
      Glauber Costa authored
      Current test does:
      
          (((ifq)->ifq_drv_len == 0) && ((ifq)->ifq_len == 0))
      
      but ifq_drv_len does not exist. Funny enough, it does not exist in BSD
      basic interface queue as well.
      7357d75d
    • Glauber Costa's avatar
      Allow device communcation of the maximum io size · 0140180d
      Glauber Costa authored
      Some block devices, such as the Xen blkfront, will have a maximum per-request size
      that needs to be obeyed. In order for us to do it, we'll need to be aware of this
      requirement in upper layers. So set up the device with it. We initialize the default
      structure to make sure only interested parties need to set this up.
      0140180d
    • Glauber Costa's avatar
      factor out device_create · 1381d181
      Glauber Costa authored
      For xen, I would like to use an already existing device instead of creating one.
      I still need to register it, though. I am here factoring out device_create in
      a allocation and a registering part so I can use the later by itself.
      1381d181
    • Glauber Costa's avatar
      xen: OSV xenbus · 2ee11194
      Glauber Costa authored
      This commit includes the basic translation layer so we can support BSD devices
      for Xen as is. I believe there is room for improvement, but that provides a
      very good starting point. I would like to provide you guys with a smaller
      commit, but it is quite cumbersome to separate the device implementation from
      the bus implementation per se. Part of it is due to the way Xen does things.
      
      For instance: when we are talking virtio devices, each of them will have its
      own pci device. For xen, only one pci device will be exposed, with its own
      interrupt, and that will be the xenbus. The xenbus is then responsible for
      querying the xenstore and figuring out which devices are there. Maybe there
      is a different way of doing things (I believe for instance that there is no
      reason to have shared interrupts between all devices) but that is the way BSD
      does things. And about the bus-is-the-device, even Linux as far as I know.
      
      Another thing to note, is that BSD devices registered with a device_method_t
      seem to be fully hierarchical. I am not doing it this way here (I am mostly
      ignoring the xenbus device_method_t definitions), which means there are a lot
      of assumptions that probably won't hold with other kinds of drivers. But it
      should not be hard to extend, and that simplifies things.
      2ee11194
    • Glauber Costa's avatar
      xen: set callback hypercall · 30313c4f
      Glauber Costa authored
      By issuing this hypercall, we can control where xen delivers the interrupt to.
      Right now we will only support vectored callbacks. It should not be hard to extend
      this for gsi and intx for HVM guests.
      30313c4f
    • Glauber Costa's avatar
      xen: build features array · 965639f3
      Glauber Costa authored
      If we have this array, BSD code that checks for features can run unmodified.
      965639f3
    • Glauber Costa's avatar
      BSDEDIT/xenbus: compile xenbus files · 1bb0512a
      Glauber Costa authored
      Changes needed for xenbus operation. They are, as usual:
      * delete function tables and make previously static functions on it public
      * comment out sysctl code
      * change order of includes between sbuf.h and malloc.h. sbuf calls into our
        functions, and those have a single malloc instead of a 3-argument one. This
        is by far the easiest way to handle this
      * Modify calling convention for device_add_child. It is just way easier if we
        now the path at creation time. BSD does not need it because it creates all
        devices equal (they are the same device_t structure), but for us is way more
        convenient if we can create the appropriate classes.
      1bb0512a
    • Glauber Costa's avatar
      BSDEDIT/xenstore: connect to osv stubs and compile · 2b7e37e5
      Glauber Costa authored
      In particular, I am not implementing the struct filling in the end of
      the file. Just comment it out, and make the relevant static functions
      public. We will call them from our code.
      2b7e37e5
    • Glauber Costa's avatar
      BSDEDIT/xenstore: mechanically convert log to bsd_log · 01221ec0
      Glauber Costa authored
      As suggested by Guy
      01221ec0
    • Glauber Costa's avatar
    • Glauber Costa's avatar
      BSDEDIT/evtchn.c: changes for pv event channel · 2cd983e4
      Glauber Costa authored
      Mostly trivial changes needed to compile the pv event channel.  We need some
      type adjustments, but the most complex ones are assembly fixes.  Because BSD
      seems to only do this for 32-bit guests, we need to adjust the inline asm
      instructions to take quad words for longs, and force int types for double
      words.
      
      After this, the evtchn can be compiled.
      2cd983e4
    • Glauber Costa's avatar
      Xen paravirtual event channel · a8560f2d
      Glauber Costa authored
      This file implements the pv and pv-on-hvm event channel mechanism.
      Verbatim copy from BSD.
      a8560f2d
    • Glauber Costa's avatar
      Xen layer for interrupt registering · fbec6608
      Glauber Costa authored
      The BSD pv event channel will expect the underlying OS to be able to register a
      PIC.  For now we will just allow that for xen, and provide the expected
      translation functions to allow xen to work.
      
      The design I have chosen is to let the xen event handler run in interrupt
      context. We can do threaded if it really becomes a problem, but right now it
      should do. The handlers themselves, though, will be threaded. So the
      intr_execute_handlers() function will do nothing more than to wake the
      respective threads.
      
      BSD will provide us functions, not threads. So we have a common thread that
      executes the function that we were given. One exception for this is the xenstore.
      The xenstore is already threaded, and its interrupt handler will also just wake
      up a thread. So for that we could do better in the future.
      fbec6608
    • Glauber Costa's avatar
      porting: bus definitions · d8dd6623
      Glauber Costa authored
      This contains interrupts, devices and bus definitions. Most of them are is bus
      files in BSD anyway.
      d8dd6623
    • Glauber Costa's avatar
      BSDEDIT/gnttab: compile in the grant tables · b16bdd49
      Glauber Costa authored
      With this patch, the grant table code is compiled into osv.
      The edits in the file reflect the fact that we don't need to go through PCI
      memory for the Xen special device even for HVM. We have mappings that are
      way simpler, so we can just use them. All the rest is kept as unchanged as I
      could.
      b16bdd49
    • Glauber Costa's avatar
      bsd: mmu stub functions · 3e5657ed
      Glauber Costa authored
      3e5657ed
    • Glauber Costa's avatar
      xen: provide C accessible of HYPERVISOR_shared_info · 6fc3d663
      Glauber Costa authored
      Xen files in BSD (and Linux for that matter) expect a variable called
      HYPERVISOR_shared_info that points to the hypercall page - that in our case is
      statically defined. So we just need to point it with the correct name to our
      shared info page.
      
      Note the type mismatch: we are defining our own xen_shared_info to be able to
      access some parts of the structure, like the wallclock, more conveniently.
      Because of that, we need a type cast.
      6fc3d663
    • Glauber Costa's avatar
      generalize interrupt handler further · 4fbb1834
      Glauber Costa authored
      Xen does not need to EOI. At least not with the APIC anywyay: it signals
      end of interrupt by flipping vcpu_info->evtchn_upcall_pending to 0, but
      that is already done by the BSD handler, so we might as well do nothing.
      
      Avi generalized the irq handler to have a pre_eoi and a handler, and in
      this patch I am taking the extra step of adding an EOI indirection as well.
      4fbb1834
    • Glauber Costa's avatar
      add uoff_t to netport.h · d4f0a78f
      Glauber Costa authored
      This is for the lack of a better place.
      d4f0a78f
    • Glauber Costa's avatar
      bus_dma verbatim copy · 2a4d0aa4
      Glauber Costa authored
      2a4d0aa4
    • Glauber Costa's avatar
      xen: verbatim copy of BSD's blkif header · d22e88c8
      Glauber Costa authored
      d22e88c8
    • Avi Kivity's avatar
      build: drop extraneous libstdc++ linking · ecbaccf3
      Avi Kivity authored
      Already specified elsewhere.  Noted by Nadav.
      ecbaccf3
    • Avi Kivity's avatar
      rcu: fix debug build re rcu_read_lock · 14865fa2
      Avi Kivity authored
      The release build optimizes away references to this object, but the debug
      build does not.  Define it.
      14865fa2
    • Avi Kivity's avatar
      dhcp: fix random dhcp failures · 26a04985
      Avi Kivity authored
      We don't initialize the dhcp packets, so some of them get the relay agent IP
      set, and the DHCP DISCOVER packets get sent to a random address on the
      Internet.  Usually it doesn't have a DHCP server installed, so the guest
      does not get configured.
      
      Fix by zero-initializing the packet.
      26a04985
    • Pekka Enberg's avatar
      cli: Catch errors for 'perf callstack' · fba58999
      Pekka Enberg authored
      Currently, looking up a non-existing tracepoint kills the guest:
      
      sun.org.mozilla.javascript.WrappedException: Wrapped java.lang.RuntimeException: Cannot find tracepoint (/console/perf.js#91)
      	at sun.org.mozilla.javascript.Context.throwAsScriptRuntimeEx(Context.java:1786)
      	at sun.org.mozilla.javascript.MemberBox.newInstance(MemberBox.java:202)
      	at sun.org.mozilla.javascript.NativeJavaClass.constructSpecific(NativeJavaClass.java:284)
      	at sun.org.mozilla.javascript.NativeJavaClass.construct(NativeJavaClass.java:202)
      	at sun.org.mozilla.javascript.ScriptRuntime.newObject(ScriptRuntime.java:2440)
      	at sun.org.mozilla.javascript.gen._console_perf_js_17._c_anonymous_7(/console/perf.js:91)
      	at sun.org.mozilla.javascript.gen._console_perf_js_17.call(/console/perf.js)
      	at sun.org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:66)
      	at sun.org.mozilla.javascript.gen._console_perf_js_17._c_anonymous_10(/console/perf.js:114)
      	at sun.org.mozilla.javascript.gen._console_perf_js_17.call(/console/perf.js)
      	at sun.org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:66)
      	at sun.org.mozilla.javascript.gen._console_perf_js_17._c_anonymous_1(/console/perf.js:8)
      	at sun.org.mozilla.javascript.gen._console_perf_js_17.call(/console/perf.js)
      	at sun.org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:66)
      	at sun.org.mozilla.javascript.gen.cli_js_21._c_run_sync_15(cli.js:202)
      	at sun.org.mozilla.javascript.gen.cli_js_21.call(cli.js)
      	at sun.org.mozilla.javascript.optimizer.OptRuntime.call2(OptRuntime.java:76)
      	at sun.org.mozilla.javascript.gen.cli_js_21._c_invoke_18(cli.js:223)
      	at sun.org.mozilla.javascript.gen.cli_js_21.call(cli.js)
      	at sun.org.mozilla.javascript.optimizer.OptRuntime.callName(OptRuntime.java:97)
      	at sun.org.mozilla.javascript.gen.cli_js_21._c_command_19(cli.js:237)
      	at sun.org.mozilla.javascript.gen.cli_js_21.call(cli.js)
      	at sun.org.mozilla.javascript.optimizer.OptRuntime.callName0(OptRuntime.java:108)
      	at sun.org.mozilla.javascript.gen.cli_js_21._c_main_loop_21(cli.js:290)
      	at sun.org.mozilla.javascript.gen.cli_js_21.call(cli.js)
      	at sun.org.mozilla.javascript.optimizer.OptRuntime.callName0(OptRuntime.java:108)
      	at sun.org.mozilla.javascript.gen.cli_js_21._c_script_0(cli.js:323)
      	at sun.org.mozilla.javascript.gen.cli_js_21.call(cli.js)
      	at sun.org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:426)
      	at sun.org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3178)
      	at sun.org.mozilla.javascript.gen.cli_js_21.call(cli.js)
      	at sun.org.mozilla.javascript.gen.cli_js_21.exec(cli.js)
      	at sun.org.mozilla.javascript.Context.evaluateReader(Context.java:1142)
      	at com.cloudius.cli.main.RhinoCLI.run(Unknown Source)
      	at com.cloudius.cli.util.TelnetCLI.handleConnection(Unknown Source)
      	at com.cloudius.cli.util.TelnetD$1.run(Unknown Source)
      Caused by: java.lang.RuntimeException: Cannot find tracepoint
      	at com.cloudius.trace.Tracepoint.findByName(Native Method)
      	at com.cloudius.trace.Tracepoint.<init>(Unknown Source)
      	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
      	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      	at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
      	at sun.org.mozilla.javascript.MemberBox.newInstance(MemberBox.java:194)
      	... 34 more
      
      Fix that by catching errors like "perf stat" does.
      fba58999
  2. Aug 12, 2013
    • Avi Kivity's avatar
      build: link libstdc++, libgcc_s only once · c9e61d4a
      Avi Kivity authored
      Currently we statically link to libstdc++ and libgcc_s, and also dynamically
      link to the same libraries (since the payload requires them).  This causes
      some symbols to be available from both the static and dynamic version.
      
      With the resolution order change introduced by 82513d41, we can
      resolve the same symbol to different addresses at different times.  This
      violates the One Definition Rule, and in fact breaks std::string's
      destructor.
      
      Fix by only linking in the libraries statically.  We use ld's --whole-archive
      flag to bring in all symbols, including those that may be used by the payload
      but not by the kernel.
      
      Some symbols now become duplicates; we drop our version.
      c9e61d4a
    • Avi Kivity's avatar
      runtime: add get_nprocs() · 286dd7a0
      Avi Kivity authored
      Needed to link the entirety of libstdc++.a.
      286dd7a0
    • Avi Kivity's avatar
      libc: add sigdelset() · 96f8d595
      Avi Kivity authored
      Needed for statically linking the entirety of libgcc_eh.a.
      96f8d595
    • Avi Kivity's avatar
      tst-lfring: reduce memory overhead · 20e7eb13
      Avi Kivity authored
      Reduce memory consumption so we can test in a 1GB guest.
      20e7eb13
    • Avi Kivity's avatar
      bsd: fix msleep() with mtx == NULL · 61c54fb2
      Avi Kivity authored
      msleep() will fault if mtx is NULL.
      61c54fb2
    • Avi Kivity's avatar
      tst-rwlock: fix rwlock test · 40d1a8fe
      Avi Kivity authored
      The test tries to acquire the write lock while the read lock is taken in the
      same thread, which deadlocks.
      
      Remove the deadlocking construct.
      40d1a8fe
    • Avi Kivity's avatar
      tst-bsd-taskqueue: fix taskqueue creation · 5ecaf3df
      Avi Kivity authored
      taskqueue_thread_enqueue expects a pointer to a pointer to the taskqueue as
      context, give it that.
      5ecaf3df
Loading