Date: Tue, 30 Sep 2008 21:43:30 -0500 From: Matt Sealey <matt@genesi-usa.com> To: Peter Grehan <grehan@freebsd.org> Cc: freebsd-ppc@freebsd.org Subject: Re: 64-bit atomic ops on 32-bit CPU -- was: ZFS .. on PowerPC ? Message-ID: <48E2E3D2.7020206@genesi-usa.com> In-Reply-To: <48E29BF3.40106@freebsd.org> References: <B4645B39-9D9D-49C5-8F69-55704CD2F6AA@delfi-konsult.com> <60ACBA3B-927C-4F2C-8680-A6B40B81E06C@mac.com> <48DA84D5.4010109@semihalf.com> <C725D17E-E199-4E70-BE56-07BD21783A7A@mac.com> <48DA99F8.7070904@semihalf.com> <111399E3-2BC7-4724-8AFB-A40F2A47E66D@mac.com> <48DBC59C.3040101@semihalf.com> <48E28E58.1020901@genesi-usa.com> <48E29BF3.40106@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
Peter Grehan wrote: > Hi Matt, > >> Isn't there some kind of semaphore primitive in FreeBSD that can be >> used? > > The issue is the OpenSolaris ZFS code that makes liberal use of calls > such as atomic_add_64(&ptr_to_uint64). Indeed I had a look at the ZFS-FUSE project a while back, had a lot of discussion with the developer, and even got Tom Riddle of Sun involved in implementing a lot of the 32-bit atomicity code which wasn't present in Solaris at the time. > global lock for all 64-bit atomic operations, but it would be better if > this could be done without such workarounds on 32-bit ppc. What makes this any different to the Giant Lock problem? I don't suppose it needs to be TOO fine grained - after all there are still big locks in FreeBSD, Linux and pick-another-OS, they are just not so clumsy as the old FreeBSD Giant or Linux's equivalent. Stripping it down so that you have many 64-bit atomic access locks first, would be probably an easier task than attempting to come up with some clever way of implementing 64-bit atomicity on all 32-bit PPC processors. Why not simply access protect individual structures? For instance anything which you have to update some member in an atomic manner, lock the entire structure. Other atomic accesses can be made to other structures in parallel (within reason, since PPC can only hold one reservation at a time, so trying to get two locks in tandem will fail, but in this case, one will work, the atomic update will happen, and the other lock attempt will spin until it succeeds.. and then that atomic update will happen) -- Matt Sealey <matt@genesi-usa.com> Genesi, Manager, Developer Relations
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?48E2E3D2.7020206>