svn commit: r278431 - head/sys/contrib/vchiq/interface/vchiq_arm

Oleksandr Tymoshenko gonzo at FreeBSD.org
Mon Feb 9 02:31:28 UTC 2015


Author: gonzo
Date: Mon Feb  9 02:31:27 2015
New Revision: 278431
URL: https://svnweb.freebsd.org/changeset/base/278431

Log:
  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.

Modified:
  head/sys/contrib/vchiq/interface/vchiq_arm/vchiq_core.h

Modified: head/sys/contrib/vchiq/interface/vchiq_arm/vchiq_core.h
==============================================================================
--- head/sys/contrib/vchiq/interface/vchiq_arm/vchiq_core.h	Mon Feb  9 02:27:33 2015	(r278430)
+++ head/sys/contrib/vchiq/interface/vchiq_arm/vchiq_core.h	Mon Feb  9 02:31:27 2015	(r278431)
@@ -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;


More information about the svn-src-all mailing list