20 May, 2015

1 commit

  • A non-percpu VIRQ (e.g., VIRQ_CONSOLE) may be freed on a different
    VCPU than it is bound to. This can result in a race between
    handle_percpu_irq() and removing the action in __free_irq() because
    handle_percpu_irq() does not take desc->lock. The interrupt handler
    sees a NULL action and oopses.

    Only use the percpu chip/handler for per-CPU VIRQs (like VIRQ_TIMER).

    # cat /proc/interrupts | grep virq
    40: 87246 0 xen-percpu-virq timer0
    44: 0 0 xen-percpu-virq debug0
    47: 0 20995 xen-percpu-virq timer1
    51: 0 0 xen-percpu-virq debug1
    69: 0 0 xen-dyn-virq xen-pcpu
    74: 0 0 xen-dyn-virq mce
    75: 29 0 xen-dyn-virq hvc_console

    Signed-off-by: David Vrabel
    Cc:

    David Vrabel
     

23 Sep, 2014

1 commit


18 Mar, 2014

1 commit

  • Add support for MSI message groups for Xen Dom0 using the
    MAP_PIRQ_TYPE_MULTI_MSI pirq map type.

    In order to keep track of which pirq is the first one in the group all
    pirqs in the MSI group except for the first one have the newly
    introduced PIRQ_MSI_GROUP flag set. This prevents calling
    PHYSDEVOP_unmap_pirq on them, since the unmap must be done with the
    first pirq in the group.

    Signed-off-by: Roger Pau Monné
    Signed-off-by: David Vrabel
    Cc: Boris Ostrovsky

    Roger Pau Monne
     

01 Mar, 2014

1 commit


06 Jan, 2014

3 commits


21 Jun, 2013

1 commit

  • [Purpose of this patch]

    As Vaibhav explained in the thread below, tracepoints for irq vectors
    are useful.

    http://www.spinics.net/lists/mm-commits/msg85707.html

    The current interrupt traces from irq_handler_entry and irq_handler_exit
    provide when an interrupt is handled. They provide good data about when
    the system has switched to kernel space and how it affects the currently
    running processes.

    There are some IRQ vectors which trigger the system into kernel space,
    which are not handled in generic IRQ handlers. Tracing such events gives
    us the information about IRQ interaction with other system events.

    The trace also tells where the system is spending its time. We want to
    know which cores are handling interrupts and how they are affecting other
    processes in the system. Also, the trace provides information about when
    the cores are idle and which interrupts are changing that state.

    On the other hand, my usecase is tracing just local timer event and
    getting a value of instruction pointer.

    I suggested to add an argument local timer event to get instruction pointer before.
    But there is another way to get it with external module like systemtap.
    So, I don't need to add any argument to irq vector tracepoints now.

    [Patch Description]

    Vaibhav's patch shared a trace point ,irq_vector_entry/irq_vector_exit, in all events.
    But there is an above use case to trace specific irq_vector rather than tracing all events.
    In this case, we are concerned about overhead due to unwanted events.

    So, add following tracepoints instead of introducing irq_vector_entry/exit.
    so that we can enable them independently.
    - local_timer_vector
    - reschedule_vector
    - call_function_vector
    - call_function_single_vector
    - irq_work_entry_vector
    - error_apic_vector
    - thermal_apic_vector
    - threshold_apic_vector
    - spurious_apic_vector
    - x86_platform_ipi_vector

    Also, introduce a logic switching IDT at enabling/disabling time so that a time penalty
    makes a zero when tracepoints are disabled. Detailed explanations are as follows.
    - Create trace irq handlers with entering_irq()/exiting_irq().
    - Create a new IDT, trace_idt_table, at boot time by adding a logic to
    _set_gate(). It is just a copy of original idt table.
    - Register the new handlers for tracpoints to the new IDT by introducing
    macros to alloc_intr_gate() called at registering time of irq_vector handlers.
    - Add checking, whether irq vector tracing is on/off, into load_current_idt().
    This has to be done below debug checking for these reasons.
    - Switching to debug IDT may be kicked while tracing is enabled.
    - On the other hands, switching to trace IDT is kicked only when debugging
    is disabled.

    In addition, the new IDT is created only when CONFIG_TRACING is enabled to avoid being
    used for other purposes.

    Signed-off-by: Seiji Aguchi
    Link: http://lkml.kernel.org/r/51C323ED.5050708@hds.com
    Signed-off-by: H. Peter Anvin
    Cc: Steven Rostedt

    Seiji Aguchi
     

17 Apr, 2013

1 commit

  • For quite a few Xen versions, this wasn't the IRQ vector anymore
    anyway, and it is not being used by the kernel for anything. Hence
    drop the field from struct irq_info, and respective function
    parameters.

    Signed-off-by: Jan Beulich
    Acked-by: Stefano Stabellini
    Signed-off-by: Konrad Rzeszutek Wilk

    Jan Beulich
     

14 Sep, 2012

1 commit


22 May, 2012

1 commit

  • PV on HVM guests map GSIs into event channels. At restore time the
    event channels are resumed by restore_pirqs.

    Device drivers might try to register the same GSI again through ACPI at
    restore time, but the GSI has already been mapped and bound by
    restore_pirqs. This patch detects these situations and avoids
    mapping the same GSI multiple times.

    Without this patch we get:
    (XEN) irq.c:2235: dom4: pirq 23 or emuirq 28 already mapped
    and waste a pirq.

    CC: stable@kernel.org
    Signed-off-by: Stefano Stabellini
    Signed-off-by: Konrad Rzeszutek Wilk

    Stefano Stabellini
     

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