From: Thomas Gleixner <tglx@linutronix•de>
To: Eliav Farber <farbere@amazon•com>,
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, farbere@amazon•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 <maz@kernel•org>
Cc: jonnyc@amazon•com
Subject: Re: [PATCH v4 1/2] kexec: Consolidate machine_kexec_mask_interrupts() implementation
Date: Fri, 29 Nov 2024 14:30:41 +0100 [thread overview]
Message-ID: <87zfliw4ji.ffs@tglx> (raw)
In-Reply-To: <20241129113119.26669-2-farbere@amazon.com>
On Fri, Nov 29 2024 at 11:31, Eliav Farber 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.
> +void machine_kexec_mask_interrupts(void)
> +{
> + unsigned int i;
> + struct irq_desc *desc;
struct irq_desc *desc;
unsigned int i;
please
> + 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?
> + /*
> + * 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.
> + */
> + 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?
> + }
> +
> + if (check_eoi && chip->irq_eoi && irqd_irq_inprogress(&desc->irq_data))
> + chip->irq_eoi(&desc->irq_data);
Thanks,
tglx
next prev parent reply other threads:[~2024-11-29 13:30 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87zfliw4ji.ffs@tglx \
--to=tglx@linutronix$(echo .)de \
--cc=adityag@linux$(echo .)ibm.com \
--cc=akpm@linux-foundation$(echo .)org \
--cc=aou@eecs$(echo .)berkeley.edu \
--cc=bhe@redhat$(echo .)com \
--cc=catalin.marinas@arm$(echo .)com \
--cc=christophe.leroy@csgroup$(echo .)eu \
--cc=ebiederm@xmission$(echo .)com \
--cc=farbere@amazon$(echo .)com \
--cc=hbathini@linux$(echo .)ibm.com \
--cc=jonnyc@amazon$(echo .)com \
--cc=kexec@lists$(echo .)infradead.org \
--cc=linux-arm-kernel@lists$(echo .)infradead.org \
--cc=linux-kernel@vger$(echo .)kernel.org \
--cc=linux-riscv@lists$(echo .)infradead.org \
--cc=linux@armlinux$(echo .)org.uk \
--cc=linuxppc-dev@lists$(echo .)ozlabs.org \
--cc=maddy@linux$(echo .)ibm.com \
--cc=maz@kernel$(echo .)org \
--cc=mpe@ellerman$(echo .)id.au \
--cc=naveen@kernel$(echo .)org \
--cc=npiggin@gmail$(echo .)com \
--cc=palmer@dabbelt$(echo .)com \
--cc=paul.walmsley@sifive$(echo .)com \
--cc=songshuaishuai@tinylab$(echo .)org \
--cc=sourabhjain@linux$(echo .)ibm.com \
--cc=takakura@valinux$(echo .)co.jp \
--cc=will@kernel$(echo .)org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox