[Skiboot] [RFC PATCH] core/opal: Add OPAL call statistics

Cédric Le Goater clg at kaod.org
Sat Mar 14 01:35:02 AEDT 2020


On 3/12/20 3:09 PM, Naveen N. Rao wrote:
> Cédric Le Goater wrote:
>> On 2/29/20 10:27 AM, Nicholas Piggin wrote:
>>> Cédric Le Goater's on February 29, 2020 4:34 am:
>>>> Here is a proposal to collect OPAL call statistics, counts and duration,
>>>> and track areas we could possibly improve.
>>>>
>>>> With a small Linux driver to dump the stats in debugfs, here is what
>>>> we get on a P9 after boot:
>>>
>>> Seems interesting... you could just do it all on the Linux side though.
>>
>> I thought we might collect more data from OPAL in opal_exit. 
> 
> As Nick points out, this can be done from Linux through the use of tracepoints. We already have similar statistics for hcalls through a perf script. A similar script should be able to support OPAL calls.
> 
> See:
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/perf/scripts/python/powerpc-hcalls.py

Thanks,


I need to go a little deeper to collect the statistics  I am 
interested in. Some low level HW procedures do polling.

I have cooked a set of routines to collect statistics on 
function calls in :

	struct stat_range {
		uint64_t count;
		uint64_t sum;
		uint64_t min;
		uint64_t max;
	};

	struct stat {
		const char *name;
		uint64_t nr_ranges;
		uint64_t count;
		struct stat_range all;
		struct stat_range ranges[STAT_NR_RANGES];
	};

The stat structure addresses are exported in the DT under 
"ibm,opal/stats" and the values are exposed to user space 
using a generic sysfs driver. 

It's simple and good enough for my needs. 

Cheers,

C.

 
> 
>>
>>> Any reason you want these stats? 
>>
>> HW configuration (XIVE) is in mind but it could be applied to other areas.
>>
>> 1. To see which calls are being used and how frequently 2. to track average and max values which would reflect issues in    OPAL, locking or polling.
>> 3. to see impact of some changes
>>
>>> I'd like to try get basic perf and possibly even ftrace support for OPAL (driven from Linux). It's still a way off but coming along slowly.
> 
> By 'perf', do you mean PMU support?
> I guess we already have basic _mcount() support in skiboot. Do you plan to have this data be fed to Linux ftrace in some manner? Would be good to hear your plans.
> 
> 
> Thanks,
> Naveen
> 



More information about the Skiboot mailing list