lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250127163905.GC25757@willie-the-truck>
Date: Mon, 27 Jan 2025 16:39:06 +0000
From: Will Deacon <will@...nel.org>
To: Eliav Farber <farbere@...zon.com>
Cc: linux@...linux.org.uk, catalin.marinas@....com, mpe@...erman.id.au,
	npiggin@...il.com, christophe.leroy@...roup.eu, naveen@...nel.org,
	maddy@...ux.ibm.com, paul.walmsley@...ive.com, palmer@...belt.com,
	aou@...s.berkeley.edu, tglx@...utronix.de,
	akpm@...ux-foundation.org, bhe@...hat.com, hbathini@...ux.ibm.com,
	sourabhjain@...ux.ibm.com, adityag@...ux.ibm.com,
	songshuaishuai@...ylab.org, takakura@...inux.co.jp,
	linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
	linuxppc-dev@...ts.ozlabs.org, linux-riscv@...ts.infradead.org,
	jonnyc@...zon.com
Subject: Re: [PATCH v6 1/2] kexec: Consolidate
 machine_kexec_mask_interrupts() implementation

On Wed, Dec 04, 2024 at 02:20:02PM +0000, Eliav Farber wrote:
> Consolidate the machine_kexec_mask_interrupts implementation into a common
> function located in a new file: kernel/irq/kexec.c. This removes duplicate
> implementations from architecture-specific files in arch/arm, arch/arm64,
> arch/powerpc, and arch/riscv, reducing code duplication and improving
> maintainability.
> 
> The new implementation retains architecture-specific behavior for
> CONFIG_GENERIC_IRQ_KEXEC_CLEAR_VM_FORWARD, which was previously implemented
> for ARM64. When enabled (currently for ARM64), it clears the active state
> of interrupts forwarded to virtual machines (VMs) before handling other
> interrupt masking operations.
> 
> Signed-off-by: Eliav Farber <farbere@...zon.com>
> ---
> V5 -> V6:
>  - Change GENERIC_IRQ_KEXEC_CLEAR_VM_FORWARD to not be user selectable.
> 
>  arch/arm/kernel/machine_kexec.c   | 23 ------------------
>  arch/arm64/Kconfig                |  1 +
>  arch/arm64/kernel/machine_kexec.c | 31 ------------------------
>  arch/powerpc/include/asm/kexec.h  |  1 -
>  arch/powerpc/kexec/core.c         | 22 -----------------
>  arch/powerpc/kexec/core_32.c      |  1 +
>  arch/riscv/kernel/machine_kexec.c | 23 ------------------
>  include/linux/irq.h               |  3 +++
>  kernel/irq/Kconfig                |  6 +++++
>  kernel/irq/Makefile               |  2 +-
>  kernel/irq/kexec.c                | 40 +++++++++++++++++++++++++++++++
>  11 files changed, 52 insertions(+), 101 deletions(-)
>  create mode 100644 kernel/irq/kexec.c
> 
> diff --git a/arch/arm/kernel/machine_kexec.c b/arch/arm/kernel/machine_kexec.c
> index 80ceb5bd2680..dd430477e7c1 100644
> --- a/arch/arm/kernel/machine_kexec.c
> +++ b/arch/arm/kernel/machine_kexec.c
> @@ -127,29 +127,6 @@ void crash_smp_send_stop(void)
>  	cpus_stopped = 1;
>  }
>  
> -static void machine_kexec_mask_interrupts(void)
> -{
> -	unsigned int i;
> -	struct irq_desc *desc;
> -
> -	for_each_irq_desc(i, desc) {
> -		struct irq_chip *chip;
> -
> -		chip = irq_desc_get_chip(desc);
> -		if (!chip)
> -			continue;
> -
> -		if (chip->irq_eoi && irqd_irq_inprogress(&desc->irq_data))
> -			chip->irq_eoi(&desc->irq_data);
> -
> -		if (chip->irq_mask)
> -			chip->irq_mask(&desc->irq_data);
> -
> -		if (chip->irq_disable && !irqd_irq_disabled(&desc->irq_data))
> -			chip->irq_disable(&desc->irq_data);
> -	}
> -}
> -
>  void machine_crash_shutdown(struct pt_regs *regs)
>  {
>  	local_irq_disable();
> diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
> index 100570a048c5..dcc3551cf6c2 100644
> --- a/arch/arm64/Kconfig
> +++ b/arch/arm64/Kconfig
> @@ -149,6 +149,7 @@ config ARM64
>  	select GENERIC_IDLE_POLL_SETUP
>  	select GENERIC_IOREMAP
>  	select GENERIC_IRQ_IPI
> +	select GENERIC_IRQ_KEXEC_CLEAR_VM_FORWARD

Is this really specific to VMs? In the new code, it's just controlling
this part of the old code:

> diff --git a/arch/arm64/kernel/machine_kexec.c b/arch/arm64/kernel/machine_kexec.c
> index 82e2203d86a3..6f121a0164a4 100644
> --- a/arch/arm64/kernel/machine_kexec.c
> +++ b/arch/arm64/kernel/machine_kexec.c
> @@ -207,37 +207,6 @@ void machine_kexec(struct kimage *kimage)
>  	BUG(); /* Should never get here. */
>  }
>  
> -static void machine_kexec_mask_interrupts(void)
> -{
> -	unsigned int i;
> -	struct irq_desc *desc;
> -
> -	for_each_irq_desc(i, desc) {
> -		struct irq_chip *chip;
> -		int ret;
> -
> -		chip = irq_desc_get_chip(desc);
> -		if (!chip)
> -			continue;
> -
> -		/*
> -		 * First try to remove the active state. If this
> -		 * fails, try to EOI the interrupt.
> -		 */
> -		ret = irq_set_irqchip_state(i, IRQCHIP_STATE_ACTIVE, false);

which is about active interrupts. Why can't that happen for the host?

Will

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ