diff options
author | CamVan Nguyen <ctnguyen@us.ibm.com> | 2012-01-06 15:28:35 -0600 |
---|---|---|
committer | A. Patrick Williams III <iawillia@us.ibm.com> | 2012-01-25 08:53:50 -0600 |
commit | cad6f41c5ceb5affe968a32618e4cf5d53cb7554 (patch) | |
tree | 93ba18d835402cb175e41f412eb67cc0d8d52d7c /src/build/vpo | |
parent | 52b60aea13ffc9a8d67a6714e1416402fd203139 (diff) | |
download | talos-hostboot-cad6f41c5ceb5affe968a32618e4cf5d53cb7554.tar.gz talos-hostboot-cad6f41c5ceb5affe968a32618e4cf5d53cb7554.zip |
VPO implementation of debug framework.
Change-Id: Ic4efd38fb189efa7c42a7b3089c82c7f6d408c14
Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/596
Tested-by: Jenkins Server
Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/build/vpo')
-rwxr-xr-x | src/build/vpo/hb-errl | 196 | ||||
-rwxr-xr-x | src/build/vpo/hb-printk | 144 | ||||
-rwxr-xr-x | src/build/vpo/hb-trace | 158 | ||||
-rwxr-xr-x | src/build/vpo/hb-virtdebug.pl | 125 |
4 files changed, 107 insertions, 516 deletions
diff --git a/src/build/vpo/hb-errl b/src/build/vpo/hb-errl deleted file mode 100755 index 64f7cc9f4..000000000 --- a/src/build/vpo/hb-errl +++ /dev/null @@ -1,196 +0,0 @@ -#!/usr/bin/perl -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. -# -# $Source: src/build/vpo/hb-errl $ -# -# IBM CONFIDENTIAL -# -# COPYRIGHT International Business Machines Corp. 2011 -# -# p1 -# -# Object Code Only (OCO) source materials -# Licensed Internal Code Source Materials -# IBM HostBoot Licensed Internal Code -# -# The source code for this program is not published or other- -# wise divested of its trade secrets, irrespective of what has -# been deposited with the U.S. Copyright Office. -# -# Origin: 30 -# -# IBM_PROLOG_END - -# -# Purpose: This perl script works on VBU and will dump error log buffer -# -# Author: CamVan Nguyen -# Last Updated: 09/07/2011 -# - -#------------------------------------------------------------------------------ -# Specify perl modules to use -#------------------------------------------------------------------------------ -use strict; -use warnings; -use POSIX; - - -#------------------------------------------------------------------------------ -# Forward Declaration -#------------------------------------------------------------------------------ -sub printUsage; - - -#============================================================================== -# MAIN -#============================================================================== - -#------------------------------------------------------------------------------ -# Parse optional input arguments -#------------------------------------------------------------------------------ -my $numArgs = $#ARGV + 1; -#print "num args = $numArgs\n"; -#print "argument list = @ARGV\n"; - -my $hbDir = $ENV{'HBDIR'}; -if (defined ($hbDir)) -{ - unless ($hbDir ne "") - { - $hbDir = '.'; #Set to current directory - } -} -else -{ - $hbDir = '.'; #Set to current directory -} - -my $dumpErrlList = 0; -my $dumpErrlDtl = 0; -my @errlOpt; -for (my $i=0; $i<$numArgs; $i++) -{ - if (($ARGV[$i] eq "--help") || ($ARGV[$i] eq "-h")) - { - #Print command line help - printUsage(); - exit (0); - } - elsif ($ARGV[$i] eq "--in") - { - if (($i + 1) >= $numArgs) - { - die "No value given for --in parameter.\n"; - } - $i++; - $hbDir = $ARGV[$i]; - } - elsif ($ARGV[$i] eq "--out") - { - if (($i + 1) >= $numArgs) - { - die "No value given for --out parameter.\n"; - } - $i++; - } - elsif (($ARGV[$i] eq "-d") && ($dumpErrlList == 0)) - { - $dumpErrlDtl = 1; - - #save the error log option & remove it from @ARGV - push(@errlOpt, $ARGV[$i]); - splice(@ARGV, $i, 1); - $numArgs--; - $i--; - - last if (($i + 1) >= $numArgs); - $i++; - - if (substr($ARGV[$i], 0, 1) eq '-') - { - $i--; - } - else - { - if (($ARGV[$i] =~ /all/i) || isdigit($ARGV[$i])) - { - #save the error log option & remove it from @ARGV - push(@errlOpt, $ARGV[$i]); - splice(@ARGV, $i, 1); - $numArgs--; - $i--; - } - else - { - die "ERROR: Enter logid or 'all'" - } - } - } - elsif (($ARGV[$i] eq "-l") && ($dumpErrlDtl == 0)) - { - $dumpErrlList = 1; - - #save the error log option & remove it from @ARGV - push(@errlOpt, $ARGV[$i]); - splice(@ARGV, $i, 1); - $numArgs--; - $i--; - } - elsif (($ARGV[$i] ne "--test") && ($ARGV[$i] !~ m/^-[cknsp]\d+/)) - { - print "Invalid argument entered: $ARGV[$i]\n"; - printUsage(); - exit(1); - } -} - - -#------------------------------------------------------------------------------ -# Dump the error log(s) -#------------------------------------------------------------------------------ -my $command = "$hbDir/hb-virtdebug.pl --errl @errlOpt @ARGV"; -system($command); - - -#============================================================================== -# SUBROUTINES -#============================================================================== - -#------------------------------------------------------------------------------ -# Print command line help -#------------------------------------------------------------------------------ -sub printUsage() -{ - print ("\nUsage: hb-errl [--help] | [-l | -d [<logid>|all]]\n"); - print (" [--in <path to .syms file, hb-virtdebug.pl & errlparser>]\n"); - print (" [--out <path to save output data>]\n"); - print (" [--test] [-k#] [-n#] [-s#] [-p#] [-c#]\n\n"); - print (" This program retrieves the error log(s) from L3.\n"); - print (" User should copy the relevant .syms file, hb-virtdebug.pl & errlparser\n"); - print (" to the current directory or set the env variable HBDIR to the path\n"); - print (" of the files.\n\n"); - print (" --help Prints usage information.\n"); - print (" --in Overrides the automatically detected .syms file,\n"); - print (" hb-virtdebug.pl & errlparser in HBDIR or the current directory.\n"); - print (" This program will search for the files in the "); - print ("following order:\n"); - print (" 1. from the path specified by the user\n"); - print (" 2. from HBDIR if it is defined\n"); - print (" 3. from the current directory\n"); - print (" --out Directory where the output data will be saved.\n"); - print (" Default path is the current directory.\n"); - print (" --test Use the hbicore_test.syms file vs the hbicore.syms file\n"); - print (" -l Dumps a listing of all the error logs\n"); - print (" -d <logid> Dumps detailed data of the specified error log.\n"); - print (" -d [all] Dumps detailed data of all error logs\n"); - print (" -k# Specify which cage to act on (default = 0).\n"); - print (" -n# Specify which node to act on (default = 0).\n"); - print (" -s# Specify which slot to act on (default = 0).\n"); - print (" -p# Specify which chip position to act on (default = 0).\n"); - print (" -c# Specify which core/chipUnit to act on (default = 3).\n"); - print ("\n NOTE: This program will not work if user has not stopped instructions\n"); - print (" prior to running this program.\n"); -} - diff --git a/src/build/vpo/hb-printk b/src/build/vpo/hb-printk deleted file mode 100755 index 95ad98e26..000000000 --- a/src/build/vpo/hb-printk +++ /dev/null @@ -1,144 +0,0 @@ -#!/usr/bin/perl -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. -# -# $Source: src/build/vpo/hb-printk $ -# -# IBM CONFIDENTIAL -# -# COPYRIGHT International Business Machines Corp. 2011 -# -# p1 -# -# Object Code Only (OCO) source materials -# Licensed Internal Code Source Materials -# IBM HostBoot Licensed Internal Code -# -# The source code for this program is not published or other- -# wise divested of its trade secrets, irrespective of what has -# been deposited with the U.S. Copyright Office. -# -# Origin: 30 -# -# IBM_PROLOG_END - -# -# Purpose: This perl script works on VBU and will dump kernel printk buffer -# -# Author: CamVan Nguyen -# Last Updated: 09/07/2011 -# - -#------------------------------------------------------------------------------ -# Specify perl modules to use -#------------------------------------------------------------------------------ -use strict; -use warnings; - - -#------------------------------------------------------------------------------ -# Forward Declaration -#------------------------------------------------------------------------------ -sub printUsage; - - -#============================================================================== -# MAIN -#============================================================================== - -#------------------------------------------------------------------------------ -# Parse optional input arguments -#------------------------------------------------------------------------------ -my $numArgs = $#ARGV + 1; -#print "num args = $numArgs\n"; -#print "argument list = @ARGV\n"; - -my $hbDir = $ENV{'HBDIR'}; -if (defined ($hbDir)) -{ - unless ($hbDir ne "") - { - $hbDir = '.'; #Set to current directory - } -} -else -{ - $hbDir = '.'; #Set to current directory -} - -for (my $i=0; $i<$numArgs; $i++) -{ - if (($ARGV[$i] eq "--help") || ($ARGV[$i] eq "-h")) - { - #Print command line help - printUsage(); - exit (0); - } - elsif ($ARGV[$i] eq "--in") - { - if (($i + 1) >= $numArgs) - { - die "No value given for --in parameter.\n"; - } - $i++; - $hbDir = $ARGV[$i]; - } - elsif ($ARGV[$i] eq "--out") - { - if (($i + 1) >= $numArgs) - { - die "No value given for --out parameter.\n"; - } - $i++; - } - elsif (($ARGV[$i] ne "--test") && ($ARGV[$i] !~ m/^-[cknsp]\d+/)) - { - print "Invalid argument entered: $ARGV[$i]\n"; - printUsage(); - exit(1); - } -} - - -#------------------------------------------------------------------------------ -# Dump the kernel printk buffer -#------------------------------------------------------------------------------ -my $command = "$hbDir/hb-virtdebug.pl --printk @ARGV"; -system($command); - - -#============================================================================== -# SUBROUTINES -#============================================================================== - -#------------------------------------------------------------------------------ -# Print command line help -#------------------------------------------------------------------------------ -sub printUsage() -{ - print ("\nUsage: hb-printk [--help] | [--in <path to .syms file & hb-virtdebug.pl>]\n"); - print (" [--out <path to save output data>]\n"); - print (" [--test] [-k#] [-n#] [-s#] [-p#] [-c#]\n\n"); - print (" This program retrieves the kernel printk buffer from L3.\n"); - print (" User should copy the relevant .syms file & hb-virtdebug.pl to the\n"); - print (" current directory or set the env variable HBDIR to the path of the files.\n\n"); - print (" --help Prints usage information.\n"); - print (" --in Overrides the automatically detected .syms file &\n"); - print (" hb-virtebug.pl in HBDIR or the current directory.\n"); - print (" This program will search for the files in the "); - print ("following order:\n"); - print (" 1. from the path specified by the user\n"); - print (" 2. from HBDIR if it is defined\n"); - print (" 3. from the current directory\n"); - print (" --out Directory where the output data will be saved.\n"); - print (" Default path is the current directory.\n"); - print (" --test Use the hbicore_test.syms file vs the hbicore.syms file\n"); - print (" -k# Specify which cage to act on (default = 0).\n"); - print (" -n# Specify which node to act on (default = 0).\n"); - print (" -s# Specify which slot to act on (default = 0).\n"); - print (" -p# Specify which chip position to act on (default = 0).\n"); - print (" -c# Specify which core/chipUnit to act on (default = 3).\n"); - print ("\n NOTE: This program will not work if user has not stopped instructions\n"); - print (" prior to running this program.\n"); -} - diff --git a/src/build/vpo/hb-trace b/src/build/vpo/hb-trace deleted file mode 100755 index 5b3556c80..000000000 --- a/src/build/vpo/hb-trace +++ /dev/null @@ -1,158 +0,0 @@ -#!/usr/bin/perl -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. -# -# $Source: src/build/vpo/hb-trace $ -# -# IBM CONFIDENTIAL -# -# COPYRIGHT International Business Machines Corp. 2011 -# -# p1 -# -# Object Code Only (OCO) source materials -# Licensed Internal Code Source Materials -# IBM HostBoot Licensed Internal Code -# -# The source code for this program is not published or other- -# wise divested of its trade secrets, irrespective of what has -# been deposited with the U.S. Copyright Office. -# -# Origin: 30 -# -# IBM_PROLOG_END - -# -# Purpose: This perl script works on VBU and will dump the component trace -# buffers. -# -# Author: CamVan Nguyen -# Last Updated: 09/07/2011 -# - -#------------------------------------------------------------------------------ -# Specify perl modules to use -#------------------------------------------------------------------------------ -use strict; -use warnings; - - -#------------------------------------------------------------------------------ -# Forward Declaration -#------------------------------------------------------------------------------ -sub printUsage; - - -#============================================================================== -# MAIN -#============================================================================== - -#------------------------------------------------------------------------------ -# Parse optional input arguments -#------------------------------------------------------------------------------ -my $numArgs = $#ARGV + 1; -#print "num args = $numArgs\n"; -#print "argument list = @ARGV\n"; - -my $hbDir = $ENV{'HBDIR'}; -if (defined ($hbDir)) -{ - unless ($hbDir ne "") - { - $hbDir = '.'; #Set to current directory - } -} -else -{ - $hbDir = '.'; #Set to current directory -} - -# Skip the component names -my $i = 0; -for ($i=0; $i<$numArgs; $i++) -{ - last if (substr($ARGV[$i], 0, 1) eq '-') -} - -# Parse the other arguments -for ( ;$i<$numArgs; $i++) -{ - if (($ARGV[$i] eq "--help") || ($ARGV[$i] eq "-h")) - { - #Print command line help - printUsage(); - exit (0); - } - elsif ($ARGV[$i] eq "--in") - { - if (($i + 1) >= $numArgs) - { - die "No value given for --in parameter.\n"; - } - $i++; - $hbDir = $ARGV[$i]; - } - elsif ($ARGV[$i] eq "--out") - { - if (($i + 1) >= $numArgs) - { - die "No value given for --out parameter.\n"; - } - $i++; - } - elsif (($ARGV[$i] ne "--test") && ($ARGV[$i] !~ m/^-[cknsp]\d+/)) - { - print "Invalid argument entered: $ARGV[$i]\n"; - printUsage(); - exit(1); - } -} - - -#------------------------------------------------------------------------------ -# Dump the component trace buffer(s) -#------------------------------------------------------------------------------ -my $command = "$hbDir/hb-virtdebug.pl --trace @ARGV"; -system($command); - - -#============================================================================== -# SUBROUTINES -#============================================================================== - -#------------------------------------------------------------------------------ -# Print command line help -#------------------------------------------------------------------------------ -sub printUsage() -{ - print ("\nUsage: hb-trace [--help] | [<compName1> <compName2> ...]\n"); - print (" [--in <path to .syms file, hbotStringFile & hb-virtdebug.pl>]\n"); - print (" [--out <path to save output data>]\n"); - print (" [--test] [-k#] [-n#] [-s#] [-p#] [-c#]\n\n"); - print (" This program retrieves the component trace buffer(s) from L3.\n"); - print (" User should copy the relevant .syms file, hbotStringFile & hb-virtdebug.pl\n"); - print (" to the current directory or set the env variable HBDIR to the path of "); - print ("the files.\n\n"); - print (" User should also set the env variable PATH to include the path to the "); - print ("fsp-trace program.\n\n"); - print (" --help Prints usage information.\n"); - print (" --in Overrides the automatically detected .syms file,\n"); - print (" hbotStringFile & hb-virtdebug.pl in HBDIR or the\n"); - print (" current directory.\n"); - print (" This program will search for the files in the "); - print ("following order:\n"); - print (" 1. from the path specified by the user\n"); - print (" 2. from HBDIR if it is defined\n"); - print (" 3. from the current directory\n"); - print (" --out Directory where the output data will be saved.\n"); - print (" Default path is the current directory.\n"); - print (" --test Use the hbicore_test.syms file vs the hbicore.syms file\n"); - print (" -k# Specify which cage to act on (default = 0).\n"); - print (" -n# Specify which node to act on (default = 0).\n"); - print (" -s# Specify which slot to act on (default = 0).\n"); - print (" -p# Specify which chip position to act on (default = 0).\n"); - print (" -c# Specify which core/chipUnit to act on (default = 3).\n"); - print ("\n NOTE: This program will not work if user has not stopped instructions\n"); - print (" prior to running this program.\n"); -} - diff --git a/src/build/vpo/hb-virtdebug.pl b/src/build/vpo/hb-virtdebug.pl index 19dc38d3f..f468c199c 100755 --- a/src/build/vpo/hb-virtdebug.pl +++ b/src/build/vpo/hb-virtdebug.pl @@ -49,6 +49,7 @@ use constant TRAC_DEFAULT_BUFFER_SIZE => 0x0800; use constant CACHE_LINE_SIZE => 128; use constant TRAC_BUFFER_SIZE_OFFSET => 20; use constant TRAC_BUFFER_SIZE_SIZE => 4; +use constant NUMTHREADS => 8; #------------------------------------------------------------------------------ @@ -89,6 +90,7 @@ my @symsLines; #Array to store the .syms file data my $outDir = getcwd(); #Default = current working directory my @ecmdOpt; #Array of ecmd options my $core = "3"; #Default is core 3 +my @threadState = (); #Array to store the thread states my $hbDir = $ENV{'HBDIR'}; if (defined ($hbDir)) @@ -267,11 +269,10 @@ if (!$dumpAll) } #------------------------------------------------------------------------------ -# Output reminder to stop instructions +# Save the original thread states and stop instructions #------------------------------------------------------------------------------ -print "\n++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n"; -print "\nREMINDER: User need to stop instructions prior to running this program.\n"; -print "\n++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n\n"; +saveThreadStates(); +stopInstructions("all"); #------------------------------------------------------------------------------ #Flush L2 - this step is needed in order to dump L3 quickly @@ -279,8 +280,8 @@ print "\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ my $command = ""; $command = "/afs/awd.austin.ibm.com/projects/eclipz/lab/p8/compiled_procs/procs/p8_l2_flush_wrap.x86 "; $command .= "@ecmdOpt -quiet"; -print "$command\n"; -die if (system("$command") != 0); +#print "$command\n"; +die "ERROR: cannot flush L2" if (system("$command") != 0); #------------------------------------------------------------------------------ @@ -321,16 +322,16 @@ if ($dumpPrintk) if (-s $string) { - #Extract and save just the kernel printk buffer - $buffer = readStringBinFile($string, $offset); + #Extract and save just the kernel printk buffer + $buffer = readStringBinFile($string, $offset); - writeBinFile($string, $buffer); + writeBinFile($string, $buffer); - #Output to screen - print "\nKernel printk buffer:"; - print "\n=====================\n\n$buffer\n"; - print "\n=====================\n\n"; - print "Data saved to file $string\n\n"; + #Output to screen + print "\nKernel printk buffer:"; + print "\n=====================\n\n$buffer\n"; + print "\n=====================\n\n"; + print "Data saved to file $string\n\n"; } else { @@ -551,8 +552,8 @@ if ($dumpAll) #Dump L3 to file my $hbDumpFile = "$outDir/hbdump.$timeStamp"; $command = "p8_dump_l3 0 65536 -f $hbDumpFile -b @ecmdOpt"; - print "$command\n"; - die if (system("$command") != 0); + #print "$command\n"; + die "ERROR: cannot dump L3" if (system("$command") != 0); #Check if hbDumpFile exists and is not empty if (-s "$hbDumpFile") @@ -567,6 +568,10 @@ if ($dumpAll) } } +#------------------------------------------------------------------------------ +# Restore the original thread states +#------------------------------------------------------------------------------ +restoreThreadStates(); @@ -575,6 +580,92 @@ if ($dumpAll) #============================================================================== #------------------------------------------------------------------------------ +# Stop instructions +#------------------------------------------------------------------------------ +sub stopInstructions +{ + my $thread = shift; + + #todo Change to a hostboot dir where a copy of the tool will be kept + #Stopping all threads + my $command = "/afs/awd/projects/eclipz/lab/p8/u/karm/ekb/eclipz/chips/p8/working/procedures/utils/p8_thread_control.x86"; + $command .= " @ecmdOpt -stop -t$thread -quiet"; + die "ERROR: cannot stop instructions" if (system("$command") != 0); +} + +#------------------------------------------------------------------------------ +# Start instructions +#------------------------------------------------------------------------------ +sub startInstructions +{ + my $thread = shift; + + #todo Change to a hostboot dir where a copy of the tool will be kept + #Starting all threads + my $command = "/afs/awd/projects/eclipz/lab/p8/u/karm/ekb/eclipz/chips/p8/working/procedures/utils/p8_thread_control.x86"; + $command .= " @ecmdOpt -start -t$thread -quiet"; + die "ERROR: cannot start instructions" if (system("$command") != 0); +} + +#------------------------------------------------------------------------------ +# Query thread state +# @brief query whether thread state is quiesced or running +#------------------------------------------------------------------------------ +sub queryThreadState +{ + my $thread = shift; + #print "thread $thread\n"; + + #todo Change to a hostboot dir where a copy of the tool will be kept + my $command = "/afs/awd/projects/eclipz/lab/p8/u/karm/ekb/eclipz/chips/p8/working/procedures/utils/p8_thread_control.x86"; + $command .= " @ecmdOpt -query -t$thread --quiet"; + my $result = `$command`; + #print "result:\n $result"; + if ($result =~ m/Quiesced/) + { + #print "Thread $thread is quiesced\n"; + return "Quiesced"; + } + #print "Thread $thread is running\n"; + return "Running"; +} + +#------------------------------------------------------------------------------ +# Save thread states +# @brief Save the thread states +#------------------------------------------------------------------------------ +sub saveThreadStates +{ + for (my $i = 0; $i < NUMTHREADS; $i++) + { + push (@threadState, queryThreadState($i)); + } +} + +#------------------------------------------------------------------------------ +# Restore thread states +# @brief Restore the thread states +#------------------------------------------------------------------------------ +sub restoreThreadStates +{ + for (my $i = 0; $i < NUMTHREADS; $i++) + { + my $curState = queryThreadState($i); + if ($threadState[$i] ne $curState) + { + if ("Quiesced" eq $curState) + { + startInstructions($i); + } + else + { + stopInstructions($i); + } + } + } +} + +#------------------------------------------------------------------------------ # Parse the .syms data to find the relevant address and size for the data # requested. #------------------------------------------------------------------------------ @@ -720,7 +811,5 @@ sub printUsage() print (" -s# Specify which slot to act on (default = 0)\n"); print (" -p# Specify which chip position to act on (default = 0)\n"); print (" -c# Specify which core/chipUnit to act on (default = 3)\n"); - print ("\n NOTE: This program will not work if user has not stopped instructions\n"); - print (" prior to running this program.\n"); } |