[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2c9489cc-d276-7c52-5d52-7f234fdc726e@hisilicon.com>
Date: Fri, 19 Jul 2024 17:42:02 +0800
From: Zhou Wang <wangzhou1@...ilicon.com>
To: Marc Zyngier <maz@...nel.org>, <kvmarm@...ts.linux.dev>,
<linux-arm-kernel@...ts.infradead.org>, <linux-kernel@...r.kernel.org>
CC: Thomas Gleixner <tglx@...utronix.de>, Nianyao Tang
<tangnianyao@...wei.com>
Subject: Re: [PATCH 3/3] irqchip/gic-v4: Make sure a VPE is locked when VMAPP
is issued
On 2024/7/5 17:31, Marc Zyngier wrote:
> In order to make sure that vpe->col_idx is correctly sampled
> when a VMAPP command is issued, we must hold the lock for the
> VPE. This is now possible since the introduction of the per-VM
> vmapp_lock, which can be taken before vpe_lock in the locking
> order.
>
> Signed-off-by: Marc Zyngier <maz@...nel.org>
> ---
> drivers/irqchip/irq-gic-v3-its.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c
> index b52d60097cad5..951ec140bcea2 100644
> --- a/drivers/irqchip/irq-gic-v3-its.c
> +++ b/drivers/irqchip/irq-gic-v3-its.c
> @@ -1810,7 +1810,9 @@ static void its_map_vm(struct its_node *its, struct its_vm *vm)
> for (i = 0; i < vm->nr_vpes; i++) {
> struct its_vpe *vpe = vm->vpes[i];
>
> - its_send_vmapp(its, vpe, true);
> + scoped_guard(raw_spinlock, &vpe->vpe_lock)
> + its_send_vmapp(its, vpe, true);
> +
> its_send_vinvall(its, vpe);
> }
> }
> @@ -1827,8 +1829,10 @@ static void its_unmap_vm(struct its_node *its, struct its_vm *vm)
> if (!--vm->vlpi_count[its->list_nr]) {
> int i;
>
> - for (i = 0; i < vm->nr_vpes; i++)
> + for (i = 0; i < vm->nr_vpes; i++) {
> + guard(raw_spinlock)(&vm->vpes[i]->vpe_lock);
> its_send_vmapp(its, vm->vpes[i], false);
> + }
> }
> }
>
Hi Marc,
It looks like there is ABBA deadlock after applying this series:
In its_map_vm: vmapp_lock -> vpe_lock
In its_vpe_set_affinity: vpe_to_cpuid_lock(vpe_lock) -> its_send_vmovp(vmapp_lock)
Any idea about this?
Best,
Zhou
Powered by blists - more mailing lists