[DTrace-devel] [PATCH v2] test: fix speculation/tst.SingleCPU.d

Kris Van Hees kris.van.hees at oracle.com
Mon Feb 27 01:12:37 UTC 2023


On Sun, Feb 26, 2023 at 07:39:07PM +0000, Nick Alcock via DTrace-devel wrote:
> This test is meant to verify that simultaneously-active speculations get
> drained and committed/discarded appropriately without losing any of
> them.  Unfortunately, it never sets nspec, which is 1 by default, so it
> actually runs out of speculations almost immediately: we need at least
> 16 for this test, which is not so coincidentally the maximum this
> implementation supports right now.  Boosting that reveals another
> problem: we print out the speculation ID, which is not in any sense a
> guaranteed value, so we get lots of test failures: what we *actually*
> care about is that the n value printed is suitable (indicating that the
> first speculation in any block of (64 / 4) was committed and the rest
> were discarded, and who cares what its ID is).
> 
> We also knock the switchrate down again because if we knock it up any
> higher the discards (which are processed in userspace) don't get
> processed fast enough to keep up, and we run out.  We consume 16
> speculations in 6.4ms, so set the switchrate to 3ms to give us a bit of
> headroom.  (This will still be racy on highly-loaded test systems where
> the polls just don't happen fast enough because of system load: if that
> happens, we can tag the test suitably in future.)
> 
> Signed-off-by: Nick Alcock <nick.alcock at oracle.com>

Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>

> ---
>  test/unittest/speculation/tst.SingleCPU.d |  4 ++-
>  test/unittest/speculation/tst.SingleCPU.r | 32 +++++++++++------------
>  2 files changed, 19 insertions(+), 17 deletions(-)
> 
> diff --git a/test/unittest/speculation/tst.SingleCPU.d b/test/unittest/speculation/tst.SingleCPU.d
> index 81a5afa100b9b..dd68db1a1f380 100644
> --- a/test/unittest/speculation/tst.SingleCPU.d
> +++ b/test/unittest/speculation/tst.SingleCPU.d
> @@ -13,6 +13,8 @@
>  /* @@trigger: bogus-ioctl */
>  
>  #pragma D option quiet
> +#pragma D option nspec=16
> +#pragma D option switchrate=3ms
>  
>  BEGIN
>  {
> @@ -37,7 +39,7 @@ syscall::ioctl:entry
>  / pid == $target && (n & 3) == 1 /
>  {
>  	speculate(i);
> -	printf("%4d %4d", n, i);
> +	printf("%4d", n);
>  }
>  
>  syscall::ioctl:entry
> diff --git a/test/unittest/speculation/tst.SingleCPU.r b/test/unittest/speculation/tst.SingleCPU.r
> index 3659925d10b0f..66740b74ddf21 100644
> --- a/test/unittest/speculation/tst.SingleCPU.r
> +++ b/test/unittest/speculation/tst.SingleCPU.r
> @@ -1,17 +1,17 @@
> -   1    1   2 hello world
> -  65    1  66 hello world
> - 129    1 130 hello world
> - 193    1 194 hello world
> - 257    1 258 hello world
> - 321    1 322 hello world
> - 385    1 386 hello world
> - 449    1 450 hello world
> - 513    1 514 hello world
> - 577    1 578 hello world
> - 641    1 642 hello world
> - 705    1 706 hello world
> - 769    1 770 hello world
> - 833    1 834 hello world
> - 897    1 898 hello world
> - 961    1 962 hello world
> +   1   2 hello world
> +  65  66 hello world
> + 129 130 hello world
> + 193 194 hello world
> + 257 258 hello world
> + 321 322 hello world
> + 385 386 hello world
> + 449 450 hello world
> + 513 514 hello world
> + 577 578 hello world
> + 641 642 hello world
> + 705 706 hello world
> + 769 770 hello world
> + 833 834 hello world
> + 897 898 hello world
> + 961 962 hello world
>  
> -- 
> 2.39.0
> 
> 
> _______________________________________________
> DTrace-devel mailing list
> DTrace-devel at oss.oracle.com
> https://oss.oracle.com/mailman/listinfo/dtrace-devel



More information about the DTrace-devel mailing list