arm: gic: deactivate sgi immediately after eoi
PATCH 1/1 arm: gic: deactivate sgi immediately after eoi
On i.MX8, we implemented partition reboot which means Cortex-A reboot will not impact M4 cores and System control Unit core. However GICv3 is not reset because we also need to support A72 Cluster reboot without affecting A53 Cluster.
The gic-v3 controller is configured with EOImode to 1, so during xen reboot, there is a function call "smp_call_function(halt_this_cpu, NULL, 0);" ,but halt_this_cpu never return, that means other CPUs have no chance to deactive the SGI interrupt, because the deactivate_irq operation is at the end of do_sgi. During xen booting again, CPU0 will issue GIC_SGI_CALL_FUNCTION to other CPUs. Because GIC_SGI_CALL_FUNCTION of other CPUs are active during the last reboot, interrupts could not be triggered unless we deactivate the interrupt first.
To fix this issue, let's move the deactivate_irq operation just after eoi_irq, then the SGI interrupt will be in deactive state when smp_call_function_interrupt.
--- xen/arch/arm/gic.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
xen/arch/arm/gic.c +2 -3
@@ -347,6 +347,8 @@ static void do_sgi(struct cpu_user_regs *regs, enum gic_sgi sgi)/* Lower the priority */ gic_hw_ops->eoi_irq (desc); +/* Deactivate */ + gic_hw_ops->deactivate_irq (desc);/* * Ensure any shared data written by the CPU sending
@@ -370,9 +372,6 @@ static void do_sgi(struct cpu_user_regs *regs, enum gic_sgi sgi)panic ("Unhandled SGI %d on CPU%d\n" , sgi,smp_processor_id ());break ; } - -/* Deactivate */ - gic_hw_ops->deactivate_irq (desc); }/* Accept an interrupt from the GIC and dispatch its handler */
Signature · 7 lines
2.14.1 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 14 lines · Peng Fan
On i.MX8, we implemented partition reboot which means Cortex-A reboot will not impact M4 cores and System control Unit core. However GICv3 is not reset because we also need to support A72 Cluster reboot without affecting A53 Cluster.
The gic-v3 controller is configured with EOImode to 1, so during xen reboot, there is a function call "
smp_call_function(halt_this_cpu, NULL, 0);" ,buthalt_this_cpunever return, that means other CPUs have no chance to deactive the SGI interrupt, because thedeactivate_irqoperation is at the end ofdo_sgi. During xen booting again, CPU0 will issueGIC_SGI_CALL_FUNCTIONto other CPUs. BecauseGIC_SGI_CALL_FUNCTIONof other CPUs are active during the last reboot, interrupts could not be triggered unless we deactivate the interrupt first.
Quoted 5 lines
To fix this issue, let's move the
deactivate_irqoperation just aftereoi_irq, then the SGI interrupt will be in deactive state whensmp_call_function_interrupt.Signed-off-by Peng Fan <[email protected]>
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
(+ Andre)
Hi Peng,
Quoted 4 lines · Peng Fan
On i.MX8, we implemented partition reboot which means Cortex-A reboot will not impact M4 cores and System control Unit core. However GICv3 is not reset because we also need to support A72 Cluster reboot without affecting A53 Cluster.
How about the other interrupts? For instance, it would be theoretically possible to have a PPI/SPI active and receive the order to turn it off. Is this going to be an issue?
Quoted 4 lines
The gic-v3 controller is configured with EOImode to 1, so during xen reboot, there is a function call "
smp_call_function(halt_this_cpu, NULL, 0);" ,buthalt_this_cpunever return, that means other CPUs have no chance to
s/,/, /
Quoted 1 line
deactive the SGI interrupt, because the
deactivate_irqoperation is at
s/deactive/deactivate/
Quoted 1 line
the end of
do_sgi. During xen booting again, CPU0 will issue
s/xen/Xen/
Also:
"During the next boot of Xen,"
Quoted 2 lines
GIC_SGI_CALL_FUNCTIONto other CPUs. BecauseGIC_SGI_CALL_FUNCTIONof other CPUs are active during the last reboot, interrupts could not be
s/of other/on the others/
Quoted 1 line
triggered unless we deactivate the interrupt first.
I think it would be clearer if you say: "As the Active state for SGI is left untouched during the reboot, the GIC_SGI_CALL_FUNCTION will still be active on the non-boot CPUs. This means the interrupt cannot be triggered again until it get deactivated."
Quoted 3 lines
To fix this issue, let's move the
deactivate_irqoperation just aftereoi_irq, then the SGI interrupt will be in deactive state when
s/deactive/deactivate/
Quoted 1 line
smp_call_function_interrupt.
I would add: "This is fine because the interrupts are masked while handling the SGI.".
Quoted 2 lines
Signed-off-by Peng Fan <[email protected]>
I think the patch makes sense in itself. This is a saner behavior than turning off the CPU with active interrupts. I want to double-check a few things before committing it. But I will definitely commit it by the end of the week.
No need to resend the patch if there are no changes in the code. I can take care for the commit message.
Cheers,
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Hi Julien
Quoted 13 lines
-----Original Message-----
From: Julien Grall [mailto:[email protected]]
Sent: 2019年1月29日 23:57
To: Peng Fan <[email protected]>; [email protected]; [email protected]
Cc: [email protected]; Andre Przywara <[email protected]>
Subject: Re: [PATCH for-4.12] arm: gic: deactivate sgi immediately after eoi(+ Andre)
Hi Peng,
On 24/01/2019 12:43, Peng Fan wrote:
Quoted 8 lines
Quoted 4 lines
On i.MX8, we implemented partition reboot which means Cortex-A reboot will not impact M4 cores and System control Unit core. However GICv3 is not reset because we also need to support A72 Cluster reboot without affecting A53 Cluster.
How about the other interrupts? For instance, it would be theoretically possible to have a PPI/SPI active and receive the order to turn it off. Is this going to be an issue?
Currently we only met this issue when doing Xen reboot, because halt_this_cpu never return. For other interrupts, I think they are deactivated properly.
Quoted 49 lines
Quoted 6 lines
The gic-v3 controller is configured with EOImode to 1, so during xen reboot, there is a function call "
smp_call_function(halt_this_cpu, NULL, 0);" ,buthalt_this_cpunever return, that means other CPUs have no chance tos/,/, /
Quoted 1 line
deactive the SGI interrupt, because the
deactivate_irqoperation is ats/deactive/deactivate/
Quoted 1 line
the end of
do_sgi. During xen booting again, CPU0 will issues/xen/Xen/
Also:
"During the next boot of Xen,"
Quoted 1 line
GIC_SGI_CALL_FUNCTIONto other CPUs. Because
GIC_SGI_CALL_FUNCTIONofQuoted 1 line
other CPUs are active during the last reboot, interrupts could not be
s/of other/on the others/
Quoted 1 line
triggered unless we deactivate the interrupt first.
I think it would be clearer if you say: "As the Active state for SGI is left untouched during the reboot, the
GIC_SGI_CALL_FUNCTIONwill still be active on the non-boot CPUs. This means the interrupt cannot be triggered again until it get deactivated."Quoted 3 lines
To fix this issue, let's move the
deactivate_irqoperation just aftereoi_irq, then the SGI interrupt will be in deactive state whens/deactive/deactivate/
Quoted 1 line
smp_call_function_interrupt.I would add: "This is fine because the interrupts are masked while handling the
SGI.".Quoted 2 lines
Signed-off-by Peng Fan <[email protected]>
Quoted 7 lines
I think the patch makes sense in itself. This is a saner behavior than turning off the CPU with active interrupts. I want to double-check a few things before committing it. But I will definitely commit it by the end of the week.
No need to resend the patch if there are no changes in the code. I can take care
for the commit message.
Thanks,
Peng.
Quoted 5 lines
Cheers,
--
Julien Grall
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 1 line · Peng Fan
Hi Julien
Hi Peng,
Quoted 18 lines
Quoted 18 lines
-----Original Message-----
From: Julien Grall [mailto:[email protected]]
Sent: 2019年1月29日 23:57
To: Peng Fan <[email protected]>; [email protected]; [email protected]
Cc: [email protected]; Andre Przywara <[email protected]>
Subject: Re: [PATCH for-4.12] arm: gic: deactivate sgi immediately after eoi(+ Andre)
Hi Peng,
Quoted 4 lines · Peng Fan
On i.MX8, we implemented partition reboot which means Cortex-A reboot will not impact M4 cores and System control Unit core. However GICv3 is not reset because we also need to support A72 Cluster reboot without affecting A53 Cluster.
Quoted 6 lines
Quoted 3 lines
How about the other interrupts? For instance, it would be theoretically possible to have a PPI/SPI active and receive the order to turn it off. Is this going to be an issue?
Currently we only met this issue when doing Xen reboot, because
halt_this_cpunever return. For other interrupts, I think they are deactivated properly.
I don't think so, IPIs has an higher priority than all the other interrupt. So you may receive the IPI while handling another interrupts. This will leave the interrupts activated while turning off the processor.
I spoke with Marc Z. (GIC expert) today regarding rebooting/kexecing with interrupts activated. He said this is a valid case and the boot code should take care of de-activating all interrupts. So your first patch might be more suitable here. Sorry for the inconvenience. I will comment back on the first one again.
Cheers,
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel