public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] hrtimer: correct a few numbers in comments and printk outputs
@ 2009-11-20 19:23 Uwe Kleine-König
  2009-11-20 19:23 ` [PATCH 2/2] clockevents: assert min_delta_ns being increased in error path Uwe Kleine-König
  2009-11-23 23:25 ` [PATCH 1/2] hrtimer: correct a few numbers in comments and printk outputs Andrew Morton
  0 siblings, 2 replies; 8+ messages in thread
From: Uwe Kleine-König @ 2009-11-20 19:23 UTC (permalink / raw)
  To: linux-kernel; +Cc: Thomas Gleixner, Ingo Molnar, Peter Zijlstra, Luming Yu

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Luming Yu <luming.yu@gmail.com>
---
 kernel/hrtimer.c           |    4 ++--
 kernel/time/tick-oneshot.c |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c
index 3e1c36e..4443295 100644
--- a/kernel/hrtimer.c
+++ b/kernel/hrtimer.c
@@ -1220,7 +1220,7 @@ static void __run_hrtimer(struct hrtimer *timer, ktime_t *now)
 static int force_clock_reprogram;
 
 /*
- * After 5 iteration's attempts, we consider that hrtimer_interrupt()
+ * After 4 iteration's attempts, we consider that hrtimer_interrupt()
  * is hanging, which could happen with something that slows the interrupt
  * such as the tracing. Then we force the clock reprogramming for each future
  * hrtimer interrupts to avoid infinite loops and use the min_delta_ns
@@ -1257,7 +1257,7 @@ void hrtimer_interrupt(struct clock_event_device *dev)
 	dev->next_event.tv64 = KTIME_MAX;
 
  retry:
-	/* 5 retries is enough to notice a hang */
+	/* 4 retries is enough to notice a hang */
 	if (!(++nr_retries % 5))
 		hrtimer_interrupt_hanging(dev, ktime_sub(ktime_get(), now));
 
diff --git a/kernel/time/tick-oneshot.c b/kernel/time/tick-oneshot.c
index a96c0e2..2dd23c3 100644
--- a/kernel/time/tick-oneshot.c
+++ b/kernel/time/tick-oneshot.c
@@ -39,7 +39,7 @@ int tick_dev_program_event(struct clock_event_device *dev, ktime_t expires,
 
 		/*
 		 * We tried 2 times to program the device with the given
-		 * min_delta_ns. If that's not working then we double it
+		 * min_delta_ns. If that's not working then we increase it
 		 * and emit a warning.
 		 */
 		if (++i > 2) {
@@ -52,7 +52,7 @@ int tick_dev_program_event(struct clock_event_device *dev, ktime_t expires,
 			printk(KERN_WARNING
 			       "CE: %s increasing min_delta_ns to %lu nsec\n",
 			       dev->name ? dev->name : "?",
-			       dev->min_delta_ns << 1);
+			       dev->min_delta_ns);
 
 			i = 0;
 		}
-- 
1.6.5.2


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

* [PATCH 2/2] clockevents: assert min_delta_ns being increased in error path
  2009-11-20 19:23 [PATCH 1/2] hrtimer: correct a few numbers in comments and printk outputs Uwe Kleine-König
@ 2009-11-20 19:23 ` Uwe Kleine-König
  2009-11-23 23:25 ` [PATCH 1/2] hrtimer: correct a few numbers in comments and printk outputs Andrew Morton
  1 sibling, 0 replies; 8+ messages in thread
From: Uwe Kleine-König @ 2009-11-20 19:23 UTC (permalink / raw)
  To: linux-kernel; +Cc: Thomas Gleixner, Ingo Molnar, Peter Zijlstra, Luming Yu

tick_dev_program_event failed to increase min_delta_ns if the initial
value was 1.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Luming Yu <luming.yu@gmail.com>
---
 kernel/time/tick-oneshot.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/kernel/time/tick-oneshot.c b/kernel/time/tick-oneshot.c
index 2dd23c3..c3712c4 100644
--- a/kernel/time/tick-oneshot.c
+++ b/kernel/time/tick-oneshot.c
@@ -44,7 +44,7 @@ int tick_dev_program_event(struct clock_event_device *dev, ktime_t expires,
 		 */
 		if (++i > 2) {
 			/* Increase the min. delta and try again */
-			if (!dev->min_delta_ns)
+			if (dev->min_delta_ns <= 1)
 				dev->min_delta_ns = 5000;
 			else
 				dev->min_delta_ns += dev->min_delta_ns >> 1;
-- 
1.6.5.2


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

* Re: [PATCH 1/2] hrtimer: correct a few numbers in comments and printk outputs
  2009-11-20 19:23 [PATCH 1/2] hrtimer: correct a few numbers in comments and printk outputs Uwe Kleine-König
  2009-11-20 19:23 ` [PATCH 2/2] clockevents: assert min_delta_ns being increased in error path Uwe Kleine-König
@ 2009-11-23 23:25 ` Andrew Morton
  2009-11-24 10:14   ` Uwe Kleine-König
  1 sibling, 1 reply; 8+ messages in thread
From: Andrew Morton @ 2009-11-23 23:25 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: linux-kernel, Thomas Gleixner, Ingo Molnar, Peter Zijlstra,
	Luming Yu

On Fri, 20 Nov 2009 20:23:39 +0100
Uwe Kleine-K__nig  <u.kleine-koenig@pengutronix.de> wrote:

> @@ -52,7 +52,7 @@ int tick_dev_program_event(struct clock_event_device *dev, ktime_t expires,
>  			printk(KERN_WARNING
>  			       "CE: %s increasing min_delta_ns to %lu nsec\n",
>  			       dev->name ? dev->name : "?",
> -			       dev->min_delta_ns << 1);
> +			       dev->min_delta_ns);
>  
>  			i = 0;
>  		}

This one's already in linux-next:

@@ -50,9 +50,9 @@ int tick_dev_program_event(struct clock_
 				dev->min_delta_ns += dev->min_delta_ns >> 1;
 
 			printk(KERN_WARNING
-			       "CE: %s increasing min_delta_ns to %lu nsec\n",
+			       "CE: %s increasing min_delta_ns to %llu nsec\n",
 			       dev->name ? dev->name : "?",
-			       dev->min_delta_ns << 1);
+			       (unsigned long long) dev->min_delta_ns << 1);
 
 			i = 0;
 		}

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

* Re: [PATCH 1/2] hrtimer: correct a few numbers in comments and printk outputs
  2009-11-23 23:25 ` [PATCH 1/2] hrtimer: correct a few numbers in comments and printk outputs Andrew Morton
@ 2009-11-24 10:14   ` Uwe Kleine-König
  2009-11-25 19:56     ` Andrew Morton
  0 siblings, 1 reply; 8+ messages in thread
From: Uwe Kleine-König @ 2009-11-24 10:14 UTC (permalink / raw)
  To: Andrew Morton
  Cc: linux-kernel, Thomas Gleixner, Ingo Molnar, Peter Zijlstra,
	Luming Yu

Hello Andrew,

On Mon, Nov 23, 2009 at 03:25:16PM -0800, Andrew Morton wrote:
> On Fri, 20 Nov 2009 20:23:39 +0100
> Uwe Kleine-K__nig  <u.kleine-koenig@pengutronix.de> wrote:
> 
> > @@ -52,7 +52,7 @@ int tick_dev_program_event(struct clock_event_device *dev, ktime_t expires,
> >  			printk(KERN_WARNING
> >  			       "CE: %s increasing min_delta_ns to %lu nsec\n",
> >  			       dev->name ? dev->name : "?",
> > -			       dev->min_delta_ns << 1);
> > +			       dev->min_delta_ns);
> >  
> >  			i = 0;
> >  		}
> 
> This one's already in linux-next:
> 
> @@ -50,9 +50,9 @@ int tick_dev_program_event(struct clock_
>  				dev->min_delta_ns += dev->min_delta_ns >> 1;
>  
>  			printk(KERN_WARNING
> -			       "CE: %s increasing min_delta_ns to %lu nsec\n",
> +			       "CE: %s increasing min_delta_ns to %llu nsec\n",
>  			       dev->name ? dev->name : "?",
> -			       dev->min_delta_ns << 1);
> +			       (unsigned long long) dev->min_delta_ns << 1);
'<< 1' is wrong here, too.

Best regards
Uwe

-- 
Pengutronix e.K.                              | Uwe Kleine-König            |
Industrial Linux Solutions                    | http://www.pengutronix.de/  |

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

* Re: [PATCH 1/2] hrtimer: correct a few numbers in comments and printk outputs
  2009-11-24 10:14   ` Uwe Kleine-König
@ 2009-11-25 19:56     ` Andrew Morton
  2009-11-25 20:18       ` Thomas Gleixner
  0 siblings, 1 reply; 8+ messages in thread
From: Andrew Morton @ 2009-11-25 19:56 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: linux-kernel, Thomas Gleixner, Ingo Molnar, Peter Zijlstra,
	Luming Yu

On Tue, 24 Nov 2009 11:14:03 +0100
Uwe Kleine-K__nig  <u.kleine-koenig@pengutronix.de> wrote:

> Hello Andrew,
> 
> On Mon, Nov 23, 2009 at 03:25:16PM -0800, Andrew Morton wrote:
> > On Fri, 20 Nov 2009 20:23:39 +0100
> > Uwe Kleine-K__nig  <u.kleine-koenig@pengutronix.de> wrote:
> > 
> > > @@ -52,7 +52,7 @@ int tick_dev_program_event(struct clock_event_device *dev, ktime_t expires,
> > >  			printk(KERN_WARNING
> > >  			       "CE: %s increasing min_delta_ns to %lu nsec\n",
> > >  			       dev->name ? dev->name : "?",
> > > -			       dev->min_delta_ns << 1);
> > > +			       dev->min_delta_ns);
> > >  
> > >  			i = 0;
> > >  		}
> > 
> > This one's already in linux-next:
> > 
> > @@ -50,9 +50,9 @@ int tick_dev_program_event(struct clock_
> >  				dev->min_delta_ns += dev->min_delta_ns >> 1;
> >  
> >  			printk(KERN_WARNING
> > -			       "CE: %s increasing min_delta_ns to %lu nsec\n",
> > +			       "CE: %s increasing min_delta_ns to %llu nsec\n",
> >  			       dev->name ? dev->name : "?",
> > -			       dev->min_delta_ns << 1);
> > +			       (unsigned long long) dev->min_delta_ns << 1);
> '<< 1' is wrong here, too.
> 

What's wrong with it?  That leftshift appears to be to compensate for
the rightshift a few lines above.

That change was unobvious and unchangelogged, so here we are again.

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

* Re: [PATCH 1/2] hrtimer: correct a few numbers in comments and printk outputs
  2009-11-25 19:56     ` Andrew Morton
@ 2009-11-25 20:18       ` Thomas Gleixner
  2009-11-25 21:18         ` Andrew Morton
  0 siblings, 1 reply; 8+ messages in thread
From: Thomas Gleixner @ 2009-11-25 20:18 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Uwe Kleine-König, linux-kernel, Ingo Molnar, Peter Zijlstra,
	Luming Yu

On Wed, 25 Nov 2009, Andrew Morton wrote:

> On Tue, 24 Nov 2009 11:14:03 +0100
> Uwe Kleine-K__nig  <u.kleine-koenig@pengutronix.de> wrote:
> 
> > Hello Andrew,
> > 
> > On Mon, Nov 23, 2009 at 03:25:16PM -0800, Andrew Morton wrote:
> > > On Fri, 20 Nov 2009 20:23:39 +0100
> > > Uwe Kleine-K__nig  <u.kleine-koenig@pengutronix.de> wrote:
> > > 
> > > > @@ -52,7 +52,7 @@ int tick_dev_program_event(struct clock_event_device *dev, ktime_t expires,
> > > >  			printk(KERN_WARNING
> > > >  			       "CE: %s increasing min_delta_ns to %lu nsec\n",
> > > >  			       dev->name ? dev->name : "?",
> > > > -			       dev->min_delta_ns << 1);
> > > > +			       dev->min_delta_ns);
> > > >  
> > > >  			i = 0;
> > > >  		}
> > > 
> > > This one's already in linux-next:
> > > 
> > > @@ -50,9 +50,9 @@ int tick_dev_program_event(struct clock_
> > >  				dev->min_delta_ns += dev->min_delta_ns >> 1;
> > >  
> > >  			printk(KERN_WARNING
> > > -			       "CE: %s increasing min_delta_ns to %lu nsec\n",
> > > +			       "CE: %s increasing min_delta_ns to %llu nsec\n",
> > >  			       dev->name ? dev->name : "?",
> > > -			       dev->min_delta_ns << 1);
> > > +			       (unsigned long long) dev->min_delta_ns << 1);
> > '<< 1' is wrong here, too.
> > 
> 
> What's wrong with it?  That leftshift appears to be to compensate for
> the rightshift a few lines above.
> 
> That change was unobvious and unchangelogged, so here we are again.

That's actually my fault. In commit 61c22c34 I removed the WARN_ON
which we put there to gather data on kerneloops.org for a while and
did not fix the printk format string.

Will take care of it. Thanks,

     tglx

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

* Re: [PATCH 1/2] hrtimer: correct a few numbers in comments and printk outputs
  2009-11-25 20:18       ` Thomas Gleixner
@ 2009-11-25 21:18         ` Andrew Morton
  2009-11-25 22:07           ` Thomas Gleixner
  0 siblings, 1 reply; 8+ messages in thread
From: Andrew Morton @ 2009-11-25 21:18 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: Uwe Kleine-König, linux-kernel, Ingo Molnar, Peter Zijlstra,
	Luming Yu

On Wed, 25 Nov 2009 21:18:39 +0100 (CET)
Thomas Gleixner <tglx@linutronix.de> wrote:

> On Wed, 25 Nov 2009, Andrew Morton wrote:
> 
> > On Tue, 24 Nov 2009 11:14:03 +0100
> > Uwe Kleine-K__nig  <u.kleine-koenig@pengutronix.de> wrote:
> > 
> > > Hello Andrew,
> > > 
> > > On Mon, Nov 23, 2009 at 03:25:16PM -0800, Andrew Morton wrote:
> > > > On Fri, 20 Nov 2009 20:23:39 +0100
> > > > Uwe Kleine-K__nig  <u.kleine-koenig@pengutronix.de> wrote:
> > > > 
> > > > > @@ -52,7 +52,7 @@ int tick_dev_program_event(struct clock_event_device *dev, ktime_t expires,
> > > > >  			printk(KERN_WARNING
> > > > >  			       "CE: %s increasing min_delta_ns to %lu nsec\n",
> > > > >  			       dev->name ? dev->name : "?",
> > > > > -			       dev->min_delta_ns << 1);
> > > > > +			       dev->min_delta_ns);
> > > > >  
> > > > >  			i = 0;
> > > > >  		}
> > > > 
> > > > This one's already in linux-next:
> > > > 
> > > > @@ -50,9 +50,9 @@ int tick_dev_program_event(struct clock_
> > > >  				dev->min_delta_ns += dev->min_delta_ns >> 1;
> > > >  
> > > >  			printk(KERN_WARNING
> > > > -			       "CE: %s increasing min_delta_ns to %lu nsec\n",
> > > > +			       "CE: %s increasing min_delta_ns to %llu nsec\n",
> > > >  			       dev->name ? dev->name : "?",
> > > > -			       dev->min_delta_ns << 1);
> > > > +			       (unsigned long long) dev->min_delta_ns << 1);
> > > '<< 1' is wrong here, too.
> > > 
> > 
> > What's wrong with it?  That leftshift appears to be to compensate for
> > the rightshift a few lines above.
> > 
> > That change was unobvious and unchangelogged, so here we are again.
> 
> That's actually my fault. In commit 61c22c34 I removed the WARN_ON
> which we put there to gather data on kerneloops.org for a while and
> did not fix the printk format string.
> 

The issue is not the format string.  I'm wondering why Uwe removed that
left-shift of dev->min_delta_ns.


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

* Re: [PATCH 1/2] hrtimer: correct a few numbers in comments and printk outputs
  2009-11-25 21:18         ` Andrew Morton
@ 2009-11-25 22:07           ` Thomas Gleixner
  0 siblings, 0 replies; 8+ messages in thread
From: Thomas Gleixner @ 2009-11-25 22:07 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Uwe Kleine-König, linux-kernel, Ingo Molnar, Peter Zijlstra,
	Luming Yu

On Wed, 25 Nov 2009, Andrew Morton wrote:
> On Wed, 25 Nov 2009 21:18:39 +0100 (CET)
> Thomas Gleixner <tglx@linutronix.de> wrote:
> > > > > @@ -50,9 +50,9 @@ int tick_dev_program_event(struct clock_
> > > > >  				dev->min_delta_ns += dev->min_delta_ns >> 1;
> > > > >  
> > > > >  			printk(KERN_WARNING
> > > > > -			       "CE: %s increasing min_delta_ns to %lu nsec\n",
> > > > > +			       "CE: %s increasing min_delta_ns to %llu nsec\n",
> > > > >  			       dev->name ? dev->name : "?",
> > > > > -			       dev->min_delta_ns << 1);
> > > > > +			       (unsigned long long) dev->min_delta_ns << 1);
> > > > '<< 1' is wrong here, too.
> > > > 
> > > 
> > > What's wrong with it?  That leftshift appears to be to compensate for
> > > the rightshift a few lines above.
> > > 
> > > That change was unobvious and unchangelogged, so here we are again.
> > 
> > That's actually my fault. In commit 61c22c34 I removed the WARN_ON
> > which we put there to gather data on kerneloops.org for a while and
> > did not fix the printk format string.
> > 
> 
> The issue is not the format string.  I'm wondering why Uwe removed that
> left-shift of dev->min_delta_ns.

Sorry, I'm confused: I did not fix the argument. The printk was
actually before the code which adjusted the min_delta_ns in the old
WARN_ON case. When I removed the WARN_ON I moved the printk down and
kept the << 1 which is crap. We want to print the new value not the
double of it.

Thanks,

	tglx

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

end of thread, other threads:[~2009-11-25 22:08 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-20 19:23 [PATCH 1/2] hrtimer: correct a few numbers in comments and printk outputs Uwe Kleine-König
2009-11-20 19:23 ` [PATCH 2/2] clockevents: assert min_delta_ns being increased in error path Uwe Kleine-König
2009-11-23 23:25 ` [PATCH 1/2] hrtimer: correct a few numbers in comments and printk outputs Andrew Morton
2009-11-24 10:14   ` Uwe Kleine-König
2009-11-25 19:56     ` Andrew Morton
2009-11-25 20:18       ` Thomas Gleixner
2009-11-25 21:18         ` Andrew Morton
2009-11-25 22:07           ` Thomas Gleixner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox