lkml.org 
[lkml]   [2006]   [May]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH 53 of 53] ipath - add memory barrier when waiting for writes
From
> On Mon, 2006-05-15 at 08:57 -0700, Roland Dreier wrote:
>> > static void i2c_wait_for_writes(struct ipath_devdata *dd)
>> > {
>> > + mb();
>> > (void)ipath_read_kreg32(dd, dd->ipath_kregs->kr_scratch);
>> > }
>>
>> This needs a comment explaining why it's needed. A memory barrier
>> before a readl() looks very strange since readl() should be ordered
>> anyway.
>
> Yeah. It's actually working around what appears to be a gcc bug if the
> kernel is compiled with -Os. Ralph knows the details; he can give a
> more complete answer.
>
> <b

I don't have a lot to add to this other than I looked at the
assembly code output for -Os and -O3 and both looked OK.
I put the mb() in to be sure the writes were complete and
I found this to work by experimentation.
Without it, the driver fails to read the EEPROM correctly.

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

\
 
 \ /
  Last update: 2006-05-16 01:04    [W:0.069 / U:1.428 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site