Re: [patch update-v1] a simple hardware detector for latency as wellas throughput ver. 0.1.0

From: Luming Yu
Date: Wed Jun 27 2012 - 11:00:05 EST


On Mon, Jun 25, 2012 at 9:37 PM, Luming Yu <luming.yu@xxxxxxxxx> wrote:
> On Tue, Jun 26, 2012 at 5:23 AM, Luming Yu <luming.yu@xxxxxxxxx> wrote:
>> The patch is the fist step to test some basic hardware functions like
>> TSC to help people understand if there is any hardware latency as well
>> as throughput problem exposed on bare metal or left behind by BIOS or
>> interfered by SMI. Currently the patch tests TSC, CPU Frequency, and
>> RDRAND, which is a new CPU instruction to get random number introudced
>> in new CPU like Intel Ivy Bridge, in stop_machine context.
>>
>> The tsc samples (ns) below are from a P4 system. You can change from 0
>> to 1000 in /sys/kernel/debug/hw_atency_test/threshold to TSC sample at ms.
>
> typo.
>
> s/ms/us/
>
>>
>> [root@p4 linux]# rmmod hw_latency_test
>> [root@p4 linux]# insmod drivers/misc/hw_latency_test.ko
>> [root@p4 linux]# echo tsc > /sys/kernel/debug/hw_latency_test/current
>> [root@p4 linux]# echo 1 > /sys/kernel/debug/hw_latency_test/enable
>> [root@p4 linux]# cat /sys/kernel/debug/hw_latency_test/sample
>> 1340657264.0434121340 Â 388
>> 1340657264.0935125912 Â 379
>> 1340657265.0436123548 Â 404
>> 1340657265.0937122432 Â 441
>> ....
>> ^C
>> [root@p4 linux]# echo 0 > /sys/kernel/debug/hw_latency_test/enable
>>
>> Signed-off-by: Luming ÂYu <luming.yu@xxxxxxxxx>
>> ---
>> I will add more tests after the first patch gets merged for those guys
>> who want to directly play with new hardware functions, and latency and
>> bandwidth is concern, or simply out of curiosity. The patch is based on
>> hardware latency dector written by Jcm in RT-tree. I assume I can add
>> Jcm's signed off here.
>>
>>
>> Âdrivers/misc/Kconfig      |  Â7 +
>> Âdrivers/misc/Makefile     Â|  Â2 +
>> Âdrivers/misc/hw_latency_test.c | Â833 ++++++++++++++++++++++++++++++++++++++++
>> Â3 files changed, 842 insertions(+), 0 deletions(-)
>>
>>
>> diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
>> index c779509..a5216b5 100644
>> --- a/drivers/misc/Kconfig
>> +++ b/drivers/misc/Kconfig
>> @@ -123,6 +123,13 @@ config IBM_ASM
>> Â Â Â Â Âfor information on the specific driver level and support statement
>> Â Â Â Â Âfor your IBM server.
>>
>> +config HW_LATENCY_TEST
>> + Â Â Â tristate "Testing module to detect hardware lattency and throughput"
>> + Â Â Â depends on DEBUG_FS
>> + Â Â Â depends on RING_BUFFER
>> + Â Â Â depends on X86

I begun the tool on X86, but bear in mind that use standard kernel interface
as much as possible. I was trying to measure CPU Frequency, but the use of
calibrate_tsc forced me add a X86 dependency here.

Other finding is recalibrate_cpu_khz() is a null function in SMP.
But the only two users (p4-clockmod.c and powernow-k7.c) themselves
could lack of users roo these days.

Let me know if there are any other comments.

My plan for the tool is to push it in 3.6 or 3.7. So I will routinely
get back to the thread probably weekly or bi-weekly in the time frame.
:-)
The 0.2 will based on what I can see in upstream of the tool.

Thanks!!!
--
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/