09 Sep, 2008

1 commit


25 Aug, 2008

1 commit


22 Jul, 2008

1 commit

  • This allow to dynamically generate attributes and share show/store
    functions between attributes. Right now most attributes are generated
    by special macros and lots of duplicated code. With the attribute
    passed it's instead possible to attach some data to the attribute
    and then use that in shared low level functions to do different things.

    I need this for the dynamically generated bank attributes in the x86
    machine check code, but it'll allow some further cleanups.

    I converted all users in tree to the new show/store prototype. It's a single
    huge patch to avoid unbisectable sections.

    Runtime tested: x86-32, x86-64
    Compiled only: ia64, powerpc
    Not compile tested/only grep converted: sh, arm, avr32

    Signed-off-by: Andi Kleen
    Signed-off-by: Greg Kroah-Hartman

    Andi Kleen
     

21 Jul, 2008

1 commit


18 Jul, 2008

1 commit

  • Today's linux-next build (x86_64 allmodconfig) failed like this:

    drivers/xen/manage.c: In function 'xen_suspend':
    drivers/xen/manage.c:66: error: too few arguments to function 'device_power_up'
    drivers/xen/manage.c: In function 'do_suspend':
    drivers/xen/manage.c:117: error: too few arguments to function 'device_resume'

    Caused by commit 1eede070a59e1cc73da51e1aaa00d9ab86572cfc ("Introduce new
    top level suspend and hibernation callbacks") interacting with new
    usages ...

    Signed-off-by: Stephen Rothwell
    Cc: Jeremy Fitzhardinge
    Acked-by: Rafael J. Wysocki
    Cc: Jesse Barnes
    Signed-off-by: Ingo Molnar

    Stephen Rothwell
     

16 Jul, 2008

2 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
     
  • 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
     

15 Jul, 2008

1 commit

  • * 'x86/for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: (821 commits)
    x86: make 64bit hpet_set_mapping to use ioremap too, v2
    x86: get x86_phys_bits early
    x86: max_low_pfn_mapped fix #4
    x86: change _node_to_cpumask_ptr to return const ptr
    x86: I/O APIC: remove an IRQ2-mask hack
    x86: fix numaq_tsc_disable calling
    x86, e820: remove end_user_pfn
    x86: max_low_pfn_mapped fix, #3
    x86: max_low_pfn_mapped fix, #2
    x86: max_low_pfn_mapped fix, #1
    x86_64: fix delayed signals
    x86: remove conflicting nx6325 and nx6125 quirks
    x86: Recover timer_ack lost in the merge of the NMI watchdog
    x86: I/O APIC: Never configure IRQ2
    x86: L-APIC: Always fully configure IRQ0
    x86: L-APIC: Set IRQ0 as edge-triggered
    x86: merge dwarf2 headers
    x86: use AS_CFI instead of UNWIND_INFO
    x86: use ignore macro instead of hash comment
    x86: use matching CFI_ENDPROC
    ...

    Linus Torvalds
     

03 Jul, 2008

1 commit

  • Avoid allocations causing swap activity on the resume path by
    preventing the allocations from doing IO and allowing them
    to access the emergency pools.

    These paths are used when a frontend device is trying to connect
    to its backend driver over Xenbus. These reconnections are triggered
    on demand by IO, so by definition there is already IO underway,
    and further IO would naturally deadlock. On resume, this path
    is triggered when the running system tries to continue using its
    devices. If it cannot then the resume will fail; to try to avoid this
    we let it dip into the emergency pools.

    [ linux-2.6.18-xen changesets e8b49cfbdac, fdb998e79aba ]

    Signed-off-by: Ian Campbell
    Signed-off-by: Jeremy Fitzhardinge
    Signed-off-by: Jens Axboe

    Ian Campbell
     

20 Jun, 2008

2 commits

  • This patch is ported one from 534:77db69c38249 of linux-2.6.18-xen.hg.
    Use wmb instead of rmb to enforce ordering between
    evtchn_upcall_pending and evtchn_pending_sel stores
    in xen_evtchn_do_upcall().

    Cc: Samuel Thibault
    Signed-off-by: Isaku Yamahata
    Cc: Nick Piggin
    Cc: the arch/x86 maintainers
    Signed-off-by: Ingo Molnar

    Isaku Yamahata
     
  • This patch is ported one from 534:77db69c38249 of linux-2.6.18-xen.hg.
    Use wmb instead of rmb to enforce ordering between
    evtchn_upcall_pending and evtchn_pending_sel stores
    in xen_evtchn_do_upcall().

    Cc: Samuel Thibault
    Signed-off-by: Isaku Yamahata
    Cc: Nick Piggin
    Cc: the arch/x86 maintainers
    Signed-off-by: Ingo Molnar

    Isaku Yamahata
     

02 Jun, 2008

1 commit


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
     
  • When restoring, rebind the existing xenbus irq to the new xenbus event
    channel. (It turns out in practice that this is always the same, and
    is never updated on restore. That's a bug, but Xeno-linux has been
    like this for a long time, so it can't really be fixed.)

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

    Jeremy Fitzhardinge
     
  • Rearrange the tests in unbind_from_irq() so that we can still unbind
    an irq even if the underlying event channel is bad. This allows a
    device driver to shuffle its irqs on save/restore before the
    underlying event channels have been fixed up.

    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
     
  • Make the needlessly global balloon_set_new_target() static.

    Signed-off-by: Adrian Bunk
    Acked-by: Chris Wright
    Signed-off-by: Andrew Morton
    Signed-off-by: Thomas Gleixner

    Adrian Bunk
     
  • fix compilation error of ballon driver on ia64.
    extent_start member is pointer argument. On x86 pointer argument for
    xen hypercall is passed as virtual address.
    On the other hand, ia64 and ppc, pointer argument is passed in pseudo
    physical address. (guest physicall address.)
    So they must be passed as handle and convert right before issuing hypercall.

    CC drivers/xen/balloon.o
    linux-2.6-x86/drivers/xen/balloon.c: In function 'increase_reservation':
    linux-2.6-x86/drivers/xen/balloon.c:228: error: incompatible types in assignment
    linux-2.6-x86/drivers/xen/balloon.c: In function 'decrease_reservation':
    linux-2.6-x86/drivers/xen/balloon.c:324: error: incompatible types in assignment
    linux-2.6-x86/drivers/xen/balloon.c: In function 'dealloc_pte_fn':
    linux-2.6-x86/drivers/xen/balloon.c:486: error: incompatible types in assignment
    linux-2.6-x86/drivers/xen/balloon.c: In function 'alloc_empty_pages_and_pagevec':
    linux-2.6-x86/drivers/xen/balloon.c:522: error: incompatible types in assignment
    make[2]: *** [drivers/xen/balloon.o] Error 1

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

    Isaku Yamahata
     
  • move arch/x86/xen/manage.c under drivers/xen/to share codes
    with x86 and ia64.
    ia64/xen also uses manage.c

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

    Isaku Yamahata
     

25 Apr, 2008

11 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
     
  • Add module aliases to support autoprobing modules
    for xen frontend devices.

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

    Mark McLoughlin
     
  • 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
     
  • 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
     
  • 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
     
  • ia64/xen also uses it too. Move it into common place so that
    ia64/xen can share the code.

    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 grant table 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 right before
    issuing hypercall.
    The xen guest handle represents such arguments.
    Define necessary handles and helper functions.

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

    Isaku Yamahata
     

05 Apr, 2008

1 commit

  • fix memory corruption and crash due to mis-sized grant table.

    A PV OS has two grant table data structures: the grant table itself
    and a free list. The free list is composed of an array of pages,
    which grow dynamically as the guest OS requires more grants. While
    the grant table contains 8-byte entries, the free list contains 4-byte
    entries. So we have half as many pages in the free list than in the
    grant table.

    There was a bug in the free list allocation code. The free list was
    indexed as if it was the same size as the grant table. But it's only
    half as large. So memory got corrupted, and I was seeing crashes in
    the slab allocator later on.

    Taken from:

    http://xenbits.xensource.com/linux-2.6.18-xen.hg?rev/4018c0da3360

    Signed-off-by: Michael Abd-El-Malek
    Signed-off-by: Mark McLoughlin
    Signed-off-by: Jeremy Fitzhardinge
    Signed-off-by: Ingo Molnar

    Michael Abd-El-Malek
     

19 Oct, 2007

1 commit

  • Found these while looking at printk uses.

    Add missing newlines to dev_ uses
    Add missing KERN_ prefixes to multiline dev_s
    Fixed a wierd->weird spelling typo
    Added a newline to a printk

    Signed-off-by: Joe Perches
    Cc: "Luck, Tony"
    Cc: Jens Axboe
    Cc: Mark M. Hoffman
    Cc: Roland Dreier
    Cc: Tilman Schmidt
    Cc: David Woodhouse
    Cc: Jeff Garzik
    Cc: Stephen Hemminger
    Cc: Greg KH
    Cc: Jeremy Fitzhardinge
    Cc: Geert Uytterhoeven
    Cc: Alessandro Zummo
    Cc: David Brownell
    Cc: James Smart
    Cc: Andrew Vasquez
    Cc: "Antonino A. Daplas"
    Cc: Evgeniy Polyakov
    Cc: Russell King
    Cc: Jaroslav Kysela
    Cc: Takashi Iwai
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joe Perches
     

27 Jul, 2007

1 commit


18 Jul, 2007

2 commits

  • This communicates with the machine control software via a registry
    residing in a controlling virtual machine. This allows dynamic
    creation, destruction and modification of virtual device
    configurations (network devices, block devices and CPUS, to name some
    examples).

    [ Greg, would you mind giving this a review? Thanks -J ]

    Signed-off-by: Ian Pratt
    Signed-off-by: Christian Limpach
    Signed-off-by: Jeremy Fitzhardinge
    Signed-off-by: Chris Wright
    Cc: Greg KH

    Jeremy Fitzhardinge
     
  • Add Xen 'grant table' driver which allows granting of access to
    selected local memory pages by other virtual machines and,
    symmetrically, the mapping of remote memory pages which other virtual
    machines have granted access to.

    This driver is a prerequisite for many of the Xen virtual device
    drivers, which grant the 'device driver domain' restricted and
    temporary access to only those memory pages that are currently
    involved in I/O operations.

    Signed-off-by: Jeremy Fitzhardinge
    Signed-off-by: Ian Pratt
    Signed-off-by: Christian Limpach
    Signed-off-by: Chris Wright

    Jeremy Fitzhardinge