[PATCH] hrtimers: fixup itimer conversion
The itimer conversion removed the locking which protects the timer and variables in the shared signal structure. Steven Rostedt found the problem in the latest -rt patches. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
parent
853609b61e
commit
bc1978d404
1 changed files with 10 additions and 1 deletions
|
@ -49,9 +49,11 @@ int do_getitimer(int which, struct itimerval *value)
|
||||||
|
|
||||||
switch (which) {
|
switch (which) {
|
||||||
case ITIMER_REAL:
|
case ITIMER_REAL:
|
||||||
|
spin_lock_irq(&tsk->sighand->siglock);
|
||||||
value->it_value = itimer_get_remtime(&tsk->signal->real_timer);
|
value->it_value = itimer_get_remtime(&tsk->signal->real_timer);
|
||||||
value->it_interval =
|
value->it_interval =
|
||||||
ktime_to_timeval(tsk->signal->it_real_incr);
|
ktime_to_timeval(tsk->signal->it_real_incr);
|
||||||
|
spin_unlock_irq(&tsk->sighand->siglock);
|
||||||
break;
|
break;
|
||||||
case ITIMER_VIRTUAL:
|
case ITIMER_VIRTUAL:
|
||||||
read_lock(&tasklist_lock);
|
read_lock(&tasklist_lock);
|
||||||
|
@ -150,8 +152,14 @@ int do_setitimer(int which, struct itimerval *value, struct itimerval *ovalue)
|
||||||
|
|
||||||
switch (which) {
|
switch (which) {
|
||||||
case ITIMER_REAL:
|
case ITIMER_REAL:
|
||||||
|
again:
|
||||||
|
spin_lock_irq(&tsk->sighand->siglock);
|
||||||
timer = &tsk->signal->real_timer;
|
timer = &tsk->signal->real_timer;
|
||||||
hrtimer_cancel(timer);
|
/* We are sharing ->siglock with it_real_fn() */
|
||||||
|
if (hrtimer_try_to_cancel(timer) < 0) {
|
||||||
|
spin_unlock_irq(&tsk->sighand->siglock);
|
||||||
|
goto again;
|
||||||
|
}
|
||||||
if (ovalue) {
|
if (ovalue) {
|
||||||
ovalue->it_value = itimer_get_remtime(timer);
|
ovalue->it_value = itimer_get_remtime(timer);
|
||||||
ovalue->it_interval
|
ovalue->it_interval
|
||||||
|
@ -162,6 +170,7 @@ int do_setitimer(int which, struct itimerval *value, struct itimerval *ovalue)
|
||||||
expires = timeval_to_ktime(value->it_value);
|
expires = timeval_to_ktime(value->it_value);
|
||||||
if (expires.tv64 != 0)
|
if (expires.tv64 != 0)
|
||||||
hrtimer_start(timer, expires, HRTIMER_REL);
|
hrtimer_start(timer, expires, HRTIMER_REL);
|
||||||
|
spin_unlock_irq(&tsk->sighand->siglock);
|
||||||
break;
|
break;
|
||||||
case ITIMER_VIRTUAL:
|
case ITIMER_VIRTUAL:
|
||||||
nval = timeval_to_cputime(&value->it_value);
|
nval = timeval_to_cputime(&value->it_value);
|
||||||
|
|
Loading…
Reference in a new issue