[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [RFC PATCH v2 00/22] ARM: vGIC rework (attempt)



Hi,

this is the first part of the attempt to rewrite the VGIC to solve the
issues we discovered when adding the ITS emulation.
The problems we identified resulted in the following list of things that
need fixing:
1) introduce a per-IRQ lock
2) remove the IRQ rank scheme (of storing IRQ properties)
3) simplify the VCPU IRQ lists (getting rid of lr_queue)
4) introduce reference counting for struct pending_irq's
5) properly handle level triggered IRQs

This series addresses the first two points. I tried to move point 3) up
and fix that first, but that turned out to somehow depend on both
points 1) and 2), so we have this order now. Still having the two lists
makes things somewhat more complicated, though, but I think this is as
best as it can get. After addressing point 3) (in a later post) the end
result will look much better. I have some code for 3) and 5), mostly, but
we need to agree on the first steps first.

This is a bit of an open-heart surgery, as we try to change a locking
scheme while staying bisectable (both in terms of compilability *and*
runnability) and still having reviewable chunks.
To help reviewing I tried to split the patches up as much as possible.
Changes which are independent or introduce new functions are separate,
the motivation for some of them becomes apparent only later.
The rough idea of this series is to introduce the VGIC IRQ lock itself
first, then move each of the rank members into struct pending_irq, adjusting
the locking for that at the same time. To make the changes a bit smaller, I
fixed some read locks in separate patches after the "move" patch.
Also patch 09 adjusts the locking for setting the priority in the ITS,
which is technially needed in patch 08 already, but moved out for the sake
of reviewability. It might be squashed into patch 08 upon merging.

As hinted above still having to cope with two lists leads to some atrocities,
namely patch 03. This hideousness will vanish when the whole requirement of
queueing an IRQ in that early state will go away.

This is still somewhat work-in-progress, but I wanted to share the code
anyway, since I spent way too much time on it (rewriting it several times
on the way) and I am interested in some fresh pair of eyes to have a look.
Currently the target VCPU move (patch 18) leads to a deadlock and I just ran
out of time (before going on holidays) to debug this.
So if someone could have a look to see if this approach in general looks
good, I'd be grateful. I know that there is optimization potential (some
functions can surely be refactored), but I'd rather do one step after the
other.

Cheers,
Andre.

Andre Przywara (22):
  ARM: vGIC: introduce and initialize pending_irq lock
  ARM: vGIC: route/remove_irq: replace rank lock with IRQ lock
  ARM: vGIC: move gic_raise_inflight_irq() into vgic_vcpu_inject_irq()
  ARM: vGIC: rename pending_irq->priority to cur_priority
  ARM: vITS: rename pending_irq->lpi_priority to priority
  ARM: vGIC: introduce locking routines for multiple IRQs
  ARM: vGIC: introduce priority setter/getter
  ARM: vGIC: move virtual IRQ priority from rank to pending_irq
  ARM: vITS: protect LPI priority update with pending_irq lock
  ARM: vGIC: protect gic_set_lr() with pending_irq lock
  ARM: vGIC: protect gic_events_need_delivery() with pending_irq lock
  ARM: vGIC: protect gic_update_one_lr() with pending_irq lock
  ARM: vITS: remove no longer needed lpi_priority wrapper
  ARM: vGIC: move virtual IRQ configuration from rank to pending_irq
  ARM: vGIC: rework vgic_get_target_vcpu to take a pending_irq
  ARM: vITS: rename lpi_vcpu_id to vcpu_id
  ARM: vGIC: introduce vgic_lock_vcpu_irq()
  ARM: vGIC: move virtual IRQ target VCPU from rank to pending_irq
  ARM: vGIC: rework vgic_get_target_vcpu to take a domain instead of
    vcpu
  ARM: vGIC: move virtual IRQ enable bit from rank to pending_irq
  ARM: vITS: injecting LPIs: use pending_irq lock
  ARM: vGIC: remove remaining irq_rank code

 xen/arch/arm/gic-v2.c        |   2 +-
 xen/arch/arm/gic-v3-lpi.c    |  14 +-
 xen/arch/arm/gic-v3.c        |   2 +-
 xen/arch/arm/gic.c           |  96 ++++----
 xen/arch/arm/vgic-v2.c       | 161 ++++---------
 xen/arch/arm/vgic-v3-its.c   |  42 ++--
 xen/arch/arm/vgic-v3.c       | 182 +++++----------
 xen/arch/arm/vgic.c          | 521 +++++++++++++++++++++++++++----------------
 xen/include/asm-arm/domain.h |   6 +-
 xen/include/asm-arm/gic.h    |   2 +-
 xen/include/asm-arm/vgic.h   | 114 +++-------
 11 files changed, 540 insertions(+), 602 deletions(-)

-- 
2.9.0


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.