Skip to content
Snippets Groups Projects
  1. Dec 01, 2013
    • Nadav Har'El's avatar
      Fix HPET driver clock rollback · 778394c3
      Nadav Har'El authored
      
      When KVM paravirtual clock isn't available (e.g., on Xen or on plain Qemu),
      we used the HPET clock. Our HPET clock driver rolled back the clock
      (clock::get()->time()) once every 42 seconds, causing strange things like
      a scheduler assertion when the clock jumps back.
      
      The problem is that we read just 32 bits out of the 64 bits of the HPET
      counter. This means that we roll back the clock once every 2^32 ticks,
      and with the 10ns tick (which seems to be case in Qemu), this means about
      42 seconds.
      
      Douglas Adams would have liked this bug ;-)
      
      Fixed the code, and removed overly-optimistic comment which stated the
      rollback should take years.
      
      Added an assertion that the HPET really has a 64-bit counter; Intel's HPET
      specification from 2004 already specify that a 64-bit counter is recommended,
      and both Qemu and Xen do implement a 64-bit counter. If we had to deal
      with a 32-bit counter, we would need to write a handler for the interrupt
      that the HPET sends every time the counter wraps around.
      
      Signed-off-by: default avatarNadav Har'El <nyh@cloudius-systems.com>
      Signed-off-by: default avatarAvi Kivity <avi@cloudius-systems.com>
      778394c3
  2. Nov 28, 2013
  3. Nov 26, 2013
    • Nadav Har'El's avatar
      Warn about incorrect use of percpu<> / PERCPU(..). · 8add1b91
      Nadav Har'El authored
      
      This patch causes incorrect usage of percpu<>/PERCPU() to cause
      compilation errors instead of silent runtime corruptions.
      
      Thanks to Dmitry for first noticing this issue in xen_intr.cc (see his
      separate patch), and to Avi for suggesting a compile-time fix.
      
      With this patch:
      
      1. Using percpu<...> to *define* a per-cpu variable fails compilation.
         Instead, PERCPU(...) must be used for the definition, which is important
         because it places the variable in the ".percpu" section.
      
      2. If a *declaration* is needed additionally (e.g., for a static class
         member), percpu<...> must be used, not PERCPU().
         Trying to use PERCPU() for declaration will cause a compilation error.
      
      3. PERCPU() only works on statically-constructed objects - global variables,
         static function-variables and static class-members. Trying to use it
         on a dynamically-constructed object - stack variable, class field,
         or operator new - will cause a compilation error.
      
      With this patch, the bug in xen_intr.cc would have been caught at
      compile time.
      
      Signed-off-by: default avatarNadav Har'El <nyh@cloudius-systems.com>
      Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
      8add1b91
  4. Nov 21, 2013
  5. Nov 06, 2013
  6. Nov 05, 2013
  7. Nov 04, 2013
    • Dmitry Fleytman's avatar
      acpi: mapping of long tables fixed · 9ec9407e
      Dmitry Fleytman authored
      
      Due to incorrect mapping logic ACPI tables longer than PAGE_SIZE
      mapped partially and to wrong base address. As a result system crashed
      on ACPI tables checksum verification.
      
      Found when running on EC2 HVM instances, the problematic table was:
      ACPI: DSDT 0xfc002c40 0321F (v02    Xen      HVM 00000000 INTL 20090220)
      
      Signed-off-by: default avatarDmitry Fleytman <dmitry@daynix.com>
      9ec9407e
  8. Oct 31, 2013
    • Pekka Enberg's avatar
      acpi: Simplify ACPICA initialization · 2ce381c0
      Pekka Enberg authored
      
      Use the initialization sequence specified in 10.1.2.2 ("ACPICA
      Initialization With Early ACPI Table Access") from ACPICA reference
      manual.
      
      Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
      2ce381c0
    • Pekka Enberg's avatar
      acpi: Use mmu::isreadable() in AcpiOsReadable() · 82037caf
      Pekka Enberg authored
      
      Use mmu:isreadable() to actually check if a memory region is readable in
      AcpiOsReadable().
      
      Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
      82037caf
    • Pekka Enberg's avatar
      acpi: Use console for AcpiOsPrintf() · c9dadf2d
      Pekka Enberg authored
      
      Switch to console::write_ll() in AcpiOsPrintf() and AcpiOsvPrintf() to
      make ACPI boot-time output readable:
      
        [penberg@localhost osv]$ ./scripts/run.py
        ACPI: RSDP 0xfd8d0 00014 (v00 BOCHS )
        ACPI: RSDT 0x3fffe380 00034 (v01 BOCHS  BXPCRSDT 00000001 BXPC 00000001)
        ACPI: FACP 0x3fffff80 00074 (v01 BOCHS  BXPCFACP 00000001 BXPC 00000001)
        ACPI: DSDT 0x3fffe3c0 011A9 (v01   BXPC   BXDSDT 00000001 INTL 20100528)
        ACPI: FACS 0x3fffff40 00040
        ACPI: SSDT 0x3ffff6e0 00858 (v01 BOCHS  BXPCSSDT 00000001 BXPC 00000001)
        ACPI: APIC 0x3ffff5b0 00090 (v01 BOCHS  BXPCAPIC 00000001 BXPC 00000001)
        ACPI: HPET 0x3ffff570 00038 (v01 BOCHS  BXPCHPET 00000001 BXPC 00000001)
        acpi 0 apic 0
        acpi 1 apic 1
        acpi 2 apic 2
        acpi 3 apic 3
        APIC base fee00000
        OSv v0.02-64-ga556eab Copyright 2013 Cloudius Systems
        locale works
        ACPI: RSDP 0xfd8d0 00014 (v00 BOCHS )
        ACPI: RSDT 0x3fffe380 00034 (v01 BOCHS  BXPCRSDT 00000001 BXPC 00000001)
        ACPI: FACP 0x3fffff80 00074 (v01 BOCHS  BXPCFACP 00000001 BXPC 00000001)
        ACPI: DSDT 0x3fffe3c0 011A9 (v01   BXPC   BXDSDT 00000001 INTL 20100528)
        ACPI: FACS 0x3fffff40 00040
        ACPI: SSDT 0x3ffff6e0 00858 (v01 BOCHS  BXPCSSDT 00000001 BXPC 00000001)
        ACPI: APIC 0x3ffff5b0 00090 (v01 BOCHS  BXPCAPIC 00000001 BXPC 00000001)
        ACPI: HPET 0x3ffff570 00038 (v01 BOCHS  BXPCHPET 00000001 BXPC 00000001)
        ACPI: All ACPI Tables successfully acquired
      
      Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
      c9dadf2d
  9. Oct 29, 2013
  10. Oct 28, 2013
    • Pekka Enberg's avatar
      drivers/xenfront-xenbus: Fix scanf() variable type · 3832440a
      Pekka Enberg authored
      
      Spotted by GCC with '-Wformat=1':
      
      ../../drivers/xenfront-xenbus.cc: In function ‘XenbusState xenbus_get_state(device_t)’:
      ../../drivers/xenfront-xenbus.cc:219:80: warning: format ‘%d’ expects argument of type ‘int*’, but argument 6 has type ‘XenbusState* {aka xenbus_state*}’ [-Wformat=]
           xs_scanf(XST_NIL, dev->get_node_path().c_str(), "state", NULL, "%d", &state);
      
      Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
      3832440a
  11. Oct 24, 2013
  12. 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
  13. Oct 09, 2013
  14. Oct 07, 2013
    • Nadav Har'El's avatar
      Add interrupt and quit keys to console driver · d7292625
      Nadav Har'El authored
      
      This patch adds interrupt (by default ctrl-C) and quit (by default ctrl-\)
      handling to the console driver, when the ISIG termios flag is enabled (and
      this patch enables this flag by default). The application can change these
      characters or disable ISIG with ioctls, exactly as in Unix.
      
      The ^C character sends a SIGINT to the (only) process, and ^\ sends SIGQUIT.
      By default both abort OSv, but when running Java we get a much more
      interesting SIGQUIT handler - it shows a trace of all running threads
      and other information.
      
      Note that our line-discipline code currently sits in the console driver
      (we do not have ptys yet), so it only applies to the console, not to
      SSH connections or the likes.
      
      Also note that by default (before the patch to issue #49), qemu will catch
      the ^C and ^\ and won't even pass them to OSv, so apply the patch to #49
      (or change the interrupt or quit characters) to see this feature working.
      
      This patch relates to issue #53.
      
      Signed-off-by: default avatarNadav Har'El <nyh@cloudius-systems.com>
      d7292625
  15. Oct 02, 2013
  16. Oct 01, 2013
  17. Sep 30, 2013
  18. Sep 29, 2013
  19. Sep 20, 2013
  20. Sep 18, 2013
  21. Sep 15, 2013
    • Nadav Har'El's avatar
      Add copyright statement to drivers/* · c0e0ebf2
      Nadav Har'El authored
      Add Cloudius copyright and license statement to drivers/*.
      
      A couple of header files were based on Linux's BSD-licensed header files
      (e.g., include/uapi/linux/virtio_net.h) so they included the BSD license,
      but not any copyright statement, so we can just replace that by our own
      statement of the BSD license.
      c0e0ebf2
  22. Sep 14, 2013
    • Glauber Costa's avatar
      hpet: convert counters to nanoseconds · 02442f3f
      Glauber Costa authored
      I've made the mistake of presenting the counter value directly instead of
      converting it to nanoseconds. We need to do that, by grabbing the period from
      the device and using it.
      
      Since hpet is already our slow fallback anyway, I am using simple
      multiplication and not bothering with complex mult / shift stuff.
      02442f3f
    • Glauber Costa's avatar
      xenfront: initialize softc structure · 1025a960
      Glauber Costa authored
      The Xen hypervisor not always initialize its pages. The BSD drivers will
      however assume they are zeroed, and so things may break if they are not
      (misterious flag tests suddenly being true, for instance).
      
      Initialize manually the data we have just received from malloc when we deal
      with softc.
      1025a960
  23. Sep 12, 2013
    • Dmitry Fleytman's avatar
      Support for Xen w/o vector callbacks · 1d3e336c
      Dmitry Fleytman authored
      This patch implements GSI interrupt support for Xen bus.
      Needed in Xen environments w/o vector callbacks for HVM.
      One example of such an environment is Amazon EC2.
      1d3e336c
  24. Sep 05, 2013
    • Glauber Costa's avatar
      call read partition table · b3e47d9a
      Glauber Costa authored
      I would like to call read_partition_table automatically from device_register,
      which would guarantee that every device that comes up have its partitions
      scanned. Although totally possible on KVM, it is not possible on Xen, due to
      the assynchronous nature of the bringup protocol: the device is exposed and
      created in a moment where IO is not yet possible, so reading the partition
      table will fail. Just read them both from the drivers when we are sure the
      driver is ready.
      b3e47d9a
    • Glauber Costa's avatar
      add offset calculation · cd14aecc
      Glauber Costa authored
      To support multiple partitions to a disk, I found it easier to add a
      post-processing offset calculation to the bio just before calling the strategy.
      
      The reason is, we have many (really many) entry points for bio preparation
      (pre-strategy) and only two entry points for the strategy itself (the drivers).
      Since multiplex_strategy is a good thing to be used even for virtio (although I
      am not converting it now), since it allows for arbitrary sized requests, we
      could very well reduce it to just one.
      
      At this moment, the offset is always 0 and everything works as before.
      cd14aecc
    • Glauber Costa's avatar
      blk: derive size information from device · bfff3c6a
      Glauber Costa authored
      Currently we get it from the private data, but since I plan to use the same
      private data for all partitions, we need a unique value, that already exists in
      the device. So use it.
      bfff3c6a
    • Glauber Costa's avatar
      hpet clock driver · e2991fce
      Glauber Costa authored
      This patch implement the HPET clock driver, that should work as a fallback for
      both Xen and KVM, in case the paravirtual clock is not present. This is
      unfortunately the situation for all HVM guests running on EC2, so support for
      this is paramount. I have tested on KVM forcing the kvmclock to disappear, and
      it seems to work all right.
      e2991fce
    • Glauber Costa's avatar
      acpi: move table initialization to its own constructor · bf15592d
      Glauber Costa authored
      Right now we are doing it right before we parse the MADT, but this is by far
      not MADT specific. Other users are planned, and the best way to resolve the
      disputes is to have it in a separate constructor
      bf15592d
Loading