Re: [PATCH 2/2] i7core_edac: Add scrubbing support

From: Tony Luck
Date: Fri Jun 24 2011 - 17:47:45 EST


On Wed, Mar 30, 2011 at 6:21 AM, Samuel Gabrielsson
<samuel.gabrielsson@xxxxxxxxx> wrote:
> +       const u32 cache_line_size = 64;
> +       const u32 freq_dclk = 800*1000000;

Is dclk always 800 MHz? If so, a #define might me nice - you use it again in
get_sdram_scrub_rate(). If not, then getting the actual frequency from some
place would be good.

> +               dw_scrub = 0x00ffffff & (cache_line_size * freq_dclk / new_bw);

Does this give the right answer? It looks like you overflow the "u32" size
of these calculations when you do 64*800000000 = 51200000000.

> +       return 0xffffffff & (cache_line_size * freq_dclk / (u64) scrubval);

Ditto on the overflow question here.

-Tony
--
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/