Re: Fix for critical bogoMIPS intermittent calculation failure

From: Peter Zijlstra
Date: Tue May 31 2011 - 07:59:15 EST


On Thu, 2011-04-07 at 15:17 -0700, Andrew Morton wrote:
> On Thu, 10 Mar 2011 17:03:51 +1100
> Andrew Worsley <amworsley@xxxxxxxxx> wrote:
>

> Cc: Phil Carmody <ext-phil.2.carmody@xxxxxxxxx>
> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
> ---
>
> init/calibrate.c | 70 +++++++++++++++++++++++++++++++++++++++++----
> 1 file changed, 65 insertions(+), 5 deletions(-)
>
> diff -puN init/calibrate.c~init-calibratec-fix-for-critical-bogomips-intermittent-calculation-failure init/calibrate.c
> --- a/init/calibrate.c~init-calibratec-fix-for-critical-bogomips-intermittent-calculation-failure
> +++ a/init/calibrate.c
> @@ -38,6 +38,9 @@ static unsigned long __cpuinit calibrate
> unsigned long timer_rate_min, timer_rate_max;
> unsigned long good_timer_sum = 0;
> unsigned long good_timer_count = 0;
> + unsigned long measured_times[MAX_DIRECT_CALIBRATION_RETRIES];
> + int max = -1; /* index of measured_times with max/min values or not set */
> + int min = -1;
> int i;
>
> if (read_current_timer(&pre_start) < 0 )
> @@ -90,17 +93,74 @@ static unsigned long __cpuinit calibrate
> * If the upper limit and lower limit of the timer_rate is
> * >= 12.5% apart, redo calibration.
> */
> - if (pre_start != 0 && pre_end != 0 &&
> + printk(KERN_DEBUG
> +"calibrate_delay_direct() timer_rate_max=%lu timer_rate_min=%lu pre_start=%lu pre_end=%lu\n",
> + timer_rate_max, timer_rate_min, pre_start, pre_end);


Can we please remove this printk(), I'm not really enjoying the 120
lines of dmesg spew this creates on my dev-box.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx>
---
init/calibrate.c | 6 ++----
1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/init/calibrate.c b/init/calibrate.c
index cfd7000..a24efd3 100644
--- a/init/calibrate.c
+++ b/init/calibrate.c
@@ -93,14 +93,12 @@ static unsigned long __cpuinit calibrate_delay_direct(void)
* If the upper limit and lower limit of the timer_rate is
* >= 12.5% apart, redo calibration.
*/
- printk(KERN_DEBUG "calibrate_delay_direct() timer_rate_max=%lu "
- "timer_rate_min=%lu pre_start=%lu pre_end=%lu\n",
- timer_rate_max, timer_rate_min, pre_start, pre_end);
- if (start >= post_end)
+ if (start >= post_end) {
printk(KERN_NOTICE "calibrate_delay_direct() ignoring "
"timer_rate as we had a TSC wrap around"
" start=%lu >=post_end=%lu\n",
start, post_end);
+ }
if (start < post_end && pre_start != 0 && pre_end != 0 &&
(timer_rate_max - timer_rate_min) < (timer_rate_max >> 3)) {
good_timer_count++;

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/