Skip to content

Commit f72a209

Browse files
committed
Merge branches 'irq-urgent-for-linus', 'x86-urgent-for-linus' and 'sched-urgent-for-linus' of git://tesla.tglx.de/git/linux-2.6-tip
* 'irq-urgent-for-linus' of git://tesla.tglx.de/git/linux-2.6-tip: irq: Fix check for already initialized irq_domain in irq_domain_add irq: Add declaration of irq_domain_simple_ops to irqdomain.h * 'x86-urgent-for-linus' of git://tesla.tglx.de/git/linux-2.6-tip: x86/rtc: Don't recursively acquire rtc_lock * 'sched-urgent-for-linus' of git://tesla.tglx.de/git/linux-2.6-tip: posix-cpu-timers: Cure SMP wobbles sched: Fix up wchan borkage sched/rt: Migrate equal priority tasks to available CPUs
4 parents 47ea91b + eef24af + 47997d7 + d670ec1 commit f72a209

File tree

8 files changed

+33
-42
lines changed

8 files changed

+33
-42
lines changed

arch/x86/kernel/rtc.c

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,11 @@ int mach_set_rtc_mmss(unsigned long nowtime)
4242
{
4343
int real_seconds, real_minutes, cmos_minutes;
4444
unsigned char save_control, save_freq_select;
45+
unsigned long flags;
4546
int retval = 0;
4647

48+
spin_lock_irqsave(&rtc_lock, flags);
49+
4750
/* tell the clock it's being set */
4851
save_control = CMOS_READ(RTC_CONTROL);
4952
CMOS_WRITE((save_control|RTC_SET), RTC_CONTROL);
@@ -93,12 +96,17 @@ int mach_set_rtc_mmss(unsigned long nowtime)
9396
CMOS_WRITE(save_control, RTC_CONTROL);
9497
CMOS_WRITE(save_freq_select, RTC_FREQ_SELECT);
9598

99+
spin_unlock_irqrestore(&rtc_lock, flags);
100+
96101
return retval;
97102
}
98103

99104
unsigned long mach_get_cmos_time(void)
100105
{
101106
unsigned int status, year, mon, day, hour, min, sec, century = 0;
107+
unsigned long flags;
108+
109+
spin_lock_irqsave(&rtc_lock, flags);
102110

103111
/*
104112
* If UIP is clear, then we have >= 244 microseconds before
@@ -125,6 +133,8 @@ unsigned long mach_get_cmos_time(void)
125133
status = CMOS_READ(RTC_CONTROL);
126134
WARN_ON_ONCE(RTC_ALWAYS_BCD && (status & RTC_DM_BINARY));
127135

136+
spin_unlock_irqrestore(&rtc_lock, flags);
137+
128138
if (RTC_ALWAYS_BCD || !(status & RTC_DM_BINARY)) {
129139
sec = bcd2bin(sec);
130140
min = bcd2bin(min);
@@ -169,24 +179,15 @@ EXPORT_SYMBOL(rtc_cmos_write);
169179

170180
int update_persistent_clock(struct timespec now)
171181
{
172-
unsigned long flags;
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;
182+
return x86_platform.set_wallclock(now.tv_sec);
180183
}
181184

182185
/* not static: needed by APM */
183186
void read_persistent_clock(struct timespec *ts)
184187
{
185-
unsigned long retval, flags;
188+
unsigned long retval;
186189

187-
spin_lock_irqsave(&rtc_lock, flags);
188190
retval = x86_platform.get_wallclock();
189-
spin_unlock_irqrestore(&rtc_lock, flags);
190191

191192
ts->tv_sec = retval;
192193
ts->tv_nsec = 0;

arch/x86/platform/mrst/vrtc.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,11 @@ EXPORT_SYMBOL_GPL(vrtc_cmos_write);
5858
unsigned long vrtc_get_time(void)
5959
{
6060
u8 sec, min, hour, mday, mon;
61+
unsigned long flags;
6162
u32 year;
6263

64+
spin_lock_irqsave(&rtc_lock, flags);
65+
6366
while ((vrtc_cmos_read(RTC_FREQ_SELECT) & RTC_UIP))
6467
cpu_relax();
6568

@@ -70,6 +73,8 @@ unsigned long vrtc_get_time(void)
7073
mon = vrtc_cmos_read(RTC_MONTH);
7174
year = vrtc_cmos_read(RTC_YEAR);
7275

76+
spin_unlock_irqrestore(&rtc_lock, flags);
77+
7378
/* vRTC YEAR reg contains the offset to 1960 */
7479
year += 1960;
7580

@@ -83,8 +88,10 @@ unsigned long vrtc_get_time(void)
8388
int vrtc_set_mmss(unsigned long nowtime)
8489
{
8590
int real_sec, real_min;
91+
unsigned long flags;
8692
int vrtc_min;
8793

94+
spin_lock_irqsave(&rtc_lock, flags);
8895
vrtc_min = vrtc_cmos_read(RTC_MINUTES);
8996

9097
real_sec = nowtime % 60;
@@ -95,6 +102,8 @@ int vrtc_set_mmss(unsigned long nowtime)
95102

96103
vrtc_cmos_write(real_sec, RTC_SECONDS);
97104
vrtc_cmos_write(real_min, RTC_MINUTES);
105+
spin_unlock_irqrestore(&rtc_lock, flags);
106+
98107
return 0;
99108
}
100109

include/linux/irqdomain.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ extern void irq_domain_del(struct irq_domain *domain);
8080
#endif /* CONFIG_IRQ_DOMAIN */
8181

8282
#if defined(CONFIG_IRQ_DOMAIN) && defined(CONFIG_OF_IRQ)
83+
extern struct irq_domain_ops irq_domain_simple_ops;
8384
extern void irq_domain_add_simple(struct device_node *controller, int irq_base);
8485
extern void irq_domain_generate_simple(const struct of_device_id *match,
8586
u64 phys_base, unsigned int irq_start);

include/linux/sched.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1956,7 +1956,6 @@ static inline void disable_sched_clock_irqtime(void) {}
19561956

19571957
extern unsigned long long
19581958
task_sched_runtime(struct task_struct *task);
1959-
extern unsigned long long thread_group_sched_runtime(struct task_struct *task);
19601959

19611960
/* sched_exec is called by processes performing an exec */
19621961
#ifdef CONFIG_SMP

kernel/irq/irqdomain.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,11 @@ void irq_domain_add(struct irq_domain *domain)
2929
*/
3030
for (hwirq = 0; hwirq < domain->nr_irq; hwirq++) {
3131
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) {
3337
/* things are broken; just report, don't clean up */
3438
WARN(1, "error: irq_desc already assigned to a domain");
3539
return;

kernel/posix-cpu-timers.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ void thread_group_cputime(struct task_struct *tsk, struct task_cputime *times)
250250
do {
251251
times->utime = cputime_add(times->utime, t->utime);
252252
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);
254254
} while_each_thread(tsk, t);
255255
out:
256256
rcu_read_unlock();
@@ -312,7 +312,8 @@ static int cpu_clock_sample_group(const clockid_t which_clock,
312312
cpu->cpu = cputime.utime;
313313
break;
314314
case CPUCLOCK_SCHED:
315-
cpu->sched = thread_group_sched_runtime(p);
315+
thread_group_cputime(p, &cputime);
316+
cpu->sched = cputime.sum_exec_runtime;
316317
break;
317318
}
318319
return 0;

kernel/sched.c

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3724,30 +3724,6 @@ unsigned long long task_sched_runtime(struct task_struct *p)
37243724
return ns;
37253725
}
37263726

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-
37513727
/*
37523728
* Account user cpu time to a process.
37533729
* @p: the process that the cpu time gets accounted to
@@ -4372,7 +4348,7 @@ static inline void sched_submit_work(struct task_struct *tsk)
43724348
blk_schedule_flush_plug(tsk);
43734349
}
43744350

4375-
asmlinkage void schedule(void)
4351+
asmlinkage void __sched schedule(void)
43764352
{
43774353
struct task_struct *tsk = current;
43784354

kernel/sched_rt.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1050,7 +1050,7 @@ select_task_rq_rt(struct task_struct *p, int sd_flag, int flags)
10501050
*/
10511051
if (curr && unlikely(rt_task(curr)) &&
10521052
(curr->rt.nr_cpus_allowed < 2 ||
1053-
curr->prio < p->prio) &&
1053+
curr->prio <= p->prio) &&
10541054
(p->rt.nr_cpus_allowed > 1)) {
10551055
int target = find_lowest_rq(p);
10561056

@@ -1581,7 +1581,7 @@ static void task_woken_rt(struct rq *rq, struct task_struct *p)
15811581
p->rt.nr_cpus_allowed > 1 &&
15821582
rt_task(rq->curr) &&
15831583
(rq->curr->rt.nr_cpus_allowed < 2 ||
1584-
rq->curr->prio < p->prio))
1584+
rq->curr->prio <= p->prio))
15851585
push_rt_tasks(rq);
15861586
}
15871587

0 commit comments

Comments
 (0)