13 Oct, 2007

25 commits


07 Aug, 2007

1 commit

  • More fallout from the writeback fixes: debug register transfer
    instructions do their own writeback and thus need to disable the general
    writeback mechanism.

    This fixes oopses and some guest failures on AMD machines (the Intel
    variant decodes the instruction in hardware and thus does not need
    emulation).

    Cc: Alistair John Strachan
    Signed-off-by: Avi Kivity
    Signed-off-by: Linus Torvalds

    Avi Kivity
     

25 Jul, 2007

1 commit


21 Jul, 2007

1 commit


16 Jul, 2007

5 commits


03 May, 2007

2 commits

  • This simplifies the API somewhat (by eliminating the special-case
    cmpxchg8b on i386).

    Signed-off-by: Avi Kivity

    Avi Kivity
     
  • On x86, bit operations operate on a string of bits that can reside in
    multiple words. For example, 'btsl %eax, (blah)' will touch the word
    at blah+4 if %eax is between 32 and 63.

    The x86 emulator compensates for that by advancing the operand address
    by (bit offset / BITS_PER_LONG) and truncating the bit offset to the
    range (0..BITS_PER_LONG-1). This has a side effect of forcing the operand
    size to 8 bytes on 64-bit hosts.

    Now, a 32-bit guest goes and fork()s a process. It write protects a stack
    page at 0xbffff000 using the 'btr' instruction, at offset 0xffc in the page
    table, with bit offset 1 (for the write permission bit).

    The emulator now forces the operand size to 8 bytes as previously described,
    and an innocent page table update turns into a cross-page-boundary write,
    which is assumed by the mmu code not to be a page table, so it doesn't
    actually clear the corresponding shadow page table entry. The guest and
    host permissions are out of sync and guest memory is corrupted soon
    afterwards, leading to guest failure.

    Fix by not using BITS_PER_LONG as the word size; instead use the actual
    operand size, so we get a 32-bit write in that case.

    Note we still have to teach the mmu to handle cross-page-boundary writes
    to guest page table; but for now this allows Damn Small Linux 0.4 (2.4.20)
    to boot.

    Signed-off-by: Avi Kivity

    Avi Kivity
     

23 Jan, 2007

1 commit

  • The various bit string instructions (bts, btc, etc.) fail to adjust the
    address correctly if the bit address is beyond BITS_PER_LONG.

    This bug creeped in as the emulator originally relied on cr2 to contain the
    memory address; however we now decode it from the mod r/m bits, and must
    adjust the offset to account for large bit indices.

    The patch is rather large because it switches src and dst decoding around, so
    that the bit index is available when decoding the memory address.

    This fixes workloads like the FC5 installer.

    Signed-off-by: Avi Kivity
    Cc: Ingo Molnar
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Avi Kivity
     

06 Jan, 2007

1 commit

  • cmpxchg8b uses edx:eax as the compare operand, not edi:eax.

    cmpxchg8b is used by 32-bit pae guests to set page table entries atomically,
    and this is emulated touching shadowed guest page tables.

    Also, implement it for 32-bit hosts.

    Signed-off-by: Avi Kivity
    Acked-by: Ingo Molnar
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Avi Kivity
     

14 Dec, 2006

1 commit


11 Dec, 2006

1 commit

  • web site: http://kvm.sourceforge.net

    mailing list: kvm-devel@lists.sourceforge.net
    (http://lists.sourceforge.net/lists/listinfo/kvm-devel)

    The following patchset adds a driver for Intel's hardware virtualization
    extensions to the x86 architecture. The driver adds a character device
    (/dev/kvm) that exposes the virtualization capabilities to userspace. Using
    this driver, a process can run a virtual machine (a "guest") in a fully
    virtualized PC containing its own virtual hard disks, network adapters, and
    display.

    Using this driver, one can start multiple virtual machines on a host.

    Each virtual machine is a process on the host; a virtual cpu is a thread in
    that process. kill(1), nice(1), top(1) work as expected. In effect, the
    driver adds a third execution mode to the existing two: we now have kernel
    mode, user mode, and guest mode. Guest mode has its own address space mapping
    guest physical memory (which is accessible to user mode by mmap()ing
    /dev/kvm). Guest mode has no access to any I/O devices; any such access is
    intercepted and directed to user mode for emulation.

    The driver supports i386 and x86_64 hosts and guests. All combinations are
    allowed except x86_64 guest on i386 host. For i386 guests and hosts, both pae
    and non-pae paging modes are supported.

    SMP hosts and UP guests are supported. At the moment only Intel
    hardware is supported, but AMD virtualization support is being worked on.

    Performance currently is non-stellar due to the naive implementation of the
    mmu virtualization, which throws away most of the shadow page table entries
    every context switch. We plan to address this in two ways:

    - cache shadow page tables across tlb flushes
    - wait until AMD and Intel release processors with nested page tables

    Currently a virtual desktop is responsive but consumes a lot of CPU. Under
    Windows I tried playing pinball and watching a few flash movies; with a recent
    CPU one can hardly feel the virtualization. Linux/X is slower, probably due
    to X being in a separate process.

    In addition to the driver, you need a slightly modified qemu to provide I/O
    device emulation and the BIOS.

    Caveats (akpm: might no longer be true):

    - The Windows install currently bluescreens due to a problem with the
    virtual APIC. We are working on a fix. A temporary workaround is to
    use an existing image or install through qemu
    - Windows 64-bit does not work. That's also true for qemu, so it's
    probably a problem with the device model.

    [bero@arklinux.org: build fix]
    [simon.kagstrom@bth.se: build fix, other fixes]
    [uril@qumranet.com: KVM: Expose interrupt bitmap]
    [akpm@osdl.org: i386 build fix]
    [mingo@elte.hu: i386 fixes]
    [rdreier@cisco.com: add log levels to all printks]
    [randy.dunlap@oracle.com: Fix sparse NULL and C99 struct init warnings]
    [anthony@codemonkey.ws: KVM: AMD SVM: 32-bit host support]
    Signed-off-by: Yaniv Kamay
    Signed-off-by: Avi Kivity
    Cc: Simon Kagstrom
    Cc: Bernhard Rosenkraenzer
    Signed-off-by: Uri Lublin
    Cc: Ingo Molnar
    Cc: Roland Dreier
    Signed-off-by: Randy Dunlap
    Signed-off-by: Anthony Liguori
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Avi Kivity