[Skiboot] [RFC PATCH] core/opal: Add OPAL call statistics
Oliver O'Halloran
oohall at gmail.com
Mon Mar 30 18:12:22 AEDT 2020
On Sat, Mar 14, 2020 at 5:14 AM Cédric Le Goater <clg at kaod.org> wrote:
>
> 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.
If you're going to do this then put it in /ibm,opal/exports/ with
hdat_map and friends. That'll work out of the box with existing
kernels.
More information about the Skiboot
mailing list