[ofa-general] Issues with osm_req_set():tid

Vincent Ficet jean-vincent.ficet at bull.net
Tue Jul 1 06:18:54 PDT 2008


Hello,

In the function opensm/opensm/osm_req.c:osm_req_set(), I noticed that 
the transaction Id was generated as follows:

ib_net64_t tid;
[ ... ]
tid = cl_hton64((uint64_t) cl_atomic_inc(&sm->sm_trans_id));

However, the type of sm->sm_trans_id is atomic32_t and atomic32_t is 
declared as follows in opensm/include/complib/cl_types_osd.h:

typedef volatile int32_t atomic32_t;

Is the cast made by the compiler from int32_t (32 bit, signed) to a 
uint64_t (64 bit, unsigned) always safe w.r.t compiler(s) optimisation 
flags ?

If not, it may be necessary to:
- define a new atomic64_t type
- define a new cl_atomic_inc64 function
- use this function directly in osm_req_set()
- redefine the OSM_SM_INITIAL_TID_VALUE constant to be 64 bit long.

What is your opinion on this ?

Cheers,

Vincent






More information about the general mailing list