Re: [developer] ZFS atomics, 64-bit on 32-bit platforms

2019-10-11 Thread Garrett D'Amore
On 10/11/2019 4:51:27 PM, Richard Elling wrote: On Oct 11, 2019, at 4:47 PM, Garrett D'Amore mailto:garr...@damore.org]> wrote: On 10/11/2019 4:32:11 PM, Richard Elling mailto:richard.ell...@richardelling.com]> wrote: On Oct 11, 2019, at 2:50 PM, Garrett D'Amore mailto:garr...@damore.org]>

Re: [developer] ZFS atomics, 64-bit on 32-bit platforms

2019-10-11 Thread Richard Elling
> On Oct 11, 2019, at 4:47 PM, Garrett D'Amore wrote: > > >> On 10/11/2019 4:32:11 PM, Richard Elling >> wrote: >> >> >> >>> On Oct 11, 2019, at 2:50 PM, Garrett D'Amore >> > wrote: >>> >>> The issue is that you can't just arbitrarily throw a mutex out there --

Re: [developer] ZFS atomics, 64-bit on 32-bit platforms

2019-10-11 Thread Garrett D'Amore
On 10/11/2019 4:32:11 PM, Richard Elling wrote: On Oct 11, 2019, at 2:50 PM, Garrett D'Amore mailto:garr...@damore.org]> wrote: The issue is that you can't just arbitrarily throw a mutex out there -- you have to have a place to *store* that, and you can't fit it inside the 64-bit value.  Wi

Re: [developer] ZFS atomics, 64-bit on 32-bit platforms

2019-10-11 Thread Richard Elling
> On Oct 11, 2019, at 2:50 PM, Garrett D'Amore wrote: > > The issue is that you can't just arbitrarily throw a mutex out there -- you > have to have a place to *store* that, and you can't fit it inside the 64-bit > value. With a 64-bit ISA this isn't usually a problem, but with 32-bit ISAs

Re: [developer] ZFS atomics, 64-bit on 32-bit platforms

2019-10-11 Thread Garrett D'Amore
The issue is that you can't just arbitrarily throw a mutex out there -- you have to have a place to *store* that, and you can't fit it inside the 64-bit value.  With a 64-bit ISA this isn't usually a problem, but with 32-bit ISAs it is. The only way to store the mutex (which could just be a spi

Re: [developer] ZFS atomics, 64-bit on 32-bit platforms

2019-10-11 Thread Richard Elling
> On Oct 9, 2019, at 11:41 AM, Garrett D'Amore wrote: > > I don't think 32-bit compilers generally offer builtins for 64-bit atomics. > Frankly, they can't really unless the underlying ISA provides some additional > support for this in particular. Yes, that is why the builtins exist... the

Re: [developer] ZFS atomics, 64-bit on 32-bit platforms

2019-10-09 Thread Garrett D'Amore
I don't think 32-bit compilers generally offer builtins for 64-bit atomics.  Frankly, they can't really unless the underlying ISA provides some additional support for this in particular. To implement a 64-bit atomic on a 32-bit architecture, you generally needs some additional state somewhere -

Re: [developer] ZFS atomics, 64-bit on 32-bit platforms

2019-10-09 Thread Richard Elling
If it is possible to specify a compiler version, it might be easier to use the compiler builtin atomics. Just sayin' -- richard -- openzfs: openzfs-developer Permalink: https://openzfs.topicbox.com/groups/developer/T3ee8a81d5f09f2ec-Mabd6346845b79e16d16

Re: [developer] ZFS atomics, 64-bit on 32-bit platforms

2019-10-09 Thread Andriy Gapon
First, a note that to my shame I discovered Linux interface for atomic operations only yesterday. And I must say that the proposed zatomic interface looks very similar to what Linux has. I guess that this is not surprising. Linux defines these types: typedef struct { int counter; } atom

Re: [developer] ZFS atomics, 64-bit on 32-bit platforms

2019-10-03 Thread Andriy Gapon
On 04/10/2019 02:49, Richard Elling wrote: > isn't this addressed by the compiler builtins for atomics? 'This' -- what specifically? I do not think that plain reads of 64-bit objects on 32-bit platforms can be addressed by anything until they cease being plain. >> On Oct 3, 2019, at 10:38 AM, Mat

Re: [developer] ZFS atomics, 64-bit on 32-bit platforms

2019-10-03 Thread Richard Elling
isn't this addressed by the compiler builtins for atomics? -- richard > On Oct 3, 2019, at 10:38 AM, Matthew Ahrens wrote: > > On Wed, Oct 2, 2019 at 7:51 AM Andriy Gapon > wrote: > > This is a work in progress report for my work on safer use of atomics in ZFS > that

Re: [developer] ZFS atomics, 64-bit on 32-bit platforms

2019-10-03 Thread Matthew Ahrens
On Wed, Oct 2, 2019 at 7:51 AM Andriy Gapon wrote: > > This is a work in progress report for my work on safer use of atomics in > ZFS > that was discussed in the August developer meeting. > > I took the approach suggested at the meeting of creating a new type that > is to > be used for all object

[developer] ZFS atomics, 64-bit on 32-bit platforms

2019-10-02 Thread Andriy Gapon
This is a work in progress report for my work on safer use of atomics in ZFS that was discussed in the August developer meeting. I took the approach suggested at the meeting of creating a new type that is to be used for all objects that should be modified atomically. The type is trivial: typedef