22 Nov, 2011

1 commit

  • Event channels exposed to userspace by the evtchn module may be used by
    other modules in an asynchronous manner, which requires that reference
    counting be used to prevent the event channel from being closed before
    the signals are delivered.

    The reference count on new event channels defaults to -1 which indicates
    the event channel is not referenced outside the kernel; evtchn_get fails
    if called on such an event channel. The event channels made visible to
    userspace by evtchn have a normal reference count.

    Signed-off-by: Daniel De Graaf
    Signed-off-by: Konrad Rzeszutek Wilk

    Daniel De Graaf
     

12 Jul, 2011

1 commit

  • In the past (2.6.38) the 'xen_allocate_pirq_gsi' would allocate
    an entry in a Linux IRQ -> {XEN_IRQ, type, event, ..} array. All
    of that has been removed in 2.6.39 and the Xen IRQ subsystem uses
    an linked list that is populated when the call to
    'xen_allocate_irq_gsi' (universally done from any of the xen_bind_*
    calls) is done. The 'xen_allocate_pirq_gsi' is a NOP and there is
    no need for it anymore so lets remove it.

    Signed-off-by: Konrad Rzeszutek Wilk

    Konrad Rzeszutek Wilk
     

14 Apr, 2011

3 commits


18 Mar, 2011

1 commit

  • …it.kernel.org/pub/scm/linux/kernel/git/konrad/xen

    * 'stable/irq.fairness' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen:
    xen: events: Remove redundant clear of l2i at end of round-robin loop
    xen: events: Make round-robin scan fairer by snapshotting each l2 word once only
    xen: events: Clean up round-robin evtchn scan.
    xen: events: Make last processed event channel a per-cpu variable.
    xen: events: Process event channels notifications in round-robin order.

    * 'stable/irq.ween_of_nr_irqs' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen:
    xen: events: Fix compile error if CONFIG_SMP is not defined.
    xen: events: correct locking in xen_irq_from_pirq
    xen: events: propagate irq allocation failure instead of panicking
    xen: events: do not workaround too-small nr_irqs
    xen: events: remove use of nr_irqs as upper bound on number of pirqs
    xen: events: dynamically allocate irq info structures
    xen: events: maintain a list of Xen interrupts
    xen: events: push setup of irq<->{evtchn,ipi,virq,pirq} maps into irq_info init functions
    xen: events: turn irq_info constructors into initialiser functions
    xen: events: use per-cpu variable for cpu_evtchn_mask
    xen: events: refactor GSI pirq bindings functions
    xen: events: rename restore_cpu_pirqs -> restore_pirqs
    xen: events: remove unused public functions
    xen: events: fix xen_map_pirq_gsi error return
    xen: events: simplify comment
    xen: events: separate two unrelated halves of if condition

    Fix up trivial conflicts in drivers/xen/events.c

    Linus Torvalds
     

17 Mar, 2011

1 commit

  • * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6: (1480 commits)
    bonding: enable netpoll without checking link status
    xfrm: Refcount destination entry on xfrm_lookup
    net: introduce rx_handler results and logic around that
    bonding: get rid of IFF_SLAVE_INACTIVE netdev->priv_flag
    bonding: wrap slave state work
    net: get rid of multiple bond-related netdevice->priv_flags
    bonding: register slave pointer for rx_handler
    be2net: Bump up the version number
    be2net: Copyright notice change. Update to Emulex instead of ServerEngines
    e1000e: fix kconfig for crc32 dependency
    netfilter ebtables: fix xt_AUDIT to work with ebtables
    xen network backend driver
    bonding: Improve syslog message at device creation time
    bonding: Call netif_carrier_off after register_netdevice
    bonding: Incorrect TX queue offset
    net_sched: fix ip_tos2prio
    xfrm: fix __xfrm_route_forward()
    be2net: Fix UDP packet detected status in RX compl
    Phonet: fix aligned-mode pipe socket buffer header reserve
    netxen: support for GbE port settings
    ...

    Fix up conflicts in drivers/staging/brcm80211/brcmsmac/wl_mac80211.c
    with the staging updates.

    Linus Torvalds
     

11 Mar, 2011

8 commits


28 Feb, 2011

1 commit


02 Dec, 2010

1 commit

  • When remapping MSIs into pirqs for PV on HVM guests, qemu is responsible
    for doing the actual mapping and unmapping.
    We only give qemu the desired pirq number when we ask to do the mapping
    the first time, after that we should be reading back the pirq number
    from qemu every time we want to re-enable the MSI.

    This fixes a bug in xen_hvm_setup_msi_irqs that manifests itself when
    trying to enable the same MSI for the second time: the old MSI to pirq
    mapping is still valid at this point but xen_hvm_setup_msi_irqs would
    try to assign a new pirq anyway.
    A simple way to reproduce this bug is to assign an MSI capable network
    card to a PV on HVM guest, if the user brings down the corresponding
    ethernet interface and up again, Linux would fail to enable MSIs on the
    device.

    Signed-off-by: Stefano Stabellini

    Stefano Stabellini
     

23 Oct, 2010

4 commits


18 Oct, 2010

5 commits

  • The frontend stub lives in arch/x86/pci/xen.c, alongside other
    sub-arch PCI init code (e.g. olpc.c).

    It provides a mechanism for Xen PCI frontend to setup/destroy
    legacy interrupts, MSI/MSI-X, and PCI configuration operations.

    [ Impact: add core of Xen PCI support ]
    [ v2: Removed the IOMMU code and only focusing on PCI.]
    [ v3: removed usage of pci_scan_all_fns as that does not exist]
    [ v4: introduced pci_xen value to fix compile warnings]
    [ v5: squished fixes+features in one patch, changed Reviewed-by to Ccs]
    [ v7: added Acked-by]
    Signed-off-by: Alex Nixon
    Signed-off-by: Jeremy Fitzhardinge
    Signed-off-by: Ian Campbell
    Signed-off-by: Konrad Rzeszutek Wilk
    Signed-off-by: Stefano Stabellini
    Acked-by: Jesse Barnes
    Cc: "H. Peter Anvin"
    Cc: Matthew Wilcox
    Cc: Qing He
    Cc: Thomas Gleixner
    Cc: x86@kernel.org

    Alex Nixon
     
  • In driver/xen/events.c, whether bind_pirq is shareable or not is
    determined by desc->action is NULL or not. But in __setup_irq,
    startup(irq) is invoked before desc->action is assigned with
    new action. So desc->action in startup_irq is always NULL, and
    bind_pirq is always not shareable. This results in pt_irq_create_bind
    failure when passthrough a device which shares irq to other devices.

    This patch doesn't use probing_irq to determine if pirq is shareable
    or not, instead set shareable flag in irq_info according to trigger
    mode in xen_allocate_pirq. Set level triggered interrupts shareable.
    Thus use this flag to set bind_pirq flag accordingly.

    [v2: arch/x86/xen/pci.c no more, so file skipped]

    Signed-off-by: Weidong Han
    Signed-off-by: Jeremy Fitzhardinge
    Signed-off-by: Konrad Rzeszutek Wilk

    Konrad Rzeszutek Wilk
     
  • The 'xen_poll_irq_timeout' provides a method to pass in
    the poll timeout for IRQs if requested. We also export
    those two poll functions as Xen PCI fronted uses them.

    Signed-off-by: Konrad Rzeszutek Wilk
    Signed-off-by: Jeremy Fitzhardinge

    Konrad Rzeszutek Wilk
     
  • Impact: cleanup

    Make pirq show useful information in /proc/interrupts

    [v2: Removed the parts for arch/x86/xen/pci.c ]

    Signed-off-by: Gerd Hoffmann
    Signed-off-by: Jeremy Fitzhardinge
    Signed-off-by: Konrad Rzeszutek Wilk

    Gerd Hoffmann
     
  • A privileged PV Xen domain can get direct access to hardware. In
    order for this to be useful, it must be able to get hardware
    interrupts.

    Being a PV Xen domain, all interrupts are delivered as event channels.
    PIRQ event channels are bound to a pirq number and an interrupt
    vector. When a IO APIC raises a hardware interrupt on that vector, it
    is delivered as an event channel, which we can deliver to the
    appropriate device driver(s).

    This patch simply implements the infrastructure for dealing with pirq
    event channels.

    [ Impact: integrate hardware interrupts into Xen's event scheme ]

    Signed-off-by: Jeremy Fitzhardinge
    Signed-off-by: Konrad Rzeszutek Wilk

    Jeremy Fitzhardinge
     

23 Jul, 2010

1 commit

  • Set the callback to receive evtchns from Xen, using the
    callback vector delivery mechanism.

    The traditional way for receiving event channel notifications from Xen
    is via the interrupts from the platform PCI device.
    The callback vector is a newer alternative that allow us to receive
    notifications on any vcpu and doesn't need any PCI support: we allocate
    a vector exclusively to receive events, in the vector handler we don't
    need to interact with the vlapic, therefore we avoid a VMEXIT.

    Signed-off-by: Stefano Stabellini
    Signed-off-by: Sheng Yang
    Signed-off-by: Jeremy Fitzhardinge

    Sheng Yang
     

31 Mar, 2009

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

1 commit

  • 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
     

27 May, 2008

2 commits

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

25 Apr, 2008

2 commits

  • 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
     

18 Jul, 2007

3 commits

  • Implement a Xen back-end for hvc console.

    * * *
    Add early printk support via hvc console, enable using
    "earlyprintk=xen" on the kernel command line.

    From: Gerd Hoffmann
    Signed-off-by: Jeremy Fitzhardinge
    Signed-off-by: Chris Wright
    Acked-by: Ingo Molnar
    Acked-by: Olof Johansson

    Jeremy Fitzhardinge
     
  • This is a fairly straightforward Xen implementation of smp_ops.

    Xen has its own IPI mechanisms, and has no dependency on any
    APIC-based IPI. The smp_ops hooks and the flush_tlb_others pv_op
    allow a Xen guest to avoid all APIC code in arch/i386 (the only apic
    operation is a single apic_read for the apic version number).

    One subtle point which needs to be addressed is unpinning pagetables
    when another cpu may have a lazy tlb reference to the pagetable. Xen
    will not allow an in-use pagetable to be unpinned, so we must find any
    other cpus with a reference to the pagetable and get them to shoot
    down their references.

    Signed-off-by: Jeremy Fitzhardinge
    Signed-off-by: Chris Wright
    Cc: Benjamin LaHaise
    Cc: Ingo Molnar
    Cc: Andi Kleen

    Jeremy Fitzhardinge
     
  • Xen implements interrupts in terms of event channels. Each guest
    domain gets 1024 event channels which can be used for a variety of
    purposes, such as Xen timer events, inter-domain events,
    inter-processor events (IPI) or for real hardware IRQs.

    Within the kernel, we map the event channels to IRQs, and implement
    the whole interrupt handling using a Xen irq_chip.

    Rather than setting NR_IRQ to 1024 under PARAVIRT in order to
    accomodate Xen, we create a dynamic mapping between event channels and
    IRQs. Ideally, Linux will eventually move towards dynamically
    allocating per-irq structures, and we can use a 1:1 mapping between
    event channels and irqs.

    Signed-off-by: Jeremy Fitzhardinge
    Signed-off-by: Chris Wright
    Cc: Ingo Molnar
    Cc: Eric W. Biederman

    Jeremy Fitzhardinge