ipipe-noarch: IRQ tracing, enabling, and lockdep fixes/cleanups
Subsystems (3)
v2 cover ipipe-noarch: IRQ tracing, enabling, and lockdep fixes/cleanups
This included the patches from v1, the addition (patch 3), and the new patches needed to add return codes and irq enabling to some services.
Jan
Jan Kiszka (6):
ipipe: Restore trace_hardirqs_on_virt_caller
ipipe: lockdep: Remove duplicate context checks
ipipe: Add missing include for ipipe_root_only
ipipe: Let ipipe_enable_irq return an error code
ipipe: Activate IRQ in ipipe_enable_irq
ipipe: Let ipipe_set_irq_affinity return an error
include/linux/ipipe.h | 6 +++--- include/linux/kernel.h | 1 + kernel/irq/chip.c | 17 ++++++++++++----- kernel/locking/lockdep.c | 6 ------ kernel/trace/trace_preemptirq.c | 11 +++++++++++ 5 files changed, 27 insertions(+), 14 deletions(-)
Signature · 1 line
2.16.4
PATCH v2 1/6 ipipe: Restore trace_hardirqs_on_virt_caller
From: Jan Kiszka <[email protected]>
Lost in d7fc2c06edc9 ("lockdep: ipipe: exclude the head stage from IRQ state tracing") but still needed by x86 at least.
--- kernel/trace/trace_preemptirq.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
kernel/trace/trace_preemptirq.c +11 -0
@@ -66,6 +66,17 @@ __visible void trace_hardirqs_on_caller(unsigned long caller_addr) }EXPORT_SYMBOL (trace_hardirqs_on_caller); +__visible void trace_hardirqs_on_virt_caller(unsigned long ip) +{ +/* +* The IRQ tracing logic only applies to the root domain, and +* must consider the virtual disable flag exclusively when +* leaving an interrupt/fault context. +*/ +if (ipipe_root_p && !irqs_disabled ()) +trace_hardirqs_on_caller (ip); +} + __visible void trace_hardirqs_on_virt(void) {/*
Signature · 1 line
2.16.4
PATCH v2 2/6 ipipe: lockdep: Remove duplicate context checks
In reply to Jan KiszkaFrom: Jan Kiszka <[email protected]>
All callers of lockdep_hardirqs_on/off already filter out !ipipe_root_p.
--- kernel/locking/lockdep.c | 6 ------ 1 file changed, 6 deletions(-)
kernel/locking/lockdep.c +0 -6
@@ -2841,9 +2841,6 @@ static void __trace_hardirqs_on_caller(unsigned long ip)void lockdep_hardirqs_on (unsigned long ip) { -if (!ipipe_root_p) -return ; -if (unlikely (!debug_locks || current->lockdep_recursion))return ;
@@ -2890,9 +2887,6 @@ void lockdep_hardirqs_off(unsigned long ip) {struct task_struct *curr; -if (!ipipe_root_p) -return ; - curr = current;if (unlikely (!debug_locks || current->lockdep_recursion))
Signature · 1 line
2.16.4
PATCH v2 3/6 ipipe: Add missing include for ipipe_root_only
In reply to Jan KiszkaFrom: Jan Kiszka <[email protected]>
Breaks in non-debug builds otherwise, e.g.
https://travis-ci.com/xenomai-ci/xenomai/jobs/212725223
--- include/linux/kernel.h | 1 + 1 file changed, 1 insertion(+)
include/linux/kernel.h +1 -0
@@ -14,6 +14,7 @@#include <linux/printk.h> #include <linux/build_bug.h> #include <asm/byteorder.h> +#include <asm-generic/ipipe.h> #include <uapi/linux/kernel.h> #define USHRT_MAX ((u16)(~0U))
Signature · 1 line
2.16.4
PATCH v2 4/6 ipipe: Let ipipe_enable_irq return an error code
In reply to Jan KiszkaFrom: Jan Kiszka <[email protected]>
It's time to let ipipe_enable_irq return a proper error as it will gain another function that may fail. Drop the WARN_ON_ONCE in favor of that.
--- include/linux/ipipe.h | 2 +- kernel/irq/chip.c | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-)
include/linux/ipipe.h +1 -1
@@ -475,7 +475,7 @@ static inline struct ipipe_threadinfo *ipipe_current_threadinfo(void)#define ipipe_task_threadinfo (p) (&task_thread_info(p)->ipipe_data) -void ipipe_enable_irq (unsigned int irq); +int ipipe_enable_irq (unsigned int irq);static inline void ipipe_disable_irq (unsigned int irq) {
kernel/irq/chip.c +7 -5
@@ -1082,7 +1082,7 @@ __fixup_irq_handler(struct irq_desc *desc, irq_flow_handler_t handle, int is_chareturn handle; } -void ipipe_enable_irq (unsigned int irq) +int ipipe_enable_irq (unsigned int irq) {struct irq_desc *desc;struct irq_chip *chip;
@@ -1090,7 +1090,7 @@ void ipipe_enable_irq(unsigned int irq) desc =irq_to_desc (irq);if (desc ==NULL ) -return ; +return -EINVAL ; chip =irq_desc_get_chip (desc);
@@ -1105,16 +1105,18 @@ void ipipe_enable_irq(unsigned int irq) }raw_spin_unlock_irqrestore (&desc->lock, flags); -return ; +return 0 ; } -if (WARN_ON_ONCE (chip->irq_enable ==NULL && chip->irq_unmask ==NULL )) -return ; +if (chip->irq_enable ==NULL && chip->irq_unmask ==NULL ) +return -ENOSYS ;if (chip->irq_enable) chip->irq_enable (&desc->irq_data);else chip->irq_unmask (&desc->irq_data); + +return 0 ; }EXPORT_SYMBOL_GPL (ipipe_enable_irq);
Signature · 1 line
2.16.4
PATCH v2 5/6 ipipe: Activate IRQ in ipipe_enable_irq
In reply to Jan KiszkaFrom: Jan Kiszka <[email protected]>
Likely needed since c942cee46bba which split enabling and startup.
This fixes unpopulated vectors in the IOAPIC on x86 at least, possibly more.
--- kernel/irq/chip.c | 5 +++++ 1 file changed, 5 insertions(+)
kernel/irq/chip.c +5 -0
@@ -1087,6 +1087,7 @@ int ipipe_enable_irq(unsigned int irq)struct irq_desc *desc;struct irq_chip *chip;unsigned long flags; +int err; desc =irq_to_desc (irq);if (desc ==NULL )
@@ -1098,6 +1099,10 @@ int ipipe_enable_irq(unsigned int irq)ipipe_root_only (); + err =irq_activate (desc); +if (err) +return err; +raw_spin_lock_irqsave (&desc->lock, flags);if (desc->istate &IPIPE_IRQS_NEEDS_STARTUP ) { desc->istate &= ~IPIPE_IRQS_NEEDS_STARTUP ;
Signature · 1 line
2.16.4
PATCH v2 6/6 ipipe: Let ipipe_set_irq_affinity return an error
In reply to Jan KiszkaFrom: Jan Kiszka <[email protected]>
x86 may generate one, so change the signature.
--- include/linux/ipipe.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
include/linux/ipipe.h +2 -2
@@ -433,12 +433,12 @@ void ipipe_prepare_panic(void);#ifndef ipipe_smp_p#define ipipe_smp_p (1)#endif -void ipipe_set_irq_affinity (unsigned int irq,cpumask_t cpumask); +int ipipe_set_irq_affinity (unsigned int irq,cpumask_t cpumask);void ipipe_send_ipi (unsigned int ipi,cpumask_t cpumask);#else /* !CONFIG_SMP */ #define ipipe_smp_p (0)static inline -void ipipe_set_irq_affinity (unsigned int irq,cpumask_t cpumask) { } +int ipipe_set_irq_affinity (unsigned int irq,cpumask_t cpumask) {return 0 ; }static inline void ipipe_send_ipi (unsigned int ipi,cpumask_t cpumask) { }static inline void ipipe_disable_smp (void ) { }#endif /* CONFIG_SMP */
Signature · 1 line
2.16.4
Philippe Gerum
AppliedQuoted 13 lines · Jan Kiszka
This included the patches from v1, the addition (patch 3), and the new patches needed to add return codes and irq enabling to some services.
Jan
Jan Kiszka (6):
ipipe: Restoretrace_hardirqs_on_virt_caller
ipipe: lockdep: Remove duplicate context checks
ipipe: Add missing include foripipe_root_only
ipipe: Letipipe_enable_irqreturn an error code
ipipe: Activate IRQ inipipe_enable_irq
ipipe: Letipipe_set_irq_affinityreturn an error
Quoted 7 lines
include/linux/ipipe.h | 6 +++--- include/linux/kernel.h | 1 + kernel/irq/chip.c | 17 ++++++++++++----- kernel/locking/lockdep.c | 6 ------ kernel/trace/trace_preemptirq.c | 11 +++++++++++ 5 files changed, 27 insertions(+), 14 deletions(-)
Applied, thanks.
Signature · 1 line
Philippe.