[PATCH 2/3] powerpc: Instrument Hypervisor Calls: add wrappers

Nathan Lynch ntl at pobox.com
Sat Jul 15 10:15:45 EST 2006


Mike Kravetz wrote:
> +static inline void update_stats(unsigned long opcode, unsigned long t_before)
> +{
> +	unsigned long op_index = opcode >> 2;
> +	struct hcall_stats *hs = &__get_cpu_var(hcall_stats[op_index]);
> +
> +	hs->total_time += (mftb() - t_before);
> +	hs->num_calls++;
> +}
> +
> +/*
> + * plpar_hcall wrapper
> + */
> +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 rc;
> +	unsigned long t_before;
> +
> +	t_before = mftb();
> +	rc = plpar_hcall_base(opcode, arg1, arg2, arg3, arg4, out1, out2, out3);
> +
> +	update_stats(opcode, t_before);
> +	return rc;
> +}

Hmm, isn't it possible that the stats could be corrupted if we process
an interrupt/softirq which does an hcall while the stats are being
updated?  Maybe it's not a show-stopper, but it seems to me that
accuracy could suffer under some workloads.




More information about the Linuxppc-dev mailing list