aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2014-02-19 11:23:52 -0500
committerThomas Gleixner <tglx@linutronix.de>2014-02-19 11:23:52 -0500
commit1bc38a1d33a09949cfb6a12349e3c8dac867a5ab (patch)
treee3fa41f522857e3416854368b59e2e08c571f55d /kernel
parentddf2965d77558eefee745c9dce22ad7ef5c7b88e (diff)
parenta92444c6b2225a9115d661c950cb48a22aeace20 (diff)
Merge branch 'irq/for-arm' into irq/core
Pull the functionality which is required to cleanup sdhci/sdio in. It's in a separate branch so it can be pulled from others Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/irq/handle.c4
-rw-r--r--kernel/irq/internals.h1
-rw-r--r--kernel/irq/irqdesc.c1
-rw-r--r--kernel/irq/manage.c97
-rw-r--r--kernel/time/jiffies.c6
-rw-r--r--kernel/time/tick-broadcast.c1
-rw-r--r--kernel/trace/ring_buffer.c7
7 files changed, 95 insertions, 22 deletions
diff --git a/kernel/irq/handle.c b/kernel/irq/handle.c
index 131ca176b497..bfec453557b4 100644
--- a/kernel/irq/handle.c
+++ b/kernel/irq/handle.c
@@ -51,7 +51,7 @@ static void warn_no_thread(unsigned int irq, struct irqaction *action)
51 "but no thread function available.", irq, action->name); 51 "but no thread function available.", irq, action->name);
52} 52}
53 53
54static void irq_wake_thread(struct irq_desc *desc, struct irqaction *action) 54void __irq_wake_thread(struct irq_desc *desc, struct irqaction *action)
55{ 55{
56 /* 56 /*
57 * In case the thread crashed and was killed we just pretend that 57 * In case the thread crashed and was killed we just pretend that
@@ -157,7 +157,7 @@ handle_irq_event_percpu(struct irq_desc *desc, struct irqaction *action)
157 break; 157 break;
158 } 158 }
159 159
160 irq_wake_thread(desc, action); 160 __irq_wake_thread(desc, action);
161 161
162 /* Fall through to add to randomness */ 162 /* Fall through to add to randomness */
163 case IRQ_HANDLED: 163 case IRQ_HANDLED:
diff --git a/kernel/irq/internals.h b/kernel/irq/internals.h
index 001fa5bab490..d61ac29e32d0 100644
--- a/kernel/irq/internals.h
+++ b/kernel/irq/internals.h
@@ -82,6 +82,7 @@ irqreturn_t handle_irq_event(struct irq_desc *desc);
82/* Resending of interrupts :*/ 82/* Resending of interrupts :*/
83void check_irq_resend(struct irq_desc *desc, unsigned int irq); 83void check_irq_resend(struct irq_desc *desc, unsigned int irq);
84bool irq_wait_for_poll(struct irq_desc *desc); 84bool irq_wait_for_poll(struct irq_desc *desc);
85void __irq_wake_thread(struct irq_desc *desc, struct irqaction *action);
85 86
86#ifdef CONFIG_PROC_FS 87#ifdef CONFIG_PROC_FS
87extern void register_irq_proc(unsigned int irq, struct irq_desc *desc); 88extern void register_irq_proc(unsigned int irq, struct irq_desc *desc);
diff --git a/kernel/irq/irqdesc.c b/kernel/irq/irqdesc.c
index 192a302d6cfd..8ab8e9390297 100644
--- a/kernel/irq/irqdesc.c
+++ b/kernel/irq/irqdesc.c
@@ -274,6 +274,7 @@ struct irq_desc *irq_to_desc(unsigned int irq)
274{ 274{
275 return (irq < NR_IRQS) ? irq_desc + irq : NULL; 275 return (irq < NR_IRQS) ? irq_desc + irq : NULL;
276} 276}
277EXPORT_SYMBOL(irq_to_desc);
277 278
278static void free_desc(unsigned int irq) 279static void free_desc(unsigned int irq)
279{ 280{
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index 481a13c43b17..54eb5c99351b 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -32,24 +32,10 @@ static int __init setup_forced_irqthreads(char *arg)
32early_param("threadirqs", setup_forced_irqthreads); 32early_param("threadirqs", setup_forced_irqthreads);
33#endif 33#endif
34 34
35/** 35static void __synchronize_hardirq(struct irq_desc *desc)
36 * synchronize_irq - wait for pending IRQ handlers (on other CPUs)
37 * @irq: interrupt number to wait for
38 *
39 * This function waits for any pending IRQ handlers for this interrupt
40 * to complete before returning. If you use this function while
41 * holding a resource the IRQ handler may need you will deadlock.
42 *
43 * This function may be called - with care - from IRQ context.
44 */
45void synchronize_irq(unsigned int irq)
46{ 36{
47 struct irq_desc *desc = irq_to_desc(irq);
48 bool inprogress; 37 bool inprogress;
49 38
50 if (!desc)
51 return;
52
53 do { 39 do {
54 unsigned long flags; 40 unsigned long flags;
55 41
@@ -67,12 +53,56 @@ void synchronize_irq(unsigned int irq)
67 53
68 /* Oops, that failed? */ 54 /* Oops, that failed? */
69 } while (inprogress); 55 } while (inprogress);
56}
70 57
71 /* 58/**
72 * We made sure that no hardirq handler is running. Now verify 59 * synchronize_hardirq - wait for pending hard IRQ handlers (on other CPUs)
73 * that no threaded handlers are active. 60 * @irq: interrupt number to wait for
74 */ 61 *
75 wait_event(desc->wait_for_threads, !atomic_read(&desc->threads_active)); 62 * This function waits for any pending hard IRQ handlers for this
63 * interrupt to complete before returning. If you use this
64 * function while holding a resource the IRQ handler may need you
65 * will deadlock. It does not take associated threaded handlers
66 * into account.
67 *
68 * Do not use this for shutdown scenarios where you must be sure
69 * that all parts (hardirq and threaded handler) have completed.
70 *
71 * This function may be called - with care - from IRQ context.
72 */
73void synchronize_hardirq(unsigned int irq)
74{
75 struct irq_desc *desc = irq_to_desc(irq);
76
77 if (desc)
78 __synchronize_hardirq(desc);
79}
80EXPORT_SYMBOL(synchronize_hardirq);
81
82/**
83 * synchronize_irq - wait for pending IRQ handlers (on other CPUs)
84 * @irq: interrupt number to wait for
85 *
86 * This function waits for any pending IRQ handlers for this interrupt
87 * to complete before returning. If you use this function while
88 * holding a resource the IRQ handler may need you will deadlock.
89 *
90 * This function may be called - with care - from IRQ context.
91 */
92void synchronize_irq(unsigned int irq)
93{
94 struct irq_desc *desc = irq_to_desc(irq);
95
96 if (desc) {
97 __synchronize_hardirq(desc);
98 /*
99 * We made sure that no hardirq handler is
100 * running. Now verify that no threaded handlers are
101 * active.
102 */
103 wait_event(desc->wait_for_threads,
104 !atomic_read(&desc->threads_active));
105 }
76} 106}
77EXPORT_SYMBOL(synchronize_irq); 107EXPORT_SYMBOL(synchronize_irq);
78 108
@@ -881,6 +911,33 @@ static int irq_thread(void *data)
881 return 0; 911 return 0;
882} 912}
883 913
914/**
915 * irq_wake_thread - wake the irq thread for the action identified by dev_id
916 * @irq: Interrupt line
917 * @dev_id: Device identity for which the thread should be woken
918 *
919 */
920void irq_wake_thread(unsigned int irq, void *dev_id)
921{
922 struct irq_desc *desc = irq_to_desc(irq);
923 struct irqaction *action;
924 unsigned long flags;
925
926 if (!desc || WARN_ON(irq_settings_is_per_cpu_devid(desc)))
927 return;
928
929 raw_spin_lock_irqsave(&desc->lock, flags);
930 for (action = desc->action; action; action = action->next) {
931 if (action->dev_id == dev_id) {
932 if (action->thread)
933 __irq_wake_thread(desc, action);
934 break;
935 }
936 }
937 raw_spin_unlock_irqrestore(&desc->lock, flags);
938}
939EXPORT_SYMBOL_GPL(irq_wake_thread);
940
884static void irq_setup_forced_threading(struct irqaction *new) 941static void irq_setup_forced_threading(struct irqaction *new)
885{ 942{
886 if (!force_irqthreads) 943 if (!force_irqthreads)
diff --git a/kernel/time/jiffies.c b/kernel/time/jiffies.c
index 7a925ba456fb..a6a5bf53e86d 100644
--- a/kernel/time/jiffies.c
+++ b/kernel/time/jiffies.c
@@ -51,7 +51,13 @@
51 * HZ shrinks, so values greater than 8 overflow 32bits when 51 * HZ shrinks, so values greater than 8 overflow 32bits when
52 * HZ=100. 52 * HZ=100.
53 */ 53 */
54#if HZ < 34
55#define JIFFIES_SHIFT 6
56#elif HZ < 67
57#define JIFFIES_SHIFT 7
58#else
54#define JIFFIES_SHIFT 8 59#define JIFFIES_SHIFT 8
60#endif
55 61
56static cycle_t jiffies_read(struct clocksource *cs) 62static cycle_t jiffies_read(struct clocksource *cs)
57{ 63{
diff --git a/kernel/time/tick-broadcast.c b/kernel/time/tick-broadcast.c
index 43780ab5e279..98977a57ac72 100644
--- a/kernel/time/tick-broadcast.c
+++ b/kernel/time/tick-broadcast.c
@@ -756,6 +756,7 @@ out:
756static void tick_broadcast_clear_oneshot(int cpu) 756static void tick_broadcast_clear_oneshot(int cpu)
757{ 757{
758 cpumask_clear_cpu(cpu, tick_broadcast_oneshot_mask); 758 cpumask_clear_cpu(cpu, tick_broadcast_oneshot_mask);
759 cpumask_clear_cpu(cpu, tick_broadcast_pending_mask);
759} 760}
760 761
761static void tick_broadcast_init_next_event(struct cpumask *mask, 762static void tick_broadcast_init_next_event(struct cpumask *mask,
diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
index 294b8a271a04..fc4da2d97f9b 100644
--- a/kernel/trace/ring_buffer.c
+++ b/kernel/trace/ring_buffer.c
@@ -2397,6 +2397,13 @@ __rb_reserve_next(struct ring_buffer_per_cpu *cpu_buffer,
2397 write &= RB_WRITE_MASK; 2397 write &= RB_WRITE_MASK;
2398 tail = write - length; 2398 tail = write - length;
2399 2399
2400 /*
2401 * If this is the first commit on the page, then it has the same
2402 * timestamp as the page itself.
2403 */
2404 if (!tail)
2405 delta = 0;
2406
2400 /* See if we shot pass the end of this buffer page */ 2407 /* See if we shot pass the end of this buffer page */
2401 if (unlikely(write > BUF_PAGE_SIZE)) 2408 if (unlikely(write > BUF_PAGE_SIZE))
2402 return rb_move_tail(cpu_buffer, length, tail, 2409 return rb_move_tail(cpu_buffer, length, tail,