linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 0/2] Improve interrupt handling during machine kexec
@ 2024-11-29 11:31 Eliav Farber
  2024-11-29 11:31 ` [PATCH v4 1/2] kexec: Consolidate machine_kexec_mask_interrupts() implementation Eliav Farber
  2024-11-29 11:31 ` [PATCH v4 2/2] kexec: Prevent redundant IRQ masking by checking state before shutdown Eliav Farber
  0 siblings, 2 replies; 9+ messages in thread
From: Eliav Farber @ 2024-11-29 11:31 UTC (permalink / raw)
  To: linux, catalin.marinas, will, mpe, npiggin, christophe.leroy,
	naveen, maddy, paul.walmsley, palmer, aou, tglx, ebiederm, akpm,
	bhe, farbere, hbathini, sourabhjain, adityag, songshuaishuai,
	takakura, linux-arm-kernel, linux-kernel, linuxppc-dev,
	linux-riscv, kexec
  Cc: jonnyc

This patch series focuses on improving the machine_kexec_mask_interrupts()
function by consolidating its implementation and optimizing its behavior to
avoid redundant interrupt masking.

Patch Summary:
[PATCH v4 1/2] Move machine_kexec_mask_interrupts() to kexec_core.c,
               removing duplicate architecture-specific implementations.
[PATCH v4 2/2] Refine machine_kexec_mask_interrupts() to avoid re-masking
               already-masked interrupts, resolving specific warnings
               triggered in GPIO IRQ flows.

Changes between v3 and v4:
 - Add missing <linux/irqdesc.h> and <linux/irq.h> includes.

Eliav Farber (2):
  kexec: Consolidate machine_kexec_mask_interrupts() implementation
  kexec: Prevent redundant IRQ masking by checking state before shutdown

 arch/arm/kernel/machine_kexec.c   | 23 -----------------------
 arch/arm64/kernel/machine_kexec.c | 31 -------------------------------
 arch/powerpc/include/asm/kexec.h  |  1 -
 arch/powerpc/kexec/core.c         | 22 ----------------------
 arch/riscv/kernel/machine_kexec.c | 23 -----------------------
 include/linux/irq.h               |  3 +++
 include/linux/kexec.h             |  2 ++
 kernel/irq/internals.h            |  1 -
 kernel/kexec_core.c               | 30 ++++++++++++++++++++++++++++++
 9 files changed, 35 insertions(+), 101 deletions(-)

-- 
2.40.1



^ permalink raw reply	[flat|nested] 9+ messages in thread
* RE: [PATCH v4 1/2] kexec: Consolidate machine_kexec_mask_interrupts() implementation
@ 2024-11-30 20:08 Farber, Eliav
  2024-12-01 11:19 ` Thomas Gleixner
  0 siblings, 1 reply; 9+ messages in thread
From: Farber, Eliav @ 2024-11-30 20:08 UTC (permalink / raw)
  To: Thomas Gleixner, linux@armlinux.org.uk, catalin.marinas@arm.com,
	will@kernel.org, mpe@ellerman.id.au, npiggin@gmail.com,
	christophe.leroy@csgroup.eu, naveen@kernel.org,
	maddy@linux.ibm.com, paul.walmsley@sifive.com, palmer@dabbelt.com,
	aou@eecs.berkeley.edu, ebiederm@xmission.com,
	akpm@linux-foundation.org, bhe@redhat.com, hbathini@linux.ibm.com,
	sourabhjain@linux.ibm.com, adityag@linux.ibm.com,
	songshuaishuai@tinylab.org, takakura@valinux.co.jp,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
	linux-riscv@lists.infradead.org, kexec@lists.infradead.org,
	Marc Zyngier
  Cc: Chocron, Jonathan

On 11/29/2024 3:30 PM, Thomas Gleixner wrote:
>> Move the machine_kexec_mask_interrupts function to a common location in
>> kernel/kexec_core.c, removing duplicate implementations from architecture
>> specific files (arch/arm, arch/arm64, arch/powerpc, and arch/riscv).
>
> Can you please move this into kernel/irq/kexec.c?
>
> It's pure interrupt core internal code and there is no point to make
> core internal functions visible to random other code just because.
Done (in v5 series)

>> +void machine_kexec_mask_interrupts(void)
>> +{
>> +     unsigned int i;
>> +     struct irq_desc *desc;
>
>         struct irq_desc *desc;
>         unsigned int i;
>
> please
Done (in v5 series)

>> +     for_each_irq_desc(i, desc) {
>> +             struct irq_chip *chip;
>> +             int check_eoi = 1;
>> +
>> +             chip = irq_desc_get_chip(desc);
>> +             if (!chip)
>> +                     continue;
>> +
>> +             if (IS_ENABLED(CONFIG_ARM64)) {
>
> This should not be CONFIG_ARM64. Add something like:
>
> config GENERIC_IRQ_KEXEC_CLEAR_VM_FORWARD
>         bool
>
> and select this from ARM64?
Done (in v5 series)

>> +                     /*
>> +                      * First try to remove the active state. If this fails, try to EOI the
>> +                      * interrupt.
>
> This comment does not really explain what this is about. I know you
> copied it from the ARM64 implementation, but it should explain what this
> actually means. Something like:
>
>          First try to remove the active state from an interrupt which is
>          forwarded to a VM. If the interrupt is not forwarded, try to
>          EOI the interrupt.
>
> or something like that.
Done (in v5 series)

>> +                      */
>> +                     check_eoi = irq_set_irqchip_state(i, IRQCHIP_STATE_ACTIVE, false);
>
> Looking deeper. This function actually cannot be called from this
> context. It does:
>
>           irq_get_desc_buslock(irq, &flags, 0);
>
> which means for any interrupt which has an actual buslock implementation
> it will end up in a sleepable function and deadlock in the worst case.
>
> Marc?
I will wait for Marc's response regarding this issue.
Regardless, if any changes are required, I believe it would be better
to address them in a separate patch, as this behavior existed before my
modification.

Thanks, Eliav


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

end of thread, other threads:[~2024-12-01 11:19 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-29 11:31 [PATCH v4 0/2] Improve interrupt handling during machine kexec Eliav Farber
2024-11-29 11:31 ` [PATCH v4 1/2] kexec: Consolidate machine_kexec_mask_interrupts() implementation Eliav Farber
2024-11-29 13:30   ` Thomas Gleixner
2024-11-29 15:31   ` kernel test robot
2024-11-29 15:53   ` kernel test robot
2024-11-29 11:31 ` [PATCH v4 2/2] kexec: Prevent redundant IRQ masking by checking state before shutdown Eliav Farber
2024-11-29 13:32   ` Thomas Gleixner
  -- strict thread matches above, loose matches on Subject: below --
2024-11-30 20:08 [PATCH v4 1/2] kexec: Consolidate machine_kexec_mask_interrupts() implementation Farber, Eliav
2024-12-01 11:19 ` Thomas Gleixner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).