ia64: replace setup_irq() by request_irq()
PATCH v3 1/1 ia64: replace setup_irq() by request_irq()
request_irq() is preferred over setup_irq(). Invocations of setup_irq() occur after memory allocators are ready.
Per tglx[1], setup_irq() existed in olden days when allocators were not ready by the time early interrupts were initialized.
Hence replace setup_irq() by request_irq().
[1] https://lkml.kernel.org/r/alpine.DEB.2.20.1710191609480.1971@nanos
---
Hi ia64 maintainers,
if okay w/ this change, please consider taking it thr' your tree, else please let me know.
Regards
afzal
Link to v2 & v1,
[v2] https://lkml.kernel.org/r/[email protected]
[v1] https://lkml.kernel.org/r/[email protected]
v3:
* Split out from tree wide series, as Thomas suggested to get it thr' respective maintainers
* Modify pr_err displayed in case of error
* Re-arrange code & choose pr_err args as required to improve readability
* Remove irrelevant parts from commit message & improve
v2:
* Replace pr_err("request_irq() on %s failed" by
pr_err("%s: request_irq() failed"* Commit message massage
arch/ia64/kernel/irq_ia64.c | 42 +++++++++++-------------------- arch/ia64/kernel/mca.c | 49 ++++++++++--------------------------- 2 files changed, 27 insertions(+), 64 deletions(-)
arch/ia64/kernel/irq_ia64.c +14 -28
@@ -351,11 +351,6 @@ static irqreturn_t smp_irq_move_cleanup_interrupt(int irq, void *dev_id)return IRQ_HANDLED ; } -static struct irqaction irq_move_irqaction = { - .handler = smp_irq_move_cleanup_interrupt, - .name ="irq_move" -}; -static int __init parse_vector_domain (char *arg) {if (!arg)
@@ -586,28 +581,15 @@ static irqreturn_t dummy_handler (int irq, void *dev_id) return IRQ_NONE; } -static struct irqaction ipi_irqaction = { - .handler = handle_IPI, - .name ="IPI" -}; -/* * KVM uses this interrupt to force a cpu out of guest mode */ -static struct irqaction resched_irqaction = { - .handler = dummy_handler, - .name ="resched" -}; - -static struct irqaction tlb_irqaction = { - .handler = dummy_handler, - .name ="tlb_flush" -};#endif void -ia64_native_register_percpu_irq (ia64_vector vec,struct irqaction *action) +ia64_native_register_percpu_irq (ia64_vector vec,const char *name, +irq_handler_t handler) {unsigned int irq;
@@ -615,8 +597,9 @@ ia64_native_register_percpu_irq (ia64_vector vec, struct irqaction *action)BUG_ON (bind_irq_vector (irq, vec,CPU_MASK_ALL ));irq_set_status_flags (irq,IRQ_PER_CPU );irq_set_chip (irq, &irq_type_ia64_lsapic); -if (action) -setup_irq (irq, action); +if (handler) +if (request_irq (irq, handler,0 , name,NULL )) +pr_err ("Failed to request irq %u (%s)\n" , irq, name);irq_set_handler (irq, handle_percpu_irq); }
@@ -624,9 +607,10 @@ void __initia64_native_register_ipi (void) {#ifdef CONFIG_SMP -register_percpu_irq (IA64_IPI_VECTOR , &ipi_irqaction); -register_percpu_irq (IA64_IPI_RESCHEDULE , &resched_irqaction); -register_percpu_irq (IA64_IPI_LOCAL_TLB_FLUSH , &tlb_irqaction); +register_percpu_irq (IA64_IPI_VECTOR ,"IPI" , handle_IPI); +register_percpu_irq (IA64_IPI_RESCHEDULE ,"resched" , dummy_handler); +register_percpu_irq (IA64_IPI_LOCAL_TLB_FLUSH ,"tlb_flush" , + dummy_handler);#endif }
@@ -635,10 +619,12 @@ init_IRQ (void) {acpi_boot_init ();ia64_register_ipi (); -register_percpu_irq (IA64_SPURIOUS_INT_VECTOR ,NULL ); +register_percpu_irq (IA64_SPURIOUS_INT_VECTOR ,NULL ,NULL );#ifdef CONFIG_SMP -if (vector_domain_type !=VECTOR_DOMAIN_NONE ) -register_percpu_irq (IA64_IRQ_MOVE_VECTOR , &irq_move_irqaction); +if (vector_domain_type !=VECTOR_DOMAIN_NONE ) { +register_percpu_irq (IA64_IRQ_MOVE_VECTOR ,"irq_move" , + smp_irq_move_cleanup_interrupt); + }#endif #ifdef CONFIG_PERFMON pfm_init_percpu ();
arch/ia64/kernel/mca.c +13 -36
74 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v4 1/1 ia64: replace setup_irq() by request_irq()
request_irq() is preferred over setup_irq(). Invocations of setup_irq() occur after memory allocators are ready.
Per tglx[1], setup_irq() existed in olden days when allocators were not ready by the time early interrupts were initialized.
Hence replace setup_irq() by request_irq().
Changing 'ia64_native_register_percpu_irq' decleration to include 'irq_handler_t' as an argument type in arch/ia64/include/asm/hw_irq.h was causing build error - 'unknown type name 'irq_handler_t''
This was due to below header file sequence,
+ include/interrupt.h
+ include/hardirq.h
+ asm/hardirq.h
+ include/irq.h
+ asm/hw_irq.h
[ 'ia64_native_register_percpu_irq' declared w/ 'irq_handler_t']
[ 'irq_handler_t' typedef'ed here in 'include/interrupt.h']
'register_percpu_irq' defined to 'ia64_native_register_percpu_irq' is the one invoked by the caller, not the latter directly. This was done to support paravirtualization which was removed around 4 years back. And 'register_percpu_irq' is invoked only inside 'arch/ia64/kernel'.
So 'register_percpu_irq' define to 'ia64_native_register_percpu_irq' is removed, instead 'ia64_native_register_percpu_irq' is renamed to 'register_precpu_irq()' & it is directly invoked. Also, 'register_precpu_irq()' is declared in a new header file 'irq.h' inside 'arch/ia64/kernel/', this header file is included by C files invoking 'register_percpu_irq()'.
[1] https://lkml.kernel.org/r/alpine.DEB.2.20.1710191609480.1971@nanos
---
Link to v3, v2 & v1,
[v3] https://lkml.kernel.org/r/[email protected]
[v2] https://lkml.kernel.org/r/[email protected]
[v1] https://lkml.kernel.org/r/[email protected]
v4:
* Fix build errors
* Include modifications to callers of 'register_percpu_irq()' at two instances left out (as it's signature changed)
v3:
* Split out from tree wide series, as Thomas suggested to get it thr' respective maintainers
* Modify pr_err displayed in case of error
* Re-arrange code & choose pr_err args as required to improve readability
* Remove irrelevant parts from commit message & improve
v2:
* Replace pr_err("request_irq() on %s failed" by
pr_err("%s: request_irq() failed"* Commit message massage
arch/ia64/include/asm/hw_irq.h | 2 -- arch/ia64/kernel/irq.h | 3 ++ arch/ia64/kernel/irq_ia64.c | 43 ++++++++++------------------- arch/ia64/kernel/mca.c | 50 ++++++++++------------------------ arch/ia64/kernel/perfmon.c | 10 +++---- arch/ia64/kernel/time.c | 11 ++------ 6 files changed, 39 insertions(+), 80 deletions(-) create mode 100644 arch/ia64/kernel/irq.h
arch/ia64/include/asm/hw_irq.h +0 -2
@@ -113,7 +113,6 @@ extern struct irq_chip irq_type_ia64_lsapic; /* CPU-internal interrupt controlle#define ia64_register_ipi ia64_native_register_ipi#define assign_irq_vector ia64_native_assign_irq_vector#define free_irq_vector ia64_native_free_irq_vector -#define register_percpu_irq ia64_native_register_percpu_irq#define ia64_resend_irq ia64_native_resend_irqextern void ia64_native_register_ipi (void );
@@ -123,7 +122,6 @@ extern void ia64_native_free_irq_vector (int vector);extern int reserve_irq_vector (int vector);extern void __setup_vector_irq (int cpu);extern void ia64_send_ipi (int cpu,int vector,int delivery_mode,int redirect); -extern void ia64_native_register_percpu_irq (ia64_vector vec,struct irqaction *action);extern void destroy_and_reserve_irq (unsigned int irq);#ifdef CONFIG_SMP
arch/ia64/kernel/irq.h new file +3 -0
@@ -0,0 +1,3 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +extern void register_percpu_irq (ia64_vector vec,irq_handler_t handler, +unsigned long flags,const char *name);
arch/ia64/kernel/irq_ia64.c +15 -28
81 lines not on this page · raw message
arch/ia64/kernel/mca.c +14 -36
81 lines not on this page · raw message
arch/ia64/kernel/perfmon.c +4 -6
@@ -57,6 +57,8 @@#include <linux/uaccess.h> #include <asm/delay.h> +#include "irq.h" +#ifdef CONFIG_PERFMON /* * perfmon context state
@@ -6313,11 +6315,6 @@ pfm_flush_pmds(struct task_struct *task, pfm_context_t *ctx) } } -static struct irqaction perfmon_irqaction = { - .handler = pfm_interrupt_handler, - .name ="perfmon" -}; -static void pfm_alt_save_pmu_state (void *data) {
@@ -6591,7 +6588,8 @@ pfm_init_percpu (void)pfm_unfreeze_pmu ();if (first_time) { -register_percpu_irq (IA64_PERFMON_VECTOR , &perfmon_irqaction); +register_percpu_irq (IA64_PERFMON_VECTOR , pfm_interrupt_handler, +0 ,"perfmon" ); first_time=0 ; }
arch/ia64/kernel/time.c +3 -8
@@ -32,6 +32,7 @@#include <asm/sections.h> #include "fsyscall_gtod_data.h" +#include "irq.h" static u64 itc_get_cycles (struct clocksource *cs);
@@ -380,13 +381,6 @@ static u64 itc_get_cycles(struct clocksource *cs)return now; } - -static struct irqaction timer_irqaction = { - .handler = timer_interrupt, - .flags =IRQF_IRQPOLL , - .name ="timer" -}; -void read_persistent_clock64 (struct timespec64 *ts) {efi_gettimeofday (ts);
@@ -395,7 +389,8 @@ void read_persistent_clock64(struct timespec64 *ts)void __init time_init (void ) { -register_percpu_irq (IA64_TIMER_VECTOR , &timer_irqaction); +register_percpu_irq (IA64_TIMER_VECTOR , timer_interrupt,IRQF_IRQPOLL , +"timer" );ia64_init_itm (); }
Signature · 1 line
2.18.0
Hi Tony Luck,
Quoted 33 lines · afzal mohammed
request_irq()is preferred oversetup_irq(). Invocations ofsetup_irq()occur after memory allocators are ready.Per tglx[1],
setup_irq()existed in olden days when allocators were not ready by the time early interrupts were initialized.Hence replace
setup_irq()byrequest_irq().Changing '
ia64_native_register_percpu_irq' decleration to include 'irq_handler_t' as an argument type inarch/ia64/include/asm/hw_irq.hwas causing build error - 'unknown type name 'irq_handler_t''This was due to below header file sequence,
+include/interrupt.h
+include/hardirq.h
+asm/hardirq.h
+include/irq.h
+asm/hw_irq.h
[ 'ia64_native_register_percpu_irq' declared w/ 'irq_handler_t']
[ 'irq_handler_t' typedef'ed here in 'include/interrupt.h']'
register_percpu_irq' defined to 'ia64_native_register_percpu_irq' is the one invoked by the caller, not the latter directly. This was done to support paravirtualization which was removed around 4 years back. And 'register_percpu_irq' is invoked only inside 'arch/ia64/kernel'.So '
register_percpu_irq' define to 'ia64_native_register_percpu_irq' is removed, instead 'ia64_native_register_percpu_irq' is renamed to 'register_precpu_irq()' & it is directly invoked. Also, 'register_precpu_irq()' is declared in a new header file 'irq.h' inside 'arch/ia64/kernel/', this header file is included by C files invoking 'register_percpu_irq()'.
Quoted 3 lines
[1] https://lkml.kernel.org/r/alpine.DEB.2.20.1710191609480.1971@nanos
Signed-off-by afzal mohammed <[email protected]>
Seems you handle pull requests for ia64, if this change is okay, can please consider taking this thr' your tree ?
Regards
afzal
Quoted 2 lines
Seems you handle pull requests for ia64, if this change is okay, can please consider taking this thr' your tree ?
Looks ok. Will apply.
-Tony