25 May, 2018

8 commits

  • As we are going to register several redist regions,
    vgic_register_all_redist_iodevs() may be called several times. We need
    to register a redist_iodev for a given vcpu only once. So let's
    check if the base address has already been set. Initialize this latter
    in kvm_vgic_vcpu_init().

    Signed-off-by: Eric Auger
    Acked-by: Christoffer Dall
    Signed-off-by: Marc Zyngier

    Eric Auger
     
  • kvm_vgic_vcpu_early_init gets called after kvm_vgic_cpu_init which
    is confusing. The call path is as follows:
    kvm_vm_ioctl_create_vcpu
    |_ kvm_arch_cpu_create
    |_ kvm_vcpu_init
    |_ kvm_arch_vcpu_init
    |_ kvm_vgic_vcpu_init
    |_ kvm_arch_vcpu_postcreate
    |_ kvm_vgic_vcpu_early_init

    Static initialization currently done in kvm_vgic_vcpu_early_init()
    can be moved to kvm_vgic_vcpu_init(). So let's move the code and
    remove kvm_vgic_vcpu_early_init(). kvm_arch_vcpu_postcreate() does
    nothing.

    Signed-off-by: Eric Auger
    Signed-off-by: Marc Zyngier

    Eric Auger
     
  • We introduce a new helper that creates and inserts a new redistributor
    region into the rdist region list. This helper both handles the case
    where the redistributor region size is known at registration time
    and the legacy case where it is not (eventually depending on the number
    of online vcpus). Depending on pfns, we perform all the possible checks
    that we can do:

    - end of memory crossing
    - incorrect alignment of the base address
    - collision with distributor region if already defined
    - collision with already registered rdist regions
    - check of the new index

    Rdist regions must be inserted by increasing order of indices. Indices
    must be contiguous.

    Signed-off-by: Eric Auger
    Reviewed-by: Christoffer Dall
    Signed-off-by: Marc Zyngier

    Eric Auger
     
  • vgic_v3_check_base() currently only handles the case of a unique
    legacy redistributor region whose size is not explicitly set but
    inferred, instead, from the number of online vcpus.

    We adapt it to handle the case of multiple redistributor regions
    with explicitly defined size. We rely on two new helpers:
    - vgic_v3_rdist_overlap() is used to detect overlap with the dist
    region if defined
    - vgic_v3_rd_region_size computes the size of the redist region,
    would it be a legacy unique region or a new explicitly sized
    region.

    Signed-off-by: Eric Auger
    Reviewed-by: Christoffer Dall
    Signed-off-by: Marc Zyngier

    Eric Auger
     
  • The TYPER of an redistributor reflects whether the rdist is
    the last one of the redistributor region. Let's compare the TYPER
    GPA against the address of the last occupied slot within the
    redistributor region.

    Signed-off-by: Eric Auger
    Reviewed-by: Christoffer Dall
    Signed-off-by: Marc Zyngier

    Eric Auger
     
  • We introduce vgic_v3_rdist_free_slot to help identifying
    where we can place a new 2x64KB redistributor.

    Signed-off-by: Eric Auger
    Reviewed-by: Christoffer Dall
    Signed-off-by: Marc Zyngier

    Eric Auger
     
  • At the moment KVM supports a single rdist region. We want to
    support several separate rdist regions so let's introduce a list
    of them. This patch currently only cares about a single
    entry in this list as the functionality to register several redist
    regions is not yet there. So this only translates the existing code
    into something functionally similar using that new data struct.

    The redistributor region handle is stored in the vgic_cpu structure
    to allow later computation of the TYPER last bit.

    Signed-off-by: Eric Auger
    Reviewed-by: Christoffer Dall
    Signed-off-by: Marc Zyngier

    Eric Auger
     
  • in case kvm_vgic_map_resources() fails, typically if the vgic
    distributor is not defined, __kvm_vgic_destroy will be called
    several times. Indeed kvm_vgic_map_resources() is called on
    first vcpu run. As a result dist->spis is freeed more than once
    and on the second time it causes a "kernel BUG at mm/slub.c:3912!"

    Set dist->spis to NULL to avoid the crash.

    Fixes: ad275b8bb1e6 ("KVM: arm/arm64: vgic-new: vgic_init: implement
    vgic_init")

    Signed-off-by: Eric Auger
    Reviewed-by: Marc Zyngier
    Reviewed-by: Christoffer Dall
    Signed-off-by: Marc Zyngier

    Eric Auger
     

06 May, 2018

1 commit


04 May, 2018

1 commit


28 Apr, 2018

1 commit

  • Pull KVM fixes from Radim Krčmář:
    "ARM:
    - PSCI selection API, a leftover from 4.16 (for stable)
    - Kick vcpu on active interrupt affinity change
    - Plug a VMID allocation race on oversubscribed systems
    - Silence debug messages
    - Update Christoffer's email address (linaro -> arm)

    x86:
    - Expose userspace-relevant bits of a newly added feature
    - Fix TLB flushing on VMX with VPID, but without EPT"

    * tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm:
    x86/headers/UAPI: Move DISABLE_EXITS KVM capability bits to the UAPI
    kvm: apic: Flush TLB after APIC mode/address change if VPIDs are in use
    arm/arm64: KVM: Add PSCI version selection API
    KVM: arm/arm64: vgic: Kick new VCPU on interrupt migration
    arm64: KVM: Demote SVE and LORegion warnings to debug only
    MAINTAINERS: Update e-mail address for Christoffer Dall
    KVM: arm/arm64: Close VMID generation race

    Linus Torvalds
     

27 Apr, 2018

3 commits

  • Now that we make sure we don't inject multiple instances of the
    same GICv2 SGI at the same time, we've made another bug more
    obvious:

    If we exit with an active SGI, we completely lose track of which
    vcpu it came from. On the next entry, we restore it with 0 as a
    source, and if that wasn't the right one, too bad. While this
    doesn't seem to trouble GIC-400, the architectural model gets
    offended and doesn't deactivate the interrupt on EOI.

    Another connected issue is that we will happilly make pending
    an interrupt from another vcpu, overriding the above zero with
    something that is just as inconsistent. Don't do that.

    The final issue is that we signal a maintenance interrupt when
    no pending interrupts are present in the LR. Assuming we've fixed
    the two issues above, we end-up in a situation where we keep
    exiting as soon as we've reached the active state, and not be
    able to inject the following pending.

    The fix comes in 3 parts:
    - GICv2 SGIs have their source vcpu saved if they are active on
    exit, and restored on entry
    - Multi-SGIs cannot go via the Pending+Active state, as this would
    corrupt the source field
    - Multi-SGIs are converted to using MI on EOI instead of NPIE

    Fixes: 16ca6a607d84bef0 ("KVM: arm/arm64: vgic: Don't populate multiple LRs with the same vintid")
    Reported-by: Mark Rutland
    Tested-by: Mark Rutland
    Reviewed-by: Christoffer Dall
    Signed-off-by: Marc Zyngier

    Marc Zyngier
     
  • It's possible for userspace to control n. Sanitize n when using it as an
    array index.

    Note that while it appears that n must be bound to the interval [0,3]
    due to the way it is extracted from addr, we cannot guarantee that
    compiler transformations (and/or future refactoring) will ensure this is
    the case, and given this is a slow path it's better to always perform
    the masking.

    Found by smatch.

    Signed-off-by: Mark Rutland
    Acked-by: Christoffer Dall
    Acked-by: Marc Zyngier
    Cc: kvmarm@lists.cs.columbia.edu
    Signed-off-by: Will Deacon

    Mark Rutland
     
  • It's possible for userspace to control intid. Sanitize intid when using
    it as an array index.

    At the same time, sort the includes when adding .

    Found by smatch.

    Signed-off-by: Mark Rutland
    Acked-by: Christoffer Dall
    Acked-by: Marc Zyngier
    Cc: kvmarm@lists.cs.columbia.edu
    Signed-off-by: Will Deacon

    Mark Rutland
     

17 Apr, 2018

1 commit

  • When vgic_prune_ap_list() finds an interrupt that needs to be migrated
    to a new VCPU, we should notify this VCPU of the pending interrupt,
    since it requires immediate action.
    Kick this VCPU once we have added the new IRQ to the list, but only
    after dropping the locks.

    Reported-by: Stefano Stabellini
    Reviewed-by: Christoffer Dall
    Signed-off-by: Andre Przywara
    Signed-off-by: Marc Zyngier

    Andre Przywara
     

26 Mar, 2018

2 commits

  • vgic_copy_lpi_list() parses the LPI list and picks LPIs targeting
    a given vcpu. We allocate the array containing the intids before taking
    the lpi_list_lock, which means we can have an array size that is not
    equal to the number of LPIs.

    This is particularly obvious when looking at the path coming from
    vgic_enable_lpis, which is not a command, and thus can run in parallel
    with commands:

    vcpu 0: vcpu 1:
    vgic_enable_lpis
    its_sync_lpi_pending_table
    vgic_copy_lpi_list
    intids = kmalloc_array(irq_count)
    MAPI(lpi targeting vcpu 0)
    list_for_each_entry(lpi_list_head)
    intids[i++] = irq->intid;

    At that stage, we will happily overrun the intids array. Boo. An easy
    fix is is to break once the array is full. The MAPI command will update
    the config anyway, and we won't miss a thing. We also make sure that
    lpi_list_count is read exactly once, so that further updates of that
    value will not affect the array bound check.

    Cc: stable@vger.kernel.org
    Fixes: ccb1d791ab9e ("KVM: arm64: vgic-its: Fix pending table sync")
    Reviewed-by: Andre Przywara
    Reviewed-by: Eric Auger
    Signed-off-by: Marc Zyngier

    Marc Zyngier
     
  • It was recently reported that VFIO mediated devices, and anything
    that VFIO exposes as level interrupts, do no strictly follow the
    expected logic of such interrupts as it only lowers the input
    line when the guest has EOId the interrupt at the GIC level, rather
    than when it Acked the interrupt at the device level.

    THe GIC's Active+Pending state is fundamentally incompatible with
    this behaviour, as it prevents KVM from observing the EOI, and in
    turn results in VFIO never dropping the line. This results in an
    interrupt storm in the guest, which it really never expected.

    As we cannot really change VFIO to follow the strict rules of level
    signalling, let's forbid the A+P state altogether, as it is in the
    end only an optimization. It ensures that we will transition via
    an invalid state, which we can use to notify VFIO of the EOI.

    Reviewed-by: Eric Auger
    Tested-by: Eric Auger
    Tested-by: Shunyong Yang
    Signed-off-by: Marc Zyngier

    Marc Zyngier
     

20 Mar, 2018

1 commit


19 Mar, 2018

8 commits

  • As we're about to change the way we map devices at HYP, we need
    to move away from kern_hyp_va on an IO address.

    One way of achieving this is to store the VAs in kvm_vgic_global_state,
    and use that directly from the HYP code. This requires a small change
    to create_hyp_io_mappings so that it can also return a HYP VA.

    We take this opportunity to nuke the vctrl_base field in the emulated
    distributor, as it is not used anymore.

    Acked-by: Catalin Marinas
    Reviewed-by: Christoffer Dall
    Signed-off-by: Marc Zyngier

    Marc Zyngier
     
  • Both HYP io mappings call ioremap, followed by create_hyp_io_mappings.
    Let's move the ioremap call into create_hyp_io_mappings itself, which
    simplifies the code a bit and allows for further refactoring.

    Reviewed-by: Christoffer Dall
    Acked-by: Catalin Marinas
    Signed-off-by: Marc Zyngier

    Marc Zyngier
     
  • We can finally get completely rid of any calls to the VGICv3
    save/restore functions when the AP lists are empty on VHE systems. This
    requires carefully factoring out trap configuration from saving and
    restoring state, and carefully choosing what to do on the VHE and
    non-VHE path.

    One of the challenges is that we cannot save/restore the VMCR lazily
    because we can only write the VMCR when ICC_SRE_EL1.SRE is cleared when
    emulating a GICv2-on-GICv3, since otherwise all Group-0 interrupts end
    up being delivered as FIQ.

    To solve this problem, and still provide fast performance in the fast
    path of exiting a VM when no interrupts are pending (which also
    optimized the latency for actually delivering virtual interrupts coming
    from physical interrupts), we orchestrate a dance of only doing the
    activate/deactivate traps in vgic load/put for VHE systems (which can
    have ICC_SRE_EL1.SRE cleared when running in the host), and doing the
    configuration on every round-trip on non-VHE systems.

    Signed-off-by: Christoffer Dall
    Signed-off-by: Marc Zyngier

    Christoffer Dall
     
  • The APRs can only have bits set when the guest acknowledges an interrupt
    in the LR and can only have a bit cleared when the guest EOIs an
    interrupt in the LR. Therefore, if we have no LRs with any
    pending/active interrupts, the APR cannot change value and there is no
    need to clear it on every exit from the VM (hint: it will have already
    been cleared when we exited the guest the last time with the LRs all
    EOIed).

    The only case we need to take care of is when we migrate the VCPU away
    from a CPU or migrate a new VCPU onto a CPU, or when we return to
    userspace to capture the state of the VCPU for migration. To make sure
    this works, factor out the APR save/restore functionality into separate
    functions called from the VCPU (and by extension VGIC) put/load hooks.

    Reviewed-by: Marc Zyngier
    Signed-off-by: Christoffer Dall
    Signed-off-by: Marc Zyngier

    Christoffer Dall
     
  • Just like we can program the GICv2 hypervisor control interface directly
    from the core vgic code, we can do the same for the GICv3 hypervisor
    control interface on VHE systems.

    We do this by simply calling the save/restore functions when we have VHE
    and we can then get rid of the save/restore function calls from the VHE
    world switch function.

    One caveat is that we now write GICv3 system register state before the
    potential early exit path in the run loop, and because we sync back
    state in the early exit path, we have to ensure that we read a
    consistent GIC state from the sync path, even though we have never
    actually run the guest with the newly written GIC state. We solve this
    by inserting an ISB in the early exit path.

    Signed-off-by: Christoffer Dall
    Signed-off-by: Marc Zyngier

    Christoffer Dall
     
  • We can program the GICv2 hypervisor control interface logic directly
    from the core vgic code and can instead do the save/restore directly
    from the flush/sync functions, which can lead to a number of future
    optimizations.

    Signed-off-by: Christoffer Dall
    Signed-off-by: Marc Zyngier

    Christoffer Dall
     
  • There is really no need to store the vgic_elrsr on the VGIC data
    structures as the only need we have for the elrsr is to figure out if an
    LR is inactive when we save the VGIC state upon returning from the
    guest. We can might as well store this in a temporary local variable.

    Reviewed-by: Marc Zyngier
    Signed-off-by: Christoffer Dall
    Signed-off-by: Marc Zyngier

    Christoffer Dall
     
  • Moving the call to vcpu_load() in kvm_arch_vcpu_ioctl_run() to after
    we've called kvm_vcpu_first_run_init() simplifies some of the vgic and
    there is also no need to do vcpu_load() for things such as handling the
    immediate_exit flag.

    Reviewed-by: Julien Grall
    Reviewed-by: Marc Zyngier
    Signed-off-by: Christoffer Dall
    Signed-off-by: Marc Zyngier

    Christoffer Dall
     

15 Mar, 2018

4 commits

  • The vgic code is trying to be clever when injecting GICv2 SGIs,
    and will happily populate LRs with the same interrupt number if
    they come from multiple vcpus (after all, they are distinct
    interrupt sources).

    Unfortunately, this is against the letter of the architecture,
    and the GICv2 architecture spec says "Each valid interrupt stored
    in the List registers must have a unique VirtualID for that
    virtual CPU interface.". GICv3 has similar (although slightly
    ambiguous) restrictions.

    This results in guests locking up when using GICv2-on-GICv3, for
    example. The obvious fix is to stop trying so hard, and inject
    a single vcpu per SGI per guest entry. After all, pending SGIs
    with multiple source vcpus are pretty rare, and are mostly seen
    in scenario where the physical CPUs are severely overcomitted.

    But as we now only inject a single instance of a multi-source SGI per
    vcpu entry, we may delay those interrupts for longer than strictly
    necessary, and run the risk of injecting lower priority interrupts
    in the meantime.

    In order to address this, we adopt a three stage strategy:
    - If we encounter a multi-source SGI in the AP list while computing
    its depth, we force the list to be sorted
    - When populating the LRs, we prevent the injection of any interrupt
    of lower priority than that of the first multi-source SGI we've
    injected.
    - Finally, the injection of a multi-source SGI triggers the request
    of a maintenance interrupt when there will be no pending interrupt
    in the LRs (HCR_NPIE).

    At the point where the last pending interrupt in the LRs switches
    from Pending to Active, the maintenance interrupt will be delivered,
    allowing us to add the remaining SGIs using the same process.

    Cc: stable@vger.kernel.org
    Fixes: 0919e84c0fc1 ("KVM: arm/arm64: vgic-new: Add IRQ sync/flush framework")
    Acked-by: Christoffer Dall
    Signed-off-by: Marc Zyngier

    Marc Zyngier
     
  • On my GICv3 system, the following is printed to the kernel log at boot:

    kvm [1]: 8-bit VMID
    kvm [1]: IDMAP page: d20e35000
    kvm [1]: HYP VA range: 800000000000:ffffffffffff
    kvm [1]: vgic-v2@2c020000
    kvm [1]: GIC system register CPU interface enabled
    kvm [1]: vgic interrupt IRQ1
    kvm [1]: virtual timer IRQ4
    kvm [1]: Hyp mode initialized successfully

    The KVM IDMAP is a mapping of a statically allocated kernel structure,
    and so printing its physical address leaks the physical placement of
    the kernel when physical KASLR in effect. So change the kvm_info() to
    kvm_debug() to remove it from the log output.

    While at it, trim the output a bit more: IRQ numbers can be found in
    /proc/interrupts, and the HYP VA and vgic-v2 lines are not highly
    informational either.

    Cc:
    Acked-by: Will Deacon
    Acked-by: Christoffer Dall
    Signed-off-by: Ard Biesheuvel
    Signed-off-by: Marc Zyngier

    Ard Biesheuvel
     
  • We currently don't allow resetting mapped IRQs from userspace, because
    their state is controlled by the hardware. But we do need to reset the
    state when the VM is reset, so we provide a function for the 'owner' of
    the mapped interrupt to reset the interrupt state.

    Currently only the timer uses mapped interrupts, so we call this
    function from the timer reset logic.

    Cc: stable@vger.kernel.org
    Fixes: 4c60e360d6df ("KVM: arm/arm64: Provide a get_input_level for the arch timer")
    Signed-off-by: Christoffer Dall
    Signed-off-by: Marc Zyngier

    Christoffer Dall
     
  • Our irq_is_pending() helper function accesses multiple members of the
    vgic_irq struct, so we need to hold the lock when calling it.
    Add that requirement as a comment to the definition and take the lock
    around the call in vgic_mmio_read_pending(), where we were missing it
    before.

    Fixes: 96b298000db4 ("KVM: arm/arm64: vgic-new: Add PENDING registers handlers")
    Signed-off-by: Andre Przywara
    Signed-off-by: Marc Zyngier

    Andre Przywara
     

01 Feb, 2018

1 commit


12 Jan, 2018

1 commit

  • Commit 3d1ad640f8c94 ("KVM: arm/arm64: Fix GICv4 ITS initialization
    issues") moved the vgic_supports_direct_msis() check in vgic_v4_init().
    However when vgic_v4_init is called from vgic_its_create(), the has_its
    field is not yet set. Hence vgic_supports_direct_msis returns false and
    vgic_v4_init does nothing.

    The gic/its init sequence is a bit messy, so let's be specific about the
    prerequisite checks in the various call paths instead of relying on a
    common wrapper.

    Fixes: 3d1ad640f8c94 ("KVM: arm/arm64: Fix GICv4 ITS initialization issues")
    Reported-by: Eric Auger
    Signed-off-by: Christoffer Dall

    Christoffer Dall
     

02 Jan, 2018

5 commits

  • For mapped IRQs (with the HW bit set in the LR) we have to follow some
    rules of the architecture. One of these rules is that VM must not be
    allowed to deactivate a virtual interrupt with the HW bit set unless the
    physical interrupt is also active.

    This works fine when injecting mapped interrupts, because we leave it up
    to the injector to either set EOImode==1 or manually set the active
    state of the physical interrupt.

    However, the guest can set virtual interrupt to be pending or active by
    writing to the virtual distributor, which could lead to deactivating a
    virtual interrupt with the HW bit set without the physical interrupt
    being active.

    We could set the physical interrupt to active whenever we are about to
    enter the VM with a HW interrupt either pending or active, but that
    would be really slow, especially on GICv2. So we take the long way
    around and do the hard work when needed, which is expected to be
    extremely rare.

    When the VM sets the pending state for a HW interrupt on the virtual
    distributor we set the active state on the physical distributor, because
    the virtual interrupt can become active and then the guest can
    deactivate it.

    When the VM clears the pending state we also clear it on the physical
    side, because the injector might otherwise raise the interrupt. We also
    clear the physical active state when the virtual interrupt is not
    active, since otherwise a SPEND/CPEND sequence from the guest would
    prevent signaling of future interrupts.

    Changing the state of mapped interrupts from userspace is not supported,
    and it's expected that userspace unmaps devices from VFIO before
    attempting to set the interrupt state, because the interrupt state is
    driven by hardware.

    Reviewed-by: Marc Zyngier
    Reviewed-by: Eric Auger
    Signed-off-by: Christoffer Dall

    Christoffer Dall
     
  • The GIC sometimes need to sample the physical line of a mapped
    interrupt. As we know this to be notoriously slow, provide a callback
    function for devices (such as the timer) which can do this much faster
    than talking to the distributor, for example by comparing a few
    in-memory values. Fall back to the good old method of poking the
    physical GIC if no callback is provided.

    Reviewed-by: Marc Zyngier
    Reviewed-by: Eric Auger
    Signed-off-by: Christoffer Dall

    Christoffer Dall
     
  • Level-triggered mapped IRQs are special because we only observe rising
    edges as input to the VGIC, and we don't set the EOI flag and therefore
    are not told when the level goes down, so that we can re-queue a new
    interrupt when the level goes up.

    One way to solve this problem is to side-step the logic of the VGIC and
    special case the validation in the injection path, but it has the
    unfortunate drawback of having to peak into the physical GIC state
    whenever we want to know if the interrupt is pending on the virtual
    distributor.

    Instead, we can maintain the current semantics of a level triggered
    interrupt by sort of treating it as an edge-triggered interrupt,
    following from the fact that we only observe an asserting edge. This
    requires us to be a bit careful when populating the LRs and when folding
    the state back in though:

    * We lower the line level when populating the LR, so that when
    subsequently observing an asserting edge, the VGIC will do the right
    thing.

    * If the guest never acked the interrupt while running (for example if
    it had masked interrupts at the CPU level while running), we have
    to preserve the pending state of the LR and move it back to the
    line_level field of the struct irq when folding LR state.

    If the guest never acked the interrupt while running, but changed the
    device state and lowered the line (again with interrupts masked) then
    we need to observe this change in the line_level.

    Both of the above situations are solved by sampling the physical line
    and set the line level when folding the LR back.

    * Finally, if the guest never acked the interrupt while running and
    sampling the line reveals that the device state has changed and the
    line has been lowered, we must clear the physical active state, since
    we will otherwise never be told when the interrupt becomes asserted
    again.

    This has the added benefit of making the timer optimization patches
    (https://lists.cs.columbia.edu/pipermail/kvmarm/2017-July/026343.html) a
    bit simpler, because the timer code doesn't have to clear the active
    state on the sync anymore. It also potentially improves the performance
    of the timer implementation because the GIC knows the state or the LR
    and only needs to clear the
    active state when the pending bit in the LR is still set, where the
    timer has to always clear it when returning from running the guest with
    an injected timer interrupt.

    Reviewed-by: Marc Zyngier
    Reviewed-by: Eric Auger
    Signed-off-by: Christoffer Dall

    Christoffer Dall
     
  • We are about to distinguish between userspace accesses and mmio traps
    for a number of the mmio handlers. When the requester vcpu is NULL, it
    means we are handling a userspace access.

    Factor out the functionality to get the request vcpu into its own
    function, mostly so we have a common place to document the semantics of
    the return value.

    Also take the chance to move the functionality outside of holding a
    spinlock and instead explicitly disable and enable preemption. This
    supports PREEMPT_RT kernels as well.

    Acked-by: Marc Zyngier
    Reviewed-by: Andre Przywara
    Signed-off-by: Christoffer Dall

    Christoffer Dall
     
  • Fix ptr_ret.cocci warnings:
    virt/kvm/arm/vgic/vgic-its.c:971:1-3: WARNING: PTR_ERR_OR_ZERO can be used

    Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR

    Generated by: scripts/coccinelle/api/ptr_ret.cocci

    Signed-off-by: Vasyl Gomonovych
    Signed-off-by: Christoffer Dall

    Vasyl Gomonovych
     

01 Dec, 2017

1 commit

  • vgic_set_owner acquires the irq lock without disabling interrupts,
    resulting in a lockdep splat (an interrupt could fire and result
    in the same lock being taken if the same virtual irq is to be
    injected).

    In practice, it is almost impossible to trigger this bug, but
    better safe than sorry. Convert the lock acquisition to a
    spin_lock_irqsave() and keep lockdep happy.

    Reported-by: James Morse
    Signed-off-by: Marc Zyngier
    Signed-off-by: Christoffer Dall

    Marc Zyngier
     

29 Nov, 2017

2 commits