diff options
-rw-r--r-- | arch/x86/kernel/rtc.c | 23 | ||||
-rw-r--r-- | arch/x86/platform/mrst/vrtc.c | 9 | ||||
-rw-r--r-- | include/linux/irqdomain.h | 1 | ||||
-rw-r--r-- | include/linux/sched.h | 1 | ||||
-rw-r--r-- | kernel/irq/irqdomain.c | 6 | ||||
-rw-r--r-- | kernel/posix-cpu-timers.c | 5 | ||||
-rw-r--r-- | kernel/sched.c | 26 | ||||
-rw-r--r-- | kernel/sched_rt.c | 4 |
8 files changed, 33 insertions, 42 deletions
diff --git a/arch/x86/kernel/rtc.c b/arch/x86/kernel/rtc.c index 3f2ad2640d85..ccdbc16b8941 100644 --- a/arch/x86/kernel/rtc.c +++ b/arch/x86/kernel/rtc.c | |||
@@ -42,8 +42,11 @@ int mach_set_rtc_mmss(unsigned long nowtime) | |||
42 | { | 42 | { |
43 | int real_seconds, real_minutes, cmos_minutes; | 43 | int real_seconds, real_minutes, cmos_minutes; |
44 | unsigned char save_control, save_freq_select; | 44 | unsigned char save_control, save_freq_select; |
45 | unsigned long flags; | ||
45 | int retval = 0; | 46 | int retval = 0; |
46 | 47 | ||
48 | spin_lock_irqsave(&rtc_lock, flags); | ||
49 | |||
47 | /* tell the clock it's being set */ | 50 | /* tell the clock it's being set */ |
48 | save_control = CMOS_READ(RTC_CONTROL); | 51 | save_control = CMOS_READ(RTC_CONTROL); |
49 | CMOS_WRITE((save_control|RTC_SET), RTC_CONTROL); | 52 | CMOS_WRITE((save_control|RTC_SET), RTC_CONTROL); |
@@ -93,12 +96,17 @@ int mach_set_rtc_mmss(unsigned long nowtime) | |||
93 | CMOS_WRITE(save_control, RTC_CONTROL); | 96 | CMOS_WRITE(save_control, RTC_CONTROL); |
94 | CMOS_WRITE(save_freq_select, RTC_FREQ_SELECT); | 97 | CMOS_WRITE(save_freq_select, RTC_FREQ_SELECT); |
95 | 98 | ||
99 | spin_unlock_irqrestore(&rtc_lock, flags); | ||
100 | |||
96 | return retval; | 101 | return retval; |
97 | } | 102 | } |
98 | 103 | ||
99 | unsigned long mach_get_cmos_time(void) | 104 | unsigned long mach_get_cmos_time(void) |
100 | { | 105 | { |
101 | unsigned int status, year, mon, day, hour, min, sec, century = 0; | 106 | unsigned int status, year, mon, day, hour, min, sec, century = 0; |
107 | unsigned long flags; | ||
108 | |||
109 | spin_lock_irqsave(&rtc_lock, flags); | ||
102 | 110 | ||
103 | /* | 111 | /* |
104 | * If UIP is clear, then we have >= 244 microseconds before | 112 | * If UIP is clear, then we have >= 244 microseconds before |
@@ -125,6 +133,8 @@ unsigned long mach_get_cmos_time(void) | |||
125 | status = CMOS_READ(RTC_CONTROL); | 133 | status = CMOS_READ(RTC_CONTROL); |
126 | WARN_ON_ONCE(RTC_ALWAYS_BCD && (status & RTC_DM_BINARY)); | 134 | WARN_ON_ONCE(RTC_ALWAYS_BCD && (status & RTC_DM_BINARY)); |
127 | 135 | ||
136 | spin_unlock_irqrestore(&rtc_lock, flags); | ||
137 | |||
128 | if (RTC_ALWAYS_BCD || !(status & RTC_DM_BINARY)) { | 138 | if (RTC_ALWAYS_BCD || !(status & RTC_DM_BINARY)) { |
129 | sec = bcd2bin(sec); | 139 | sec = bcd2bin(sec); |
130 | min = bcd2bin(min); | 140 | min = bcd2bin(min); |
@@ -169,24 +179,15 @@ EXPORT_SYMBOL(rtc_cmos_write); | |||
169 | 179 | ||
170 | int update_persistent_clock(struct timespec now) | 180 | int update_persistent_clock(struct timespec now) |
171 | { | 181 | { |
172 | unsigned long flags; | 182 | return x86_platform.set_wallclock(now.tv_sec); |
173 | int retval; | ||
174 | |||
175 | spin_lock_irqsave(&rtc_lock, flags); | ||
176 | retval = x86_platform.set_wallclock(now.tv_sec); | ||
177 | spin_unlock_irqrestore(&rtc_lock, flags); | ||
178 | |||
179 | return retval; | ||
180 | } | 183 | } |
181 | 184 | ||
182 | /* not static: needed by APM */ | 185 | /* not static: needed by APM */ |
183 | void read_persistent_clock(struct timespec *ts) | 186 | void read_persistent_clock(struct timespec *ts) |
184 | { | 187 | { |
185 | unsigned long retval, flags; | 188 | unsigned long retval; |
186 | 189 | ||
187 | spin_lock_irqsave(&rtc_lock, flags); | ||
188 | retval = x86_platform.get_wallclock(); | 190 | retval = x86_platform.get_wallclock(); |
189 | spin_unlock_irqrestore(&rtc_lock, flags); | ||
190 | 191 | ||
191 | ts->tv_sec = retval; | 192 | ts->tv_sec = retval; |
192 | ts->tv_nsec = 0; | 193 | ts->tv_nsec = 0; |
diff --git a/arch/x86/platform/mrst/vrtc.c b/arch/x86/platform/mrst/vrtc.c index 73d70d65e76e..6d5dbcdd444a 100644 --- a/arch/x86/platform/mrst/vrtc.c +++ b/arch/x86/platform/mrst/vrtc.c | |||
@@ -58,8 +58,11 @@ EXPORT_SYMBOL_GPL(vrtc_cmos_write); | |||
58 | unsigned long vrtc_get_time(void) | 58 | unsigned long vrtc_get_time(void) |
59 | { | 59 | { |
60 | u8 sec, min, hour, mday, mon; | 60 | u8 sec, min, hour, mday, mon; |
61 | unsigned long flags; | ||
61 | u32 year; | 62 | u32 year; |
62 | 63 | ||
64 | spin_lock_irqsave(&rtc_lock, flags); | ||
65 | |||
63 | while ((vrtc_cmos_read(RTC_FREQ_SELECT) & RTC_UIP)) | 66 | while ((vrtc_cmos_read(RTC_FREQ_SELECT) & RTC_UIP)) |
64 | cpu_relax(); | 67 | cpu_relax(); |
65 | 68 | ||
@@ -70,6 +73,8 @@ unsigned long vrtc_get_time(void) | |||
70 | mon = vrtc_cmos_read(RTC_MONTH); | 73 | mon = vrtc_cmos_read(RTC_MONTH); |
71 | year = vrtc_cmos_read(RTC_YEAR); | 74 | year = vrtc_cmos_read(RTC_YEAR); |
72 | 75 | ||
76 | spin_unlock_irqrestore(&rtc_lock, flags); | ||
77 | |||
73 | /* vRTC YEAR reg contains the offset to 1960 */ | 78 | /* vRTC YEAR reg contains the offset to 1960 */ |
74 | year += 1960; | 79 | year += 1960; |
75 | 80 | ||
@@ -83,8 +88,10 @@ unsigned long vrtc_get_time(void) | |||
83 | int vrtc_set_mmss(unsigned long nowtime) | 88 | int vrtc_set_mmss(unsigned long nowtime) |
84 | { | 89 | { |
85 | int real_sec, real_min; | 90 | int real_sec, real_min; |
91 | unsigned long flags; | ||
86 | int vrtc_min; | 92 | int vrtc_min; |
87 | 93 | ||
94 | spin_lock_irqsave(&rtc_lock, flags); | ||
88 | vrtc_min = vrtc_cmos_read(RTC_MINUTES); | 95 | vrtc_min = vrtc_cmos_read(RTC_MINUTES); |
89 | 96 | ||
90 | real_sec = nowtime % 60; | 97 | real_sec = nowtime % 60; |
@@ -95,6 +102,8 @@ int vrtc_set_mmss(unsigned long nowtime) | |||
95 | 102 | ||
96 | vrtc_cmos_write(real_sec, RTC_SECONDS); | 103 | vrtc_cmos_write(real_sec, RTC_SECONDS); |
97 | vrtc_cmos_write(real_min, RTC_MINUTES); | 104 | vrtc_cmos_write(real_min, RTC_MINUTES); |
105 | spin_unlock_irqrestore(&rtc_lock, flags); | ||
106 | |||
98 | return 0; | 107 | return 0; |
99 | } | 108 | } |
100 | 109 | ||
diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h index e807ad687a07..3ad553e8eae2 100644 --- a/include/linux/irqdomain.h +++ b/include/linux/irqdomain.h | |||
@@ -80,6 +80,7 @@ extern void irq_domain_del(struct irq_domain *domain); | |||
80 | #endif /* CONFIG_IRQ_DOMAIN */ | 80 | #endif /* CONFIG_IRQ_DOMAIN */ |
81 | 81 | ||
82 | #if defined(CONFIG_IRQ_DOMAIN) && defined(CONFIG_OF_IRQ) | 82 | #if defined(CONFIG_IRQ_DOMAIN) && defined(CONFIG_OF_IRQ) |
83 | extern struct irq_domain_ops irq_domain_simple_ops; | ||
83 | extern void irq_domain_add_simple(struct device_node *controller, int irq_base); | 84 | extern void irq_domain_add_simple(struct device_node *controller, int irq_base); |
84 | extern void irq_domain_generate_simple(const struct of_device_id *match, | 85 | extern void irq_domain_generate_simple(const struct of_device_id *match, |
85 | u64 phys_base, unsigned int irq_start); | 86 | u64 phys_base, unsigned int irq_start); |
diff --git a/include/linux/sched.h b/include/linux/sched.h index 4ac2c0578e0f..41d0237fd449 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -1956,7 +1956,6 @@ static inline void disable_sched_clock_irqtime(void) {} | |||
1956 | 1956 | ||
1957 | extern unsigned long long | 1957 | extern unsigned long long |
1958 | task_sched_runtime(struct task_struct *task); | 1958 | task_sched_runtime(struct task_struct *task); |
1959 | extern unsigned long long thread_group_sched_runtime(struct task_struct *task); | ||
1960 | 1959 | ||
1961 | /* sched_exec is called by processes performing an exec */ | 1960 | /* sched_exec is called by processes performing an exec */ |
1962 | #ifdef CONFIG_SMP | 1961 | #ifdef CONFIG_SMP |
diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c index d5828da3fd38..b57a3776de44 100644 --- a/kernel/irq/irqdomain.c +++ b/kernel/irq/irqdomain.c | |||
@@ -29,7 +29,11 @@ void irq_domain_add(struct irq_domain *domain) | |||
29 | */ | 29 | */ |
30 | for (hwirq = 0; hwirq < domain->nr_irq; hwirq++) { | 30 | for (hwirq = 0; hwirq < domain->nr_irq; hwirq++) { |
31 | d = irq_get_irq_data(irq_domain_to_irq(domain, hwirq)); | 31 | d = irq_get_irq_data(irq_domain_to_irq(domain, hwirq)); |
32 | if (d || d->domain) { | 32 | if (!d) { |
33 | WARN(1, "error: assigning domain to non existant irq_desc"); | ||
34 | return; | ||
35 | } | ||
36 | if (d->domain) { | ||
33 | /* things are broken; just report, don't clean up */ | 37 | /* things are broken; just report, don't clean up */ |
34 | WARN(1, "error: irq_desc already assigned to a domain"); | 38 | WARN(1, "error: irq_desc already assigned to a domain"); |
35 | return; | 39 | return; |
diff --git a/kernel/posix-cpu-timers.c b/kernel/posix-cpu-timers.c index 58f405b581e7..c8008dd58ef2 100644 --- a/kernel/posix-cpu-timers.c +++ b/kernel/posix-cpu-timers.c | |||
@@ -250,7 +250,7 @@ void thread_group_cputime(struct task_struct *tsk, struct task_cputime *times) | |||
250 | do { | 250 | do { |
251 | times->utime = cputime_add(times->utime, t->utime); | 251 | times->utime = cputime_add(times->utime, t->utime); |
252 | times->stime = cputime_add(times->stime, t->stime); | 252 | times->stime = cputime_add(times->stime, t->stime); |
253 | times->sum_exec_runtime += t->se.sum_exec_runtime; | 253 | times->sum_exec_runtime += task_sched_runtime(t); |
254 | } while_each_thread(tsk, t); | 254 | } while_each_thread(tsk, t); |
255 | out: | 255 | out: |
256 | rcu_read_unlock(); | 256 | rcu_read_unlock(); |
@@ -312,7 +312,8 @@ static int cpu_clock_sample_group(const clockid_t which_clock, | |||
312 | cpu->cpu = cputime.utime; | 312 | cpu->cpu = cputime.utime; |
313 | break; | 313 | break; |
314 | case CPUCLOCK_SCHED: | 314 | case CPUCLOCK_SCHED: |
315 | cpu->sched = thread_group_sched_runtime(p); | 315 | thread_group_cputime(p, &cputime); |
316 | cpu->sched = cputime.sum_exec_runtime; | ||
316 | break; | 317 | break; |
317 | } | 318 | } |
318 | return 0; | 319 | return 0; |
diff --git a/kernel/sched.c b/kernel/sched.c index ec5f472bc5b9..b50b0f0c9aa9 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -3725,30 +3725,6 @@ unsigned long long task_sched_runtime(struct task_struct *p) | |||
3725 | } | 3725 | } |
3726 | 3726 | ||
3727 | /* | 3727 | /* |
3728 | * Return sum_exec_runtime for the thread group. | ||
3729 | * In case the task is currently running, return the sum plus current's | ||
3730 | * pending runtime that have not been accounted yet. | ||
3731 | * | ||
3732 | * Note that the thread group might have other running tasks as well, | ||
3733 | * so the return value not includes other pending runtime that other | ||
3734 | * running tasks might have. | ||
3735 | */ | ||
3736 | unsigned long long thread_group_sched_runtime(struct task_struct *p) | ||
3737 | { | ||
3738 | struct task_cputime totals; | ||
3739 | unsigned long flags; | ||
3740 | struct rq *rq; | ||
3741 | u64 ns; | ||
3742 | |||
3743 | rq = task_rq_lock(p, &flags); | ||
3744 | thread_group_cputime(p, &totals); | ||
3745 | ns = totals.sum_exec_runtime + do_task_delta_exec(p, rq); | ||
3746 | task_rq_unlock(rq, p, &flags); | ||
3747 | |||
3748 | return ns; | ||
3749 | } | ||
3750 | |||
3751 | /* | ||
3752 | * Account user cpu time to a process. | 3728 | * Account user cpu time to a process. |
3753 | * @p: the process that the cpu time gets accounted to | 3729 | * @p: the process that the cpu time gets accounted to |
3754 | * @cputime: the cpu time spent in user space since the last update | 3730 | * @cputime: the cpu time spent in user space since the last update |
@@ -4372,7 +4348,7 @@ static inline void sched_submit_work(struct task_struct *tsk) | |||
4372 | blk_schedule_flush_plug(tsk); | 4348 | blk_schedule_flush_plug(tsk); |
4373 | } | 4349 | } |
4374 | 4350 | ||
4375 | asmlinkage void schedule(void) | 4351 | asmlinkage void __sched schedule(void) |
4376 | { | 4352 | { |
4377 | struct task_struct *tsk = current; | 4353 | struct task_struct *tsk = current; |
4378 | 4354 | ||
diff --git a/kernel/sched_rt.c b/kernel/sched_rt.c index 97540f0c9e47..af1177858be3 100644 --- a/kernel/sched_rt.c +++ b/kernel/sched_rt.c | |||
@@ -1050,7 +1050,7 @@ select_task_rq_rt(struct task_struct *p, int sd_flag, int flags) | |||
1050 | */ | 1050 | */ |
1051 | if (curr && unlikely(rt_task(curr)) && | 1051 | if (curr && unlikely(rt_task(curr)) && |
1052 | (curr->rt.nr_cpus_allowed < 2 || | 1052 | (curr->rt.nr_cpus_allowed < 2 || |
1053 | curr->prio < p->prio) && | 1053 | curr->prio <= p->prio) && |
1054 | (p->rt.nr_cpus_allowed > 1)) { | 1054 | (p->rt.nr_cpus_allowed > 1)) { |
1055 | int target = find_lowest_rq(p); | 1055 | int target = find_lowest_rq(p); |
1056 | 1056 | ||
@@ -1581,7 +1581,7 @@ static void task_woken_rt(struct rq *rq, struct task_struct *p) | |||
1581 | p->rt.nr_cpus_allowed > 1 && | 1581 | p->rt.nr_cpus_allowed > 1 && |
1582 | rt_task(rq->curr) && | 1582 | rt_task(rq->curr) && |
1583 | (rq->curr->rt.nr_cpus_allowed < 2 || | 1583 | (rq->curr->rt.nr_cpus_allowed < 2 || |
1584 | rq->curr->prio < p->prio)) | 1584 | rq->curr->prio <= p->prio)) |
1585 | push_rt_tasks(rq); | 1585 | push_rt_tasks(rq); |
1586 | } | 1586 | } |
1587 | 1587 | ||