OpenSolaris

Printable Version Enter a New Search
Bug ID 6225876
Synopsis thread_db synchronization tracking causes cond_wait failure and hangs
State 10-Fix Delivered (Fix available in build)
Category:Subcategory library:libc
Keywords
Responsible Engineer Roger Faulkner
Reported Against
Duplicate Of
Introduced In solaris_10
Commit to Fix snv_11
Fixed In snv_11
Release Fixed solaris_nevada(snv_11) , solaris_10u1(s10u1_13) (Bug ID:2123757)
Related Bugs 6328294 , 6225579
Submit Date 5-February-2005
Last Update Date 16-February-2007
Description
dbx bug 6225579 describes how when an application runs under dbx
on S10 (but not older S's) it hangs in a cond_wait() and/or the
cond_wait returns bogus data.

The symptoms vanish if mutex tracking is turned off via 
	(dbx) dbxenv mt_sync_tracking off
which corresponds to thread db's td_ta_sync_tracking_enable().
 xxxxx@xxxxx.com 2005-2-05 00:27:33 GMT
From the evaluation:

When [sync tracking is enabled], the inline function gethrtime() 
is called.  gethrtime() is not called unless sync tracking is enabled.

The gethrtime() function is an inline function, declared to be:
	extern  hrtime_t        gethrtime(void);
where 'hrtime_t' is uint64_t.  gethrtime() is defined in the sparcv9.il file:
        .inline gethrtime, 0
        ta      0x24
        sllx    %o0, 32, %o0
        or      %o1, %o0, %o0
        .end

When the compiler gets through with it, the disassembled code is:

cond_wait_common+0x2f0: 9f2a3020 sllx     %o0, 32, %o7
cond_wait_common+0x2f4: 91d02024 ta       %icc, %g0 + 36
cond_wait_common+0x2f8: 9a12400f or       %o1, %o7, %o5

The compiler reordered the instructions!

Adding .volatile ... .nonvolatile around the body of gethrtime fixed it.
Work Around
N/A
Comments
N/A