Re: [PATCH] irqchip/gic-v3-its: Skip HP notifier when no ITS is registered
From: Valentin Schneider
Date: Wed Feb 02 2022 - 07:51:00 EST
On 02/02/22 10:34, Marc Zyngier wrote:
> We have some systems out there that have both LPI support and an
> ITS, but that don't expose the ITS in their firmware tables
> (either because it is broken or because they run under a hypervisor
> that hides it...).
>
Huh :)
> Is such a configuration, we still register the HP notifier to free
> the allocated tables if needed, resulting in a warning as there is
> no memory to free (nothing was allocated the first place).
>
Right, so list_empty(&its_nodes) means no ->pend_page, but still having the
HP notifier means we hit the WARN_ON(!pend_page).
> Fix it by keying the HP notifier on the presence of at least one
> sucessfully probed ITS.
>
That looks fine to me.
Reviewed-by: Valentin Schneider <valentin.schneider@xxxxxxx>
> Fixes: d23bc2bc1d63 ("irqchip/gic-v3-its: Postpone LPI pending table freeing and memreserve")
> Reported-by: Steev Klimaszewski <steev@xxxxxxxx>
> Signed-off-by: Marc Zyngier <maz@xxxxxxxxxx>
> Cc: Valentin Schneider <valentin.schneider@xxxxxxx>
> ---
> drivers/irqchip/irq-gic-v3-its.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c
> index 9e93ff2b6375..cd772973114a 100644
> --- a/drivers/irqchip/irq-gic-v3-its.c
> +++ b/drivers/irqchip/irq-gic-v3-its.c
> @@ -5517,6 +5517,9 @@ int __init its_lpi_memreserve_init(void)
> if (!efi_enabled(EFI_CONFIG_TABLES))
> return 0;
>
> + if (list_empty(&its_nodes))
> + return 0;
> +
> gic_rdists->cpuhp_memreserve_state = CPUHP_INVALID;
> state = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN,
> "irqchip/arm/gicv3/memreserve:online",
> --
> 2.34.1