From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19972 invoked by alias); 24 Mar 2006 10:38:45 -0000 Received: (qmail 19875 invoked by uid 22791); 24 Mar 2006 10:38:43 -0000 X-Spam-Status: No, hits=0.7 required=5.0 tests=AWL,BAYES_40,SPF_SOFTFAIL X-Spam-Check-By: sourceware.org Received: from e3.ny.us.ibm.com (HELO e3.ny.us.ibm.com) (32.97.182.143) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 24 Mar 2006 10:38:41 +0000 Received: from sd0208e0.au.ibm.com (d23rh904.au.ibm.com [9.190.250.241]) by e3.ny.us.ibm.com (8.12.11/8.12.11) with ESMTP id k2OAcPox030630 for ; Fri, 24 Mar 2006 05:38:26 -0500 Received: from d23av02.au.ibm.com (d23av02.au.ibm.com [9.190.250.243]) by sd0208e0.au.ibm.com (8.12.10/NCO/VER6.8) with ESMTP id k2OAfJxk198804 for ; Fri, 24 Mar 2006 21:41:30 +1100 Received: from d23av02.au.ibm.com (loopback [127.0.0.1]) by d23av02.au.ibm.com (8.12.11/8.13.3) with ESMTP id k2OAbjqi017488 for ; Fri, 24 Mar 2006 21:37:45 +1100 Received: from IBM528414E28E4 ([9.181.133.157]) by d23av02.au.ibm.com (8.12.11/8.12.11) with SMTP id k2OAbgXF017398; Fri, 24 Mar 2006 21:37:44 +1100 Message-ID: <001e01c64f2f$05dc51e0$9d85b509@IBM528414E28E4> From: "Gui,Jian" To: "Martin Hunt" , "SystemTAP" References: <1142416360.27792.8.camel@dragon> Subject: [patch] ppc64 patch for new benchmark framework Date: Fri, 24 Mar 2006 10:38:00 -0000 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_001B_01C64F72.12AC0FD0" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-Virus-Checked: Checked by ClamAV on sourceware.org X-IsSubscribed: yes Mailing-List: contact systemtap-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Post: List-Help: , Sender: systemtap-owner@sourceware.org X-SW-Source: 2006-q1/txt/msg00872.txt.bz2 This is a multi-part message in MIME format. ------=_NextPart_000_001B_01C64F72.12AC0FD0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit Content-length: 3400 Hi, Martin This patch is to fix three maybe bugs of the new benchmark framework on ppc64. This framework works fine on i686 but fails on my ppc64/2.6.9-34.EL for the following reasons: 1) The function kallsyms_lookup_name("sys_getuid") always return 0 on ppc64 and we have to use kallsysms_lookup_name(".sys_getuid") to get the function entry address instead; 2) The content of /proc/cpuinfo on ppc64 is different from on i686. It is like: processor : 0 cpu : POWER5 (gr) clock : 1502.496000MHz revision : 2.2 There is no "model name" or "physical id" information, thus current print_header always failed; 3) The assignment of (.addr = "sys_getuid") will trigger a compilation error like: "warning: initialization from incompatible pointer type" (I'm using gcc-3.4.5-2 + glibc-2.3.4-2.19) This patch works on ppc64/2.6.9-34.EL and i686/2.6.15.6 and should apply to snapshot-20060318. Could you give some comments? Thanks. Gui,Jian diff -Nur src-20060318/runtime/bench2/bench.rb src-modified/runtime/bench2/bench.rb --- src-20060318/runtime/bench2/bench.rb 2006-03-24 09:03:53.000000000 -0500 +++ src-modified/runtime/bench2/bench.rb 2006-03-24 09:06:26.000000000 -0500 @@ -149,9 +149,14 @@ MODULE_AUTHOR(\"automatically generated by bench2/run_bench\");\n\n" f << "static int inst_sys_getuid (struct kprobe *p, struct pt_regs *regs) {\n" f << @code - f << "\n return 0;\n} -static struct kprobe kp[] = {\n {\n .addr = \"sys_getuid\", - .pre_handler = inst_sys_getuid\n }\n};\n + f << "\n return 0;\n}\n" + f << " static struct kprobe kp[] = {\n {\n" + f << "#if defined __powerpc64__ \n" + f << " .addr = (void *)\".sys_getuid\",\n" + f << "#else \n" + f << " .addr = \"sys_getuid\", \n" + f << "#endif\n" + f << ".pre_handler = inst_sys_getuid\n }\n};\n #define NUM_KPROBES 1\n int probe_start(void)\n{\n return _stp_register_kprobes (kp, NUM_KPROBES);\n}\n void probe_exit (void)\n{\n _stp_unregister_kprobes (kp, NUM_KPROBES); \n}\n" @@ -185,8 +190,17 @@ else @@num_threads = [1] end - physical_cpus=`grep "physical id" /proc/cpuinfo`.split("\n").uniq.length - model=`grep "model name" /proc/cpuinfo`.match(/(model name\t: )([^\n]*)/)[2] + arch=`uname -m`.strip + if (arch.match(/ppc64/)) + cpu=`grep "cpu" /proc/cpuinfo`.match(/(cpu\t\t: )([^\n]*)/)[2] + clock=`grep "clock" /proc/cpuinfo`.match(/(clock\t\t: )([^\n]*)/)[2] + revision=`grep "revision" /proc/cpuinfo`.match(/(revision\t: )([^\n]*)/)[2] + cpuinfo=cpu + " " + clock + " revision: " + revision + else + physical_cpus=`grep "physical id" /proc/cpuinfo`.split("\n").uniq.length + model=`grep "model name" /proc/cpuinfo`.match(/(model name\t: )([^\n]*)/)[2] + cpuinfo="(#{physical_cpus} physical) #{model}" + end puts "SystemTap BENCH2 \t" + `date` puts "kernel: " + `uname -r`.strip + " " + `uname -m`.strip begin @@ -195,11 +209,7 @@ end puts `uname -n`.strip + ": " + `uptime` - if nproc > 1 - puts "processors: #{nproc} (#{physical_cpus} physical) #{model}" - else - puts "processors: #{nproc} #{model}" - end + puts "processors: #{nproc} #{cpuinfo}" begin mem=IO.read("/proc/meminfo").split("\n") ------=_NextPart_000_001B_01C64F72.12AC0FD0 Content-Type: application/octet-stream; name="bench2.ppc64.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="bench2.ppc64.patch" Content-length: 2554 diff -Nur src-20060318/runtime/bench2/bench.rb src-modified/runtime/bench2/= bench.rb=0A= --- src-20060318/runtime/bench2/bench.rb 2006-03-24 09:03:53.000000000 -050= 0=0A= +++ src-modified/runtime/bench2/bench.rb 2006-03-24 09:06:26.000000000 -050= 0=0A= @@ -149,9 +149,14 @@=0A= MODULE_AUTHOR(\"automatically generated by bench2/run_bench\");\n\n"=0A= f << "static int inst_sys_getuid (struct kprobe *p, struct pt_regs *regs)= {\n"=0A= f << @code=0A= - f << "\n return 0;\n}=0A= -static struct kprobe kp[] =3D {\n {\n .addr =3D \"sys_getuid\",=0A= - .pre_handler =3D inst_sys_getuid\n }\n};\n=0A= + f << "\n return 0;\n}\n"=0A= + f << " static struct kprobe kp[] =3D {\n {\n"=0A= + f << "#if defined __powerpc64__ \n"=0A= + f << " .addr =3D (void *)\".sys_getuid\",\n"=0A= + f << "#else \n"=0A= + f << " .addr =3D \"sys_getuid\", \n"=0A= + f << "#endif\n"=0A= + f << ".pre_handler =3D inst_sys_getuid\n }\n};\n=0A= #define NUM_KPROBES 1\n=0A= int probe_start(void)\n{\n return _stp_register_kprobes (kp, NUM_KPROBES)= ;\n}\n=0A= void probe_exit (void)\n{\n _stp_unregister_kprobes (kp, NUM_KPROBES); \n= }\n"=0A= @@ -185,8 +190,17 @@=0A= else=0A= @@num_threads =3D [1]=0A= end=0A= - physical_cpus=3D`grep "physical id" /proc/cpuinfo`.split("\n").uniq.le= ngth=0A= - model=3D`grep "model name" /proc/cpuinfo`.match(/(model name\t: )([^\n= ]*)/)[2]=0A= + arch=3D`uname -m`.strip=0A= + if (arch.match(/ppc64/))=0A= + cpu=3D`grep "cpu" /proc/cpuinfo`.match(/(cpu\t\t: )([^\n]*)/)[2]=0A= + clock=3D`grep "clock" /proc/cpuinfo`.match(/(clock\t\t: )([^\n]*)/)[2]=0A= + revision=3D`grep "revision" /proc/cpuinfo`.match(/(revision\t: )([^\n]*)/= )[2]=0A= + cpuinfo=3Dcpu + " " + clock + " revision: " + revision=0A= + else=0A= + physical_cpus=3D`grep "physical id" /proc/cpuinfo`.split("\n").uni= q.length=0A= + model=3D`grep "model name" /proc/cpuinfo`.match(/(model name\t: )(= [^\n]*)/)[2]=0A= + cpuinfo=3D"(#{physical_cpus} physical) #{model}"=0A= + end=09=0A= puts "SystemTap BENCH2 \t" + `date`=0A= puts "kernel: " + `uname -r`.strip + " " + `uname -m`.strip=0A= begin=0A= @@ -195,11 +209,7 @@=0A= end=0A= =20=0A= puts `uname -n`.strip + ": " + `uptime`=0A= - if nproc > 1=0A= - puts "processors: #{nproc} (#{physical_cpus} physical) #{model}"=0A= - else=0A= - puts "processors: #{nproc} #{model}"=0A= - end=0A= + puts "processors: #{nproc} #{cpuinfo}"=0A= =20=0A= begin=0A= mem=3DIO.read("/proc/meminfo").split("\n")=0A= ------=_NextPart_000_001B_01C64F72.12AC0FD0--