31 Mar, 2009

7 commits


09 Jan, 2009

1 commit

  • The xenfs filesystem exports various interfaces to usermode. Initially
    this exports a file to allow usermode to interact with xenbus/xenstore.

    Traditionally this appeared in /proc/xen. Rather than extending procfs,
    this patch adds a backward-compat mountpoint on /proc/xen, and provides
    a xenfs filesystem which can be mounted there.

    Signed-off-by: Alex Zeffertt
    Signed-off-by: Jeremy Fitzhardinge
    Cc: Ingo Molnar
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alex Zeffertt
     

17 Dec, 2008

1 commit


03 Oct, 2008

1 commit


21 Aug, 2008

1 commit

  • A spinlock can be interrupted while spinning, so make sure we preserve
    the previous lock of interest if we're taking a lock from within an
    interrupt handler.

    We also need to deal with the case where the blocking path gets
    interrupted between testing to see if the lock is free and actually
    blocking. If we get interrupted there and end up in the state where
    the lock is free but the irq isn't pending, then we'll block
    indefinitely in the hypervisor. This fix is to make sure that any
    nested lock-takers will always leave the irq pending if there's any
    chance the outer lock became free.

    Signed-off-by: Jeremy Fitzhardinge
    Acked-by: Jan Beulich
    Signed-off-by: Ingo Molnar

    Jeremy Fitzhardinge
     

16 Jul, 2008

4 commits

  • The standard ticket spinlocks are very expensive in a virtual
    environment, because their performance depends on Xen's scheduler
    giving vcpus time in the order that they're supposed to take the
    spinlock.

    This implements a Xen-specific spinlock, which should be much more
    efficient.

    The fast-path is essentially the old Linux-x86 locks, using a single
    lock byte. The locker decrements the byte; if the result is 0, then
    they have the lock. If the lock is negative, then locker must spin
    until the lock is positive again.

    When there's contention, the locker spin for 2^16[*] iterations waiting
    to get the lock. If it fails to get the lock in that time, it adds
    itself to the contention count in the lock and blocks on a per-cpu
    event channel.

    When unlocking the spinlock, the locker looks to see if there's anyone
    blocked waiting for the lock by checking for a non-zero waiter count.
    If there's a waiter, it traverses the per-cpu "lock_spinners"
    variable, which contains which lock each CPU is waiting on. It picks
    one CPU waiting on the lock and sends it an event to wake it up.

    This allows efficient fast-path spinlock operation, while allowing
    spinning vcpus to give up their processor time while waiting for a
    contended lock.

    [*] 2^16 iterations is threshold at which 98% locks have been taken
    according to Thomas Friebel's Xen Summit talk "Preventing Guests from
    Spinning Around". Therefore, we'd expect the lock and unlock slow
    paths will only be entered 2% of the time.

    Signed-off-by: Jeremy Fitzhardinge
    Cc: Jens Axboe
    Cc: Peter Zijlstra
    Cc: Christoph Lameter
    Cc: Petr Tesarik
    Cc: Virtualization
    Cc: Xen devel
    Cc: Thomas Friebel
    Cc: Nick Piggin
    Signed-off-by: Ingo Molnar

    Jeremy Fitzhardinge
     
  • fix:

    arch/x86/xen/built-in.o: In function `set_page_prot':
    enlighten.c:(.text+0x111d): undefined reference to `xen_raw_printk'
    arch/x86/xen/built-in.o: In function `xen_start_kernel':
    : undefined reference to `xen_raw_console_write'
    arch/x86/xen/built-in.o: In function `xen_start_kernel':
    : undefined reference to `xen_raw_console_write'

    Signed-off-by: Ingo Molnar

    Ingo Molnar
     
  • Copy 64-bit definitions of various interface structures into place.

    Signed-off-by: Jeremy Fitzhardinge
    Cc: Stephen Tweedie
    Cc: Eduardo Habkost
    Cc: Mark McLoughlin
    Signed-off-by: Ingo Molnar

    Jeremy Fitzhardinge
     
  • add xen_timer_resume() hook.

    Timer resume should be done after event channel is resumed.
    add xen_arch_resume() hook when ipi becomes usable after resume.
    After resume, some cpu specific resource must be reinitialized
    on ia64 that can't be set by another cpu.

    However available hooks is run once on only one cpu so that ipi has
    to be used.

    During stop_machine_run() ipi can't be used because interrupt is masked.
    So add another hook after stop_machine_run().
    Another approach might be use resume hook which is run by
    device_resume(). However device_resume() may be executed on
    suspend error recovery path.

    So it is necessary to determine whether it is executed on real resume path
    or error recovery path.

    Signed-off-by: Isaku Yamahata
    Cc: Stephen Tweedie
    Cc: Eduardo Habkost
    Cc: Mark McLoughlin
    Signed-off-by: Ingo Molnar

    Isaku Yamahata
     

25 Jun, 2008

3 commits

  • Xen has a pte update function which will update a pte while preserving
    its accessed and dirty bits. This means that ptep_modify_prot_start() can be
    implemented as a simple read of the pte value. The hardware may
    update the pte in the meantime, but ptep_modify_prot_commit() updates it while
    preserving any changes that may have happened in the meantime.

    The updates in ptep_modify_prot_commit() are batched if we're currently in lazy
    mmu mode.

    The mmu_update hypercall can take a batch of updates to perform, but
    this code doesn't make particular use of that feature, in favour of
    using generic multicall batching to get them all into the hypervisor.

    The net effect of this is that each mprotect pte update turns from two
    expensive trap-and-emulate faults into they hypervisor into a single
    hypercall whose cost is amortized in a batched multicall.

    Signed-off-by: Jeremy Fitzhardinge
    Acked-by: Linus Torvalds
    Acked-by: Hugh Dickins
    Signed-off-by: Ingo Molnar

    Jeremy Fitzhardinge
     
  • Conflicts:

    arch/x86/xen/enlighten.c
    arch/x86/xen/mmu.c

    Signed-off-by: Ingo Molnar

    Ingo Molnar
     
  • This patch updates the xen guest to use the pvclock structs
    and helper functions.

    Signed-off-by: Gerd Hoffmann
    Acked-by: Jeremy Fitzhardinge
    Signed-off-by: Avi Kivity

    Gerd Hoffmann
     

02 Jun, 2008

1 commit


29 May, 2008

1 commit

  • -tip testing found the following build breakage:

    drivers/built-in.o: In function `xen_suspend':
    manage.c:(.text+0x4390f): undefined reference to `xen_console_resume'

    with this config:

    http://redhat.com/~mingo/misc/config-Thu_May_29_09_23_16_CEST_2008.bad

    i have bisected it down to:

    | commit 0e91398f2a5d4eb6b07df8115917d0d1cf3e9b58
    | Author: Jeremy Fitzhardinge
    | Date: Mon May 26 23:31:27 2008 +0100
    |
    | xen: implement save/restore

    the problem is that drivers/xen/manage.c is built unconditionally if
    CONFIG_XEN is enabled and makes use of xen_suspend(), but
    drivers/char/hvc_xen.c, where the xen_suspend() method is implemented,
    is only build if CONFIG_HVC_XEN=y as well.

    i have solved this by providing a NOP implementation for xen_suspend()
    in the !CONFIG_HVC_XEN case.

    Signed-off-by: Ingo Molnar

    Ingo Molnar
     

27 May, 2008

8 commits

  • Hook into the device model to make sure that timekeeping's resume handler
    is called. This deals with our clocksource's non-monotonicity over the
    save/restore. Explicitly call clock_has_changed() to make sure that
    all the timers get retriggered properly.

    Signed-off-by: Jeremy Fitzhardinge
    Signed-off-by: Thomas Gleixner

    Jeremy Fitzhardinge
     
  • This patch implements Xen save/restore and migration.

    Saving is triggered via xenbus, which is polled in
    drivers/xen/manage.c. When a suspend request comes in, the kernel
    prepares itself for saving by:

    1 - Freeze all processes. This is primarily to prevent any
    partially-completed pagetable updates from confusing the suspend
    process. If CONFIG_PREEMPT isn't defined, then this isn't necessary.

    2 - Suspend xenbus and other devices

    3 - Stop_machine, to make sure all the other vcpus are quiescent. The
    Xen tools require the domain to run its save off vcpu0.

    4 - Within the stop_machine state, it pins any unpinned pgds (under
    construction or destruction), performs canonicalizes various other
    pieces of state (mostly converting mfns to pfns), and finally

    5 - Suspend the domain

    Restore reverses the steps used to save the domain, ending when all
    the frozen processes are thawed.

    Signed-off-by: Jeremy Fitzhardinge
    Signed-off-by: Thomas Gleixner

    Jeremy Fitzhardinge
     
  • Add code to:

    1. Deal with the console page being canonicalized. During save, the
    console's mfn in the start_info structure is canonicalized to a pfn.
    In order to deal with that, we always use a copy of the pfn and
    indirect off that all the time. However, we fall back to using the
    mfn if the pfn hasn't been initialized yet.

    2. Restore the console event channel, and rebind it to the existing irq.

    Signed-off-by: Jeremy Fitzhardinge
    Signed-off-by: Thomas Gleixner

    Jeremy Fitzhardinge
     
  • Add rebind_evtchn_irq(), which will rebind an device driver's existing
    irq to a new event channel on restore. Since the new event channel
    will be masked and bound to vcpu0, we update the state accordingly and
    unmask the irq once everything is set up.

    Signed-off-by: Jeremy Fitzhardinge
    Signed-off-by: Thomas Gleixner

    Jeremy Fitzhardinge
     
  • Add xen handles realted definitions for xen memory which ia64/xen needs.
    Pointer argumsnts for ia64/xen hypercall are passed in pseudo physical
    address (guest physical address) so that it is required to convert
    guest kernel virtual address into pseudo physical address.
    The xen guest handle represents such arguments.

    Signed-off-by: Isaku Yamahata
    Signed-off-by: Jeremy Fitzhardinge
    Signed-off-by: Thomas Gleixner

    Isaku Yamahata
     
  • The pvfb backend indicates dynamic mode support by creating node
    feature_resize with a non-zero value in its xenstore directory.
    xen-fbfront sends a resize notification event on mode change. Fully
    backwards compatible both ways.

    Framebuffer size and initial resolution can be controlled through
    kernel parameter xen_fbfront.video. The backend enforces a separate
    size limit, which it advertises in node videoram in its xenstore
    directory.

    xen-kbdfront gets the maximum screen resolution from nodes width and
    height in the backend's xenstore directory instead of hardcoding it.

    Additional goodie: support for larger framebuffers (512M on a 64-bit
    system with 4K pages).

    Changing the number of bits per pixels dynamically is not supported,
    yet.

    Ported from
    http://xenbits.xensource.com/linux-2.6.18-xen.hg?rev/92f7b3144f41
    http://xenbits.xensource.com/linux-2.6.18-xen.hg?rev/bfc040135633

    Signed-off-by: Pat Campbell
    Signed-off-by: Markus Armbruster
    Signed-off-by: Jeremy Fitzhardinge
    Signed-off-by: Thomas Gleixner

    Markus Armbruster
     
  • Add z-axis motion to pointer events. Backward compatible, because
    there's space for the z-axis in union xenkbd_in_event, and old
    backends zero it.

    Derived from
    http://xenbits.xensource.com/linux-2.6.18-xen.hg?rev/57dfe0098000
    http://xenbits.xensource.com/linux-2.6.18-xen.hg?rev/1edfea26a2a9
    http://xenbits.xensource.com/linux-2.6.18-xen.hg?rev/c3ff0b26f664

    Signed-off-by: Pat Campbell
    Signed-off-by: Markus Armbruster
    Signed-off-by: Jeremy Fitzhardinge
    Signed-off-by: Thomas Gleixner

    Markus Armbruster
     
  • Add a couple of functions which can write directly to the Xen console
    for debugging. This output ends up on the host's dom0 console
    (assuming it allows the domain to write there).

    Signed-off-by: Jeremy Fitzhardinge
    Signed-off-by: Thomas Gleixner

    Jeremy Fitzhardinge
     

25 Apr, 2008

12 commits

  • The balloon driver allows memory to be dynamically added or removed from the domain,
    in order to allow host memory to be balanced between multiple domains.

    This patch introduces the Xen balloon driver, though it currently only
    allows a domain to be shrunk from its initial size (and re-grown back to
    that size). A later patch will add the ability to grow a domain beyond
    its initial size.

    Signed-off-by: Jeremy Fitzhardinge
    Signed-off-by: Ingo Molnar
    Signed-off-by: Thomas Gleixner

    Jeremy Fitzhardinge
     
  • This is a pair of Xen para-virtual frontend device drivers:
    drivers/video/xen-fbfront.c provides a framebuffer, and
    drivers/input/xen-kbdfront provides keyboard and mouse.

    The backends run in dom0 user space.

    The two drivers are not in two separate patches, because the
    intermediate step (one driver, not the other) is somewhat problematic:
    the backend in dom0 needs both drivers, and will refuse to complete
    device initialization unless they're both present.

    Signed-off-by: Markus Armbruster

    Signed-off-by: Ingo Molnar
    Signed-off-by: Thomas Gleixner

    Markus Armbruster
     
  • When the xen block frontend driver is built as a module the module load
    is only synchronous up to the point where the frontend and the backend
    become connected rather than when the disk is added.

    This means that there can be a race on boot between loading the module and
    loading the dm-* modules and doing the scan for LVM physical volumes (all
    in the initrd). In the failure case the disk is not present until after the
    scan for physical volumes is complete.

    Taken from:

    http://xenbits.xensource.com/linux-2.6.18-xen.hg?rev/11483a00c017

    Signed-off-by: Christian Limpach
    Signed-off-by: Mark McLoughlin
    Signed-off-by: Jeremy Fitzhardinge
    Signed-off-by: Ingo Molnar
    Signed-off-by: Thomas Gleixner

    Christian Limpach
     
  • Frontends are expected to write their protocol ABI to xenstore. Since
    the protocol ABI defaults to the backend's native ABI, things work
    fine without that as long as the frontend's native ABI is identical to
    the backend's native ABI. This is not the case for xen-blkfront
    running 32-on-64, because its ABI differs between 32 and 64 bit, and
    thus needs this fix.

    Based on http://xenbits.xensource.com/xen-unstable.hg?rev/c545932a18f3
    and http://xenbits.xensource.com/xen-unstable.hg?rev/ffe52263b430 by
    Gerd Hoffmann

    Signed-off-by: Markus Armbruster
    Signed-off-by: Jeremy Fitzhardinge
    Signed-off-by: Ingo Molnar
    Signed-off-by: Thomas Gleixner

    Markus Armbruster
     
  • On xen/ia64 and xen/powerpc hypercall arguments are passed by pseudo
    physical address (guest physical address) so that it's necessary to
    convert from virtual address into pseudo physical address. The frame
    work is called xencomm.
    Import arch generic part of xencomm.

    Signed-off-by: Isaku Yamahata
    Signed-off-by: Jeremy Fitzhardinge
    Signed-off-by: Ingo Molnar
    Signed-off-by: Thomas Gleixner

    Isaku Yamahata
     
  • split out x86 specific part from grant-table.c and
    allow ia64/xen specific initialization.
    ia64/xen grant table is based on pseudo physical address
    (guest physical address) unlike x86/xen. On ia64 init_mm
    doesn't map identity straight mapped area.
    ia64/xen specific grant table initialization is necessary.

    Signed-off-by: Isaku Yamahata
    Signed-off-by: Ingo Molnar
    Signed-off-by: Thomas Gleixner

    Isaku Yamahata
     
  • Don't use alloc_vm_area()/free_vm_area() directly, instead define
    xen_alloc_vm_area()/xen_free_vm_area() and use them.

    alloc_vm_area()/free_vm_area() are used to allocate/free area which
    are for grant table mapping. Xen/x86 grant table is based on virtual
    address so that alloc_vm_area()/free_vm_area() are suitable.
    On the other hand Xen/ia64 (and Xen/powerpc) grant table is based on
    pseudo physical address (guest physical address) so that allocation
    should be done differently.
    The original version of xenified Linux/IA64 have its own
    allocate_vm_area()/free_vm_area() definitions which don't allocate vm area
    contradictory to those names.
    Now vanilla Linux already has its definitions so that it's impossible
    to have IA64 definitions of allocate_vm_area()/free_vm_area().
    Instead introduce xen_allocate_vm_area()/xen_free_vm_area() and use them.

    Signed-off-by: Isaku Yamahata
    Signed-off-by: Jeremy Fitzhardinge
    Signed-off-by: Ingo Molnar
    Signed-off-by: Thomas Gleixner

    Isaku Yamahata
     
  • The definitions in include/asm/xen/page.h are arch specific.
    ia64/xen wants to define its own version. So move them to arch specific
    directory and keep include/xen/page.h in order not to break compilation.

    Signed-off-by: Isaku Yamahata
    Signed-off-by: Jeremy Fitzhardinge
    Signed-off-by: Ingo Molnar
    Signed-off-by: Thomas Gleixner

    Isaku Yamahata
     
  • Define resend_irq_on_evtchn() which ia64/xen uses.
    Although it isn't used by current x86/xen code, it's arch generic
    so that put it into common code.

    Signed-off-by: Isaku Yamahata
    Signed-off-by: Jeremy Fitzhardinge
    Signed-off-by: Ingo Molnar
    Signed-off-by: Thomas Gleixner

    Isaku Yamahata
     
  • Remove x86 dependency in drivers/xen/events.c for ia64/xen support
    introducing include/asm/xen/events.h.
    Introduce xen_irqs_disabled() to hide regs->flags
    Introduce xen_do_IRQ() to hide regs->orig_ax.
    make enum ipi_vector definition arch specific. ia64/xen needs four vectors.
    Add one rmb() because on ia64 xchg() isn't barrier.

    Signed-off-by: Isaku Yamahata
    Signed-off-by: Jeremy Fitzhardinge
    Signed-off-by: Ingo Molnar
    Signed-off-by: Thomas Gleixner

    Isaku Yamahata
     
  • move arch/x86/xen/events.c undedr drivers/xen to share codes
    with x86 and ia64. And minor adjustment to compile.
    ia64/xen also uses events.c

    Signed-off-by: Yaozu (Eddie) Dong
    Signed-off-by: Isaku Yamahata
    Signed-off-by: Jeremy Fitzhardinge
    Signed-off-by: Ingo Molnar
    Signed-off-by: Thomas Gleixner

    Isaku Yamahata
     
  • Add xen handles realted definitions for xen vcpu which ia64/xen needs.
    Pointer argumsnts for ia64/xen hypercall are passed in pseudo physical
    address (guest physical address) so that it is required to convert
    guest kernel virtual address into pseudo physical address.
    The xen guest handle represents such arguments.

    Signed-off-by: Isaku Yamahata
    Signed-off-by: Jeremy Fitzhardinge
    Signed-off-by: Ingo Molnar
    Signed-off-by: Thomas Gleixner

    Isaku Yamahata