Re: [PATCH] Fix sb_edac compilation with 32 bits kernels

Mauro Carvalho Chehab
2011-11-07T21:54:20Z

Em 07-11-2011 19:37, Josh Boyer escreveu:
> On Mon, Nov 07, 2011 at 07:29:45PM -0200, Mauro Carvalho Chehab wrote:
>> @@ -670,6 +671,7 @@ static void get_memory_layout(const struct mem_ctl_info *mci)
>> u32 reg;
>> u64 limit, prv = 0;
>> u64 tmp_mb;
>> + u32 mb, kb;
>> u32 rir_way;
>>
>> /*
>> @@ -682,8 +684,9 @@ static void get_memory_layout(const struct mem_ctl_info *mci)
>> pvt->tolm = GET_TOLM(reg);
>> tmp_mb = (1 + pvt->tolm) >> 20;
>>
>> - debugf0("TOLM: %Lu.%03Lu GB (0x%016Lx)\n",
>> - tmp_mb / 1000, tmp_mb % 1000, (u64)pvt->tolm);
>> + mb = div_u64_rem(tmp_mb, 1000, &kb);
>> + debugf0("TOLM: %u.%03u GB (0x%016Lx)\n",
>> + mb, kb, (u64)pvt->tolm);
>
> So I realize you said that EDAC_DEBUG should (for now) always be enabled
> when this driver is built, but you just added a bunch of 64-bit divides
> outside of the debugfX stuff. Doesn't that mean you'll be doing those
> divides in the non-debug case as well, and then most likely getting an
> unused varible warning when you turn EDAC_DEBUG off?

You're right. Some additional logic is needed to remove the warnings and
unneeded calculus when debug is disabled. I may eventually work on it when
I have time. In any case, we gave a fix already for kernel 3.2, and this
patch is an alternative for those brave enough to test this driver with a 32 bits PAE
kernel.

>
>> @@ -858,7 +868,7 @@ static int get_memory_error_data(struct mem_ctl_info *mci,
>> * range (e. g. VGA addresses). It is unlikely, however, that the
>> * memory controller would generate an error on that range.
>> */
>> - if ((addr > (u64) pvt->tolm) && (addr < (1L << 32))) {
>> + if ((addr > (u64) pvt->tolm) && (addr < (1LL << 32))) {
>> sprintf(msg, "Error at TOLM area, on addr 0x%08Lx", addr);
>> edac_mc_handle_ce_no_info(mci, msg);
>> return -EINVAL;
>> @@ -1053,7 +1063,7 @@ static int get_memory_error_data(struct mem_ctl_info *mci,
>> ch_addr = addr & 0x7f;
>> /* Remove socket wayness and remove 6 bits */
>> addr >>= 6;
>> - addr /= sck_xch;
>> + addr = div_u64(addr, sck_xch);
>> #if 0
>> /* Divide by channel way */
>> addr = addr / ch_way;
>
> Those two parts look ok.
>
> josh
> --
> To unsubscribe from this list: send the line "unsubscribe linux-edac" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html