From: Nathan Lynch <ntl@pobox.com>
To: Mike Kravetz <kravetz@us.ibm.com>
Cc: Bryan Rosenburg <rosnbrg@us.ibm.com>,
linuxppc-dev@ozlabs.org, Christopher Yeoh <cyeoh@samba.org>
Subject: Re: [PATCH 2/3] powerpc: Instrument Hypervisor Calls: add wrappers
Date: Wed, 14 Jun 2006 09:42:30 -0500 [thread overview]
Message-ID: <20060614144230.GE26750@localdomain> (raw)
In-Reply-To: <20060614035258.GC6759@monkey.ibm.com>
Mike Kravetz wrote:
> +config HCALL_STATS
> + bool "Hypervisor call instrumentation"
> + depends on PPC_PSERIES
> + help
> + Adds code to keep track of number of hypervisor calls made and
> + the amount of time spent in hypervisor calls.
> +
> + This option will add a small amount of overhead to all hypervisor
> + calls.
Would be good to say how the stats are made available to userspace
here.
> +DEFINE_PER_CPU(struct hcall_stats[MAX_HCALL_OPCODES+1], hcall_stats);
> +
> +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]);
> +
> + /* racey, but acceptable for non-critical stats */
> + hs->total_time += (mfspr(SPRN_PURR) - t_before);
> + hs->num_calls++;
> +}
> +
> +extern long plpar_hcall_base (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 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 = mfspr(SPRN_PURR);
> +
> + rc = plpar_hcall_base(opcode, arg1, arg2, arg3, arg4, out1, out2, out3);
> +
> + update_stats(opcode, t_before);
> + return rc;
> +}
Without disabling preemption around the mfspr ... update_stats section
in these hcall wrappers, you risk updating the stats on the wrong cpu.
> +struct hcall_stats {
> + unsigned long num_calls;
> + unsigned long total_time;
> +};
A comment explaining the unit of time used for the total_time field
would be nice.
next prev parent reply other threads:[~2006-06-14 14:42 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-06-14 3:47 [PATCH 0/3] powerpc: Instrument Hypervisor Calls Mike Kravetz
2006-06-14 3:50 ` [PATCH 1/3] powerpc: Instrument Hypervisor Calls: merge headers Mike Kravetz
2006-06-14 3:52 ` [PATCH 2/3] powerpc: Instrument Hypervisor Calls: add wrappers Mike Kravetz
2006-06-14 7:23 ` Arnd Bergmann
2006-06-14 14:42 ` Nathan Lynch [this message]
2006-06-14 22:33 ` Paul Mackerras
2006-06-14 22:40 ` Nathan Lynch
2006-06-14 23:52 ` Mike Kravetz
2006-06-15 11:09 ` Arnd Bergmann
2006-06-15 14:58 ` Mike Kravetz
2006-06-15 16:06 ` Arnd Bergmann
2006-06-16 16:11 ` Mike Kravetz
2006-06-14 3:54 ` [PATCH 0/3] powerpc: Instrument Hypervisor Calls: add sysfs files Mike Kravetz
2006-06-14 14:22 ` Nathan Lynch
2006-06-15 11:45 ` Christopher Yeoh
2006-06-14 14:30 ` Dave C Boutcher
2006-06-14 14:39 ` [RFC] New hcall mechanism Was: [PATCH 0/3] powerpc: Instrument Hypervisor Calls Jimi Xenidis
-- strict thread matches above, loose matches on Subject: below --
2006-06-22 22:56 Mike Kravetz
2006-06-22 22:58 ` [PATCH 2/3] powerpc: Instrument Hypervisor Calls: add wrappers Mike Kravetz
2006-07-14 23:37 [PATCH 0/3] powerpc: Instrument Hypervisor Calls Mike Kravetz
2006-07-14 23:40 ` [PATCH 2/3] powerpc: Instrument Hypervisor Calls: add wrappers Mike Kravetz
2006-07-15 0:15 ` Nathan Lynch
2006-07-15 0:41 ` Mike Kravetz
2006-07-15 8:03 ` Nathan Lynch
2006-07-18 20:47 [PATCH 0/3] powerpc: Instrument Hypervisor Calls Mike Kravetz
2006-07-18 20:49 ` [PATCH 2/3] powerpc: Instrument Hypervisor Calls: add wrappers Mike Kravetz
2006-07-18 22:34 ` Olof Johansson
2006-07-18 23:18 ` Mike Kravetz
2006-07-19 3:33 ` Olof Johansson
2006-07-19 3:50 ` Mike Kravetz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20060614144230.GE26750@localdomain \
--to=ntl@pobox.com \
--cc=cyeoh@samba.org \
--cc=kravetz@us.ibm.com \
--cc=linuxppc-dev@ozlabs.org \
--cc=rosnbrg@us.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).