* [PATCH v2 1/6] ipipe: Restore trace_hardirqs_on_virt_caller
2019-07-11 19:56 [PATCH v2 0/6] ipipe-noarch: IRQ tracing, enabling, and lockdep fixes/cleanups Jan Kiszka
@ 2019-07-11 19:56 ` Jan Kiszka
2019-07-11 19:56 ` [PATCH v2 2/6] ipipe: lockdep: Remove duplicate context checks Jan Kiszka
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Jan Kiszka @ 2019-07-11 19:56 UTC (permalink / raw)
To: Philippe Gerum; +Cc: xenomai
From: Jan Kiszka <jan.kiszka@siemens.com>
Lost in d7fc2c06edc9 ("lockdep: ipipe: exclude the head stage from IRQ
state tracing") but still needed by x86 at least.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
kernel/trace/trace_preemptirq.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/kernel/trace/trace_preemptirq.c b/kernel/trace/trace_preemptirq.c
index 3c482c02c1d9..19605695a6a2 100644
--- a/kernel/trace/trace_preemptirq.c
+++ b/kernel/trace/trace_preemptirq.c
@@ -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)
{
/*
--
2.16.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v2 2/6] ipipe: lockdep: Remove duplicate context checks
2019-07-11 19:56 [PATCH v2 0/6] ipipe-noarch: IRQ tracing, enabling, and lockdep fixes/cleanups Jan Kiszka
2019-07-11 19:56 ` [PATCH v2 1/6] ipipe: Restore trace_hardirqs_on_virt_caller Jan Kiszka
@ 2019-07-11 19:56 ` Jan Kiszka
2019-07-11 19:56 ` [PATCH v2 3/6] ipipe: Add missing include for ipipe_root_only Jan Kiszka
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Jan Kiszka @ 2019-07-11 19:56 UTC (permalink / raw)
To: Philippe Gerum; +Cc: xenomai
From: Jan Kiszka <jan.kiszka@siemens.com>
All callers of lockdep_hardirqs_on/off already filter out !ipipe_root_p.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
kernel/locking/lockdep.c | 6 ------
1 file changed, 6 deletions(-)
diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
index 715fe8a49c2e..a2a8267788c6 100644
--- a/kernel/locking/lockdep.c
+++ b/kernel/locking/lockdep.c
@@ -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))
--
2.16.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v2 3/6] ipipe: Add missing include for ipipe_root_only
2019-07-11 19:56 [PATCH v2 0/6] ipipe-noarch: IRQ tracing, enabling, and lockdep fixes/cleanups Jan Kiszka
2019-07-11 19:56 ` [PATCH v2 1/6] ipipe: Restore trace_hardirqs_on_virt_caller Jan Kiszka
2019-07-11 19:56 ` [PATCH v2 2/6] ipipe: lockdep: Remove duplicate context checks Jan Kiszka
@ 2019-07-11 19:56 ` Jan Kiszka
2019-07-11 19:56 ` [PATCH v2 4/6] ipipe: Let ipipe_enable_irq return an error code Jan Kiszka
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Jan Kiszka @ 2019-07-11 19:56 UTC (permalink / raw)
To: Philippe Gerum; +Cc: xenomai
From: Jan Kiszka <jan.kiszka@siemens.com>
Breaks in non-debug builds otherwise, e.g.
https://travis-ci.com/xenomai-ci/xenomai/jobs/212725223
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
include/linux/kernel.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 50b1e0c878e0..edd37052e585 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -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))
--
2.16.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v2 4/6] ipipe: Let ipipe_enable_irq return an error code
2019-07-11 19:56 [PATCH v2 0/6] ipipe-noarch: IRQ tracing, enabling, and lockdep fixes/cleanups Jan Kiszka
` (2 preceding siblings ...)
2019-07-11 19:56 ` [PATCH v2 3/6] ipipe: Add missing include for ipipe_root_only Jan Kiszka
@ 2019-07-11 19:56 ` Jan Kiszka
2019-07-11 19:56 ` [PATCH v2 5/6] ipipe: Activate IRQ in ipipe_enable_irq Jan Kiszka
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Jan Kiszka @ 2019-07-11 19:56 UTC (permalink / raw)
To: Philippe Gerum; +Cc: xenomai
From: Jan Kiszka <jan.kiszka@siemens.com>
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.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
include/linux/ipipe.h | 2 +-
kernel/irq/chip.c | 12 +++++++-----
2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/include/linux/ipipe.h b/include/linux/ipipe.h
index b8a80eeade4f..f7c07a207093 100644
--- a/include/linux/ipipe.h
+++ b/include/linux/ipipe.h
@@ -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)
{
diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
index 6c279e065879..65d345b727be 100644
--- a/kernel/irq/chip.c
+++ b/kernel/irq/chip.c
@@ -1082,7 +1082,7 @@ __fixup_irq_handler(struct irq_desc *desc, irq_flow_handler_t handle, int is_cha
return 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);
--
2.16.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v2 5/6] ipipe: Activate IRQ in ipipe_enable_irq
2019-07-11 19:56 [PATCH v2 0/6] ipipe-noarch: IRQ tracing, enabling, and lockdep fixes/cleanups Jan Kiszka
` (3 preceding siblings ...)
2019-07-11 19:56 ` [PATCH v2 4/6] ipipe: Let ipipe_enable_irq return an error code Jan Kiszka
@ 2019-07-11 19:56 ` Jan Kiszka
2019-07-11 19:56 ` [PATCH v2 6/6] ipipe: Let ipipe_set_irq_affinity return an error Jan Kiszka
2019-07-23 16:39 ` [PATCH v2 0/6] ipipe-noarch: IRQ tracing, enabling, and lockdep fixes/cleanups Philippe Gerum
6 siblings, 0 replies; 8+ messages in thread
From: Jan Kiszka @ 2019-07-11 19:56 UTC (permalink / raw)
To: Philippe Gerum; +Cc: xenomai
From: Jan Kiszka <jan.kiszka@siemens.com>
Likely needed since c942cee46bba which split enabling and startup.
This fixes unpopulated vectors in the IOAPIC on x86 at least, possibly
more.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
kernel/irq/chip.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
index 65d345b727be..22386e509f68 100644
--- a/kernel/irq/chip.c
+++ b/kernel/irq/chip.c
@@ -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;
--
2.16.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v2 6/6] ipipe: Let ipipe_set_irq_affinity return an error
2019-07-11 19:56 [PATCH v2 0/6] ipipe-noarch: IRQ tracing, enabling, and lockdep fixes/cleanups Jan Kiszka
` (4 preceding siblings ...)
2019-07-11 19:56 ` [PATCH v2 5/6] ipipe: Activate IRQ in ipipe_enable_irq Jan Kiszka
@ 2019-07-11 19:56 ` Jan Kiszka
2019-07-23 16:39 ` [PATCH v2 0/6] ipipe-noarch: IRQ tracing, enabling, and lockdep fixes/cleanups Philippe Gerum
6 siblings, 0 replies; 8+ messages in thread
From: Jan Kiszka @ 2019-07-11 19:56 UTC (permalink / raw)
To: Philippe Gerum; +Cc: xenomai
From: Jan Kiszka <jan.kiszka@siemens.com>
x86 may generate one, so change the signature.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
include/linux/ipipe.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/linux/ipipe.h b/include/linux/ipipe.h
index f7c07a207093..45e8c87bff93 100644
--- a/include/linux/ipipe.h
+++ b/include/linux/ipipe.h
@@ -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 */
--
2.16.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v2 0/6] ipipe-noarch: IRQ tracing, enabling, and lockdep fixes/cleanups
2019-07-11 19:56 [PATCH v2 0/6] ipipe-noarch: IRQ tracing, enabling, and lockdep fixes/cleanups Jan Kiszka
` (5 preceding siblings ...)
2019-07-11 19:56 ` [PATCH v2 6/6] ipipe: Let ipipe_set_irq_affinity return an error Jan Kiszka
@ 2019-07-23 16:39 ` Philippe Gerum
6 siblings, 0 replies; 8+ messages in thread
From: Philippe Gerum @ 2019-07-23 16:39 UTC (permalink / raw)
To: Jan Kiszka; +Cc: xenomai
On 7/11/19 9:56 PM, Jan Kiszka wrote:
> 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(-)
>
Applied, thanks.
--
Philippe.
^ permalink raw reply [flat|nested] 8+ messages in thread