Collecting hypervisor call stats
Mike Kravetz
kravetz at us.ibm.com
Wed Jun 7 02:46:46 EST 2006
On Thu, Jun 01, 2006 at 03:12:15PM +1000, Christopher Yeoh wrote:
> Here's a patch we've used for collecting hcall counts and times.
Thanks for the patch/code Chris! I'm using this as a basis for something
that we may want to merge into the tree. Just a couple of questions.
Your 'wrappers' have the following general form:
> +long plpar_hcall(unsigned long opcode, unsigned long arg1,
> + unsigned long arg2, unsigned long arg3,
> + unsigned long arg4, unsigned long *out1,
> + unsigned long *out2, unsigned long *out3)
> +{
> + long retcode;
> + unsigned long t_entry;
> + int opcode_index;
> +
> + opcode_index = map_hcall_to_index(opcode);
> +
> + t_entry = mfspr(SPRN_PURR);
> + barrier();
> +
> + retcode = plpar_hcall_real(opcode, arg1, arg2, arg3, arg4,
> + out1, out2, out3);
> +
> + barrier();
> + get_cpu_var(hcall_type_count)[opcode_index]++;
> + put_cpu_var(hcall_type_count);
> + get_cpu_var(hcall_type_time)[opcode_index] += mfspr(SPRN_PURR) - t_entry;
> + put_cpu_var(hcall_type_time);
> +
> + return retcode;
> +};
Can you explain the need for barrier(s) before and after the call to the
real routine? It usually takes me a couple days of thought to figure out
exactly where these are needed. :)
The use of get_cpu_var/put_cpu_var result in disabling/enabling preemption.
I can understand why this would be desirable to assure the accuracy of the
statistics. But, I was wondering if the desired accuracy is worth the added
overhead. My thought was to make these as lightweight as possible and
sacrifice some accuracy if necessary. After all, no 'internal decisions' are
being made because of this data. It is simply exposed to user land.
Thoughts?
Thanks,
--
Mike
More information about the Linuxppc-dev
mailing list