mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Ingo Molnar <mingo@elte.hu>
Cc: Andrew Morton <akpm@osdl.org>, linux-kernel@vger.kernel.org
Subject: [patch] high-res timers: core, do itimer rearming in process context, fix2
Date: Thu, 21 Dec 2006 08:15:25 +0100	[thread overview]
Message-ID: <1166685325.29505.593.camel@localhost.localdomain> (raw)
In-Reply-To: <20061219211629.GA10586@elte.hu>

Subject: [patch] high-res timers: core, do itimer rearming in process context, fix2
From: Thomas Gleixner <tglx@linutronix.de>

The rearming code in signal.c has to read the time and can not rely on
the timer->base->softirq time anymore, as it is not longer running in
softirq context.

Ensure, that the it_real_incr variable in the shared signal struct is
set to zero, when setitimer disables the itimer. Otherwise it could
happen that an inactive itimer gets rearmed by a SIGALRM.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

---
 kernel/signal.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: 2.6.19-git19/kernel/signal.c
===================================================================
--- 2.6.19-git19.orig/kernel/signal.c
+++ 2.6.19-git19/kernel/signal.c
@@ -477,7 +477,7 @@ int dequeue_signal(struct task_struct *t
 
 			if (!hrtimer_is_queued(tmr) &&
 			    tsk->signal->it_real_incr.tv64 != 0) {
-				hrtimer_forward(tmr, hrtimer_cb_get_time(tmr),
+				hrtimer_forward(tmr, tmr->base->get_time(),
 						tsk->signal->it_real_incr);
 				hrtimer_restart(tmr);
 			}
Index: 2.6.19-git19/kernel/itimer.c
===================================================================
--- 2.6.19-git19.orig/kernel/itimer.c
+++ 2.6.19-git19/kernel/itimer.c
@@ -226,11 +226,14 @@ again:
 			spin_unlock_irq(&tsk->sighand->siglock);
 			goto again;
 		}
-		tsk->signal->it_real_incr =
-			timeval_to_ktime(value->it_interval);
 		expires = timeval_to_ktime(value->it_value);
-		if (expires.tv64 != 0)
+		if (expires.tv64 != 0) {
+			tsk->signal->it_real_incr =
+				timeval_to_ktime(value->it_interval);
 			hrtimer_start(timer, expires, HRTIMER_MODE_REL);
+		} else
+			tsk->signal->it_real_incr.tv64 = 0;
+
 		spin_unlock_irq(&tsk->sighand->siglock);
 		break;
 	case ITIMER_VIRTUAL:



      reply	other threads:[~2006-12-21  7:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-19 21:16 [patch] high-res timers: core, do itimer rearming in process context, fix Ingo Molnar
2006-12-21  7:15 ` Thomas Gleixner [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1166685325.29505.593.camel@localhost.localdomain \
    --to=tglx@linutronix.de \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®