From: H. Peter Anvin on
On 02/26/2010 03:23 AM, Luca Barbieri wrote:
> Sent patches, both to conditionally perform the test and implement the
> functions for x86 and x86-64.

Yes, and with the test turned on, the kernel crashes immediately on boot
on x86-64.

Some minor investigation reveals the following:

lib/atomic64.c has the wrong return value for atomic64_add_unless().
With "wrong" I mean it is the opposite sense compared to
atomic_add_unless(), not just on x86 but on all architectures.

Accordingly, I have to conclude that lib/atomic64.c is buggy, and that
since your test matches that bug, I will have to conclude that your
x86-32 implementation is also buggy. Thus, please send patches to fix
your test and your 32-bit implementations (and preferrably
lib/atomic64.c too, but I can do that just fine.)

Cc: Paul Mackerras who did the generic atomic64_t implementation for
verification that this is indeed a bug.

-hpa

--
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel. I don't speak on their behalf.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Paul Mackerras on
On Sun, Feb 28, 2010 at 11:35:31PM -0800, H. Peter Anvin wrote:

> On 02/26/2010 03:23 AM, Luca Barbieri wrote:
> > Sent patches, both to conditionally perform the test and implement the
> > functions for x86 and x86-64.
>
> Yes, and with the test turned on, the kernel crashes immediately on boot
> on x86-64.
>
> Some minor investigation reveals the following:
>
> lib/atomic64.c has the wrong return value for atomic64_add_unless().
> With "wrong" I mean it is the opposite sense compared to
> atomic_add_unless(), not just on x86 but on all architectures.
>
> Accordingly, I have to conclude that lib/atomic64.c is buggy, and that
> since your test matches that bug, I will have to conclude that your
> x86-32 implementation is also buggy. Thus, please send patches to fix
> your test and your 32-bit implementations (and preferrably
> lib/atomic64.c too, but I can do that just fine.)
>
> Cc: Paul Mackerras who did the generic atomic64_t implementation for
> verification that this is indeed a bug.

Yes, it sure looks like it. *blush*

Paul.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Luca Barbieri on
> Yes, and with the test turned on, the kernel crashes immediately on boot
> on x86-64.
>
> Some minor investigation reveals the following:
>
> lib/atomic64.c has the wrong return value for atomic64_add_unless().
> With "wrong" I mean it is the opposite sense compared to
> atomic_add_unless(), not just on x86 but on all architectures.
>
> Accordingly, I have to conclude that lib/atomic64.c is buggy, and that
> since your test matches that bug, I will have to conclude that your
> x86-32 implementation is also buggy. �Thus, please send patches to fix
> your test and your 32-bit implementations (and preferrably
> lib/atomic64.c too, but I can do that just fine.)

You are right: sent a patchset to fix it.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Luca Barbieri on
Upon further inspection, atomic64_inc_not_zero was broken too.

The generic implementation implements it in terms of
atomic64_add_unless and thus does not need a specific fix for it.

Sent another patchset to fix that.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/