LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH 1/5] hrtimer_nanosleep: use -EINTR, not -ERESTARTNOHAND
@ 2008-02-01 13:37 Oleg Nesterov
  2008-02-01 13:50 ` Thomas Gleixner
  0 siblings, 1 reply; 3+ messages in thread
From: Oleg Nesterov @ 2008-02-01 13:37 UTC (permalink / raw)
  To: Andrew Morton, Thomas Gleixner
  Cc: Alexey Dobriyan, Ingo Molnar, Pavel Emelyanov, Peter Zijlstra,
	linux-kernel

hrtimer_nanosleep:

	/* Absolute timers do not update the rmtp value and restart: */
	return -ERESTARTNOHAND;

This is not right, -ERESTARTNOHAND means we will do restart if there is no
in fact pending signal, and worse, this restart will use the same unchanged
"__user *rmtp" parameter.

Use -EINTR instead.

Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>

--- MM/kernel/hrtimer.c~HRT_RMTP~	2008-01-27 17:07:39.000000000 +0300
+++ MM/kernel/hrtimer.c~HRT_RMTP	2008-02-01 13:43:52.000000000 +0300
@@ -1359,7 +1359,7 @@ long hrtimer_nanosleep(struct timespec *
 
 	/* Absolute timers do not update the rmtp value and restart: */
 	if (mode == HRTIMER_MODE_ABS)
-		return -ERESTARTNOHAND;
+		return -EINTR;
 
 	if (rmtp) {
 		rem = ktime_sub(t.timer.expires, t.timer.base->get_time());


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/5] hrtimer_nanosleep: use -EINTR, not -ERESTARTNOHAND
  2008-02-01 13:37 [PATCH 1/5] hrtimer_nanosleep: use -EINTR, not -ERESTARTNOHAND Oleg Nesterov
@ 2008-02-01 13:50 ` Thomas Gleixner
  2008-02-01 14:20   ` Oleg Nesterov
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Gleixner @ 2008-02-01 13:50 UTC (permalink / raw)
  To: Oleg Nesterov
  Cc: Andrew Morton, Alexey Dobriyan, Ingo Molnar, Pavel Emelyanov,
	Peter Zijlstra, linux-kernel

On Fri, 1 Feb 2008, Oleg Nesterov wrote:

> hrtimer_nanosleep:
> 
> 	/* Absolute timers do not update the rmtp value and restart: */
> 	return -ERESTARTNOHAND;
> 
> This is not right, -ERESTARTNOHAND means we will do restart if there is no
> in fact pending signal, and worse, this restart will use the same unchanged
> "__user *rmtp" parameter.

-ERESTARTNOHAND is safe here. We want to restart the timer.

The rmtp problem is separate, but that's addressed by your follow up changes.
 
Thanks,
	tglx

> Use -EINTR instead.
> 
> Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>
> 
> --- MM/kernel/hrtimer.c~HRT_RMTP~	2008-01-27 17:07:39.000000000 +0300
> +++ MM/kernel/hrtimer.c~HRT_RMTP	2008-02-01 13:43:52.000000000 +0300
> @@ -1359,7 +1359,7 @@ long hrtimer_nanosleep(struct timespec *
>  
>  	/* Absolute timers do not update the rmtp value and restart: */
>  	if (mode == HRTIMER_MODE_ABS)
> -		return -ERESTARTNOHAND;
> +		return -EINTR;
>  
>  	if (rmtp) {
>  		rem = ktime_sub(t.timer.expires, t.timer.base->get_time());
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/5] hrtimer_nanosleep: use -EINTR, not -ERESTARTNOHAND
  2008-02-01 13:50 ` Thomas Gleixner
@ 2008-02-01 14:20   ` Oleg Nesterov
  0 siblings, 0 replies; 3+ messages in thread
From: Oleg Nesterov @ 2008-02-01 14:20 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: Andrew Morton, Alexey Dobriyan, Ingo Molnar, Pavel Emelyanov,
	Peter Zijlstra, linux-kernel

On 02/01, Thomas Gleixner wrote:
>
> On Fri, 1 Feb 2008, Oleg Nesterov wrote:
> 
> > hrtimer_nanosleep:
> > 
> > 	/* Absolute timers do not update the rmtp value and restart: */
> > 	return -ERESTARTNOHAND;
> > 
> > This is not right, -ERESTARTNOHAND means we will do restart if there is no
> > in fact pending signal, and worse, this restart will use the same unchanged
> > "__user *rmtp" parameter.
> 
> -ERESTARTNOHAND is safe here. We want to restart the timer.

Ah. I was greatly confused by the comment, it says "do not ... restart",
now I understand what this _actually_ means.

And yes, I was wrong. If restart is wanted, it is safe to use the original
*rqtp, the timer is HRTIMER_MODE_ABS.

Thanks Thomas!

Andrew, please ignore this patch.

Oleg.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-02-01 14:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-01 13:37 [PATCH 1/5] hrtimer_nanosleep: use -EINTR, not -ERESTARTNOHAND Oleg Nesterov
2008-02-01 13:50 ` Thomas Gleixner
2008-02-01 14:20   ` Oleg Nesterov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).