Re: Unable to read memory mapped PCI memory the second time == f

Jeremy Fitzhardinge (jeremy@goop.org)
Sat, 10 Jul 1999 22:42:28 -0700 (PDT)


On 10-Jul-99 Klaus Nielsen wrote:
> After a few talks Jeff suggested to try using mb(); and wmb();
>
> Doing this removed my problem. However I do not understand
> completely. If the CPU just rarranged the order of the instructions
> it would not freeze, just produce wrong results. So - did the
> processor put two instructions - one dependent of the other into each
> their pipeline, ignoring their relation, or what? That's a very odd
> thing to do... BTW, I am using an AMD K6-III.

On Intel CPUs, they don't generate any memory ordering instructions, but they
do tell the compiler that tricky things are going on, and it had better be
careful about how it reorders things. On non-Intel systems, where the CPU can
reorder memory accesses, they may also generate instructions to explicitly tell
the CPU about what reordering is allowed.

Generally misordering accesses will just produce bad results, but when you're
dealing with reads and writes to memory mapped hardware, pretty much anything
can happen if you do something it doesn't expect.

J

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