Skip to contentSkip to conversation

irqchip: gic-v3-its: irq_pipeline: Fix OOB context in-band lock warning for ITS lock

PATCH Superseded linz 3 participants 3 messages Jul 17 – Aug 3

Subsystems (2)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

linz

author
#0 lore raw

PATCH v3 1/1 irqchip: gic-v3-its: irq_pipeline: Fix OOB context in-band lock warning for ITS lock

The warning shown below could be observed on dovetail 6.6 with arm64 architecture when CONFIG_DEBUG_IRQ_PIPELINE is enabled.

The reason is the usage of a raw_spinlock_t in hard IRQ masking code path. A migration to hard_spinlock_t fixes this issue.

[    1.510903] IRQ pipeline: some code running in oob context 'Xenomai'
                             called an in-band only routine
[    1.510912] CPU: 0 PID: 0 Comm: swapper/0 Tainted: G S                 6.6.63-dovetail2 #8 [    1.510918] Hardware name: Pe2204 DEMO DDR4 (DT)
[    1.510920] IRQ stage: Xenomai
[    1.510923] Call trace:
[    1.510926]  dump_backtrace+0x90/0xe4
[    1.510940]  show_stack+0x14/0x1c
[    1.510946]  dump_stack_lvl+0x84/0xc8
[    1.510953]  dump_stack+0x14/0x1c
[    1.510957]  check_inband_stage+0xb0/0xc8
[    1.510965]  inband_irq_save+0xc/0x28
[    1.510971]  _raw_spin_lock_irqsave+0x14/0x90
[    1.510977]  its_send_single_command+0x24/0x154
[    1.510984]  lpi_update_config+0x9c/0x144
[    1.510990]  its_mask_irq+0x2c/0x64
[    1.510997]  irq_chip_mask_parent+0x18/0x20
[    1.511005]  its_mask_msi_irq+0x1c/0x28
[    1.511012]  handle_fasteoi_irq+0x1cc/0x2b4
[    1.511016]  generic_pipeline_irq_desc+0x6c/0xa4
[    1.511021]  generic_handle_domain_irq+0x18/0x20
[    1.511028]  gic_handle_irq+0x4c/0x120
[    1.511032]  handle_irq_pipelined+0x40/0x64
[    1.511038]  call_on_irq_stack+0x24/0x30
[    1.511044]  do_interrupt_handler+0x138/0x158
[    1.511050]  el1_interrupt+0x40/0x110
[    1.511055]  el1h_64_irq_handler+0x14/0x1c
[    1.511061]  el1h_64_irq+0x64/0x68
[    1.511064]  default_idle_call+0x30/0x78
[    1.511071]  do_idle+0x128/0x150
[    1.511077]  cpu_startup_entry+0x34/0x38
[    1.511081]  kernel_init+0x0/0x1d4
[    1.511088]  arch_post_acpi_subsys_init+0x0/0x8
[    1.511096]  start_kernel+0x504/0x5cc
[    1.511103]  __primary_switched+0xbc/0xc4

---
 drivers/irqchip/irq-gic-v3-its.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/irqchip/irq-gic-v3-its.c +1 -1
index 0e57735eac..3f2b02b8f4 100644
@@ -94,7 +94,7 @@ struct its_device;
  * list.
  */
 struct its_node {
-	raw_spinlock_t		lock;
+	hard_spinlock_t		lock;
 	struct mutex		dev_alloc_lock;
 	struct list_head	entry;
 	void __iomem		*base;
Signature · 1 line
2.34.1
#1 lore raw
Quoted 52 lines · linz

The warning shown below could be observed on dovetail 6.6 with arm64 architecture when CONFIG_DEBUG_IRQ_PIPELINE is enabled.

The reason is the usage of a raw_spinlock_t in hard IRQ masking code path. A migration to hard_spinlock_t fixes this issue.

[    1.510903] IRQ pipeline: some code running in oob context 'Xenomai'
                             called an in-band only routine
[    1.510912] CPU: 0 PID: 0 Comm: swapper/0 Tainted: G S                 6.6.63-dovetail2 #8 [    1.510918] Hardware name: Pe2204 DEMO DDR4 (DT)
[    1.510920] IRQ stage: Xenomai
[    1.510923] Call trace:
[    1.510926]  dump_backtrace+0x90/0xe4
[    1.510940]  show_stack+0x14/0x1c
[    1.510946]  dump_stack_lvl+0x84/0xc8
[    1.510953]  dump_stack+0x14/0x1c
[    1.510957]  check_inband_stage+0xb0/0xc8
[    1.510965]  inband_irq_save+0xc/0x28
[    1.510971]  _raw_spin_lock_irqsave+0x14/0x90
[    1.510977]  its_send_single_command+0x24/0x154
[    1.510984]  lpi_update_config+0x9c/0x144
[    1.510990]  its_mask_irq+0x2c/0x64
[    1.510997]  irq_chip_mask_parent+0x18/0x20
[    1.511005]  its_mask_msi_irq+0x1c/0x28
[    1.511012]  handle_fasteoi_irq+0x1cc/0x2b4
[    1.511016]  generic_pipeline_irq_desc+0x6c/0xa4
[    1.511021]  generic_handle_domain_irq+0x18/0x20
[    1.511028]  gic_handle_irq+0x4c/0x120
[    1.511032]  handle_irq_pipelined+0x40/0x64
[    1.511038]  call_on_irq_stack+0x24/0x30
[    1.511044]  do_interrupt_handler+0x138/0x158
[    1.511050]  el1_interrupt+0x40/0x110
[    1.511055]  el1h_64_irq_handler+0x14/0x1c
[    1.511061]  el1h_64_irq+0x64/0x68
[    1.511064]  default_idle_call+0x30/0x78
[    1.511071]  do_idle+0x128/0x150
[    1.511077]  cpu_startup_entry+0x34/0x38
[    1.511081]  kernel_init+0x0/0x1d4
[    1.511088]  arch_post_acpi_subsys_init+0x0/0x8
[    1.511096]  start_kernel+0x504/0x5cc
[    1.511103]  __primary_switched+0xbc/0xc4

---
 drivers/irqchip/irq-gic-v3-its.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/irqchip/irq-gic-v3-its.c +0 -0
index 0e57735eac..3f2b02b8f4 100644

drivers/irqchip/irq-gic-v3-its.c struct its_device; · line 100

Quoted 8 lines
drivers/irqchip/irq-gic-v3-its.c +1 -1
@@ -94,7 +94,7 @@ struct its_device;
  * list.
  */
 struct its_node {
-	raw_spinlock_t		lock;
+	hard_spinlock_t		lock;
 	struct mutex		dev_alloc_lock;
 	struct list_head	entry;
 	void __iomem		*base;

This is correct, but we need more changes for this irqchip driver, particularly for handlers mentioned by this document [1], like irq_mask, irq_unmask.

For instance, anything which calls lpi_update_config() needs to be made oob-capable, so it looks like gic_data_rdist_cpu(cpu)->rd_lock needs care too.

[1] https://v4.xenomai.org/dovetail/porting/irqflow/index.html#irqchip-fixup

Signature · 1 line
Philippe.
#2 lore raw
Quoted 67 lines · Philippe Gerum
Quoted 52 lines · linz

The warning shown below could be observed on dovetail 6.6 with arm64 architecture when CONFIG_DEBUG_IRQ_PIPELINE is enabled.

The reason is the usage of a raw_spinlock_t in hard IRQ masking code path. A migration to hard_spinlock_t fixes this issue.

[    1.510903] IRQ pipeline: some code running in oob context 'Xenomai'
                             called an in-band only routine
[    1.510912] CPU: 0 PID: 0 Comm: swapper/0 Tainted: G S                 6.6.63-dovetail2 #8 [    1.510918] Hardware name: Pe2204 DEMO DDR4 (DT)
[    1.510920] IRQ stage: Xenomai
[    1.510923] Call trace:
[    1.510926]  dump_backtrace+0x90/0xe4
[    1.510940]  show_stack+0x14/0x1c
[    1.510946]  dump_stack_lvl+0x84/0xc8
[    1.510953]  dump_stack+0x14/0x1c
[    1.510957]  check_inband_stage+0xb0/0xc8
[    1.510965]  inband_irq_save+0xc/0x28
[    1.510971]  _raw_spin_lock_irqsave+0x14/0x90
[    1.510977]  its_send_single_command+0x24/0x154
[    1.510984]  lpi_update_config+0x9c/0x144
[    1.510990]  its_mask_irq+0x2c/0x64
[    1.510997]  irq_chip_mask_parent+0x18/0x20
[    1.511005]  its_mask_msi_irq+0x1c/0x28
[    1.511012]  handle_fasteoi_irq+0x1cc/0x2b4
[    1.511016]  generic_pipeline_irq_desc+0x6c/0xa4
[    1.511021]  generic_handle_domain_irq+0x18/0x20
[    1.511028]  gic_handle_irq+0x4c/0x120
[    1.511032]  handle_irq_pipelined+0x40/0x64
[    1.511038]  call_on_irq_stack+0x24/0x30
[    1.511044]  do_interrupt_handler+0x138/0x158
[    1.511050]  el1_interrupt+0x40/0x110
[    1.511055]  el1h_64_irq_handler+0x14/0x1c
[    1.511061]  el1h_64_irq+0x64/0x68
[    1.511064]  default_idle_call+0x30/0x78
[    1.511071]  do_idle+0x128/0x150
[    1.511077]  cpu_startup_entry+0x34/0x38
[    1.511081]  kernel_init+0x0/0x1d4
[    1.511088]  arch_post_acpi_subsys_init+0x0/0x8
[    1.511096]  start_kernel+0x504/0x5cc
[    1.511103]  __primary_switched+0xbc/0xc4

---
 drivers/irqchip/irq-gic-v3-its.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/irqchip/irq-gic-v3-its.c +0 -0
index 0e57735eac..3f2b02b8f4 100644

drivers/irqchip/irq-gic-v3-its.c struct its_device; · line 100

Quoted 8 lines
drivers/irqchip/irq-gic-v3-its.c +1 -1
@@ -94,7 +94,7 @@ struct its_device;
  * list.
  */
 struct its_node {
-	raw_spinlock_t		lock;
+	hard_spinlock_t		lock;
 	struct mutex		dev_alloc_lock;
 	struct list_head	entry;
 	void __iomem		*base;

This is correct, but we need more changes for this irqchip driver, particularly for handlers mentioned by this document [1], like irq_mask, irq_unmask.

Quoted 3 lines

For instance, anything which calls lpi_update_config() needs to be made oob-capable, so it looks like gic_data_rdist_cpu(cpu)->rd_lock needs care too.

Agreed.

Btw: There is a difference in the display name between the mail address used for sending (From: header) and the Signed-off-by: tag. So I'm not sure about the greeting ;-)

linz/zhanglin, do you plan to address the comments from Philippe?

Best regards,
Florian