All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] irqchip/gic-v3-its: Skip HP notifier when no ITS is registered
@ 2022-02-02 10:34 Marc Zyngier
  2022-02-02 10:40 ` Steev Klimaszewski
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Marc Zyngier @ 2022-02-02 10:34 UTC (permalink / raw)
  To: linux-kernel
  Cc: Thomas Gleixner, kernel-team, Steev Klimaszewski, Valentin Schneider

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...).

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).

Fix it by keying the HP notifier on the presence of at least one
sucessfully probed ITS.

Fixes: d23bc2bc1d63 ("irqchip/gic-v3-its: Postpone LPI pending table freeing and memreserve")
Reported-by: Steev Klimaszewski <steev@kali.org>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Cc: Valentin Schneider <valentin.schneider@arm.com>
---
 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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] irqchip/gic-v3-its: Skip HP notifier when no ITS is registered
  2022-02-02 10:34 [PATCH] irqchip/gic-v3-its: Skip HP notifier when no ITS is registered Marc Zyngier
@ 2022-02-02 10:40 ` Steev Klimaszewski
  2022-02-02 10:46 ` [irqchip: irq/irqchip-fixes] " irqchip-bot for Marc Zyngier
  2022-02-02 12:50 ` [PATCH] " Valentin Schneider
  2 siblings, 0 replies; 5+ messages in thread
From: Steev Klimaszewski @ 2022-02-02 10:40 UTC (permalink / raw)
  To: Marc Zyngier, linux-kernel
  Cc: Thomas Gleixner, kernel-team, Valentin Schneider


On 2/2/22 4:34 AM, 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...).
>
> 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).
>
> Fix it by keying the HP notifier on the presence of at least one
> sucessfully probed ITS.
>
> Fixes: d23bc2bc1d63 ("irqchip/gic-v3-its: Postpone LPI pending table freeing and memreserve")
> Reported-by: Steev Klimaszewski <steev@kali.org>
> Signed-off-by: Marc Zyngier <maz@kernel.org>
> Cc: Valentin Schneider <valentin.schneider@arm.com>
> ---
>   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",

Tested on the Lenovo Yoga C630

Tested-by: Steev Klimaszewski <steev@kali.org>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [irqchip: irq/irqchip-fixes] irqchip/gic-v3-its: Skip HP notifier when no ITS is registered
  2022-02-02 10:34 [PATCH] irqchip/gic-v3-its: Skip HP notifier when no ITS is registered Marc Zyngier
  2022-02-02 10:40 ` Steev Klimaszewski
@ 2022-02-02 10:46 ` irqchip-bot for Marc Zyngier
  2022-02-02 12:50 ` [PATCH] " Valentin Schneider
  2 siblings, 0 replies; 5+ messages in thread
From: irqchip-bot for Marc Zyngier @ 2022-02-02 10:46 UTC (permalink / raw)
  To: linux-kernel; +Cc: Steev Klimaszewski, Marc Zyngier, Valentin Schneider, tglx

The following commit has been merged into the irq/irqchip-fixes branch of irqchip:

Commit-ID:     eba1e44beef88aa722f07755f79f604cd5d92290
Gitweb:        https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms/eba1e44beef88aa722f07755f79f604cd5d92290
Author:        Marc Zyngier <maz@kernel.org>
AuthorDate:    Wed, 02 Feb 2022 10:34:54 
Committer:     Marc Zyngier <maz@kernel.org>
CommitterDate: Wed, 02 Feb 2022 10:43:10 

irqchip/gic-v3-its: Skip HP notifier when no ITS is registered

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...).

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).

Fix it by keying the HP notifier on the presence of at least one
sucessfully probed ITS.

Fixes: d23bc2bc1d63 ("irqchip/gic-v3-its: Postpone LPI pending table freeing and memreserve")
Reported-by: Steev Klimaszewski <steev@kali.org>
Tested-by: Steev Klimaszewski <steev@kali.org>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Cc: Valentin Schneider <valentin.schneider@arm.com>
Link: https://lore.kernel.org/r/20220202103454.2480465-1-maz@kernel.org
---
 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 9e93ff2..cd77297 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",

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] irqchip/gic-v3-its: Skip HP notifier when no ITS is registered
  2022-02-02 10:34 [PATCH] irqchip/gic-v3-its: Skip HP notifier when no ITS is registered Marc Zyngier
  2022-02-02 10:40 ` Steev Klimaszewski
  2022-02-02 10:46 ` [irqchip: irq/irqchip-fixes] " irqchip-bot for Marc Zyngier
@ 2022-02-02 12:50 ` Valentin Schneider
  2022-02-02 13:30   ` Marc Zyngier
  2 siblings, 1 reply; 5+ messages in thread
From: Valentin Schneider @ 2022-02-02 12:50 UTC (permalink / raw)
  To: Marc Zyngier, linux-kernel
  Cc: Thomas Gleixner, kernel-team, Steev Klimaszewski

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@arm.com>

> Fixes: d23bc2bc1d63 ("irqchip/gic-v3-its: Postpone LPI pending table freeing and memreserve")
> Reported-by: Steev Klimaszewski <steev@kali.org>
> Signed-off-by: Marc Zyngier <maz@kernel.org>
> Cc: Valentin Schneider <valentin.schneider@arm.com>
> ---
>  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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] irqchip/gic-v3-its: Skip HP notifier when no ITS is registered
  2022-02-02 12:50 ` [PATCH] " Valentin Schneider
@ 2022-02-02 13:30   ` Marc Zyngier
  0 siblings, 0 replies; 5+ messages in thread
From: Marc Zyngier @ 2022-02-02 13:30 UTC (permalink / raw)
  To: Valentin Schneider
  Cc: linux-kernel, Thomas Gleixner, kernel-team, Steev Klimaszewski

On 2022-02-02 12:50, Valentin Schneider wrote:
> 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 :)

Yeah. Got to love these WoA machines where EL2 hides most of the
useful HW, but also can't be bothered to consistently emulate
the registers they trap (cue the bug that was causing the SMMUv2
driver to explode on store of xzr to an MMIO register). Bah.

> 
>> 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@arm.com>

Thanks,

         M.
-- 
Jazz is not dead. It just smells funny...

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-02-02 13:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-02 10:34 [PATCH] irqchip/gic-v3-its: Skip HP notifier when no ITS is registered Marc Zyngier
2022-02-02 10:40 ` Steev Klimaszewski
2022-02-02 10:46 ` [irqchip: irq/irqchip-fixes] " irqchip-bot for Marc Zyngier
2022-02-02 12:50 ` [PATCH] " Valentin Schneider
2022-02-02 13:30   ` Marc Zyngier

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.