tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: MP locking?

On Thursday 01 July 2010 11:13:12 Manuel Bouyer wrote:
> On Wed, Jun 30, 2010 at 05:15:53PM -0400, der Mouse wrote:
> > I have some kernel code which was written for a pre-MP kernel; it uses
> > spl*() for locking.
> > I'd like to roll this forward to something at
> > least slightly more modern - specifically, a dual-CPU 4.0.1 machine.
> >
> > lock(9) outlines locking facilities which I believe I can use to do
> > what I want - but there are other issues, such as cache coherency; do I
> > need to do anything special with shared data structures to ensure
> > coherency between processors?  Is it enough to declare them volatile,
> > or do I need memory barriers as well, or what?
> You need memory barriers, modern CPUs can do speculative reads, and some
> can reorder writes. AFAIK, lock operations act as memory barriers.
> atomic ops do not.

With my PAT patch you can map a page uncached. This disables
speculative accesses.


Home | Main Index | Thread Index | Old Index