diff options
Diffstat (limited to 'kernel/time/timer.c')
| -rw-r--r-- | kernel/time/timer.c | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/kernel/time/timer.c b/kernel/time/timer.c index 152a706ef8b8..71ce3f4eead3 100644 --- a/kernel/time/timer.c +++ b/kernel/time/timer.c | |||
| @@ -195,7 +195,7 @@ EXPORT_SYMBOL(jiffies_64); | |||
| 195 | #endif | 195 | #endif |
| 196 | 196 | ||
| 197 | struct timer_base { | 197 | struct timer_base { |
| 198 | spinlock_t lock; | 198 | raw_spinlock_t lock; |
| 199 | struct timer_list *running_timer; | 199 | struct timer_list *running_timer; |
| 200 | unsigned long clk; | 200 | unsigned long clk; |
| 201 | unsigned long next_expiry; | 201 | unsigned long next_expiry; |
| @@ -913,10 +913,10 @@ static struct timer_base *lock_timer_base(struct timer_list *timer, | |||
| 913 | 913 | ||
| 914 | if (!(tf & TIMER_MIGRATING)) { | 914 | if (!(tf & TIMER_MIGRATING)) { |
| 915 | base = get_timer_base(tf); | 915 | base = get_timer_base(tf); |
| 916 | spin_lock_irqsave(&base->lock, *flags); | 916 | raw_spin_lock_irqsave(&base->lock, *flags); |
| 917 | if (timer->flags == tf) | 917 | if (timer->flags == tf) |
| 918 | return base; | 918 | return base; |
| 919 | spin_unlock_irqrestore(&base->lock, *flags); | 919 | raw_spin_unlock_irqrestore(&base->lock, *flags); |
| 920 | } | 920 | } |
| 921 | cpu_relax(); | 921 | cpu_relax(); |
| 922 | } | 922 | } |
| @@ -986,9 +986,9 @@ __mod_timer(struct timer_list *timer, unsigned long expires, bool pending_only) | |||
| 986 | /* See the comment in lock_timer_base() */ | 986 | /* See the comment in lock_timer_base() */ |
| 987 | timer->flags |= TIMER_MIGRATING; | 987 | timer->flags |= TIMER_MIGRATING; |
| 988 | 988 | ||
| 989 | spin_unlock(&base->lock); | 989 | raw_spin_unlock(&base->lock); |
| 990 | base = new_base; | 990 | base = new_base; |
| 991 | spin_lock(&base->lock); | 991 | raw_spin_lock(&base->lock); |
| 992 | WRITE_ONCE(timer->flags, | 992 | WRITE_ONCE(timer->flags, |
| 993 | (timer->flags & ~TIMER_BASEMASK) | base->cpu); | 993 | (timer->flags & ~TIMER_BASEMASK) | base->cpu); |
| 994 | } | 994 | } |
| @@ -1013,7 +1013,7 @@ __mod_timer(struct timer_list *timer, unsigned long expires, bool pending_only) | |||
| 1013 | } | 1013 | } |
| 1014 | 1014 | ||
| 1015 | out_unlock: | 1015 | out_unlock: |
| 1016 | spin_unlock_irqrestore(&base->lock, flags); | 1016 | raw_spin_unlock_irqrestore(&base->lock, flags); |
| 1017 | 1017 | ||
| 1018 | return ret; | 1018 | return ret; |
| 1019 | } | 1019 | } |
| @@ -1106,16 +1106,16 @@ void add_timer_on(struct timer_list *timer, int cpu) | |||
| 1106 | if (base != new_base) { | 1106 | if (base != new_base) { |
| 1107 | timer->flags |= TIMER_MIGRATING; | 1107 | timer->flags |= TIMER_MIGRATING; |
| 1108 | 1108 | ||
| 1109 | spin_unlock(&base->lock); | 1109 | raw_spin_unlock(&base->lock); |
| 1110 | base = new_base; | 1110 | base = new_base; |
| 1111 | spin_lock(&base->lock); | 1111 | raw_spin_lock(&base->lock); |
| 1112 | WRITE_ONCE(timer->flags, | 1112 | WRITE_ONCE(timer->flags, |
| 1113 | (timer->flags & ~TIMER_BASEMASK) | cpu); | 1113 | (timer->flags & ~TIMER_BASEMASK) | cpu); |
| 1114 | } | 1114 | } |
| 1115 | 1115 | ||
| 1116 | debug_activate(timer, timer->expires); | 1116 | debug_activate(timer, timer->expires); |
| 1117 | internal_add_timer(base, timer); | 1117 | internal_add_timer(base, timer); |
| 1118 | spin_unlock_irqrestore(&base->lock, flags); | 1118 | raw_spin_unlock_irqrestore(&base->lock, flags); |
| 1119 | } | 1119 | } |
| 1120 | EXPORT_SYMBOL_GPL(add_timer_on); | 1120 | EXPORT_SYMBOL_GPL(add_timer_on); |
| 1121 | 1121 | ||
| @@ -1141,7 +1141,7 @@ int del_timer(struct timer_list *timer) | |||
| 1141 | if (timer_pending(timer)) { | 1141 | if (timer_pending(timer)) { |
| 1142 | base = lock_timer_base(timer, &flags); | 1142 | base = lock_timer_base(timer, &flags); |
| 1143 | ret = detach_if_pending(timer, base, true); | 1143 | ret = detach_if_pending(timer, base, true); |
| 1144 | spin_unlock_irqrestore(&base->lock, flags); | 1144 | raw_spin_unlock_irqrestore(&base->lock, flags); |
| 1145 | } | 1145 | } |
| 1146 | 1146 | ||
| 1147 | return ret; | 1147 | return ret; |
| @@ -1150,7 +1150,7 @@ EXPORT_SYMBOL(del_timer); | |||
| 1150 | 1150 | ||
| 1151 | /** | 1151 | /** |
| 1152 | * try_to_del_timer_sync - Try to deactivate a timer | 1152 | * try_to_del_timer_sync - Try to deactivate a timer |
| 1153 | * @timer: timer do del | 1153 | * @timer: timer to delete |
| 1154 | * | 1154 | * |
| 1155 | * This function tries to deactivate a timer. Upon successful (ret >= 0) | 1155 | * This function tries to deactivate a timer. Upon successful (ret >= 0) |
| 1156 | * exit the timer is not queued and the handler is not running on any CPU. | 1156 | * exit the timer is not queued and the handler is not running on any CPU. |
| @@ -1168,7 +1168,7 @@ int try_to_del_timer_sync(struct timer_list *timer) | |||
| 1168 | if (base->running_timer != timer) | 1168 | if (base->running_timer != timer) |
| 1169 | ret = detach_if_pending(timer, base, true); | 1169 | ret = detach_if_pending(timer, base, true); |
| 1170 | 1170 | ||
| 1171 | spin_unlock_irqrestore(&base->lock, flags); | 1171 | raw_spin_unlock_irqrestore(&base->lock, flags); |
| 1172 | 1172 | ||
| 1173 | return ret; | 1173 | return ret; |
| 1174 | } | 1174 | } |
| @@ -1299,13 +1299,13 @@ static void expire_timers(struct timer_base *base, struct hlist_head *head) | |||
| 1299 | data = timer->data; | 1299 | data = timer->data; |
| 1300 | 1300 | ||
| 1301 | if (timer->flags & TIMER_IRQSAFE) { | 1301 | if (timer->flags & TIMER_IRQSAFE) { |
| 1302 | spin_unlock(&base->lock); | 1302 | raw_spin_unlock(&base->lock); |
| 1303 | call_timer_fn(timer, fn, data); | 1303 | call_timer_fn(timer, fn, data); |
| 1304 | spin_lock(&base->lock); | 1304 | raw_spin_lock(&base->lock); |
| 1305 | } else { | 1305 | } else { |
| 1306 | spin_unlock_irq(&base->lock); | 1306 | raw_spin_unlock_irq(&base->lock); |
| 1307 | call_timer_fn(timer, fn, data); | 1307 | call_timer_fn(timer, fn, data); |
| 1308 | spin_lock_irq(&base->lock); | 1308 | raw_spin_lock_irq(&base->lock); |
| 1309 | } | 1309 | } |
| 1310 | } | 1310 | } |
| 1311 | } | 1311 | } |
| @@ -1474,7 +1474,7 @@ u64 get_next_timer_interrupt(unsigned long basej, u64 basem) | |||
| 1474 | if (cpu_is_offline(smp_processor_id())) | 1474 | if (cpu_is_offline(smp_processor_id())) |
| 1475 | return expires; | 1475 | return expires; |
| 1476 | 1476 | ||
| 1477 | spin_lock(&base->lock); | 1477 | raw_spin_lock(&base->lock); |
| 1478 | nextevt = __next_timer_interrupt(base); | 1478 | nextevt = __next_timer_interrupt(base); |
| 1479 | is_max_delta = (nextevt == base->clk + NEXT_TIMER_MAX_DELTA); | 1479 | is_max_delta = (nextevt == base->clk + NEXT_TIMER_MAX_DELTA); |
| 1480 | base->next_expiry = nextevt; | 1480 | base->next_expiry = nextevt; |
| @@ -1502,7 +1502,7 @@ u64 get_next_timer_interrupt(unsigned long basej, u64 basem) | |||
| 1502 | if ((expires - basem) > TICK_NSEC) | 1502 | if ((expires - basem) > TICK_NSEC) |
| 1503 | base->is_idle = true; | 1503 | base->is_idle = true; |
| 1504 | } | 1504 | } |
| 1505 | spin_unlock(&base->lock); | 1505 | raw_spin_unlock(&base->lock); |
| 1506 | 1506 | ||
| 1507 | return cmp_next_hrtimer_event(basem, expires); | 1507 | return cmp_next_hrtimer_event(basem, expires); |
| 1508 | } | 1508 | } |
| @@ -1590,7 +1590,7 @@ static inline void __run_timers(struct timer_base *base) | |||
| 1590 | if (!time_after_eq(jiffies, base->clk)) | 1590 | if (!time_after_eq(jiffies, base->clk)) |
| 1591 | return; | 1591 | return; |
| 1592 | 1592 | ||
| 1593 | spin_lock_irq(&base->lock); | 1593 | raw_spin_lock_irq(&base->lock); |
| 1594 | 1594 | ||
| 1595 | while (time_after_eq(jiffies, base->clk)) { | 1595 | while (time_after_eq(jiffies, base->clk)) { |
| 1596 | 1596 | ||
| @@ -1601,7 +1601,7 @@ static inline void __run_timers(struct timer_base *base) | |||
| 1601 | expire_timers(base, heads + levels); | 1601 | expire_timers(base, heads + levels); |
| 1602 | } | 1602 | } |
| 1603 | base->running_timer = NULL; | 1603 | base->running_timer = NULL; |
| 1604 | spin_unlock_irq(&base->lock); | 1604 | raw_spin_unlock_irq(&base->lock); |
| 1605 | } | 1605 | } |
| 1606 | 1606 | ||
| 1607 | /* | 1607 | /* |
| @@ -1786,16 +1786,16 @@ int timers_dead_cpu(unsigned int cpu) | |||
| 1786 | * The caller is globally serialized and nobody else | 1786 | * The caller is globally serialized and nobody else |
| 1787 | * takes two locks at once, deadlock is not possible. | 1787 | * takes two locks at once, deadlock is not possible. |
| 1788 | */ | 1788 | */ |
| 1789 | spin_lock_irq(&new_base->lock); | 1789 | raw_spin_lock_irq(&new_base->lock); |
| 1790 | spin_lock_nested(&old_base->lock, SINGLE_DEPTH_NESTING); | 1790 | raw_spin_lock_nested(&old_base->lock, SINGLE_DEPTH_NESTING); |
| 1791 | 1791 | ||
| 1792 | BUG_ON(old_base->running_timer); | 1792 | BUG_ON(old_base->running_timer); |
| 1793 | 1793 | ||
| 1794 | for (i = 0; i < WHEEL_SIZE; i++) | 1794 | for (i = 0; i < WHEEL_SIZE; i++) |
| 1795 | migrate_timer_list(new_base, old_base->vectors + i); | 1795 | migrate_timer_list(new_base, old_base->vectors + i); |
| 1796 | 1796 | ||
| 1797 | spin_unlock(&old_base->lock); | 1797 | raw_spin_unlock(&old_base->lock); |
| 1798 | spin_unlock_irq(&new_base->lock); | 1798 | raw_spin_unlock_irq(&new_base->lock); |
| 1799 | put_cpu_ptr(&timer_bases); | 1799 | put_cpu_ptr(&timer_bases); |
| 1800 | } | 1800 | } |
| 1801 | return 0; | 1801 | return 0; |
| @@ -1811,7 +1811,7 @@ static void __init init_timer_cpu(int cpu) | |||
| 1811 | for (i = 0; i < NR_BASES; i++) { | 1811 | for (i = 0; i < NR_BASES; i++) { |
| 1812 | base = per_cpu_ptr(&timer_bases[i], cpu); | 1812 | base = per_cpu_ptr(&timer_bases[i], cpu); |
| 1813 | base->cpu = cpu; | 1813 | base->cpu = cpu; |
| 1814 | spin_lock_init(&base->lock); | 1814 | raw_spin_lock_init(&base->lock); |
| 1815 | base->clk = jiffies; | 1815 | base->clk = jiffies; |
| 1816 | } | 1816 | } |
| 1817 | } | 1817 | } |
