summaryrefslogtreecommitdiff
path: root/kernel/irq
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2012-08-21 20:38:50 +0200
committerDaniel Wagner <wagi@monom.org>2018-07-26 06:47:21 +0200
commit2a55c745c7e761d31ea30434406b6128abc22dda (patch)
tree95a88c9bb7fd51f51a6d5968a3d9df88c56878fd /kernel/irq
parent2a2ca5f9a624ea92432feded53079696c4ed077a (diff)
downloadlinux-rt-2a55c745c7e761d31ea30434406b6128abc22dda.tar.gz
random: Make it work on rt
Delegate the random insertion to the forced threaded interrupt handler. Store the return IP of the hard interrupt handler in the irq descriptor and feed it into the random generator as a source of entropy. Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'kernel/irq')
-rw-r--r--kernel/irq/handle.c8
-rw-r--r--kernel/irq/manage.c6
2 files changed, 13 insertions, 1 deletions
diff --git a/kernel/irq/handle.c b/kernel/irq/handle.c
index 57bff7857e87..6c65c9252991 100644
--- a/kernel/irq/handle.c
+++ b/kernel/irq/handle.c
@@ -134,6 +134,8 @@ void __irq_wake_thread(struct irq_desc *desc, struct irqaction *action)
irqreturn_t handle_irq_event_percpu(struct irq_desc *desc)
{
+ struct pt_regs *regs = get_irq_regs();
+ u64 ip = regs ? instruction_pointer(regs) : 0;
irqreturn_t retval = IRQ_NONE;
unsigned int flags = 0, irq = desc->irq_data.irq;
struct irqaction *action = desc->action;
@@ -176,7 +178,11 @@ irqreturn_t handle_irq_event_percpu(struct irq_desc *desc)
action = action->next;
}
- add_interrupt_randomness(irq, flags);
+#ifdef CONFIG_PREEMPT_RT_FULL
+ desc->random_ip = ip;
+#else
+ add_interrupt_randomness(irq, flags, ip);
+#endif
if (!noirqdebug)
note_interrupt(desc, retval);
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index 71f479196709..ab1ec5b20887 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -1045,6 +1045,12 @@ static int irq_thread(void *data)
if (action_ret == IRQ_WAKE_THREAD)
irq_wake_secondary(desc, action);
+#ifdef CONFIG_PREEMPT_RT_FULL
+ migrate_disable();
+ add_interrupt_randomness(action->irq, 0,
+ desc->random_ip ^ (unsigned long) action);
+ migrate_enable();
+#endif
wake_threads_waitq(desc);
}