Re: S390 support to be removed from next oprofile release

Maynard Johnson <[email protected]>
Newsgroups gmane.linux.oprofile
Message-ID <[email protected]>
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?
Did you run operf and pass the "--events=HWSAMPLING" option?  Did you try running
operf without passing that option to see how it behaves for the default event?
It seems to me that the default event selection algorithm for s390 is incorrect
(even before your patch).  In libop/op_events.c:op_default_event, the case
for s390 models does the following:

		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 you look at op_get_nr_counters(), it returns a value > 1 if we *are* in timer mode.
So it looks to me like the logic above is turned around.  Please verify this default
event selection code let me know if anything needs fixing.  Be aware that for the next
release, there will be no timer mode (since that was only available via opcontrol).

Thanks.
-Maynard

> 
> -Maynard
>>
>>
>> -- >8 --
>> From: Andreas Arnez <[email protected]>
>> Date: Fri, 1 Aug 2014 13:12:01 +0200
>> Subject: [PATCH] Determine s390 cpu type from /proc/cpuinfo.
>>
>> Signed-off-by: Andreas Arnez <[email protected]>
>> ---
>>  libop/op_cpu_type.c |   36 ++++++++++++++++++++++++++++++++++++
>>  1 file changed, 36 insertions(+)
>>
>> diff --git a/libop/op_cpu_type.c b/libop/op_cpu_type.c
>> index 055c64b..94d832f 100644
>> --- a/libop/op_cpu_type.c
>> +++ b/libop/op_cpu_type.c
>> @@ -629,6 +629,39 @@ static op_cpu _get_mips_cpu_type(void)
>>  	return CPU_NO_GOOD;
>>  }
>>
>> +static op_cpu _get_s390_cpu_type(void)
>> +{
>> +	char line[100];
>> +	char *ptr;
>> +	const char prefix[] = "machine = ";
>> +	unsigned model;
>> +
>> +	ptr = _get_cpuinfo_cpu_type_line(line, sizeof(line), "processor", 0);
>> +	if (!ptr)
>> +		return CPU_NO_GOOD;
>> +
>> +	ptr = strstr(ptr, prefix);
>> +	if (!ptr)
>> +		return CPU_NO_GOOD;
>> +
>> +	ptr += sizeof(prefix) - 1;
>> +	if (sscanf(ptr, "%u", &model) != 1)
>> +		return CPU_NO_GOOD;
>> +
>> +	switch (model) {
>> +	case 2097:
>> +	case 2098:
>> +		return CPU_S390_Z10;
>> +	case 2817:
>> +	case 2818:
>> +		return CPU_S390_Z196;
>> +	case 2827:
>> +	case 2828:
>> +		return CPU_S390_ZEC12;
>> +	}
>> +	return CPU_NO_GOOD;
>> +}
>> +
>>  static op_cpu __get_cpu_type_alt_method(void)
>>  {
>>  	struct utsname uname_info;
>> @@ -654,6 +687,9 @@ static op_cpu __get_cpu_type_alt_method(void)
>>  	if (strncmp(uname_info.machine, "mips", 4) == 0) {
>>  		return _get_mips_cpu_type();
>>  	}
>> +	if (strncmp(uname_info.machine, "s390", 4) == 0) {
>> +		return _get_s390_cpu_type();
>> +	}
>>  	return CPU_NO_GOOD;
>>  }
>>
> 
> 
> ------------------------------------------------------------------------------
> Want fast and easy access to all the code in your enterprise? Index and
> search up to 200,000 lines of code with a free copy of Black Duck
> Code Sight - the same software that powers the world's largest code
> search on Ohloh, the Black Duck Open Hub! Try it now.
> http://p.sf.net/sfu/bds
> _______________________________________________
> oprofile-list mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/oprofile-list
> 


------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
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.