[Cbe-oss-dev] [PATCH 02/10]MARS/core: Workload module split make headers public

Kazunori Asayama asayama at sm.sony.co.jp
Tue Nov 25 18:00:28 EST 2008


Yuji Mano wrote:
> Kazunori Asayama wrote:
>>> -struct mars_mutex;
>>> +struct mars_mutex {
>>> +	uint32_t lock;
>>> +	uint8_t pad[124];
>>> +} __attribute__((aligned(MARS_MUTEX_ALIGN)));
>> It seems to be unnecessary to make mars_mutex structure public, since
>> workload module implementation doesn't access any member of mars_mutex
>> directly.
> 
> Yes. However, the current task synchronization structures casts itself to
> a mars_mutex and passes it into the mars_mutex APIs...
> 
> mars_mutex_lock_get(queue_ea, (struct mars_mutex *)&queue);
> 
> This is done because the mars_mutex structure only modifies the first
> 32-bits of the 128-byte area. Therefore the task synchronization
> structures reserve the first 32-bits for the mutex and the rest for its
> own use, allowing it to be passed into the mars_mutex APIs.
> 
> If we make the mars_mutex structure private, I think the cast would be
> really bad (even more so than now) because at that point we would be
> casting it blindly to an unknown structure.
> 
> It also creates the following compiler warning:
> warning: type-punning to incomplete type might break strict-aliasing rules
> 
> Do you have any other suggestions?

ok, I understand your intention. After we apply upcoming 'Wrapping EA
access' patches, we can discuss this issue again.

-- 
(ASAYAMA Kazunori
  (asayama at sm.sony.co.jp))
t



More information about the cbe-oss-dev mailing list