* ktimers in RT causing bad bogomips and more.
@ 2005-10-25 22:15 Steven Rostedt
2005-10-25 22:26 ` Thomas Gleixner
0 siblings, 1 reply; 3+ messages in thread
From: Steven Rostedt @ 2005-10-25 22:15 UTC (permalink / raw)
To: Thomas Gleixner; +Cc: john stultz, LKML, Ingo Molnar
Hi Thomas,
A colleague of mine at my customer site (also named Thomas), noticed
that the Bogomips of Ingo's kernel did not match the Bogomips of the
2.6.14-rc5 kernel. I had other problems at the time to take a look, but
my machine at home is showing weirdness that was seen on that machine
the other Thomas had. So I started taking a look into the cause for the
differences in the bogomips.
Well, you seem to have the jiffies running wild. At least for start up.
First, lets take a look at where jiffies is incremented. That's done by
do_timer, which is called in clockevents.c by handle_tick,
handle_tick_update and handle_tick_update_profile. So when any of these
functions are called, jiffies is incremented. Is that expected?
This gets even more complex, since handle_tick is called by
handle_next_event_tick, handle_next_event_tick_update and
handle_next_event_all.
Now these functions call handle_tick several times, determined by the
value returned by ktimer_interrupt.
For example:
static void handle_nextevent_tick(struct pt_regs *regs)
{
int res;
res = ktimer_interrupt();
for (; res > 0; res--)
handle_tick(regs);
}
Now looking at ktimer_interrupt, the beginning looks like this:
int ktimer_interrupt(void)
{
struct ktimer_base *base;
ktime_t expires_next, now;
int i, raise = 0, ret = 0;
int cpu = smp_processor_id();
struct ktimer_hres *hres = &per_cpu(ktimer_hres, cpu);
/* As long as we did not switch over to high resolution mode
* we expect, that the event source is running in periodic
* mode when it is a source serving other (tick based)
* functionality than next event
*
*/
if (!hres->active)
return CLOCK_EVT_RUN_CYCLIC;
Is it really expected to call handle_ticks CLOCK_EVT_RUN_CYCLIC
times? :-) I don't think so (It's seven BTW).
So, I figured the following patch might be in order. Thomas, what do you
think?
It at least makes my bogomips go back to 736.41 from 74.27 :-)
-- Steve
Index: rt_linux_ernie/kernel/ktimers.c
===================================================================
--- rt_linux_ernie.orig/kernel/ktimers.c 2005-10-25 08:49:42.000000000 -0400
+++ rt_linux_ernie/kernel/ktimers.c 2005-10-25 18:03:21.000000000 -0400
@@ -341,7 +341,7 @@
*
*/
if (!hres->active)
- return CLOCK_EVT_RUN_CYCLIC;
+ return -CLOCK_EVT_RUN_CYCLIC;
now = do_ktime_get();
Index: rt_linux_ernie/kernel/time/clockevents.c
===================================================================
--- rt_linux_ernie.orig/kernel/time/clockevents.c 2005-10-25 18:02:33.000000000 -0400
+++ rt_linux_ernie/kernel/time/clockevents.c 2005-10-25 18:07:07.000000000 -0400
@@ -167,6 +167,10 @@
int res;
res = ktimer_interrupt();
+
+ if (res == -CLOCK_EVT_RUN_CYCLIC)
+ res = 1;
+
for (; res > 0; res--)
handle_tick(regs);
}
@@ -190,6 +194,9 @@
if ((res = ktimer_interrupt()) == 0)
return;
+ if (res == -CLOCK_EVT_RUN_CYCLIC)
+ res = 1;
+
for (; res > 0; res--)
handle_tick(regs);
@@ -224,6 +231,9 @@
if ((res = ktimer_interrupt()) == 0)
return;
+ if (res == -CLOCK_EVT_RUN_CYCLIC)
+ res = 1;
+
for (; res > 0; res--)
handle_tick(regs);
Either the above patch, or just have ktimer_interrupt return 1. But I
figured that you want to differentiate this. But maybe not.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: ktimers in RT causing bad bogomips and more.
2005-10-25 22:15 ktimers in RT causing bad bogomips and more Steven Rostedt
@ 2005-10-25 22:26 ` Thomas Gleixner
2005-10-25 22:36 ` Steven Rostedt
0 siblings, 1 reply; 3+ messages in thread
From: Thomas Gleixner @ 2005-10-25 22:26 UTC (permalink / raw)
To: Steven Rostedt; +Cc: john stultz, LKML, Ingo Molnar
On Tue, 2005-10-25 at 18:15 -0400, Steven Rostedt wrote:
> if (!hres->active)
> return CLOCK_EVT_RUN_CYCLIC;
I'm searching for the brown paperbag.
Thats the startup code before switching over to high resolution, so it
should return 1, nothing else.
CLOCK_EVT_RUN_CYCLIC is a leftover of the initial implementation, which
did not take tick overruns into account.
Thanks,
tglx
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: ktimers in RT causing bad bogomips and more.
2005-10-25 22:26 ` Thomas Gleixner
@ 2005-10-25 22:36 ` Steven Rostedt
0 siblings, 0 replies; 3+ messages in thread
From: Steven Rostedt @ 2005-10-25 22:36 UTC (permalink / raw)
To: tglx; +Cc: john stultz, LKML, Ingo Molnar
On Wed, 2005-10-26 at 00:26 +0200, Thomas Gleixner wrote:
> On Tue, 2005-10-25 at 18:15 -0400, Steven Rostedt wrote:
> > if (!hres->active)
> > return CLOCK_EVT_RUN_CYCLIC;
>
> I'm searching for the brown paperbag.
>
> Thats the startup code before switching over to high resolution, so it
> should return 1, nothing else.
>
> CLOCK_EVT_RUN_CYCLIC is a leftover of the initial implementation, which
> did not take tick overruns into account.
Here, I'll make it easy for you. ;-)
-- Steve
Index: rt_linux_ernie/kernel/ktimers.c
===================================================================
--- rt_linux_ernie.orig/kernel/ktimers.c 2005-10-25 18:31:51.000000000 -0400
+++ rt_linux_ernie/kernel/ktimers.c 2005-10-25 18:32:38.000000000 -0400
@@ -338,10 +338,9 @@
* we expect, that the event source is running in periodic
* mode when it is a source serving other (tick based)
* functionality than next event
- *
*/
if (!hres->active)
- return CLOCK_EVT_RUN_CYCLIC;
+ return 1;
now = do_ktime_get();
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2005-10-25 22:36 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-10-25 22:15 ktimers in RT causing bad bogomips and more Steven Rostedt
2005-10-25 22:26 ` Thomas Gleixner
2005-10-25 22:36 ` Steven Rostedt
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.