summaryrefslogtreecommitdiffstats
path: root/sys/contrib/vchiq
diff options
context:
space:
mode:
authorgonzo <gonzo@FreeBSD.org>2015-02-09 02:31:27 +0000
committergonzo <gonzo@FreeBSD.org>2015-02-09 02:31:27 +0000
commit0e8f15c1955b01cf082fe6bc42d4376daeac3f73 (patch)
tree1499f7580e75596e3c5e46a40abf1228c6ac53be /sys/contrib/vchiq
parent17a9c0e974f9796848510329b0a076e1198d0e5b (diff)
downloadFreeBSD-src-0e8f15c1955b01cf082fe6bc42d4376daeac3f73.zip
FreeBSD-src-0e8f15c1955b01cf082fe6bc42d4376daeac3f73.tar.gz
Do not mark shared structures as __packed, it leads to race condition
If structure packed as __packed clang (and probably gcc) generates code that loads word fields (e.g. tx_pos) byte-by-byte and if it's modified by VideoCore in the same time as ARM loads the value result is going to be mixed combination of bytes from previous value and new one.
Diffstat (limited to 'sys/contrib/vchiq')
-rw-r--r--sys/contrib/vchiq/interface/vchiq_arm/vchiq_core.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/contrib/vchiq/interface/vchiq_arm/vchiq_core.h b/sys/contrib/vchiq/interface/vchiq_arm/vchiq_core.h
index 298a0cc..fb50e85 100644
--- a/sys/contrib/vchiq/interface/vchiq_arm/vchiq_core.h
+++ b/sys/contrib/vchiq/interface/vchiq_arm/vchiq_core.h
@@ -280,7 +280,7 @@ typedef struct vchiq_slot_info_struct {
/* Use two counters rather than one to avoid the need for a mutex. */
short use_count;
short release_count;
-} __packed VCHIQ_SLOT_INFO_T; /* XXXGONZO: check it */
+} VCHIQ_SLOT_INFO_T;
typedef struct vchiq_service_struct {
VCHIQ_SERVICE_BASE_T base;
@@ -381,7 +381,7 @@ typedef struct vchiq_shared_state_struct {
/* Debugging state */
int debug[DEBUG_MAX];
-} __packed VCHIQ_SHARED_STATE_T;
+} VCHIQ_SHARED_STATE_T;
typedef struct vchiq_slot_zero_struct {
int magic;
@@ -395,7 +395,7 @@ typedef struct vchiq_slot_zero_struct {
VCHIQ_SHARED_STATE_T master;
VCHIQ_SHARED_STATE_T slave;
VCHIQ_SLOT_INFO_T slots[VCHIQ_MAX_SLOTS];
-} __packed VCHIQ_SLOT_ZERO_T;
+} VCHIQ_SLOT_ZERO_T;
struct vchiq_state_struct {
int id;
OpenPOWER on IntegriCloud