* [PATCH v3 0/2] Improve interrupt handling during machine kexec
@ 2024-11-28 20:10 Eliav Farber
2024-11-28 20:10 ` [PATCH v3 1/2] kexec: Consolidate machine_kexec_mask_interrupts() implementation Eliav Farber
2024-11-28 20:10 ` [PATCH v3 2/2] kexec: Prevent redundant IRQ masking by checking state before shutdown Eliav Farber
0 siblings, 2 replies; 6+ messages in thread
From: Eliav Farber @ 2024-11-28 20:10 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 v3 1/2] Move machine_kexec_mask_interrupts() to kexec_core.c,
removing duplicate architecture-specific implementations.
[PATCH v3 2/2] Refine machine_kexec_mask_interrupts() to avoid re-masking
already-masked interrupts, resolving specific warnings
triggered in GPIO IRQ flows.
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 | 28 ++++++++++++++++++++++++++++
9 files changed, 33 insertions(+), 101 deletions(-)
--
2.40.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v3 1/2] kexec: Consolidate machine_kexec_mask_interrupts() implementation
2024-11-28 20:10 [PATCH v3 0/2] Improve interrupt handling during machine kexec Eliav Farber
@ 2024-11-28 20:10 ` Eliav Farber
2024-11-29 2:46 ` kernel test robot
2024-11-29 4:30 ` kernel test robot
2024-11-28 20:10 ` [PATCH v3 2/2] kexec: Prevent redundant IRQ masking by checking state before shutdown Eliav Farber
1 sibling, 2 replies; 6+ messages in thread
From: Eliav Farber @ 2024-11-28 20:10 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
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).
This consolidation reduces code duplication and improves maintainability.
The unified function includes an architecture-specific behavior for
CONFIG_ARM64 by conditionally clearing the active interrupt state before
handling other interrupt masking operations.
Signed-off-by: Eliav Farber <farbere@amazon.com>
---
V2 -> V3: This patch is new and didn't exist in V2.
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/kexec.h | 2 ++
kernel/kexec_core.c | 32 +++++++++++++++++++++++++++++++
7 files changed, 34 insertions(+), 100 deletions(-)
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/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);
-
- if (ret && irqd_irq_inprogress(&desc->irq_data) &&
- chip->irq_eoi)
- 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);
- }
-}
-
/**
* machine_crash_shutdown - shutdown non-crashing cpus and save registers
*/
diff --git a/arch/powerpc/include/asm/kexec.h b/arch/powerpc/include/asm/kexec.h
index 270ee93a0f7d..601e569303e1 100644
--- a/arch/powerpc/include/asm/kexec.h
+++ b/arch/powerpc/include/asm/kexec.h
@@ -61,7 +61,6 @@ struct pt_regs;
extern void kexec_smp_wait(void); /* get and clear naca physid, wait for
master to copy new code to 0 */
extern void default_machine_kexec(struct kimage *image);
-extern void machine_kexec_mask_interrupts(void);
void relocate_new_kernel(unsigned long indirection_page, unsigned long reboot_code_buffer,
unsigned long start_address) __noreturn;
diff --git a/arch/powerpc/kexec/core.c b/arch/powerpc/kexec/core.c
index b8333a49ea5d..58a930a47422 100644
--- a/arch/powerpc/kexec/core.c
+++ b/arch/powerpc/kexec/core.c
@@ -22,28 +22,6 @@
#include <asm/setup.h>
#include <asm/firmware.h>
-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);
- }
-}
-
#ifdef CONFIG_CRASH_DUMP
void machine_crash_shutdown(struct pt_regs *regs)
{
diff --git a/arch/riscv/kernel/machine_kexec.c b/arch/riscv/kernel/machine_kexec.c
index 3c830a6f7ef4..2306ce3e5f22 100644
--- a/arch/riscv/kernel/machine_kexec.c
+++ b/arch/riscv/kernel/machine_kexec.c
@@ -114,29 +114,6 @@ void machine_shutdown(void)
#endif
}
-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);
- }
-}
-
/*
* machine_crash_shutdown - Prepare to kexec after a kernel crash
*
diff --git a/include/linux/kexec.h b/include/linux/kexec.h
index f0e9f8eda7a3..9dac0524c0be 100644
--- a/include/linux/kexec.h
+++ b/include/linux/kexec.h
@@ -375,6 +375,8 @@ extern void machine_kexec(struct kimage *image);
extern int machine_kexec_prepare(struct kimage *image);
extern void machine_kexec_cleanup(struct kimage *image);
extern int kernel_kexec(void);
+extern void machine_kexec_mask_interrupts(void);
+
extern struct page *kimage_alloc_control_pages(struct kimage *image,
unsigned int order);
diff --git a/kernel/kexec_core.c b/kernel/kexec_core.c
index c0caa14880c3..6e1e420946e0 100644
--- a/kernel/kexec_core.c
+++ b/kernel/kexec_core.c
@@ -1072,3 +1072,35 @@ int kernel_kexec(void)
kexec_unlock();
return error;
}
+
+void machine_kexec_mask_interrupts(void)
+{
+ unsigned int i;
+ struct irq_desc *desc;
+
+ 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)) {
+ /*
+ * First try to remove the active state. If this fails, try to EOI the
+ * interrupt.
+ */
+ check_eoi = irq_set_irqchip_state(i, IRQCHIP_STATE_ACTIVE, false);
+ }
+
+ if (check_eoi && 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);
+ }
+}
--
2.40.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v3 2/2] kexec: Prevent redundant IRQ masking by checking state before shutdown
2024-11-28 20:10 [PATCH v3 0/2] Improve interrupt handling during machine kexec Eliav Farber
2024-11-28 20:10 ` [PATCH v3 1/2] kexec: Consolidate machine_kexec_mask_interrupts() implementation Eliav Farber
@ 2024-11-28 20:10 ` Eliav Farber
2024-11-29 4:42 ` kernel test robot
1 sibling, 1 reply; 6+ messages in thread
From: Eliav Farber @ 2024-11-28 20:10 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
During machine kexec, the function machine_kexec_mask_interrupts() is
responsible for disabling or masking all interrupts. While the irq_disable
hook ensures that an already-disabled IRQ is not disabled again, the
current implementation unconditionally invokes the irq_mask() function for
every interrupt descriptor, even when the interrupt is already masked.
A specific issue was observed in the crash kernel flow after unbinding a
device (prior to kexec) that used a GPIO as an IRQ source. The warning was
triggered by the gpiochip_disable_irq() function, which attempted to clear
the FLAG_IRQ_IS_ENABLED flag when FLAG_USED_AS_IRQ was not set:
```
void gpiochip_disable_irq(struct gpio_chip *gc, unsigned int offset)
{
struct gpio_desc *desc = gpiochip_get_desc(gc, offset);
if (!IS_ERR(desc) &&
!WARN_ON(!test_bit(FLAG_USED_AS_IRQ, &desc->flags)))
clear_bit(FLAG_IRQ_IS_ENABLED, &desc->flags);
}
```
This issue surfaced after commit a8173820f441 ("gpio: gpiolib: Allow GPIO
IRQs to lazy disable") introduced lazy disablement for GPIO IRQs. It
replaced disable/enable hooks with mask/unmask hooks. Unlike the disable
hook, the mask hook doesn't handle already-masked IRQs.
When a GPIO-IRQ driver is unbound, the IRQ is released, triggering
__irq_disable() and irq_state_set_masked(). A subsequent call to
machine_kexec_mask_interrupts() re-invokes chip->irq_mask(). This results
in a call chain, including gpiochip_irq_mask() and gpiochip_disable_irq().
Since FLAG_USED_AS_IRQ was cleared earlier, a warning occurs.
This patch addresses the issue by:
- Replacing the calls to irq_mask() and irq_disable() hooks with a
simplified call to irq_shutdown().
- Checking if the interrupt is started (irqd_is_started) before calling
the shutdown.
As part of this change, the irq_shutdown() declaration was moved from
kernel/irq/internals.h to include/linux/irq.h to make it accessible
outside the kernel/irq/ directory, as the former can only be included
within that directory.
Signed-off-by: Eliav Farber <farbere@amazon.com>
---
V2 -> V3:
- Check if IRQ is started using irqd_is_started().
- Use irq_shutdown() instead of irq_disable().
include/linux/irq.h | 3 +++
kernel/irq/internals.h | 1 -
kernel/kexec_core.c | 8 ++------
3 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/include/linux/irq.h b/include/linux/irq.h
index fa711f80957b..48a3df728c47 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -694,6 +694,9 @@ extern int irq_chip_request_resources_parent(struct irq_data *data);
extern void irq_chip_release_resources_parent(struct irq_data *data);
#endif
+/* Shut down the interrupt */
+extern void irq_shutdown(struct irq_desc *desc);
+
/* Handling of unhandled and spurious interrupts: */
extern void note_interrupt(struct irq_desc *desc, irqreturn_t action_ret);
diff --git a/kernel/irq/internals.h b/kernel/irq/internals.h
index fe0272cd84a5..1f9287b1ccb7 100644
--- a/kernel/irq/internals.h
+++ b/kernel/irq/internals.h
@@ -88,7 +88,6 @@ extern int irq_activate(struct irq_desc *desc);
extern int irq_activate_and_startup(struct irq_desc *desc, bool resend);
extern int irq_startup(struct irq_desc *desc, bool resend, bool force);
-extern void irq_shutdown(struct irq_desc *desc);
extern void irq_shutdown_and_deactivate(struct irq_desc *desc);
extern void irq_enable(struct irq_desc *desc);
extern void irq_disable(struct irq_desc *desc);
diff --git a/kernel/kexec_core.c b/kernel/kexec_core.c
index 6e1e420946e0..928b4387502b 100644
--- a/kernel/kexec_core.c
+++ b/kernel/kexec_core.c
@@ -1083,7 +1083,7 @@ void machine_kexec_mask_interrupts(void)
int check_eoi = 1;
chip = irq_desc_get_chip(desc);
- if (!chip)
+ if (!chip || !irqd_is_started(&desc->irq_data))
continue;
if (IS_ENABLED(CONFIG_ARM64)) {
@@ -1097,10 +1097,6 @@ void machine_kexec_mask_interrupts(void)
if (check_eoi && 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);
+ irq_shutdown(desc);
}
}
--
2.40.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v3 1/2] kexec: Consolidate machine_kexec_mask_interrupts() implementation
2024-11-28 20:10 ` [PATCH v3 1/2] kexec: Consolidate machine_kexec_mask_interrupts() implementation Eliav Farber
@ 2024-11-29 2:46 ` kernel test robot
2024-11-29 4:30 ` kernel test robot
1 sibling, 0 replies; 6+ messages in thread
From: kernel test robot @ 2024-11-29 2:46 UTC (permalink / raw)
To: Eliav Farber, linux, catalin.marinas, will, mpe, npiggin,
christophe.leroy, naveen, maddy, paul.walmsley, palmer, aou, tglx,
ebiederm, akpm, bhe, hbathini, sourabhjain, adityag,
songshuaishuai, takakura, linux-arm-kernel, linux-kernel,
linuxppc-dev, linux-riscv, kexec
Cc: oe-kbuild-all, jonnyc
Hi Eliav,
kernel test robot noticed the following build errors:
[auto build test ERROR on powerpc/next]
[also build test ERROR on powerpc/fixes tip/irq/core arm64/for-next/core linus/master v6.12 next-20241128]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Eliav-Farber/kexec-Consolidate-machine_kexec_mask_interrupts-implementation/20241129-041259
base: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next
patch link: https://lore.kernel.org/r/20241128201027.10396-2-farbere%40amazon.com
patch subject: [PATCH v3 1/2] kexec: Consolidate machine_kexec_mask_interrupts() implementation
config: x86_64-rhel-9.4 (https://download.01.org/0day-ci/archive/20241129/202411291047.R9P698b2-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241129/202411291047.R9P698b2-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202411291047.R9P698b2-lkp@intel.com/
All error/warnings (new ones prefixed by >>):
kernel/kexec_core.c: In function 'machine_kexec_mask_interrupts':
>> kernel/kexec_core.c:1085:24: error: implicit declaration of function 'irq_desc_get_chip' [-Werror=implicit-function-declaration]
1085 | chip = irq_desc_get_chip(desc);
| ^~~~~~~~~~~~~~~~~
>> kernel/kexec_core.c:1085:22: warning: assignment to 'struct irq_chip *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
1085 | chip = irq_desc_get_chip(desc);
| ^
>> kernel/kexec_core.c:1097:38: error: invalid use of undefined type 'struct irq_chip'
1097 | if (check_eoi && chip->irq_eoi && irqd_irq_inprogress(&desc->irq_data))
| ^~
>> kernel/kexec_core.c:1097:51: error: implicit declaration of function 'irqd_irq_inprogress' [-Werror=implicit-function-declaration]
1097 | if (check_eoi && chip->irq_eoi && irqd_irq_inprogress(&desc->irq_data))
| ^~~~~~~~~~~~~~~~~~~
>> kernel/kexec_core.c:1097:76: error: invalid use of undefined type 'struct irq_desc'
1097 | if (check_eoi && chip->irq_eoi && irqd_irq_inprogress(&desc->irq_data))
| ^~
kernel/kexec_core.c:1098:29: error: invalid use of undefined type 'struct irq_chip'
1098 | chip->irq_eoi(&desc->irq_data);
| ^~
kernel/kexec_core.c:1098:44: error: invalid use of undefined type 'struct irq_desc'
1098 | chip->irq_eoi(&desc->irq_data);
| ^~
kernel/kexec_core.c:1100:25: error: invalid use of undefined type 'struct irq_chip'
1100 | if (chip->irq_mask)
| ^~
kernel/kexec_core.c:1101:29: error: invalid use of undefined type 'struct irq_chip'
1101 | chip->irq_mask(&desc->irq_data);
| ^~
kernel/kexec_core.c:1101:45: error: invalid use of undefined type 'struct irq_desc'
1101 | chip->irq_mask(&desc->irq_data);
| ^~
kernel/kexec_core.c:1103:25: error: invalid use of undefined type 'struct irq_chip'
1103 | if (chip->irq_disable && !irqd_irq_disabled(&desc->irq_data))
| ^~
kernel/kexec_core.c:1103:43: error: implicit declaration of function 'irqd_irq_disabled'; did you mean 'arch_irqs_disabled'? [-Werror=implicit-function-declaration]
1103 | if (chip->irq_disable && !irqd_irq_disabled(&desc->irq_data))
| ^~~~~~~~~~~~~~~~~
| arch_irqs_disabled
kernel/kexec_core.c:1103:66: error: invalid use of undefined type 'struct irq_desc'
1103 | if (chip->irq_disable && !irqd_irq_disabled(&desc->irq_data))
| ^~
kernel/kexec_core.c:1104:29: error: invalid use of undefined type 'struct irq_chip'
1104 | chip->irq_disable(&desc->irq_data);
| ^~
kernel/kexec_core.c:1104:48: error: invalid use of undefined type 'struct irq_desc'
1104 | chip->irq_disable(&desc->irq_data);
| ^~
cc1: some warnings being treated as errors
vim +/irq_desc_get_chip +1085 kernel/kexec_core.c
1075
1076 void machine_kexec_mask_interrupts(void)
1077 {
1078 unsigned int i;
1079 struct irq_desc *desc;
1080
1081 for_each_irq_desc(i, desc) {
1082 struct irq_chip *chip;
1083 int check_eoi = 1;
1084
> 1085 chip = irq_desc_get_chip(desc);
1086 if (!chip)
1087 continue;
1088
1089 if (IS_ENABLED(CONFIG_ARM64)) {
1090 /*
1091 * First try to remove the active state. If this fails, try to EOI the
1092 * interrupt.
1093 */
1094 check_eoi = irq_set_irqchip_state(i, IRQCHIP_STATE_ACTIVE, false);
1095 }
1096
> 1097 if (check_eoi && chip->irq_eoi && irqd_irq_inprogress(&desc->irq_data))
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v3 1/2] kexec: Consolidate machine_kexec_mask_interrupts() implementation
2024-11-28 20:10 ` [PATCH v3 1/2] kexec: Consolidate machine_kexec_mask_interrupts() implementation Eliav Farber
2024-11-29 2:46 ` kernel test robot
@ 2024-11-29 4:30 ` kernel test robot
1 sibling, 0 replies; 6+ messages in thread
From: kernel test robot @ 2024-11-29 4:30 UTC (permalink / raw)
To: Eliav Farber, linux, catalin.marinas, will, mpe, npiggin,
christophe.leroy, naveen, maddy, paul.walmsley, palmer, aou, tglx,
ebiederm, akpm, bhe, hbathini, sourabhjain, adityag,
songshuaishuai, takakura, linux-arm-kernel, linux-kernel,
linuxppc-dev, linux-riscv, kexec
Cc: llvm, oe-kbuild-all, jonnyc
Hi Eliav,
kernel test robot noticed the following build errors:
[auto build test ERROR on powerpc/next]
[also build test ERROR on powerpc/fixes tip/irq/core arm64/for-next/core linus/master v6.12 next-20241128]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Eliav-Farber/kexec-Consolidate-machine_kexec_mask_interrupts-implementation/20241129-041259
base: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next
patch link: https://lore.kernel.org/r/20241128201027.10396-2-farbere%40amazon.com
patch subject: [PATCH v3 1/2] kexec: Consolidate machine_kexec_mask_interrupts() implementation
config: x86_64-kexec (https://download.01.org/0day-ci/archive/20241129/202411291225.18ZMjZcQ-lkp@intel.com/config)
compiler: clang version 19.1.3 (https://github.com/llvm/llvm-project ab51eccf88f5321e7c60591c5546b254b6afab99)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241129/202411291225.18ZMjZcQ-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202411291225.18ZMjZcQ-lkp@intel.com/
All errors (new ones prefixed by >>):
In file included from kernel/kexec_core.c:9:
In file included from include/linux/btf.h:8:
In file included from include/linux/bpfptr.h:6:
In file included from include/linux/mm.h:2223:
include/linux/vmstat.h:504:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
504 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
505 | item];
| ~~~~
include/linux/vmstat.h:511:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
511 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
512 | NR_VM_NUMA_EVENT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~~
include/linux/vmstat.h:518:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
518 | return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
| ~~~~~~~~~~~ ^ ~~~
include/linux/vmstat.h:524:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
524 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
525 | NR_VM_NUMA_EVENT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~~
>> kernel/kexec_core.c:1085:10: error: call to undeclared function 'irq_desc_get_chip'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
1085 | chip = irq_desc_get_chip(desc);
| ^
>> kernel/kexec_core.c:1085:8: error: incompatible integer to pointer conversion assigning to 'struct irq_chip *' from 'int' [-Wint-conversion]
1085 | chip = irq_desc_get_chip(desc);
| ^ ~~~~~~~~~~~~~~~~~~~~~~~
>> kernel/kexec_core.c:1097:24: error: incomplete definition of type 'struct irq_chip'
1097 | if (check_eoi && chip->irq_eoi && irqd_irq_inprogress(&desc->irq_data))
| ~~~~^
kernel/kexec_core.c:1082:10: note: forward declaration of 'struct irq_chip'
1082 | struct irq_chip *chip;
| ^
>> kernel/kexec_core.c:1097:37: error: call to undeclared function 'irqd_irq_inprogress'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
1097 | if (check_eoi && chip->irq_eoi && irqd_irq_inprogress(&desc->irq_data))
| ^
>> kernel/kexec_core.c:1097:62: error: incomplete definition of type 'struct irq_desc'
1097 | if (check_eoi && chip->irq_eoi && irqd_irq_inprogress(&desc->irq_data))
| ~~~~^
include/linux/irqnr.h:10:15: note: forward declaration of 'struct irq_desc'
10 | extern struct irq_desc *irq_to_desc(unsigned int irq);
| ^
kernel/kexec_core.c:1098:8: error: incomplete definition of type 'struct irq_chip'
1098 | chip->irq_eoi(&desc->irq_data);
| ~~~~^
kernel/kexec_core.c:1082:10: note: forward declaration of 'struct irq_chip'
1082 | struct irq_chip *chip;
| ^
kernel/kexec_core.c:1098:23: error: incomplete definition of type 'struct irq_desc'
1098 | chip->irq_eoi(&desc->irq_data);
| ~~~~^
include/linux/irqnr.h:10:15: note: forward declaration of 'struct irq_desc'
10 | extern struct irq_desc *irq_to_desc(unsigned int irq);
| ^
kernel/kexec_core.c:1100:11: error: incomplete definition of type 'struct irq_chip'
1100 | if (chip->irq_mask)
| ~~~~^
kernel/kexec_core.c:1082:10: note: forward declaration of 'struct irq_chip'
1082 | struct irq_chip *chip;
| ^
kernel/kexec_core.c:1101:8: error: incomplete definition of type 'struct irq_chip'
1101 | chip->irq_mask(&desc->irq_data);
| ~~~~^
kernel/kexec_core.c:1082:10: note: forward declaration of 'struct irq_chip'
1082 | struct irq_chip *chip;
| ^
kernel/kexec_core.c:1101:24: error: incomplete definition of type 'struct irq_desc'
1101 | chip->irq_mask(&desc->irq_data);
| ~~~~^
include/linux/irqnr.h:10:15: note: forward declaration of 'struct irq_desc'
10 | extern struct irq_desc *irq_to_desc(unsigned int irq);
| ^
kernel/kexec_core.c:1103:11: error: incomplete definition of type 'struct irq_chip'
1103 | if (chip->irq_disable && !irqd_irq_disabled(&desc->irq_data))
| ~~~~^
kernel/kexec_core.c:1082:10: note: forward declaration of 'struct irq_chip'
1082 | struct irq_chip *chip;
| ^
kernel/kexec_core.c:1103:29: error: call to undeclared function 'irqd_irq_disabled'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
1103 | if (chip->irq_disable && !irqd_irq_disabled(&desc->irq_data))
| ^
kernel/kexec_core.c:1103:29: note: did you mean 'arch_irqs_disabled'?
arch/x86/include/asm/irqflags.h:145:28: note: 'arch_irqs_disabled' declared here
145 | static __always_inline int arch_irqs_disabled(void)
| ^
kernel/kexec_core.c:1103:52: error: incomplete definition of type 'struct irq_desc'
1103 | if (chip->irq_disable && !irqd_irq_disabled(&desc->irq_data))
| ~~~~^
include/linux/irqnr.h:10:15: note: forward declaration of 'struct irq_desc'
10 | extern struct irq_desc *irq_to_desc(unsigned int irq);
| ^
kernel/kexec_core.c:1104:8: error: incomplete definition of type 'struct irq_chip'
1104 | chip->irq_disable(&desc->irq_data);
| ~~~~^
kernel/kexec_core.c:1082:10: note: forward declaration of 'struct irq_chip'
1082 | struct irq_chip *chip;
| ^
kernel/kexec_core.c:1104:27: error: incomplete definition of type 'struct irq_desc'
1104 | chip->irq_disable(&desc->irq_data);
| ~~~~^
include/linux/irqnr.h:10:15: note: forward declaration of 'struct irq_desc'
10 | extern struct irq_desc *irq_to_desc(unsigned int irq);
| ^
4 warnings and 15 errors generated.
vim +/irq_desc_get_chip +1085 kernel/kexec_core.c
1075
1076 void machine_kexec_mask_interrupts(void)
1077 {
1078 unsigned int i;
1079 struct irq_desc *desc;
1080
1081 for_each_irq_desc(i, desc) {
1082 struct irq_chip *chip;
1083 int check_eoi = 1;
1084
> 1085 chip = irq_desc_get_chip(desc);
1086 if (!chip)
1087 continue;
1088
1089 if (IS_ENABLED(CONFIG_ARM64)) {
1090 /*
1091 * First try to remove the active state. If this fails, try to EOI the
1092 * interrupt.
1093 */
1094 check_eoi = irq_set_irqchip_state(i, IRQCHIP_STATE_ACTIVE, false);
1095 }
1096
> 1097 if (check_eoi && chip->irq_eoi && irqd_irq_inprogress(&desc->irq_data))
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v3 2/2] kexec: Prevent redundant IRQ masking by checking state before shutdown
2024-11-28 20:10 ` [PATCH v3 2/2] kexec: Prevent redundant IRQ masking by checking state before shutdown Eliav Farber
@ 2024-11-29 4:42 ` kernel test robot
0 siblings, 0 replies; 6+ messages in thread
From: kernel test robot @ 2024-11-29 4:42 UTC (permalink / raw)
To: Eliav Farber, linux, catalin.marinas, will, mpe, npiggin,
christophe.leroy, naveen, maddy, paul.walmsley, palmer, aou, tglx,
ebiederm, akpm, bhe, hbathini, sourabhjain, adityag,
songshuaishuai, takakura, linux-arm-kernel, linux-kernel,
linuxppc-dev, linux-riscv, kexec
Cc: oe-kbuild-all, jonnyc
Hi Eliav,
kernel test robot noticed the following build errors:
[auto build test ERROR on powerpc/next]
[also build test ERROR on powerpc/fixes tip/irq/core arm64/for-next/core linus/master v6.12 next-20241128]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Eliav-Farber/kexec-Consolidate-machine_kexec_mask_interrupts-implementation/20241129-041259
base: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next
patch link: https://lore.kernel.org/r/20241128201027.10396-3-farbere%40amazon.com
patch subject: [PATCH v3 2/2] kexec: Prevent redundant IRQ masking by checking state before shutdown
config: x86_64-rhel-9.4 (https://download.01.org/0day-ci/archive/20241129/202411291251.RwA1dKZL-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241129/202411291251.RwA1dKZL-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202411291251.RwA1dKZL-lkp@intel.com/
All errors (new ones prefixed by >>):
kernel/kexec_core.c: In function 'machine_kexec_mask_interrupts':
kernel/kexec_core.c:1085:24: error: implicit declaration of function 'irq_desc_get_chip' [-Werror=implicit-function-declaration]
1085 | chip = irq_desc_get_chip(desc);
| ^~~~~~~~~~~~~~~~~
kernel/kexec_core.c:1085:22: warning: assignment to 'struct irq_chip *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
1085 | chip = irq_desc_get_chip(desc);
| ^
>> kernel/kexec_core.c:1086:31: error: implicit declaration of function 'irqd_is_started' [-Werror=implicit-function-declaration]
1086 | if (!chip || !irqd_is_started(&desc->irq_data))
| ^~~~~~~~~~~~~~~
kernel/kexec_core.c:1086:52: error: invalid use of undefined type 'struct irq_desc'
1086 | if (!chip || !irqd_is_started(&desc->irq_data))
| ^~
kernel/kexec_core.c:1097:38: error: invalid use of undefined type 'struct irq_chip'
1097 | if (check_eoi && chip->irq_eoi && irqd_irq_inprogress(&desc->irq_data))
| ^~
kernel/kexec_core.c:1097:51: error: implicit declaration of function 'irqd_irq_inprogress' [-Werror=implicit-function-declaration]
1097 | if (check_eoi && chip->irq_eoi && irqd_irq_inprogress(&desc->irq_data))
| ^~~~~~~~~~~~~~~~~~~
kernel/kexec_core.c:1097:76: error: invalid use of undefined type 'struct irq_desc'
1097 | if (check_eoi && chip->irq_eoi && irqd_irq_inprogress(&desc->irq_data))
| ^~
kernel/kexec_core.c:1098:29: error: invalid use of undefined type 'struct irq_chip'
1098 | chip->irq_eoi(&desc->irq_data);
| ^~
kernel/kexec_core.c:1098:44: error: invalid use of undefined type 'struct irq_desc'
1098 | chip->irq_eoi(&desc->irq_data);
| ^~
>> kernel/kexec_core.c:1100:17: error: implicit declaration of function 'irq_shutdown'; did you mean 'timer_shutdown'? [-Werror=implicit-function-declaration]
1100 | irq_shutdown(desc);
| ^~~~~~~~~~~~
| timer_shutdown
cc1: some warnings being treated as errors
vim +/irqd_is_started +1086 kernel/kexec_core.c
1075
1076 void machine_kexec_mask_interrupts(void)
1077 {
1078 unsigned int i;
1079 struct irq_desc *desc;
1080
1081 for_each_irq_desc(i, desc) {
1082 struct irq_chip *chip;
1083 int check_eoi = 1;
1084
1085 chip = irq_desc_get_chip(desc);
> 1086 if (!chip || !irqd_is_started(&desc->irq_data))
1087 continue;
1088
1089 if (IS_ENABLED(CONFIG_ARM64)) {
1090 /*
1091 * First try to remove the active state. If this fails, try to EOI the
1092 * interrupt.
1093 */
1094 check_eoi = irq_set_irqchip_state(i, IRQCHIP_STATE_ACTIVE, false);
1095 }
1096
1097 if (check_eoi && chip->irq_eoi && irqd_irq_inprogress(&desc->irq_data))
1098 chip->irq_eoi(&desc->irq_data);
1099
> 1100 irq_shutdown(desc);
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-11-29 4:43 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-28 20:10 [PATCH v3 0/2] Improve interrupt handling during machine kexec Eliav Farber
2024-11-28 20:10 ` [PATCH v3 1/2] kexec: Consolidate machine_kexec_mask_interrupts() implementation Eliav Farber
2024-11-29 2:46 ` kernel test robot
2024-11-29 4:30 ` kernel test robot
2024-11-28 20:10 ` [PATCH v3 2/2] kexec: Prevent redundant IRQ masking by checking state before shutdown Eliav Farber
2024-11-29 4:42 ` kernel test robot
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).