From 9a35743df691b0173ef5ef49cfb664e88e2fc9da Mon Sep 17 00:00:00 2001 From: Christian Helmuth Date: Fri, 20 Dec 2019 14:34:22 +0100 Subject: [PATCH] Mark packet-stream descriptor head/tail as volatile `volatile` effectively prevents instruction reordering by the compiler and fixes an issue with -O3 compiled components. Note, this commit does not address further arguments regarding memory barriers and volatile voiced in issue #693. Issue #693 --- repos/os/include/os/packet_stream.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/repos/os/include/os/packet_stream.h b/repos/os/include/os/packet_stream.h index 77ae905bdb..ca43afa768 100644 --- a/repos/os/include/os/packet_stream.h +++ b/repos/os/include/os/packet_stream.h @@ -168,8 +168,8 @@ class Genode::Packet_descriptor_queue */ struct { - unsigned _head; - unsigned _tail; + unsigned volatile _head; + unsigned volatile _tail; PACKET_DESCRIPTOR _queue[QUEUE_SIZE]; };