Re: [LTP] [TESTING] x86: implement prctl PR_GET_TSC and PR_SET_TSCin 2.6.26

From: Erik Bosman
Date: Fri Sep 05 2008 - 11:14:28 EST




On Fri, 5 Sep 2008, Subrata Modak wrote:
>
> 2) Built fine on i686, but disable-tsc-on-off-stress-test failed:
>
> # uname -a
> Linux 2.6.26-autokern1 #1 SMP Fri Sep 5 09:49:37 UTC 2008 i686 GNU/Linux
>
> # ./disable-tsc-test
> rdtsc() == 4098191459558
> prctl(PR_GET_TSC, &tsc_val); tsc_val == PR_TSC_ENABLE
> rdtsc() == 4098192032718
> prctl(PR_SET_TSC, PR_TSC_ENABLE)
> rdtsc() == 4098192209502
> prctl(PR_SET_TSC, PR_TSC_SIGSEGV)
> rdtsc() == [ SIG_SEGV ]
> prctl(PR_GET_TSC, &tsc_val); tsc_val == PR_TSC_SIGSEGV
> prctl(PR_SET_TSC, PR_TSC_ENABLE)
> rdtsc() == 4098192880534
> # echo $?
> 0
>
> # ./disable-tsc-on-off-stress-test
> Floating point exception
> # echo $?
> 136

I'm a bit puzzled by this, since I don't use any floats
in my test (or even integer division.)

Another strange thing is that it is the parent process getting
the signal, while the parent doesn't do anything but forking
and waiting.

If the bug was in the kernel (for example sending a SIGFPE instead
of a SIGSEGV,) the signal would be expected to go to the child process
doing the actual testing (I know, bugs are bugs, but my patches were
not that invasive.)

Does it fail every time? Does it fail immediately? Can you use gdb
to locate where it happens?

I cannot reproduce this error using gcc 4.2.3.
Valgrind doesn't give me any errors except uninitialized (and in
this case unused) prctl arguments.
Could it be a optimization bug?

>
> # ./disable-tsc-ctxt-sw-stress-test
> [No further output means we're allright]
> # echo $?
> 0
>
>
> 3) Build failure on ppc64 with a POWER6 cpu:
>

The test uses the intel RDTSC instruction
and PR_SET_TSC/PR_GET_TSC is currently only
implemented on x86. So it is of little use to
try to compile this test on other platforms.

>
> Can you kindly help us fix the:
> 1) Floating point exception for disable-tsc-on-off-stress-test, running
> 2.6.26 on i686,
> 2) build failure issue(s) with ppc64.
>
> I also see the following issue(s) when i run it on i386 machine running
> kernel less than 2.6.26:
>

...

> $ ./disable-tsc-ctxt-sw-stress-test
> [No further output means we're allright]
> prctl: Invalid argument
> prctl: Invalid argument
> ..............
> ..............
> prctl: Invalid argument
> $ echo $?
> 0
>
> $ ./disable-tsc-ctxt-sw-stress-test
> [No further output means we're allright]
> prctl: Invalid argument
> prctl: Invalid argument
> ..............
> ..............
> prctl: Invalid argument
> $ echo $?
> 0
>
> Should it not fail on any kernel(s) below 2.6.26 ? It shows pass for all
> the tests. And also lots of lines like:
>
> prctl: Invalid argument
>
> is printed, which in ideal situation should not be printed at all. What
> do you think ?
>
> Regards--
> Subrata
>

The current test wasn't written to be integrated into an automated testing
framework and only uses stderr output for error reporting. To integrate
the test into a framework, just test whether all children terminate using
SIGALRM (which means success.)

Regards,
Erik Bosman
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/