Messages in this thread | | | From | David Howells <> | Subject | Re: [PATCH] Keys: Improve usage of memory barriers and remove IRQ disablement | Date | Wed, 05 Apr 2006 09:46:10 +0100 |
| |
Nick Piggin <nickpiggin@yahoo.com.au> wrote:
> Shouldn't be needed: Documentation/atomic_ops.txt specifies that any atomic_ > which both modifies its atomic operand and returns something is to be a full > barrier before and after the operation.
Hmmm... It's possible that I've misunderstood what atomic_ops.txt actually says. For instance:
| int atomic_inc_and_test(atomic_t *v); | int atomic_dec_and_test(atomic_t *v); | | These two routines increment and decrement by 1, respectively, the | given atomic counter. They return a boolean indicating whether the | resulting counter value was zero or not. | | It requires explicit memory barrier semantics around the operation as | above.
Note the last paragraph. "It requires" should be "They require", but the sense would seem to be obvious. However, it's not clear on a second reading as to whether this is an instruction to the _caller_ or an instruction to the arch _implementer_.
I suppose from reading the abstract at the top:
| This document is intended to serve as a guide to Linux port maintainers on | how to implement atomic counter, bitops, and spinlock interfaces properly.
that it is meant to be read by the implementor and not the user/caller, in which case, Nick is correct.
It seems I need to adjust my memory barrier doc, and perhaps I should adjust atomic_ops.txt too to make it clearer.
David - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |