Re: [RFT] llquantize for FreeBSD's dtrace

2012-06-29 Thread George Neville-Neil

On Jun 26, 2012, at 15:06 , Fabian Keil wrote:

> Pedro Giffuni  wrote:
> 
>> --- Mar 26/6/12, Mark Peek  ha scritto:
> 
>>> Try this, change the assert on line 1429 in file dt_cc.c
>>> from:
>>> 
>>> assert(!(arg & (UINT16_MAX << args[i].shift)));
>>> 
>>> to
>>> 
>>> assert(!(arg & ((uint64_t)UINT16_MAX <<
>>> args[i].shift)));
>>> 
>> 
>> This certainly looks correct. Thanks Mark !
>> 
>> I updated the patch:
>> 
>> http://people.freebsd.org/~pfg/patches/patch-dtrace-llquantize
> 
> Thanks a lot. Seems to work for me:
> 

And me as well.  I tested the example from the web site.

Nicely done!

Best,
George

___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: [RFT] llquantize for FreeBSD's dtrace

2012-06-26 Thread Pedro Giffuni


--- Mar 26/6/12, Fabian Keil  ha scritto:

> Pedro Giffuni  wrote:
> 
> > --- Mar 26/6/12, Mark Peek 
> ha scritto:
> 
> > > Try this, change the assert on line 1429 in file
> dt_cc.c
> > > from:
> > > 
> > > assert(!(arg & (UINT16_MAX <<
> args[i].shift)));
> > > 
> > > to
> > > 
> > > assert(!(arg & ((uint64_t)UINT16_MAX <<
> > > args[i].shift)));
> > > 
> > 
> > This certainly looks correct. Thanks Mark !
> > 
> > I updated the patch:
> > 
> > http://people.freebsd.org/~pfg/patches/patch-dtrace-llquantize
> 
> Thanks a lot. Seems to work for me:
> 

Nice!

I don't use Dtrace though ... so I'll ask:

Any objections against committing it? :).

Pedro.


___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: [RFT] llquantize for FreeBSD's dtrace

2012-06-26 Thread Fabian Keil
Pedro Giffuni  wrote:

> --- Mar 26/6/12, Mark Peek  ha scritto:

> > Try this, change the assert on line 1429 in file dt_cc.c
> > from:
> > 
> > assert(!(arg & (UINT16_MAX << args[i].shift)));
> > 
> > to
> > 
> > assert(!(arg & ((uint64_t)UINT16_MAX <<
> > args[i].shift)));
> > 
> 
> This certainly looks correct. Thanks Mark !
> 
> I updated the patch:
> 
> http://people.freebsd.org/~pfg/patches/patch-dtrace-llquantize

Thanks a lot. Seems to work for me:

fk@r500 /usr/src/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize 
$for t in tst.*.d; do sudo dtrace -s $t > $t.myout; diff $t.out $t.myout && 
echo success for $t; done
success for tst.bases.d
success for tst.basic.d
success for tst.negorder.d
success for tst.negvalue.d
success for tst.normal.d
success for tst.range.d
success for tst.steps.d
success for tst.trunc.d
fk@r500 /usr/src/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize 
$for t in err.*.d; do sudo dtrace -s $t
dtrace: failed to compile script err.D_LLQUANT_FACTOREVEN.nodivide.d: line 28: 
llquantize( ) factor (argument #1) must evenly divide the number of steps per 
magnitude (argument #4), and the number of steps per magnitude must evenly 
divide a power of the factor
dtrace: failed to compile script err.D_LLQUANT_FACTOREVEN.notfactor.d: line 28: 
llquantize( ) factor (argument #1) must evenly divide the number of steps per 
magnitude (argument #4), and the number of steps per magnitude must evenly 
divide a power of the factor
dtrace: failed to compile script err.D_LLQUANT_FACTORMATCH.d: line 29: 
llquantize( ) factor (argument #1) doesn't match previous declaration: expected 
10, found 3
dtrace: failed to compile script err.D_LLQUANT_FACTORNSTEPS.d: line 28: 
llquantize( ) factor (argument #1) must be less than or equal to the number of 
linear steps per magnitude (argument #4)
dtrace: failed to compile script err.D_LLQUANT_FACTORSMALL.d: line 28: 
llquantize( ) factor (argument #1) must be two or more
dtrace: failed to compile script err.D_LLQUANT_FACTORTYPE.d: line 29: 
llquantize( ) argument #1 (factor) must be an integer constant
dtrace: failed to compile script err.D_LLQUANT_FACTORVAL.d: line 28: 
llquantize( ) argument #1 (factor) must be an unsigned 16-bit quantity
dtrace: failed to compile script err.D_LLQUANT_HIGHMATCH.d: line 29: 
llquantize( ) high magnitude (argument #3) doesn't match previous declaration: 
expected 10, found 11
dtrace: failed to compile script err.D_LLQUANT_HIGHTYPE.d: line 29: llquantize( 
) argument #3 (high magnitude) must be an integer constant
dtrace: failed to compile script err.D_LLQUANT_HIGHVAL.d: line 28: llquantize( 
) argument #3 (high magnitude) must be an unsigned 16-bit quantity
dtrace: failed to compile script err.D_LLQUANT_LOWMATCH.d: line 29: llquantize( 
) low magnitude (argument #2) doesn't match previous declaration: expected 0, 
found 1
dtrace: failed to compile script err.D_LLQUANT_LOWTYPE.d: line 29: llquantize( 
) argument #2 (low magnitude) must be an integer constant
dtrace: failed to compile script err.D_LLQUANT_LOWVAL.d: line 28: llquantize( ) 
argument #2 (low magnitude) must be an unsigned 16-bit quantity
dtrace: failed to compile script err.D_LLQUANT_MAGRANGE.d: line 28: llquantize( 
) high magnitude (argument #3) must be greater than low magnitude (argument #2)
dtrace: failed to compile script err.D_LLQUANT_MAGTOOBIG.d: line 28: 
llquantize( ) factor (10) raised to power of high magnitude (100) overflows 
64-bits
dtrace: failed to compile script err.D_LLQUANT_NSTEPMATCH.d: line 29: 
llquantize( ) linear steps per magnitude (argument #4) doesn't match previous 
declaration: expected 10, found 100
dtrace: failed to compile script err.D_LLQUANT_NSTEPTYPE.d: line 29: 
llquantize( ) argument #4 (linear steps per magnitude) must be an integer 
constant
dtrace: failed to compile script err.D_LLQUANT_NSTEPVAL.d: line 28: llquantize( 
) argument #4 (linear steps per magnitude) must be an unsigned 16-bit quantity

Fabian


signature.asc
Description: PGP signature


Re: [RFT] llquantize for FreeBSD's dtrace

2012-06-26 Thread Pedro Giffuni


--- Mar 26/6/12, Mark Peek  ha scritto:

> >
> > It's a different assertion.
> >
> > Probably some difference between Solaris and BSD.
> > this is very useful, thanks!
> 
> Try this, change the assert on line 1429 in file dt_cc.c
> from:
> 
> assert(!(arg & (UINT16_MAX << args[i].shift)));
> 
> to
> 
> assert(!(arg & ((uint64_t)UINT16_MAX <<
> args[i].shift)));
> 

This certainly looks correct. Thanks Mark !

I updated the patch:

http://people.freebsd.org/~pfg/patches/patch-dtrace-llquantize

cheers,

Pedro.
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: [RFT] llquantize for FreeBSD's dtrace

2012-06-26 Thread Mark Peek

On 6/23/12 11:09 AM, Pedro Giffuni wrote:



--- Sab 23/6/12, Fabian Keil  ha scritto:
...

My suggestion would be to instead try using the test
scripts in


cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize/


err.D_LLQUANT_FACTORSMALL.d (for example) has

@ = llquantize(0, 1, 0, 10, 10);


The problem appears to be unrelated to the syntax change:

fk@r500
/usr/src/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize
$sudo dtrace -s err.D_LLQUANT_FACTORSMALL.d
Assertion failed: (!(arg & (UINT16_MAX <<
args[i].shift))), file



It's a different assertion.

Probably some difference between Solaris and BSD.
this is very useful, thanks!


Try this, change the assert on line 1429 in file dt_cc.c from:

assert(!(arg & (UINT16_MAX << args[i].shift)));

to

assert(!(arg & ((uint64_t)UINT16_MAX << args[i].shift)));


Mark
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: [RFT] llquantize for FreeBSD's dtrace

2012-06-23 Thread Pedro Giffuni


--- Sab 23/6/12, Fabian Keil  ha scritto:
...
> > My suggestion would be to instead try using the test
> > scripts in
> >
> cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize/
> > 
> > err.D_LLQUANT_FACTORSMALL.d (for example) has
> > 
> > @ = llquantize(0, 1, 0, 10, 10);
> 
> The problem appears to be unrelated to the syntax change:
> 
> fk@r500
> /usr/src/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize
> $sudo dtrace -s err.D_LLQUANT_FACTORSMALL.d
> Assertion failed: (!(arg & (UINT16_MAX <<
> args[i].shift))), file
> 

It's a different assertion.

Probably some difference between Solaris and BSD.
this is very useful, thanks!

Pedro.

___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: [RFT] llquantize for FreeBSD's dtrace

2012-06-23 Thread Fabian Keil
Pedro Giffuni  wrote:

> Hello Fabian;
> 
> --- Sab 23/6/12, Fabian Keil ha scritto:
> 
> > Pedro Giffuni  wrote:
> > 
> > > I am not a Dtrace user (yet) but I started to port the
> > Log/linear
> > > quantizations from Illumos:
> > > 
> > > http://dtrace.org/blogs/bmc/2011/02/08/llquantize/
> > > 
> > > Apparently this patch should do it:
> > > 
> > > http://people.freebsd.org/~pfg/patches/patch-llquantize-complete
> > > 
> > > Unfortunately when I tried to build current with Dtrace
> > > support, my i386 Virtualbox VM got stuck in ctfmerge so
> > > this is completely untested.
> > > 
> > > Testers that know how to use it are welcome :).
> > 
> > I applied it on 10-CURRENT amd64 from /usr/src with patch
> > -p0 without any conflicts, but it doesn't appear to be
> > working.
> > 
> > The example from the blog post above triggers an assertion
> > that is still reproducible when reducing the test case:
> > 
> > fk@r500 /tmp $sudo dtrace -n 'tick-1ms{@ = llquantize(i++,
> > 10, 0, 6, 20);}'
> > Assertion failed: (!(arg & (UINT16_MAX <<
> > args[i].shift))), file
> > /usr/src/cddl/lib/libdtrace/../../../cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c,
> > line 1429.
> >
> 
> Thanks for testing!
> 
> It seems like the syntax has changed from the time the
> example from the blog was made. The code says:
> 
> /*
>  * For log/linear quantizations, we have between one and five
>  * arguments in addition to the expression:
>  *
>  *arg1 => Factor
>  *arg2 => Low magnitude
>  *arg3 => High magnitude
>  *arg4 => Number of steps per magnitude
>  *arg5 => Quantization increment value (defaults to 1)
>  */
> 
> 
> My suggestion would be to instead try using the test
> scripts in
> cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize/
> 
> err.D_LLQUANT_FACTORSMALL.d (for example) has
> 
> @ = llquantize(0, 1, 0, 10, 10);

The problem appears to be unrelated to the syntax change:

fk@r500 /usr/src/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize 
$sudo dtrace -s err.D_LLQUANT_FACTORSMALL.d
Assertion failed: (!(arg & (UINT16_MAX << args[i].shift))), file 
/usr/src/cddl/lib/libdtrace/../../../cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c,
 line 1429.
fk@r500 /usr/src/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize 
$sudo dtrace -s tst.bases.d
Assertion failed: (!(arg & (UINT16_MAX << args[i].shift))), file 
/usr/src/cddl/lib/libdtrace/../../../cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c,
 line 1429.
fk@r500 /usr/src/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize 
$sudo dtrace -s tst.negvalue.d
Assertion failed: (!(arg & (UINT16_MAX << args[i].shift))), file 
/usr/src/cddl/lib/libdtrace/../../../cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c,
 line 1429.
fk@r500 /usr/src/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize 
$sudo dtrace -s tst.steps.d
Assertion failed: (!(arg & (UINT16_MAX << args[i].shift))), file 
/usr/src/cddl/lib/libdtrace/../../../cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c,
 line 1429.

root@r500:/root # dtrace -s 
/usr/src/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize/tst.steps.d
Assertion failed: (!(arg & (UINT16_MAX << args[i].shift))), file 
/usr/src/cddl/lib/libdtrace/../../../cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c,
 line 1429.
Abort (core dumped)

Fabian


signature.asc
Description: PGP signature


Re: [RFT] llquantize for FreeBSD's dtrace

2012-06-23 Thread Pedro Giffuni
Hello Fabian;

--- Sab 23/6/12, Fabian Keil ha scritto:

> Pedro Giffuni  wrote:
> 
> > I am not a Dtrace user (yet) but I started to port the
> Log/linear
> > quantizations from Illumos:
> > 
> > http://dtrace.org/blogs/bmc/2011/02/08/llquantize/
> > 
> > Apparently this patch should do it:
> > 
> > http://people.freebsd.org/~pfg/patches/patch-llquantize-complete
> > 
> > Unfortunately when I tried to build current with Dtrace
> > support, my i386 Virtualbox VM got stuck in ctfmerge so
> > this is completely untested.
> > 
> > Testers that know how to use it are welcome :).
> 
> I applied it on 10-CURRENT amd64 from /usr/src with patch
> -p0 without any conflicts, but it doesn't appear to be
> working.
> 
> The example from the blog post above triggers an assertion
> that is still reproducible when reducing the test case:
> 
> fk@r500 /tmp $sudo dtrace -n 'tick-1ms{@ = llquantize(i++,
> 10, 0, 6, 20);}'
> Assertion failed: (!(arg & (UINT16_MAX <<
> args[i].shift))), file
> /usr/src/cddl/lib/libdtrace/../../../cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c,
> line 1429.
>

Thanks for testing!

It seems like the syntax has changed from the time the
example from the blog was made. The code says:

/*
 * For log/linear quantizations, we have between one and five
 * arguments in addition to the expression:
 *
 *arg1 => Factor
 *arg2 => Low magnitude
 *arg3 => High magnitude
 *arg4 => Number of steps per magnitude
 *arg5 => Quantization increment value (defaults to 1)
 */


My suggestion would be to instead try using the test
scripts in
cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize/

err.D_LLQUANT_FACTORSMALL.d (for example) has

@ = llquantize(0, 1, 0, 10, 10);

hope that helps!

Pedro.


___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: [RFT] llquantize for FreeBSD's dtrace

2012-06-23 Thread Fabian Keil
Pedro Giffuni  wrote:

> I am not a Dtrace user (yet) but I started to port the Log/linear
> quantizations from Illumos:
> 
> http://dtrace.org/blogs/bmc/2011/02/08/llquantize/
> 
> Apparently this patch should do it:
> 
> http://people.freebsd.org/~pfg/patches/patch-llquantize-complete
> 
> Unfortunately when I tried to build current with Dtrace support,
> my i386 Virtualbox VM got stuck in ctfmerge so this is
> completely untested.
> 
> Testers that know how to use it are welcome :).

I applied it on 10-CURRENT amd64 from /usr/src with patch -p0
without any conflicts, but it doesn't appear to be working.

The example from the blog post above triggers an assertion
that is still reproducible when reducing the test case:

fk@r500 /tmp $sudo dtrace -n 'tick-1ms{@ = llquantize(i++, 10, 0, 6, 20);}'
Assertion failed: (!(arg & (UINT16_MAX << args[i].shift))), file 
/usr/src/cddl/lib/libdtrace/../../../cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c,
 line 1429.

Changing the i++ to i seems to trigger a different bug
(or at least doesn't behave like I would expect):

fk@r500 /tmp $sudo dtrace -n 'tick-1ms{@ = llquantize(i, 10, 0, 6, 20);}'
dtrace: invalid probe specifier tick-1ms{@ = llquantize(i, 10, 0, 6, 20);}: in 
action list: failed to resolve i: Unknown variable name

Replacing the i with a zero behaves similar to the version that uses i++ again:

fk@r500 /tmp $sudo dtrace -n 'tick-1ms{ i = 0; @ = llquantize(0, 10, 0, 6, 
20);}'
Assertion failed: (!(arg & (UINT16_MAX << args[i].shift))), file 
/usr/src/cddl/lib/libdtrace/../../../cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c,
 line 1429.

fk@r500 /tmp $gdb741 $(which dtrace) dtrace.core
[GDB will not be able to debug user-mode threads: Undefined symbol 
"td_thr_getxmmregs"]
GNU gdb (GDB) 7.4.1 [GDB v7.4.1 for FreeBSD]
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-portbld-freebsd10.0".
For bug reporting instructions, please see:
...
Reading symbols from /usr/sbin/dtrace...done.
[New process 100454]
Core was generated by `dtrace'.
Program terminated with signal 6, Aborted.
#0  0x0008019a26ac in thr_kill () at thr_kill.S:3
3   RSYSCALL(thr_kill)
(gdb) where
#0  0x0008019a26ac in thr_kill () at thr_kill.S:3
#1  0x00080082ff5c in _thr_send_sig (thread=, sig=6) at 
/usr/src/lib/libthr/thread/thr_sig.c:113
#2  0x0008008305b6 in _raise (sig=0) at 
/usr/src/lib/libthr/thread/thr_sig.c:505
#3  0x000801a517d3 in abort () at /usr/src/lib/libc/stdlib/abort.c:65
#4  0x000800a91c60 in __assert (line=, file=, 
expr=) at 
/usr/src/cddl/lib/libdtrace/../../../cddl/compat/opensolaris/include/assert.h:56
#5  dt_compile_agg (dtp=0x80243f000, dnp=0x803e223e0, sdp=0x803e17140) at 
/usr/src/cddl/lib/libdtrace/../../../cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c:1366
#6  0x000800a9257f in dt_compile_one_clause (pnp=, 
cnp=, dtp=)
at 
/usr/src/cddl/lib/libdtrace/../../../cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c:1597
#7  dt_compile_clause (dtp=0x80243f000, cnp=0x803e23040) at 
/usr/src/cddl/lib/libdtrace/../../../cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c:1628
#8  0x000800a94441 in dt_compile (dtp=0x80243f000, context=362, 
pspec=DTRACE_PROBESPEC_NAME, arg=0x0, cflags=128, argc=1, argv=0x802417040, 
fp=0x0,
s=0x7fffd9ca "tick-1ms{ i = 0; @ = llquantize(i, 10, 0, 6, 20);}") at 
/usr/src/cddl/lib/libdtrace/../../../cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c:2396
#9  0x000800a948bc in dtrace_program_strcompile (dtp=0x18866, s=, spec=DTRACE_PROBESPEC_PROVIDER, cflags=0, argc=-2123430480, 
argv=)
at 
/usr/src/cddl/lib/libdtrace/../../../cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c:2460
#10 0x00405ae4 in compile_str (dcp=0x802418e00) at 
/usr/src/cddl/usr.sbin/dtrace/../../../cddl/contrib/opensolaris/cmd/dtrace/dtrace.c:766
#11 0x00403b41 in main (argc=, argv=0x7fffd668) at 
/usr/src/cddl/usr.sbin/dtrace/../../../cddl/contrib/opensolaris/cmd/dtrace/dtrace.c:1632

Fabian


signature.asc
Description: PGP signature


[RFT] llquantize for FreeBSD's dtrace

2012-06-22 Thread Pedro Giffuni

Hello;

I am not a Dtrace user (yet) but I started to port the Log/linear
quantizations from Illumos:

http://dtrace.org/blogs/bmc/2011/02/08/llquantize/

Apparently this patch should do it:

http://people.freebsd.org/~pfg/patches/patch-llquantize-complete

Unfortunately when I tried to build current with Dtrace support,
my i386 Virtualbox VM got stuck in ctfmerge so this is
completely untested.

Testers that know how to use it are welcome :).

best regards,

Pedro.

ps. just for reference, the original code was taken from here:
https://hg.openindiana.org/upstream/illumos/illumos-gate/rev/15b74a2a9a9d
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"