Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assembler code for atomic_sub_64 seems wrong (i386) #5671

Closed
Ringdingcoder opened this issue Jan 26, 2017 · 2 comments
Closed

Assembler code for atomic_sub_64 seems wrong (i386) #5671

Ringdingcoder opened this issue Jan 26, 2017 · 2 comments

Comments

@Ringdingcoder
Copy link

While poring over the atomic code I noticed that atomic_sub_64 in lib/libspl/asm-i386/atomic.S looks wrong. Shouldn't it be subl followed by sbbl instead of adcl?

@behlendorf
Copy link
Contributor

Yes, that does look wrong. @ironMann could you comment on the this.

The good news is that is the user space implementation of these atomics. They're mainly used for statistics tracking when testing ZFS in user space with ztest.

        ENTRY(atomic_sub_64)
        ALTENTRY(atomic_sub_64_nv)
        pushl   %edi
        pushl   %ebx
        movl    12(%esp), %edi
        movl    (%edi), %eax
        movl    4(%edi), %edx
1:
        movl    16(%esp), %ebx
        movl    20(%esp), %ecx
        subl    %eax, %ebx
>>>        adcl    %edx, %ecx
        lock
        cmpxchg8b (%edi)
        jne     1b
        movl    %ebx, %eax
        movl    %ecx, %edx
        popl    %ebx
        popl    %edi
        ret
        SET_SIZE(atomic_sub_64_nv)
        SET_SIZE(atomic_sub_64)

@ironMann
Copy link
Contributor

Agree, that should be sbbl instead of adcl.

behlendorf added a commit to behlendorf/zfs that referenced this issue Jan 31, 2017
The atomic_sub_64() should use sbbl instead of adcl.  In user
space these atomics are used for statistics tracking and aren't
critical which explain how this was overlooked.  The kernel
space implementation of these atomics are layered on the
architecture specific implementations provided by the kernel.

Signed-off-by: Brian Behlendorf <[email protected]>
Issue openzfs#5671
wli5 pushed a commit to wli5/zfs that referenced this issue Feb 28, 2017
The atomic_sub_64() should use sbbl instead of adcl.  In user
space these atomics are used for statistics tracking and aren't
critical which explain how this was overlooked.  The kernel
space implementation of these atomics are layered on the
architecture specific implementations provided by the kernel.

Reviewed by: Stefan Ring <[email protected]>
Reviewed-by: Gvozden Neskovic <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Closes openzfs#5671 
Closes openzfs#5717
wli5 pushed a commit to wli5/zfs that referenced this issue Feb 28, 2017
The atomic_sub_64() should use sbbl instead of adcl.  In user
space these atomics are used for statistics tracking and aren't
critical which explain how this was overlooked.  The kernel
space implementation of these atomics are layered on the
architecture specific implementations provided by the kernel.

Reviewed by: Stefan Ring <[email protected]>
Reviewed-by: Gvozden Neskovic <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Closes openzfs#5671
Closes openzfs#5717
l1k pushed a commit to l1k/zfs that referenced this issue Apr 17, 2017
The atomic_sub_64() should use sbbl instead of adcl.  In user
space these atomics are used for statistics tracking and aren't
critical which explain how this was overlooked.  The kernel
space implementation of these atomics are layered on the
architecture specific implementations provided by the kernel.

Reviewed by: Stefan Ring <[email protected]>
Reviewed-by: Gvozden Neskovic <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Closes openzfs#5671
Closes openzfs#5717
tonyhutter pushed a commit to tonyhutter/zfs that referenced this issue May 18, 2017
The atomic_sub_64() should use sbbl instead of adcl.  In user
space these atomics are used for statistics tracking and aren't
critical which explain how this was overlooked.  The kernel
space implementation of these atomics are layered on the
architecture specific implementations provided by the kernel.

Reviewed by: Stefan Ring <[email protected]>
Reviewed-by: Gvozden Neskovic <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Closes openzfs#5671
Closes openzfs#5717
tonyhutter pushed a commit that referenced this issue Jun 9, 2017
The atomic_sub_64() should use sbbl instead of adcl.  In user
space these atomics are used for statistics tracking and aren't
critical which explain how this was overlooked.  The kernel
space implementation of these atomics are layered on the
architecture specific implementations provided by the kernel.

Reviewed by: Stefan Ring <[email protected]>
Reviewed-by: Gvozden Neskovic <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Closes #5671
Closes #5717
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants