[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: MP locking?
Hello. Having just recently spent quite a bit of time porting a kernel
module from NetBSD-3 to NetBSD-5, and working out a bunch of
synchronization issues, I suggest skipping over NetBSD-4 and going straight
for 5. You'll get better multi-cpu capability, and it looks like the
locking APIs in 5.x will be longer lived going forward than the now
depracated and no longer functioning APIs in 4.x and earlier.
On Jul 1, 11:13am, Manuel Bouyer wrote:
} Subject: Re: MP locking?
} 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.
} Manuel Bouyer <bouyer%antioche.eu.org@localhost>
} NetBSD: 26 ans d'experience feront toujours la difference
>-- End of excerpt from Manuel Bouyer
Main Index |
Thread Index |