1. 24 5月, 2016 1 次提交
    • R
      xen/events: Don't move disabled irqs · f0f39387
      Ross Lagerwall 提交于
      Commit ff1e22e7 ("xen/events: Mask a moving irq") open-coded
      irq_move_irq() but left out checking if the IRQ is disabled. This broke
      resuming from suspend since it tries to move a (disabled) irq without
      holding the IRQ's desc->lock. Fix it by adding in a check for disabled
      IRQs.
      
      The resulting stacktrace was:
      kernel BUG at /build/linux-UbQGH5/linux-4.4.0/kernel/irq/migration.c:31!
      invalid opcode: 0000 [#1] SMP
      Modules linked in: xenfs xen_privcmd ...
      CPU: 0 PID: 9 Comm: migration/0 Not tainted 4.4.0-22-generic #39-Ubuntu
      Hardware name: Xen HVM domU, BIOS 4.6.1-xs125180 05/04/2016
      task: ffff88003d75ee00 ti: ffff88003d7bc000 task.ti: ffff88003d7bc000
      RIP: 0010:[<ffffffff810e26e2>]  [<ffffffff810e26e2>] irq_move_masked_irq+0xd2/0xe0
      RSP: 0018:ffff88003d7bfc50  EFLAGS: 00010046
      RAX: 0000000000000000 RBX: ffff88003d40ba00 RCX: 0000000000000001
      RDX: 0000000000000001 RSI: 0000000000000100 RDI: ffff88003d40bad8
      RBP: ffff88003d7bfc68 R08: 0000000000000000 R09: ffff88003d000000
      R10: 0000000000000000 R11: 000000000000023c R12: ffff88003d40bad0
      R13: ffffffff81f3a4a0 R14: 0000000000000010 R15: 00000000ffffffff
      FS:  0000000000000000(0000) GS:ffff88003da00000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 00007fd4264de624 CR3: 0000000037922000 CR4: 00000000003406f0
      DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      Stack:
       ffff88003d40ba38 0000000000000024 0000000000000000 ffff88003d7bfca0
       ffffffff814c8d92 00000010813ef89d 00000000805ea732 0000000000000009
       0000000000000024 ffff88003cc39b80 ffff88003d7bfce0 ffffffff814c8f66
      Call Trace:
       [<ffffffff814c8d92>] eoi_pirq+0xb2/0xf0
       [<ffffffff814c8f66>] __startup_pirq+0xe6/0x150
       [<ffffffff814ca659>] xen_irq_resume+0x319/0x360
       [<ffffffff814c7e75>] xen_suspend+0xb5/0x180
       [<ffffffff81120155>] multi_cpu_stop+0xb5/0xe0
       [<ffffffff811200a0>] ? cpu_stop_queue_work+0x80/0x80
       [<ffffffff811203d0>] cpu_stopper_thread+0xb0/0x140
       [<ffffffff810a94e6>] ? finish_task_switch+0x76/0x220
       [<ffffffff810ca731>] ? __raw_callee_save___pv_queued_spin_unlock+0x11/0x20
       [<ffffffff810a3935>] smpboot_thread_fn+0x105/0x160
       [<ffffffff810a3830>] ? sort_range+0x30/0x30
       [<ffffffff810a0588>] kthread+0xd8/0xf0
       [<ffffffff810a04b0>] ? kthread_create_on_node+0x1e0/0x1e0
       [<ffffffff8182568f>] ret_from_fork+0x3f/0x70
       [<ffffffff810a04b0>] ? kthread_create_on_node+0x1e0/0x1e0
      Signed-off-by: NRoss Lagerwall <ross.lagerwall@citrix.com>
      Reviewed-by: NBoris Ostrovsky <boris.ostrovsky@oracle.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NDavid Vrabel <david.vrabel@citrix.com>
      f0f39387
  2. 04 4月, 2016 1 次提交
    • B
      xen/events: Mask a moving irq · ff1e22e7
      Boris Ostrovsky 提交于
      Moving an unmasked irq may result in irq handler being invoked on both
      source and target CPUs.
      
      With 2-level this can happen as follows:
      
      On source CPU:
              evtchn_2l_handle_events() ->
                  generic_handle_irq() ->
                      handle_edge_irq() ->
                         eoi_pirq():
                             irq_move_irq(data);
      
                             /***** WE ARE HERE *****/
      
                             if (VALID_EVTCHN(evtchn))
                                 clear_evtchn(evtchn);
      
      If at this moment target processor is handling an unrelated event in
      evtchn_2l_handle_events()'s loop it may pick up our event since target's
      cpu_evtchn_mask claims that this event belongs to it *and* the event is
      unmasked and still pending. At the same time, source CPU will continue
      executing its own handle_edge_irq().
      
      With FIFO interrupt the scenario is similar: irq_move_irq() may result
      in a EVTCHNOP_unmask hypercall which, in turn, may make the event
      pending on the target CPU.
      
      We can avoid this situation by moving and clearing the event while
      keeping event masked.
      Signed-off-by: NBoris Ostrovsky <boris.ostrovsky@oracle.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: NDavid Vrabel <david.vrabel@citrix.com>
      ff1e22e7
  3. 21 3月, 2016 1 次提交
  4. 27 11月, 2015 1 次提交
  5. 23 10月, 2015 1 次提交
  6. 09 9月, 2015 1 次提交
  7. 20 8月, 2015 1 次提交
    • J
      xen/events: Support event channel rebind on ARM · 4a5b6946
      Julien Grall 提交于
      Currently, the event channel rebind code is gated with the presence of
      the vector callback.
      
      The virtual interrupt controller on ARM has the concept of per-CPU
      interrupt (PPI) which allow us to support per-VCPU event channel.
      Therefore there is no need of vector callback for ARM.
      
      Xen is already using a free PPI to notify the guest VCPU of an event.
      Furthermore, the xen code initialization in Linux (see
      arch/arm/xen/enlighten.c) is requesting correctly a per-CPU IRQ.
      
      Introduce new helper xen_support_evtchn_rebind to allow architecture
      decide whether rebind an event is support or not. It will always return
      true on ARM and keep the same behavior on x86.
      
      This is also allow us to drop the usage of xen_have_vector_callback
      entirely in the ARM code.
      Signed-off-by: NJulien Grall <julien.grall@citrix.com>
      Signed-off-by: NDavid Vrabel <david.vrabel@citrix.com>
      4a5b6946
  8. 11 8月, 2015 1 次提交
  9. 04 8月, 2015 1 次提交
    • R
      xen/events/fifo: Handle linked events when closing a port · fcdf31a7
      Ross Lagerwall 提交于
      An event channel bound to a CPU that was offlined may still be linked
      on that CPU's queue.  If this event channel is closed and reused,
      subsequent events will be lost because the event channel is never
      unlinked and thus cannot be linked onto the correct queue.
      
      When a channel is closed and the event is still linked into a queue,
      ensure that it is unlinked before completing.
      
      If the CPU to which the event channel bound is online, spin until the
      event is handled by that CPU. If that CPU is offline, it can't handle
      the event, so clear the event queue during the close, dropping the
      events.
      
      This fixes the missing interrupts (and subsequent disk stalls etc.)
      when offlining a CPU.
      Signed-off-by: NRoss Lagerwall <ross.lagerwall@citrix.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NDavid Vrabel <david.vrabel@citrix.com>
      fcdf31a7
  10. 14 7月, 2015 1 次提交
  11. 17 6月, 2015 1 次提交
  12. 20 5月, 2015 1 次提交
    • D
      xen/events: don't bind non-percpu VIRQs with percpu chip · 77bb3dfd
      David Vrabel 提交于
      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: NDavid Vrabel <david.vrabel@citrix.com>
      Cc: <stable@vger.kernel.org>
      77bb3dfd
  13. 06 5月, 2015 2 次提交
    • B
      xen/events: Set irq_info->evtchn before binding the channel to CPU in __startup_pirq() · 16e6bd59
      Boris Ostrovsky 提交于
      .. because bind_evtchn_to_cpu(evtchn, cpu) will map evtchn to
      'info' and pass 'info' down to xen_evtchn_port_bind_to_cpu().
      Signed-off-by: NBoris Ostrovsky <boris.ostrovsky@oracle.com>
      Tested-by: NAnnie Li <annie.li@oracle.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NDavid Vrabel <david.vrabel@citrix.com>
      16e6bd59
    • B
      xen/events: Clear cpu_evtchn_mask before resuming · 5cec9883
      Boris Ostrovsky 提交于
      When a guest is resumed, the hypervisor may change event channel
      assignments. If this happens and the guest uses 2-level events it
      is possible for the interrupt to be claimed by wrong VCPU since
      cpu_evtchn_mask bits may be stale. This can happen even though
      evtchn_2l_bind_to_cpu() attempts to clear old bits: irq_info that
      is passed in is not necessarily the original one (from pre-migration
      times) but instead is freshly allocated during resume and so any
      information about which CPU the channel was bound to is lost.
      
      Thus we should clear the mask during resume.
      
      We also need to make sure that bits for xenstore and console channels
      are set when these two subsystems are resumed. While rebind_evtchn_irq()
      (which is invoked for both of them on a resume) calls irq_set_affinity(),
      the latter will in fact postpone setting affinity until handling the
      interrupt. But because cpu_evtchn_mask will have bits for these two
      cleared we won't be able to take the interrupt.
      
      With that in mind, we need to bind those two channels explicitly in
      rebind_evtchn_irq(). We will keep irq_set_affinity() so that we have a
      pass through generic irq affinity code later, in case something needs
      to be updated there as well.
      
      (Also replace cpumask_of(0) with cpumask_of(info->cpu) in
      rebind_evtchn_irq(): it should be set to zero in preceding
      xen_irq_info_evtchn_setup().)
      Signed-off-by: NBoris Ostrovsky <boris.ostrovsky@oracle.com>
      Reported-by: NAnnie Li <annie.li@oracle.com>
      Cc: <stable@vger.kernel.org> # 3.14+
      Signed-off-by: NDavid Vrabel <david.vrabel@citrix.com>
      5cec9883
  14. 06 3月, 2015 1 次提交
    • J
      xen/events: avoid NULL pointer dereference in dom0 on large machines · 85e40b05
      Juergen Gross 提交于
      Using the pvops kernel a NULL pointer dereference was detected on a
      large machine (144 processors) when booting as dom0 in
      evtchn_fifo_unmask() during assignment of a pirq.
      
      The event channel in question was the first to need a new entry in
      event_array[] in events_fifo.c. Unfortunately xen_irq_info_pirq_setup()
      is called with evtchn being 0 for a new pirq and the real event channel
      number is assigned to the pirq only during __startup_pirq().
      
      It is mandatory to call xen_evtchn_port_setup() after assigning the
      event channel number to the pirq to make sure all memory needed for the
      event channel is allocated.
      Signed-off-by: NJuergen Gross <jgross@suse.com>
      Cc: <stable@vger.kernel.org> # 3.14+
      Signed-off-by: NDavid Vrabel <david.vrabel@citrix.com>
      85e40b05
  15. 23 9月, 2014 1 次提交
  16. 01 8月, 2014 1 次提交
  17. 16 5月, 2014 1 次提交
  18. 07 4月, 2014 1 次提交
    • A
      Xen: do hv callback accounting only on x86 · d06eb3ee
      Arnd Bergmann 提交于
      Patch 99c8b79d "xen: Add proper irq accounting for HYPERCALL vector"
      added a call to inc_irq_stat(irq_hv_callback_count) in common Xen code,
      however both the inc_irq_stat function and the irq_hv_callback_count
      counter are architecture specific.
      
      This makes the code build again on ARM by moving the call into the
      existing #ifdef CONFIG_X86. We may want to later do the same implementation
      on ARM that x86 has though.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NDavid Vrabel <david.vrabel@citrix.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Cc: Xen <xen-devel@lists.xenproject.org>
      d06eb3ee
  19. 18 3月, 2014 1 次提交
    • R
      xen: add support for MSI message groups · 4892c9b4
      Roger Pau Monne 提交于
      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: NRoger Pau Monné <roger.pau@citrix.com>
      Signed-off-by: NDavid Vrabel <david.vrabel@citrix.com>
      Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
      4892c9b4
  20. 12 3月, 2014 1 次提交
  21. 05 3月, 2014 3 次提交
  22. 01 3月, 2014 2 次提交
  23. 11 2月, 2014 1 次提交
  24. 06 1月, 2014 13 次提交