I need help in understanding this alignment error. The error message is dtrace: error on enabled probe ID 14 (ID 24380: iscsi:idm:idm_pdu_rx_forward_ffp:nop-receive): invalid alignment (0xffffff03df31b06c) in action #1 at DIF offset 32 This is a new probe that has two arguments - conninfo_t and iscsiinfo_t In my D script, I print out just the datalen field from argument 1. iscsi::: { printf("datalen[%d],", args[1]->ii_datalen); } I use a translator to translate from C struct iscsi_nop_out_hdr_t to D struct iscsiinfo_t The D struct iscsiinfo_t is defined as typedef struct iscsiinfo { string ii_target; /* target iqn */ string ii_initiator; /* initiator iqn */ string ii_isid; /* initiator session identifier */ string ii_tsih; /* target session identifying handle */ string ii_transport; /* transport type ("iser-ib", "sockets") */ uint64_t ii_lun; /* target logical unit number */ uint32_t ii_itt; /* initiator task tag */ uint32_t ii_ttt; /* target transfer tag */ uint32_t ii_cmdsn; /* command sequence number */ uint32_t ii_statsn; /* status sequence number */ uint32_t ii_datasn; /* data sequence number */ uint32_t ii_datalen; /* length of data payload */ uint32_t ii_flags; /* probe-specific flags */ } iscsiinfo_t; The native structure is defined as /* NOP-Out Message */ typedef struct _iscsi_nop_out_hdr { uint8_t opcode; uint8_t flags; uint16_t rsvd2; uint8_t rsvd3; uint8_t dlength[3]; uint8_t lun[8]; uint32_t itt; /* Initiator Task Tag */ uint32_t ttt; /* Target Transfer Tag */ uint32_t cmdsn; uint32_t expstatsn; uint8_t rsvd4[16]; } iscsi_nop_out_hdr_t; My translator looks like this #pragma D binding "1.5" translator translator iscsiinfo_t < iscsi_nop_out_hdr_t *P > { <snip> <snip> ii_datalen = P->dlength[0] << 16 || P->dlength[1] << 8 || P->dlength[2]; }; Any hints on how I can debug this problem is appreciated thanks Priya
Priya Krishnan wrote:> I need help in understanding this alignment error. The error message is > dtrace: error on enabled probe ID 14 (ID 24380: > iscsi:idm:idm_pdu_rx_forward_ffp:nop-receive): invalid alignment > (0xffffff03df31b06c) in action #1 at DIF offset 32 > > This is a new probe that has two arguments - conninfo_t and iscsiinfo_t > In my D script, I print out just the datalen field from argument 1. > iscsi::: > { > printf("datalen[%d],", args[1]->ii_datalen); > } > > I use a translator to translate from C struct iscsi_nop_out_hdr_t to D > struct iscsiinfo_t > > The D struct iscsiinfo_t is defined as > typedef struct iscsiinfo { > string ii_target; /* target iqn */ > string ii_initiator; /* initiator iqn */ > string ii_isid; /* initiator session identifier */ > string ii_tsih; /* target session identifying handle */ > string ii_transport; /* transport type ("iser-ib", > "sockets") */ > > uint64_t ii_lun; /* target logical unit number */ > > uint32_t ii_itt; /* initiator task tag */ > uint32_t ii_ttt; /* target transfer tag */ > > uint32_t ii_cmdsn; /* command sequence number */ > uint32_t ii_statsn; /* status sequence number */ > uint32_t ii_datasn; /* data sequence number */ > > uint32_t ii_datalen; /* length of data payload */ > uint32_t ii_flags; /* probe-specific flags */ > } iscsiinfo_t; > > The native structure is defined as > /* NOP-Out Message */ > typedef struct _iscsi_nop_out_hdr { > uint8_t opcode; > uint8_t flags; > uint16_t rsvd2; > uint8_t rsvd3; > uint8_t dlength[3]; > uint8_t lun[8]; > uint32_t itt; /* Initiator Task Tag */ > uint32_t ttt; /* Target Transfer Tag */ > uint32_t cmdsn; > uint32_t expstatsn; > uint8_t rsvd4[16]; > } iscsi_nop_out_hdr_t; > > My translator looks like this > > #pragma D binding "1.5" translator > translator iscsiinfo_t < iscsi_nop_out_hdr_t *P > { > <snip> > <snip> > ii_datalen = P->dlength[0] << 16 || P->dlength[1] << 8 || > P->dlength[2]; > }; > > Any hints on how I can debug this problem is appreciatedHmm... nothing jumps out at me right off -- the address is 4-byte-aligned and you don''t access any 8-byte values that I can see. Unless struct iscsiinfo somehow doesn''t get 8-byte-aligned and you actually croak while initializing ii_lun? What happens if you move ii_lun to be the first member of the struct? Those strings are just char[256] (unless you''ve changed the size limit), and don''t impose any alignment constraints. It shouldn''t matter, but who knows... You could also try not initializing ii_lun at all to see if the error disappears, though that''s obviously not a permanent solution. BTW, you are using logical ''||'' instead bitwise ''|'' to reconstruct ii_datalen, which is probably not what you want. Regards, Ryan
krishnan parthasarathi - Sun Microsystems - Bangalore India
2009-May-14 08:08 UTC
[dtrace-discuss] invalid alignment error message
Hi Priya, I had a similar problem. Check whether the -32/-64 dtrace flag in your dtrace script is in line with the application your tracing. Hope this helps, Krishnan On Wed, 2009-05-13 at 15:25 -0400, Priya Krishnan wrote:> I need help in understanding this alignment error. The error message is > dtrace: error on enabled probe ID 14 (ID 24380: > iscsi:idm:idm_pdu_rx_forward_ffp:nop-receive): invalid alignment > (0xffffff03df31b06c) in action #1 at DIF offset 32 > > This is a new probe that has two arguments - conninfo_t and iscsiinfo_t > In my D script, I print out just the datalen field from argument 1. > iscsi::: > { > printf("datalen[%d],", args[1]->ii_datalen); > } > > I use a translator to translate from C struct iscsi_nop_out_hdr_t to D > struct iscsiinfo_t > > The D struct iscsiinfo_t is defined as > typedef struct iscsiinfo { > string ii_target; /* target iqn */ > string ii_initiator; /* initiator iqn */ > string ii_isid; /* initiator session identifier */ > string ii_tsih; /* target session identifying handle */ > string ii_transport; /* transport type ("iser-ib", "sockets") */ > > uint64_t ii_lun; /* target logical unit number */ > > uint32_t ii_itt; /* initiator task tag */ > uint32_t ii_ttt; /* target transfer tag */ > > uint32_t ii_cmdsn; /* command sequence number */ > uint32_t ii_statsn; /* status sequence number */ > uint32_t ii_datasn; /* data sequence number */ > > uint32_t ii_datalen; /* length of data payload */ > uint32_t ii_flags; /* probe-specific flags */ > } iscsiinfo_t; > > The native structure is defined as > /* NOP-Out Message */ > typedef struct _iscsi_nop_out_hdr { > uint8_t opcode; > uint8_t flags; > uint16_t rsvd2; > uint8_t rsvd3; > uint8_t dlength[3]; > uint8_t lun[8]; > uint32_t itt; /* Initiator Task Tag */ > uint32_t ttt; /* Target Transfer Tag */ > uint32_t cmdsn; > uint32_t expstatsn; > uint8_t rsvd4[16]; > } iscsi_nop_out_hdr_t; > > My translator looks like this > > #pragma D binding "1.5" translator > translator iscsiinfo_t < iscsi_nop_out_hdr_t *P > { > <snip> > <snip> > ii_datalen = P->dlength[0] << 16 || P->dlength[1] << 8 || > P->dlength[2]; > }; > > Any hints on how I can debug this problem is appreciated > > thanks > Priya > > > _______________________________________________ > dtrace-discuss mailing list > dtrace-discuss at opensolaris.org