Re: ARM/gic-v4: deadlock occurred
From: Marc Zyngier
Date: Mon May 06 2019 - 05:21:41 EST
On Sun, 05 May 2019 12:15:51 +0100,
Heyi Guo <guoheyi@xxxxxxxxxx> wrote:
>
> BTW since its_irq_set_vcpu_affinity() is already in atomic context,
> do we really need a separate lock its_dev->event_map.vlpi_lock? I
> didn't find anywhere outside its_irq_set_vcpu_affinity() call chain
> acquires this lock.
The reason is that the vlpi_maps array covers the whole of the
generating device, and not just a single interrupt. Relying on the
irq_desc lock to protect the array wouldn't work, as you could still
have concurrent accesses to the array (map, unmap and get all access
the same data).
So one way or another, we need some form of mutual exclusion at this
level. I guess one of the design mistakes that we have in the current
code is that there is no "device wide" operation, and that we rely on
map/unmap to perform the allocations on demand in the low level code.
What we could potentially do would be to move this allocation higher
up in the stack, and track the first time an LPI is turned into a VLPI
at that level. That's an invasive change though...
Thanks,
M.
--
Jazz is not dead, it just smell funny.