1. 02 12月, 2010 1 次提交
  2. 23 11月, 2010 1 次提交
    • K
      xen/events: Use PIRQ instead of GSI value when unmapping MSI/MSI-X irqs. · 12334715
      Konrad Rzeszutek Wilk 提交于
      When we allocate a vector for MSI/MSI-X we save away the PIRQ, and the
      vector value. When we unmap (de-allocate) the MSI/MSI-X vector(s) we
      need to provide the PIRQ and the vector value. What we did instead
      was to provide the GSI (which was zero) and the vector value, and we
      got these unhappy error messages:
      
      (XEN) irq.c:1575: dom0: pirq 0 not mapped
      [    7.733415] unmap irq failed -22
      
      This patches fixes this and we use the PIRQ value instead of the GSI
      value.
      
      CC: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      12334715
  3. 17 11月, 2010 2 次提交
  4. 11 11月, 2010 1 次提交
    • I
      xen: events: do not unmask event channels on resume · 6903591f
      Ian Campbell 提交于
      The IRQ core code will take care of disabling and reenabling
      interrupts over suspend resume automatically, therefore we do not need
      to do this in the Xen event channel code.
      
      The only exception is those event channels marked IRQF_NO_SUSPEND
      which the IRQ core ignores. We must unmask these ourselves, taking
      care to obey the current IRQ_DISABLED status. Failure check for
      IRQ_DISABLED leads to enabling polled only event channels, such as
      that associated with the pv spinlocks, which must never be enabled:
      
      [   21.970432] ------------[ cut here ]------------
      [   21.970432] kernel BUG at arch/x86/xen/spinlock.c:343!
      [   21.970432] invalid opcode: 0000 [#1] SMP
      [   21.970432] last sysfs file: /sys/devices/virtual/net/lo/operstate
      [   21.970432] Modules linked in:
      [   21.970432]
      [   21.970432] Pid: 0, comm: swapper Not tainted (2.6.32.24-x86_32p-xen-01034-g787c727 #34)
      [   21.970432] EIP: 0061:[<c102e209>] EFLAGS: 00010046 CPU: 3
      [   21.970432] EIP is at dummy_handler+0x3/0x7
      [   21.970432] EAX: 0000021c EBX: dfc16880 ECX: 0000001a EDX: 00000000
      [   21.970432] ESI: dfc02c00 EDI: 00000001 EBP: dfc47e10 ESP: dfc47e10
      [   21.970432]  DS: 007b ES: 007b FS: 00d8 GS: 0000 SS: 0069
      [   21.970432] Process swapper (pid: 0, ti=dfc46000 task=dfc39440 task.ti=dfc46000)
      [   21.970432] Stack:
      [   21.970432]  dfc47e30 c10a39f0 0000021c 00000000 00000000 dfc16880 0000021c 00000001
      [   21.970432] <0> dfc47e40 c10a4f08 0000021c 00000000 dfc47e78 c12240a7 c1839284 c1839284
      [   21.970432] <0> 00000200 00000000 00000000 f5720000 c1f3d028 c1f3d02c 00000180 dfc47e90
      [   21.970432] Call Trace:
      [   21.970432]  [<c10a39f0>] ? handle_IRQ_event+0x5f/0x122
      [   21.970432]  [<c10a4f08>] ? handle_percpu_irq+0x2f/0x55
      [   21.970432]  [<c12240a7>] ? __xen_evtchn_do_upcall+0xdb/0x15f
      [   21.970432]  [<c122481e>] ? xen_evtchn_do_upcall+0x20/0x30
      [   21.970432]  [<c1030d47>] ? xen_do_upcall+0x7/0xc
      [   21.970432]  [<c102007b>] ? apic_reg_read+0xd3/0x22d
      [   21.970432]  [<c1002227>] ? hypercall_page+0x227/0x1005
      [   21.970432]  [<c102d30b>] ? xen_force_evtchn_callback+0xf/0x14
      [   21.970432]  [<c102da7c>] ? check_events+0x8/0xc
      [   21.970432]  [<c102da3b>] ? xen_irq_enable_direct_end+0x0/0x1
      [   21.970432]  [<c105e485>] ? finish_task_switch+0x62/0xba
      [   21.970432]  [<c14e3f84>] ? schedule+0x808/0x89d
      [   21.970432]  [<c1084dc5>] ? hrtimer_start_expires+0x1a/0x22
      [   21.970432]  [<c1085154>] ? tick_nohz_restart_sched_tick+0x15a/0x162
      [   21.970432]  [<c102f43a>] ? cpu_idle+0x6d/0x6f
      [   21.970432]  [<c14db29e>] ? cpu_bringup_and_idle+0xd/0xf
      [   21.970432] Code: 5d 0f 95 c0 0f b6 c0 c3 55 66 83 78 02 00 89 e5 5d 0f 95 \
      c0 0f b6 c0 c3 55 b2 01 86 10 31 c0 84 d2 89 e5 0f 94 c0 5d c3 55 89 e5 <0f> 0b \
      eb fe 55 80 3d 4c ce 84 c1 00 89 e5 57 56 89 c6 53 74 15
      [   21.970432] EIP: [<c102e209>] dummy_handler+0x3/0x7 SS:ESP 0069:dfc47e10
      [   21.970432] ---[ end trace c0b71f7e12cf3011 ]---
      Signed-off-by: NIan Campbell <ian.campbell@citrix.com>
      Signed-off-by: NJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
      6903591f
  5. 23 10月, 2010 12 次提交
  6. 19 10月, 2010 1 次提交
  7. 18 10月, 2010 9 次提交
  8. 12 10月, 2010 1 次提交
  9. 25 8月, 2010 2 次提交
    • J
      xen: handle events as edge-triggered · dffe2e1e
      Jeremy Fitzhardinge 提交于
      Xen events are logically edge triggered, as Xen only calls the event
      upcall when an event is newly set, but not continuously as it remains set.
      As a result, use handle_edge_irq rather than handle_level_irq.
      
      This has the important side-effect of fixing a long-standing bug of
      events getting lost if:
       - an event's interrupt handler is running
       - the event is migrated to a different vcpu
       - the event is re-triggered
      
      The most noticable symptom of these lost events is occasional lockups
      of blkfront.
      
      Many thanks to Tom Kopec and Daniel Stodden in tracking this down.
      Signed-off-by: NJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
      Cc: Tom Kopec <tek@acm.org>
      Cc: Daniel Stodden <daniel.stodden@citrix.com>
      Cc: Stable Kernel <stable@kernel.org>
      dffe2e1e
    • J
      xen: use percpu interrupts for IPIs and VIRQs · aaca4964
      Jeremy Fitzhardinge 提交于
      IPIs and VIRQs are inherently per-cpu event types, so treat them as such:
       - use a specific percpu irq_chip implementation, and
       - handle them with handle_percpu_irq
      
      This makes the path for delivering these interrupts more efficient
      (no masking/unmasking, no locks), and it avoid problems with attempts
      to migrate them.
      Signed-off-by: NJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
      Cc: Stable Kernel <stable@kernel.org>
      aaca4964
  10. 30 7月, 2010 1 次提交
  11. 29 7月, 2010 1 次提交
    • I
      xen: Do not suspend IPI IRQs. · 4877c737
      Ian Campbell 提交于
      In general the semantics of IPIs are that they are are expected to
      continue functioning after dpm_suspend_noirq().
      
      Specifically I have seen a deadlock between the callfunc IPI and the
      stop machine used by xen's do_suspend() routine. If one CPU has already
      called dpm_suspend_noirq() then there is a window where it can be sent
      a callfunc IPI before all the other CPUs have entered stop_cpu().
      
      If this happens then the first CPU ends up spinning in stop_cpu()
      waiting for the other to rendezvous in state STOPMACHINE_PREPARE while
      the other is spinning in csd_lock_wait().
      Signed-off-by: NIan Campbell <ian.campbell@citrix.com>
      Cc: Jeremy Fitzhardinge <jeremy@goop.org>
      Cc: xen-devel@lists.xensource.com
      LKML-Reference: <1280398595-29708-4-git-send-email-ian.campbell@citrix.com>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      4877c737
  12. 23 7月, 2010 3 次提交
    • S
      xen: Fix find_unbound_irq in presence of ioapic irqs. · 99ad198c
      Stefano Stabellini 提交于
      Don't break the assumption that the first 16 irqs are ISA irqs;
      make sure that the irq is actually free before using it.
      
      Use dynamic_irq_init_keep_chip_data instead of
      dynamic_irq_init so that chip_data is not NULL (a NULL chip_data breaks
      setup_vector_irq).
      Signed-off-by: NStefano Stabellini <stefano.stabellini@eu.citrix.com>
      Signed-off-by: NJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
      99ad198c
    • S
      xen: Xen PCI platform device driver. · 183d03cc
      Stefano Stabellini 提交于
      Add the xen pci platform device driver that is responsible
      for initializing the grant table and xenbus in PV on HVM mode.
      Few changes to xenbus and grant table are necessary to allow the delayed
      initialization in HVM mode.
      Grant table needs few additional modifications to work in HVM mode.
      
      The Xen PCI platform device raises an irq every time an event has been
      delivered to us. However these interrupts are only delivered to vcpu 0.
      The Xen PCI platform interrupt handler calls xen_hvm_evtchn_do_upcall
      that is a little wrapper around __xen_evtchn_do_upcall, the traditional
      Xen upcall handler, the very same used with traditional PV guests.
      
      When running on HVM the event channel upcall is never called while in
      progress because it is a normal Linux irq handler (and we cannot switch
      the irq chip wholesale to the Xen PV ones as we are running QEMU and
      might have passed in PCI devices), therefore we cannot be sure that
      evtchn_upcall_pending is 0 when returning.
      For this reason if evtchn_upcall_pending is set by Xen we need to loop
      again on the event channels set pending otherwise we might loose some
      event channel deliveries.
      Signed-off-by: NStefano Stabellini <stefano.stabellini@eu.citrix.com>
      Signed-off-by: NSheng Yang <sheng@linux.intel.com>
      Signed-off-by: NJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
      183d03cc
    • S
      x86/xen: event channels delivery on HVM. · 38e20b07
      Sheng Yang 提交于
      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: NStefano Stabellini <stefano.stabellini@eu.citrix.com>
      Signed-off-by: NSheng Yang <sheng@linux.intel.com>
      Signed-off-by: NJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
      38e20b07
  13. 30 3月, 2010 1 次提交
    • T
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking... · 5a0e3ad6
      Tejun Heo 提交于
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
      
      percpu.h is included by sched.h and module.h and thus ends up being
      included when building most .c files.  percpu.h includes slab.h which
      in turn includes gfp.h making everything defined by the two files
      universally available and complicating inclusion dependencies.
      
      percpu.h -> slab.h dependency is about to be removed.  Prepare for
      this change by updating users of gfp and slab facilities include those
      headers directly instead of assuming availability.  As this conversion
      needs to touch large number of source files, the following script is
      used as the basis of conversion.
      
        http://userweb.kernel.org/~tj/misc/slabh-sweep.py
      
      The script does the followings.
      
      * Scan files for gfp and slab usages and update includes such that
        only the necessary includes are there.  ie. if only gfp is used,
        gfp.h, if slab is used, slab.h.
      
      * When the script inserts a new include, it looks at the include
        blocks and try to put the new include such that its order conforms
        to its surrounding.  It's put in the include block which contains
        core kernel includes, in the same order that the rest are ordered -
        alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
        doesn't seem to be any matching order.
      
      * If the script can't find a place to put a new include (mostly
        because the file doesn't have fitting include block), it prints out
        an error message indicating which .h file needs to be added to the
        file.
      
      The conversion was done in the following steps.
      
      1. The initial automatic conversion of all .c files updated slightly
         over 4000 files, deleting around 700 includes and adding ~480 gfp.h
         and ~3000 slab.h inclusions.  The script emitted errors for ~400
         files.
      
      2. Each error was manually checked.  Some didn't need the inclusion,
         some needed manual addition while adding it to implementation .h or
         embedding .c file was more appropriate for others.  This step added
         inclusions to around 150 files.
      
      3. The script was run again and the output was compared to the edits
         from #2 to make sure no file was left behind.
      
      4. Several build tests were done and a couple of problems were fixed.
         e.g. lib/decompress_*.c used malloc/free() wrappers around slab
         APIs requiring slab.h to be added manually.
      
      5. The script was run on all .h files but without automatically
         editing them as sprinkling gfp.h and slab.h inclusions around .h
         files could easily lead to inclusion dependency hell.  Most gfp.h
         inclusion directives were ignored as stuff from gfp.h was usually
         wildly available and often used in preprocessor macros.  Each
         slab.h inclusion directive was examined and added manually as
         necessary.
      
      6. percpu.h was updated not to include slab.h.
      
      7. Build test were done on the following configurations and failures
         were fixed.  CONFIG_GCOV_KERNEL was turned off for all tests (as my
         distributed build env didn't work with gcov compiles) and a few
         more options had to be turned off depending on archs to make things
         build (like ipr on powerpc/64 which failed due to missing writeq).
      
         * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
         * powerpc and powerpc64 SMP allmodconfig
         * sparc and sparc64 SMP allmodconfig
         * ia64 SMP allmodconfig
         * s390 SMP allmodconfig
         * alpha SMP allmodconfig
         * um on x86_64 SMP allmodconfig
      
      8. percpu.h modifications were reverted so that it could be applied as
         a separate patch and serve as bisection point.
      
      Given the fact that I had only a couple of failures from tests on step
      6, I'm fairly confident about the coverage of this conversion patch.
      If there is a breakage, it's likely to be something in one of the arch
      headers which should be easily discoverable easily on most builds of
      the specific arch.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Guess-its-ok-by: NChristoph Lameter <cl@linux-foundation.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
      5a0e3ad6
  14. 19 2月, 2010 1 次提交
  15. 04 12月, 2009 1 次提交
    • I
      xen: don't leak IRQs over suspend/resume. · fed5ea87
      Ian Campbell 提交于
      On resume irq_info[*].evtchn is reset to 0 since event channel mappings
      are not preserved over suspend/resume. The other contents of irq_info
      is preserved to allow rebind_evtchn_irq() to function.
      
      However when a device resumes it will try to unbind from the
      previous IRQ (e.g.  blkfront goes blkfront_resume() -> blkif_free() ->
      unbind_from_irqhandler() -> unbind_from_irq()). This will fail due to the
      check for VALID_EVTCHN in unbind_from_irq() and the IRQ is leaked. The
      device will then continue to resume and allocate a new IRQ, eventually
      leading to find_unbound_irq() panic()ing.
      
      Fix this by changing unbind_from_irq() to handle teardown of interrupts
      which have type!=IRQT_UNBOUND but are not currently bound to a specific
      event channel.
      Signed-off-by: NIan Campbell <ian.campbell@citrix.com>
      Signed-off-by: NJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
      Cc: Stable Kernel <stable@kernel.org>
      fed5ea87
  16. 01 7月, 2009 1 次提交
    • P
      xen: Use kcalloc() in xen_init_IRQ() · a70c352a
      Pekka Enberg 提交于
      The init_IRQ() function is now called with slab allocator initialized.
      Therefore, we must not use the bootmem allocator in xen_init_IRQ().
      
      Fixes the following boot-time warning:
      
        ------------[ cut here ]------------
        WARNING: at mm/bootmem.c:535 alloc_arch_preferred_bootmem+0x27/0x45()
        Modules linked in:
        Pid: 0, comm: swapper Not tainted 2.6.30 #1
        Call Trace:
         [<ffffffff8102d6e3>] ? warn_slowpath_common+0x73/0xb0
         [<ffffffff810210d9>] ? pvclock_clocksource_read+0x49/0x90
         [<ffffffff812e522f>] ? alloc_arch_preferred_bootmem+0x27/0x45
         [<ffffffff812e5761>] ? ___alloc_bootmem_nopanic+0x39/0xc9
         [<ffffffff812e57fa>] ? ___alloc_bootmem+0x9/0x2f
         [<ffffffff812e9e21>] ? xen_init_IRQ+0x25/0x61
         [<ffffffff812d69ee>] ? start_kernel+0x1b5/0x29e
        ---[ end trace 4eaa2a86a8e2da22 ]---
      Acked-by: NJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
      Tested-by: NChristian Kujau <lists@nerdbynature.de>
      Reported-by: NChristian Kujau <lists@nerdbynature.de>
      Signed-off-by: NPekka Enberg <penberg@cs.helsinki.fi>
      Cc: lists@nerdbynature.de
      Cc: jeremy.fitzhardinge@citrix.com
      LKML-Reference: <1246438278.22417.28.camel@penberg-laptop>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      a70c352a
  17. 24 6月, 2009 1 次提交
    • T
      percpu: clean up percpu variable definitions · 245b2e70
      Tejun Heo 提交于
      Percpu variable definition is about to be updated such that all percpu
      symbols including the static ones must be unique.  Update percpu
      variable definitions accordingly.
      
      * as,cfq: rename ioc_count uniquely
      
      * cpufreq: rename cpu_dbs_info uniquely
      
      * xen: move nesting_count out of xen_evtchn_do_upcall() and rename it
      
      * mm: move ratelimits out of balance_dirty_pages_ratelimited_nr() and
        rename it
      
      * ipv4,6: rename cookie_scratch uniquely
      
      * x86 perf_counter: rename prev_left to pmc_prev_left, irq_entry to
        pmc_irq_entry and nmi_entry to pmc_nmi_entry
      
      * perf_counter: rename disable_count to perf_disable_count
      
      * ftrace: rename test_event_disable to ftrace_test_event_disable
      
      * kmemleak: rename test_pointer to kmemleak_test_pointer
      
      * mce: rename next_interval to mce_next_interval
      
      [ Impact: percpu usage cleanups, no duplicate static percpu var names ]
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Reviewed-by: NChristoph Lameter <cl@linux-foundation.org>
      Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
      Cc: Jens Axboe <jens.axboe@oracle.com>
      Cc: Dave Jones <davej@redhat.com>
      Cc: Jeremy Fitzhardinge <jeremy@xensource.com>
      Cc: linux-mm <linux-mm@kvack.org>
      Cc: David S. Miller <davem@davemloft.net>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Steven Rostedt <srostedt@redhat.com>
      Cc: Li Zefan <lizf@cn.fujitsu.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Andi Kleen <andi@firstfloor.org>
      245b2e70