Add concurrency checking based on GenMC - serial queue#561
Conversation
296e51d to
8a231aa
Compare
8a231aa to
e09fd1a
Compare
3ca0bc9 to
aadc40e
Compare
aadc40e to
d5e1b60
Compare
6c0e8dd to
b1ff1df
Compare
b1ff1df to
9249fce
Compare
Courtney3141
left a comment
There was a problem hiding this comment.
I'm going to make some additional modifications to the serial queue, but otherwise this is a great PR!
|
Also, I will leave it to you to add the additional comments to all the queue functions: "This function is only to be called by the CONSUMER/PRODUCER of the queue." (I'll leave the phrasing up to you) |
Never mind, I did this in my last commit. Please just check that my comments are in fact correct! |
9300ac7 to
35216e4
Compare
| */ | ||
| static inline uint32_t load_acquire_32(const uint32_t *ptr) | ||
| { | ||
| #ifdef CONFIG_ENABLE_SMP_SUPPORT |
There was a problem hiding this comment.
Is it really worth having this?
I'd thought we'd discussed this with Gernot and decided the queues should just always be correct for cross-core since it's misleading if not.
(and when I tested it made no performance impact).
There was a problem hiding this comment.
I remember the discussion on GitHub as well. I'll run additional benchmarks on this. The current implementation is based on memory of my recent benchmarks that it increases utilisation by 5~10%.
In addition, I will also benchmark whether the dmb ishst barrier is beneficial to the store-release function, which cannot be represented by the C standard library.
There was a problem hiding this comment.
I am very surprised by you finding it had no performance impact, as when I tested it a long ago I remember it being very significant. Although I can't seem to find those results for the life of me...
There was a problem hiding this comment.
I finally found the graph!
There was a problem hiding this comment.
I suspect it probably depends on what system we test on, as they will have different costs? But yeah, IDK. All my tests were run with it forced to 1 as per the docs I had in the description.
There was a problem hiding this comment.
Yes, it is system dependent. There is an about 5-10% system-wide relative overhead on maaxboard (cortex-a53)

with higher cycles per packet as well. There is no overhead on odroid c4 (cortex-a55, under investigation). These are unicore UDP benchmarks comparing different implementations of network queues.
bafadd8 to
1810982
Compare
|
I'm thinking it may be worth adding an introductory comment at the top of the serial queue file saying something along the lines of: The serial queue, like all sDDF queues, is an implementation of a single-producer, single-consumer FIFO queue. The key assumption being that only the producer is permitted to modify the tail, and only the consumer is permitted to modify the head. Both components are permitted to read both indices. The library's atomic operations are written to ensure correctness under these assumptions, thus each function's description contains an explicit notes on its assumed caller. |
4711f06 to
8a99a20
Compare
Signed-off-by: Ivan Velickovic <i.velickovic@unsw.edu.au> Signed-off-by: Kurt Wu <rihui.wu@unsw.edu.au>
Signed-off-by: Kurt Wu <rihui.wu@unsw.edu.au>
8a99a20 to
9e62c2e
Compare

This PR is a variant of PR Add concurrency checking based on GenMC #523 that targets serial queues. It should also fix issue serial example failures on Rasberry Pi 4B #528.
The following invalid assertion
sddf/include/sddf/serial/queue.h
Lines 159 to 172 in 63ac0fd
headbetween L168 and L169.A similar assertion in
serial_update_shared_head()has also been removed.Queue operations with the
_lengthsuffix always use relaxed atomic operation to prevent data races in all situations. These operation do not provide any synchronisation. On the contrary, other operations with_empty/_full/_freesuffix use acquire atomic operation appropriately for synchronisation.Limitations
On the memory model side, compared with PR Add concurrency checking based on GenMC #523, this PR uses additional relaxed atomic operations that may be a concern for verifiers like GenMC.
The test does not cover all serial queue APIs.
There are some redundant memory operations that will not be removed in compiler's dead-code elimination optimisation, e.g. in the updated
serial_update_shared_tail().