Re: S390 support to be removed from next oprofile release

Andreas Arnez <[email protected]>
Newsgroups gmane.linux.oprofile
Organization IBM Deutschland Research & Development GmbH
Message-ID <[email protected]>
On Fri, Aug 01 2014, Maynard Johnson wrote:

> On 08/01/2014 08:22 AM, Maynard Johnson wrote:
>> On 08/01/2014 06:16 AM, Andreas Arnez wrote:
>>> On Thu, Jul 31 2014, Andreas Arnez wrote:
>>>
>>>> [...] I think I can provide you with a patch that implements
>>>> _get_s390_cpu_type() by tomorrow.
>>>
>>> OK, here you go.  Note that I only unit-tested the new function
>>> _get_s390_cpu_type(), but I didn't build (and test) oprofile with this
>>> change.
>> 
>> Patch committed.  Pretty simple. Now operf and ocount support s390.  Thanks!
> Andreas,
> I have a question that is tangentially related to this patch.  How did you test it?

As I said, I didn't.  Today I've grabbed a machine with hardware
sampling enabled and tried it out, and it failed -- maybe not
surprisingly.  Note that I haven't done anyting with perf or oprofile
yet, so there might be lots of user errors involved.

The problems I stumbled upon:

* The linker complained about an undefined symbol "pthread_key_create".
  This seems to always happen when linking a C++ program that has static
  string initializers with librt but without libpthread.

* "operf" didn't like the fact that the address of "_text" in kallsyms
  is zero on S390.

* As you indicated, the default event selection seemed to (wrongly) pick
  timer mode.

So I've performed the changes below, but operf still fails:

[root@p23lp54 arnez]# operf --verbose=all -s
Using samples dir /root/arnez/oprofile_data/samples
kernel_start = 0; kernel_end = 778848
operf_record ctor using output fd 7
calling sigaction
calling setup
operf_record::setup() for system-wide profiling
op_get_process_info
calling perf_event_open for pid -1 on 24 cpus
perf_event_open failed: No such file or directory
perf_event_open failed with No such file or directory
Caught runtime_error: Internal Error.  Perf event setup failed.
operf record process failure; exiting
Error running profiler

Any hint how to quickly get to the bottom of this?

Thanks,
Andreas

-- >8 --
Subject: [PATCH] Preliminary fixes to get oprofile running on S390
From: Andreas Arnez <[email protected]>

diff --git a/libop/op_events.c b/libop/op_events.c
index bbeb212..33028b4 100644
--- a/libop/op_events.c
+++ b/libop/op_events.c
@@ -1323,14 +1323,14 @@ void op_default_event(op_cpu cpu_type, struct op_default_event_descr * descr)
 		case CPU_S390_Z10:
 		case CPU_S390_Z196:
 		case CPU_S390_ZEC12:
- 			if (op_get_nr_counters(cpu_type) > 1) {
- 				descr->name = "HWSAMPLING";
- 				descr->count = 4127518;
- 			} else {
- 				descr->name = TIMER_EVENT_NAME;
- 				descr->count = 10000;
- 			}
-  			break;
+			if (op_get_nr_counters(cpu_type) > 1) {
+				descr->name = TIMER_EVENT_NAME;
+				descr->count = 10000;
+			} else {
+				descr->name = "HWSAMPLING";
+				descr->count = 4127518;
+			}
+			break;
 
 		case CPU_TILE_TILE64:
 		case CPU_TILE_TILEPRO:
diff --git a/pe_counting/Makefile.am b/pe_counting/Makefile.am
index c46fd74..b803134 100644
--- a/pe_counting/Makefile.am
+++ b/pe_counting/Makefile.am
@@ -19,7 +19,7 @@ AM_CXXFLAGS = @OP_CXXFLAGS@
 AM_LDFLAGS = @OP_LDFLAGS@
 
 bin_PROGRAMS = ocount
-ocount_LDADD = -lrt ../libpe_utils/libpe_utils.a \
+ocount_LDADD = -lrt -lpthread ../libpe_utils/libpe_utils.a \
 	../libpe_utils/libpe_utils.a \
 	../libop/libop.a \
 	../libutil/libutil.a \
diff --git a/pe_profiling/operf.cpp b/pe_profiling/operf.cpp
index 51f55a5..efc3c65 100644
--- a/pe_profiling/operf.cpp
+++ b/pe_profiling/operf.cpp
@@ -1099,7 +1099,7 @@ static bool _add_kernel_entry(string start_addr_str, string end_addr_str, string
 		return false;
 	}
 
-	if ((start_addr == 0) || (end_addr == 0)) {
+	if ((start_addr == 0) && (end_addr == 0)) {
 		no_vmlinux = true;
 		cerr << "Kernel profiling is not possible with current system "
 		     << "config." << endl


------------------------------------------------------------------------------
Infragistics Professional
Build stunning WinForms apps today!
Reboot your WinForms applications with our WinForms controls. 
Build a bridge from your legacy apps to the future.
http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.