Skip to contentSkip to conversation

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

PATCH Applied Marc Zyngier 4 participants 5 messages Feb 2, 2022

Subsystems (2)
lore
Share & tools
lore

Marc Zyngier

author maintainer
#0 lore raw

PATCH 1/1 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")
Cc Valentin Schneider <[email protected]>
---
 drivers/irqchip/irq-gic-v3-its.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/irqchip/irq-gic-v3-its.c +3 -0
index 9e93ff2b6375..cd772973114a 100644
@@ -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",
Signature · 1 line
2.34.1
Tested-by on v1 1/1
#1 lore raw
Quoted 25 lines · Marc Zyngier

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")
Cc Valentin Schneider <[email protected]>
---
  drivers/irqchip/irq-gic-v3-its.c | 3 +++
  1 file changed, 3 insertions(+)
drivers/irqchip/irq-gic-v3-its.c +0 -0
index 9e93ff2b6375..cd772973114a 100644

drivers/irqchip/irq-gic-v3-its.c int __init its_lpi_memreserve_init(void) · line 5525

Quoted 9 lines
drivers/irqchip/irq-gic-v3-its.c +3 -0
@@ -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

#2 lore raw
In reply to Marc Zyngier
The following commit has been merged into the irq/irqchip-fixes branch of irqchip:

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 <[email protected]>
AuthorDate:    Wed, 02 Feb 2022 10:34:54 
Committer:     Marc Zyngier <[email protected]>
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")
Cc Valentin Schneider <[email protected]>
---
 drivers/irqchip/irq-gic-v3-its.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/irqchip/irq-gic-v3-its.c +3 -0
index 9e93ff2..cd77297 100644
@@ -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",
Reviewed-by on v1 1/1
#3 lore raw
In reply to Marc Zyngier
Quoted 5 lines · Marc Zyngier

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

Quoted 4 lines

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

Quoted 3 lines

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

That looks fine to me.

Quoted 24 lines
Fixes d23bc2bc1d63 ("irqchip/gic-v3-its: Postpone LPI pending table freeing and memreserve")
Cc Valentin Schneider <[email protected]>
---
 drivers/irqchip/irq-gic-v3-its.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/irqchip/irq-gic-v3-its.c +3 -1
index 9e93ff2b6375..cd772973114a 100644
@@ -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

author maintainer
#4 lore raw
Quoted 8 lines · Valentin Schneider
Quoted 5 lines · Marc Zyngier

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.

Quoted 9 lines
Quoted 5 lines

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

Quoted 7 lines
Quoted 3 lines

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

That looks fine to me.

Thanks,

        M.
Signature · 1 line
Jazz is not dead. It just smells funny...