Hi All,
i''m debugging some code around the vmem_alloc() functions.
vmem_create was called to create a span of (1,10], and
since i''m expecting vmem_alloc to return a small integer,
i''m casting the (void *) that vmem_alloc() returns with
vmem_alloc:return
/ self->tr == 1 /
{
printf( "id == %d\n", (int) args[1] );
}
...
1 10710 vmem_alloc:return id == 56151448
what am i doing wrong ?
Thanks,
sam
On Wed, 2006-04-12 at 07:34, sang-suan gam wrote:> vmem_alloc:return > / self->tr == 1 / > { > printf( "id == %d\n", (int) args[1] ); > } > > ... > 1 10710 vmem_alloc:return id == 56151448 > > what am i doing wrong ?You didn''t show the entire script, so I''m going to guess: You''re not seeing the return you''re expecting -- there''s some artful mutual recursion between vmem and kmem going on under the covers -- so you may be seeing the return from a more deeply-nested vmem_alloc() used to allocate memory. Include a stack(); in the action to see which call to vmem_alloc() you''re hitting. Use something like self->tr as a counter to match enters and returns.. - Bill
Thanks Bill for replying,
i suspected the same when i saw that the e2900 output i get
had recursive vmem calls, so i coded that possiblity into
the script.
however, on the v880, i see only one invocation of vmem_alloc:
[s10_74L2a.3]# cat sysevent.d
unbind_common:entry
/ self->unbind == 0 /
{
self->unbind = 1;
self->chan = args[0];
printf( "chan == %s, type == %d, id == %d.\n",
stringof(self->chan->scd_channel_name), args[1], (int)
args[2] );
printf( "scd_subscriber_ids[0..4] == %d, %d, %d, %d.\n",
self->chan->scd_subscriber_ids[0],
self->chan->scd_subscriber_ids[1],
self->chan->scd_subscriber_ids[2],
self->chan->scd_subscriber_ids[3] );
printf( "scd_publisher_ids[0..1] == %d, %d.\n",
self->chan->scd_publisher_ids[0],
self->chan->scd_publisher_ids[1] );
}
vmem_free:entry
/ self->unbind == 1 /
{
stack();
}
unbind_common:return
/ self->unbind == 1 /
{
self->unbind = 0;
}
bind_common:entry
/ self->bind == 0 /
{
self->vmem_depth = 0;
self->bind = 1;
self->chan = args[0];
printf( "chan == %s, type == %d.\n",
stringof(self->chan->scd_channel_name), args[1] );
printf( "scd_subscriber_ids[0..4] == %d, %d, %d, %d.\n",
self->chan->scd_subscriber_ids[0],
self->chan->scd_subscriber_ids[1],
self->chan->scd_subscriber_ids[2],
self->chan->scd_subscriber_ids[3] );
printf( "scd_publisher_ids[0..1] == %d, %d.\n",
self->chan->scd_publisher_ids[0],
self->chan->scd_publisher_ids[1] );
}
vmem_alloc:entry
/ self->bind == 1 /
{
trace(self->vmem_depth);
self->vmem_depth++;
}
vmem_alloc:return
/ self->bind == 1 /
{
trace(self->vmem_depth);
self->vmem_depth--;
}
vmem_alloc:return
/ self->bind == 1 && self->vmem_depth == 0 /
{
printf( "id == %p\n", (int) args[1] );
}
bind_common:return
/ self->bind == 1 /
{
self->bind = 0;
}
[s10_74L2a.3]#
The output i received is:
---------
3 6926 unbind_common:entry chan ==
devfsadm_event_channel, type == 1, id == 1.
scd_subscriber_ids[0..4] == 0, 0, 0, 0.
scd_publisher_ids[0..1] == 0, 1.
3 15017 vmem_free:entry
genunix`unbind_common+0xb8
genunix`log_sysevent_register+0x234
genunix`modctl+0x30c
unix`syscall_trap32+0xcc
3 6926 unbind_common:entry chan ==
syseventconfd_event_channel, type == 1, id == 1.
scd_subscriber_ids[0..4] == 0, 0, 0, 0.
scd_publisher_ids[0..1] == 0, 1.
3 15017 vmem_free:entry
genunix`unbind_common+0xb8
genunix`log_sysevent_register+0x234
genunix`modctl+0x30c
unix`syscall_trap32+0xcc
3 6926 unbind_common:entry chan == syseventd_channel,
type == 1, id == 1.
scd_subscriber_ids[0..4] == 0, 1, 0, 0.
scd_publisher_ids[0..1] == 0, 1.
3 15017 vmem_free:entry
genunix`unbind_common+0xb8
genunix`log_sysevent_register+0x234
genunix`modctl+0x30c
unix`syscall_trap32+0xcc
3 6924 bind_common:entry chan ==
devfsadm_event_channel, type == 1.
scd_subscriber_ids[0..4] == 0, 0, 0, 0.
scd_publisher_ids[0..1] == 0, 0.
3 10709 vmem_alloc:entry 0
3 10710 vmem_alloc:return 1
3 10710 vmem_alloc:return id == 3588000
3 6924 bind_common:entry chan ==
syseventconfd_event_channel, type == 1.
scd_subscriber_ids[0..4] == 0, 0, 0, 0.
scd_publisher_ids[0..1] == 0, 0.
3 10709 vmem_alloc:entry 0
3 10710 vmem_alloc:return 1
3 10710 vmem_alloc:return id == 3586d98
3 6924 bind_common:entry chan == syseventd_channel,
type == 1.
scd_subscriber_ids[0..4] == 0, 1, 0, 0.
scd_publisher_ids[0..1] == 0, 0.
3 10709 vmem_alloc:entry 0
3 10710 vmem_alloc:return 1
3 10710 vmem_alloc:return id == 358cd98
---------
i haven''t retried this script on the e2900, but the v880 should be
sufficient ?
Thanks,
sam
Bill Sommerfeld wrote:
>On Wed, 2006-04-12 at 07:34, sang-suan gam wrote:
>
>
>
>>vmem_alloc:return
>>/ self->tr == 1 /
>>{
>> printf( "id == %d\n", (int) args[1] );
>>}
>>
>>...
>> 1 10710 vmem_alloc:return id == 56151448
>>
>>what am i doing wrong ?
>>
>>
>
>You didn''t show the entire script, so I''m going to guess:
>
>You''re not seeing the return you''re expecting --
there''s some artful
>mutual recursion between vmem and kmem going on under the covers -- so
>you may be seeing the return from a more deeply-nested vmem_alloc() used
>to allocate memory.
>
>Include a stack(); in the action to see which call to vmem_alloc()
>you''re hitting. Use something like self->tr as a counter to
match
>enters and returns..
>
> - Bill
>
>
>
>
>
On Wed, Apr 12, 2006 at 11:09:36AM -0400, Bill Sommerfeld wrote:> On Wed, 2006-04-12 at 07:34, sang-suan gam wrote: > > > vmem_alloc:return > > / self->tr == 1 / > > { > > printf( "id == %d\n", (int) args[1] ); > > } > > > > ... > > 1 10710 vmem_alloc:return id == 56151448 > > > > what am i doing wrong ? > > You didn''t show the entire script, so I''m going to guess: > > You''re not seeing the return you''re expecting -- there''s some artful > mutual recursion between vmem and kmem going on under the covers -- so > you may be seeing the return from a more deeply-nested vmem_alloc() used > to allocate memory. > > Include a stack(); in the action to see which call to vmem_alloc() > you''re hitting. Use something like self->tr as a counter to match > enters and returns..More likely, it''s a tail call; vmem_alloc() can tailcall two other functions:> vmem_alloc::dis... vmem_alloc+0x30: call -0xe4cf0 <kmem_cache_alloc> vmem_alloc+0x34: restore ... vmem_alloc+0xd0: call -0x10c4 <vmem_nextfit_alloc> vmem_alloc+0xd4: restore ... The actual return will be the return value from those functions. Cheers, - jonathan -- Jonathan Adams, Solaris Kernel Development
Thanks Jonathan, i''ll try this out tomorrow. cheers! sam Jonathan Adams wrote:>On Wed, Apr 12, 2006 at 11:09:36AM -0400, Bill Sommerfeld wrote: > > >>On Wed, 2006-04-12 at 07:34, sang-suan gam wrote: >> >> >> >>>vmem_alloc:return >>>/ self->tr == 1 / >>>{ >>> printf( "id == %d\n", (int) args[1] ); >>>} >>> >>>... >>> 1 10710 vmem_alloc:return id == 56151448 >>> >>>what am i doing wrong ? >>> >>> >>You didn''t show the entire script, so I''m going to guess: >> >>You''re not seeing the return you''re expecting -- there''s some artful >>mutual recursion between vmem and kmem going on under the covers -- so >>you may be seeing the return from a more deeply-nested vmem_alloc() used >>to allocate memory. >> >>Include a stack(); in the action to see which call to vmem_alloc() >>you''re hitting. Use something like self->tr as a counter to match >>enters and returns.. >> >> > >More likely, it''s a tail call; vmem_alloc() can tailcall two other functions: > > > >>vmem_alloc::dis >> >> >... >vmem_alloc+0x30: call -0xe4cf0 <kmem_cache_alloc> >vmem_alloc+0x34: restore >... >vmem_alloc+0xd0: call -0x10c4 <vmem_nextfit_alloc> >vmem_alloc+0xd4: restore >... > >The actual return will be the return value from those functions. > >Cheers, >- jonathan > > >