All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hemant Kumar <hemant@linux.vnet.ibm.com>
To: Scott Wood <scottwood@freescale.com>
Cc: maddy@linux.vnet.ibm.com, srikar@linux.vnet.ibm.com,
	peterz@infradead.org, agraf@suse.de, kvm-ppc@vger.kernel.org,
	linux-kernel@vger.kernel.org, mingo@redhat.com, paulus@samba.org,
	acme@kernel.org, warrier@linux.vnet.ibm.com,
	linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH v3 1/2] perf/kvm: Port perf kvm to powerpc
Date: Tue, 12 May 2015 16:16:52 +0000	[thread overview]
Message-ID: <555224A4.5050502@linux.vnet.ibm.com> (raw)
In-Reply-To: <1431382120.16357.471.camel@freescale.com>

Hi Scott,

On 05/12/2015 03:38 AM, Scott Wood wrote:
> On Fri, 2015-05-08 at 06:37 +0530, Hemant Kumar wrote:
>> From: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
>>
>> perf kvm can be used to analyze guest exit reasons. This support already
>> exists in x86. Hence, porting it to powerpc.
>>
>>   - To trace KVM events :
>>    perf kvm stat record
>>    If many guests are running, we can track for a specific guest by using
>>    --pid as in : perf kvm stat record --pid <pid>
>>
>>   - To see the results :
>>    perf kvm stat report
>>
>> The result shows the number of exits (from the guest context to
>> host/hypervisor context) grouped by their respective exit reasons with
>> their frequency.
>>
>> This patch makes use of the guest exit reasons available in
>> "trace_book3s.h". It records on two already available tracepoints :
>> "kvm_hv:kvm_guest_exit" and "kvm_hv:kvm_guest_enter".
>>
>> Note : This patch has a dependency on the patch "kvm/powerpc: Export
>> kvm exit reasons" which exports the KVM exit reasons through the uapi.
>>
>> Here is a sample o/p:
>>   # pgrep qemu
>> 19378
>> 60515
>>
>> 2 Guests are running on the host.
>>
>>   # perf kvm stat record -a
>> ^C[ perf record: Woken up 1 times to write data ]
>> [ perf record: Captured and wrote 4.153 MB perf.data.guest (39624 samples) ]
>>
>>   # perf kvm stat report -p 60515
>> Analyze events for pid(s) 60515, all VCPUs:
>>
>>         VM-EXIT    Samples  Samples%     Time%    Min Time         Max        Time         Avg time
>>
>> H_DATA_STORAGE       5006    35.30%     0.13%      1.94us     49.46us     12.37us ( +-   0.52% )
>> HV_DECREMENTER       4457    31.43%     0.02%      0.72us     16.14us      1.91us ( +-   0.96% )
>>         SYSCALL       2690    18.97%     0.10%      2.84us    528.24us     18.29us ( +-   3.75% )
>> RETURN_TO_HOST       1789    12.61%    99.76%      1.58us 672791.91us  27470.23us ( +-   3.00% )
>>        EXTERNAL        240     1.69%     0.00%        0.69us     10.67us      1.33us ( +-   5.34% )
>>
>> Total Samples:14182, Total events handled time:49264158.30us.
>>
>> Signed-off-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
>> Signed-off-by: Hemant Kumar <hemant@linux.vnet.ibm.com>
>> ---
>> Patch has a dependency on : https://patchwork.ozlabs.org/patch/469839/
>> which exports the exit reasons to perf through uapi.
>>
>> Changes:
>> - Original series split into two patchsets now : perf and powerpc
>>    side changes.
>>
>>   arch/powerpc/include/uapi/asm/kvm_perf.h | 15 +++++++++++++++
>>   tools/perf/arch/powerpc/Makefile         |  1 +
>>   tools/perf/arch/powerpc/util/Build       |  1 +
>>   tools/perf/arch/powerpc/util/kvm-stat.c  | 33 ++++++++++++++++++++++++++++++++
>>   4 files changed, 50 insertions(+)
>>   create mode 100644 arch/powerpc/include/uapi/asm/kvm_perf.h
>>   create mode 100644 tools/perf/arch/powerpc/util/kvm-stat.c
>>
>> diff --git a/arch/powerpc/include/uapi/asm/kvm_perf.h b/arch/powerpc/include/uapi/asm/kvm_perf.h
>> new file mode 100644
>> index 0000000..30fa670
>> --- /dev/null
>> +++ b/arch/powerpc/include/uapi/asm/kvm_perf.h
>> @@ -0,0 +1,15 @@
>> +#ifndef _ASM_POWERPC_KVM_PERF_H
>> +#define _ASM_POWERPC_KVM_PERF_H
>> +
>> +#include <asm/trace_book3s.h>
>> +#include <asm/kvm.h>
>> +
>> +#define DECODE_STR_LEN 20
>> +
>> +#define VCPU_ID "vcpu_id"
>> +
>> +#define KVM_ENTRY_TRACE "kvm_hv:kvm_guest_enter"
>> +#define KVM_EXIT_TRACE "kvm_hv:kvm_guest_exit"
>> +#define KVM_EXIT_REASON "trap"
>> +
>> +#endif /* _ASM_POWERPC_KVM_PERF_H */
> Please make sure that anything book3s-specific is named that way.

Are you suggesting to name it to something like _ASM_POWERPC_BOOK3S_PERF_H ?

> And shouldn't this be part of the arch/powerpc-side patchset?

It should. Thanks, will move this to arch/powerpc side patchset.

>> diff --git a/tools/perf/arch/powerpc/Makefile b/tools/perf/arch/powerpc/Makefile
>> index 7fbca17..21322e0 100644
>> --- a/tools/perf/arch/powerpc/Makefile
>> +++ b/tools/perf/arch/powerpc/Makefile
>> @@ -1,3 +1,4 @@
>>   ifndef NO_DWARF
>>   PERF_HAVE_DWARF_REGS := 1
>>   endif
>> +HAVE_KVM_STAT_SUPPORT := 1
> Does this stuff fail gracefully if used on a PPC target that doesn't
> support this?

Yes, it does.

> -Scott
>
>
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev

-- 
Thanks,
Hemant Kumar


WARNING: multiple messages have this Message-ID (diff)
From: Hemant Kumar <hemant@linux.vnet.ibm.com>
To: Scott Wood <scottwood@freescale.com>
Cc: maddy@linux.vnet.ibm.com, srikar@linux.vnet.ibm.com,
	peterz@infradead.org, linux-kernel@vger.kernel.org,
	kvm-ppc@vger.kernel.org, agraf@suse.de, mingo@redhat.com,
	paulus@samba.org, acme@kernel.org, warrier@linux.vnet.ibm.com,
	linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH v3 1/2] perf/kvm: Port perf kvm to powerpc
Date: Tue, 12 May 2015 21:34:52 +0530	[thread overview]
Message-ID: <555224A4.5050502@linux.vnet.ibm.com> (raw)
In-Reply-To: <1431382120.16357.471.camel@freescale.com>

Hi Scott,

On 05/12/2015 03:38 AM, Scott Wood wrote:
> On Fri, 2015-05-08 at 06:37 +0530, Hemant Kumar wrote:
>> From: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
>>
>> perf kvm can be used to analyze guest exit reasons. This support already
>> exists in x86. Hence, porting it to powerpc.
>>
>>   - To trace KVM events :
>>    perf kvm stat record
>>    If many guests are running, we can track for a specific guest by using
>>    --pid as in : perf kvm stat record --pid <pid>
>>
>>   - To see the results :
>>    perf kvm stat report
>>
>> The result shows the number of exits (from the guest context to
>> host/hypervisor context) grouped by their respective exit reasons with
>> their frequency.
>>
>> This patch makes use of the guest exit reasons available in
>> "trace_book3s.h". It records on two already available tracepoints :
>> "kvm_hv:kvm_guest_exit" and "kvm_hv:kvm_guest_enter".
>>
>> Note : This patch has a dependency on the patch "kvm/powerpc: Export
>> kvm exit reasons" which exports the KVM exit reasons through the uapi.
>>
>> Here is a sample o/p:
>>   # pgrep qemu
>> 19378
>> 60515
>>
>> 2 Guests are running on the host.
>>
>>   # perf kvm stat record -a
>> ^C[ perf record: Woken up 1 times to write data ]
>> [ perf record: Captured and wrote 4.153 MB perf.data.guest (39624 samples) ]
>>
>>   # perf kvm stat report -p 60515
>> Analyze events for pid(s) 60515, all VCPUs:
>>
>>         VM-EXIT    Samples  Samples%     Time%    Min Time         Max        Time         Avg time
>>
>> H_DATA_STORAGE       5006    35.30%     0.13%      1.94us     49.46us     12.37us ( +-   0.52% )
>> HV_DECREMENTER       4457    31.43%     0.02%      0.72us     16.14us      1.91us ( +-   0.96% )
>>         SYSCALL       2690    18.97%     0.10%      2.84us    528.24us     18.29us ( +-   3.75% )
>> RETURN_TO_HOST       1789    12.61%    99.76%      1.58us 672791.91us  27470.23us ( +-   3.00% )
>>        EXTERNAL        240     1.69%     0.00%        0.69us     10.67us      1.33us ( +-   5.34% )
>>
>> Total Samples:14182, Total events handled time:49264158.30us.
>>
>> Signed-off-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
>> Signed-off-by: Hemant Kumar <hemant@linux.vnet.ibm.com>
>> ---
>> Patch has a dependency on : https://patchwork.ozlabs.org/patch/469839/
>> which exports the exit reasons to perf through uapi.
>>
>> Changes:
>> - Original series split into two patchsets now : perf and powerpc
>>    side changes.
>>
>>   arch/powerpc/include/uapi/asm/kvm_perf.h | 15 +++++++++++++++
>>   tools/perf/arch/powerpc/Makefile         |  1 +
>>   tools/perf/arch/powerpc/util/Build       |  1 +
>>   tools/perf/arch/powerpc/util/kvm-stat.c  | 33 ++++++++++++++++++++++++++++++++
>>   4 files changed, 50 insertions(+)
>>   create mode 100644 arch/powerpc/include/uapi/asm/kvm_perf.h
>>   create mode 100644 tools/perf/arch/powerpc/util/kvm-stat.c
>>
>> diff --git a/arch/powerpc/include/uapi/asm/kvm_perf.h b/arch/powerpc/include/uapi/asm/kvm_perf.h
>> new file mode 100644
>> index 0000000..30fa670
>> --- /dev/null
>> +++ b/arch/powerpc/include/uapi/asm/kvm_perf.h
>> @@ -0,0 +1,15 @@
>> +#ifndef _ASM_POWERPC_KVM_PERF_H
>> +#define _ASM_POWERPC_KVM_PERF_H
>> +
>> +#include <asm/trace_book3s.h>
>> +#include <asm/kvm.h>
>> +
>> +#define DECODE_STR_LEN 20
>> +
>> +#define VCPU_ID "vcpu_id"
>> +
>> +#define KVM_ENTRY_TRACE "kvm_hv:kvm_guest_enter"
>> +#define KVM_EXIT_TRACE "kvm_hv:kvm_guest_exit"
>> +#define KVM_EXIT_REASON "trap"
>> +
>> +#endif /* _ASM_POWERPC_KVM_PERF_H */
> Please make sure that anything book3s-specific is named that way.

Are you suggesting to name it to something like _ASM_POWERPC_BOOK3S_PERF_H ?

> And shouldn't this be part of the arch/powerpc-side patchset?

It should. Thanks, will move this to arch/powerpc side patchset.

>> diff --git a/tools/perf/arch/powerpc/Makefile b/tools/perf/arch/powerpc/Makefile
>> index 7fbca17..21322e0 100644
>> --- a/tools/perf/arch/powerpc/Makefile
>> +++ b/tools/perf/arch/powerpc/Makefile
>> @@ -1,3 +1,4 @@
>>   ifndef NO_DWARF
>>   PERF_HAVE_DWARF_REGS := 1
>>   endif
>> +HAVE_KVM_STAT_SUPPORT := 1
> Does this stuff fail gracefully if used on a PPC target that doesn't
> support this?

Yes, it does.

> -Scott
>
>
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev

-- 
Thanks,
Hemant Kumar

WARNING: multiple messages have this Message-ID (diff)
From: Hemant Kumar <hemant@linux.vnet.ibm.com>
To: Scott Wood <scottwood@freescale.com>
Cc: maddy@linux.vnet.ibm.com, srikar@linux.vnet.ibm.com,
	peterz@infradead.org, agraf@suse.de, kvm-ppc@vger.kernel.org,
	linux-kernel@vger.kernel.org, mingo@redhat.com, paulus@samba.org,
	acme@kernel.org, warrier@linux.vnet.ibm.com,
	linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH v3 1/2] perf/kvm: Port perf kvm to powerpc
Date: Tue, 12 May 2015 21:34:52 +0530	[thread overview]
Message-ID: <555224A4.5050502@linux.vnet.ibm.com> (raw)
In-Reply-To: <1431382120.16357.471.camel@freescale.com>

Hi Scott,

On 05/12/2015 03:38 AM, Scott Wood wrote:
> On Fri, 2015-05-08 at 06:37 +0530, Hemant Kumar wrote:
>> From: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
>>
>> perf kvm can be used to analyze guest exit reasons. This support already
>> exists in x86. Hence, porting it to powerpc.
>>
>>   - To trace KVM events :
>>    perf kvm stat record
>>    If many guests are running, we can track for a specific guest by using
>>    --pid as in : perf kvm stat record --pid <pid>
>>
>>   - To see the results :
>>    perf kvm stat report
>>
>> The result shows the number of exits (from the guest context to
>> host/hypervisor context) grouped by their respective exit reasons with
>> their frequency.
>>
>> This patch makes use of the guest exit reasons available in
>> "trace_book3s.h". It records on two already available tracepoints :
>> "kvm_hv:kvm_guest_exit" and "kvm_hv:kvm_guest_enter".
>>
>> Note : This patch has a dependency on the patch "kvm/powerpc: Export
>> kvm exit reasons" which exports the KVM exit reasons through the uapi.
>>
>> Here is a sample o/p:
>>   # pgrep qemu
>> 19378
>> 60515
>>
>> 2 Guests are running on the host.
>>
>>   # perf kvm stat record -a
>> ^C[ perf record: Woken up 1 times to write data ]
>> [ perf record: Captured and wrote 4.153 MB perf.data.guest (39624 samples) ]
>>
>>   # perf kvm stat report -p 60515
>> Analyze events for pid(s) 60515, all VCPUs:
>>
>>         VM-EXIT    Samples  Samples%     Time%    Min Time         Max        Time         Avg time
>>
>> H_DATA_STORAGE       5006    35.30%     0.13%      1.94us     49.46us     12.37us ( +-   0.52% )
>> HV_DECREMENTER       4457    31.43%     0.02%      0.72us     16.14us      1.91us ( +-   0.96% )
>>         SYSCALL       2690    18.97%     0.10%      2.84us    528.24us     18.29us ( +-   3.75% )
>> RETURN_TO_HOST       1789    12.61%    99.76%      1.58us 672791.91us  27470.23us ( +-   3.00% )
>>        EXTERNAL        240     1.69%     0.00%        0.69us     10.67us      1.33us ( +-   5.34% )
>>
>> Total Samples:14182, Total events handled time:49264158.30us.
>>
>> Signed-off-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
>> Signed-off-by: Hemant Kumar <hemant@linux.vnet.ibm.com>
>> ---
>> Patch has a dependency on : https://patchwork.ozlabs.org/patch/469839/
>> which exports the exit reasons to perf through uapi.
>>
>> Changes:
>> - Original series split into two patchsets now : perf and powerpc
>>    side changes.
>>
>>   arch/powerpc/include/uapi/asm/kvm_perf.h | 15 +++++++++++++++
>>   tools/perf/arch/powerpc/Makefile         |  1 +
>>   tools/perf/arch/powerpc/util/Build       |  1 +
>>   tools/perf/arch/powerpc/util/kvm-stat.c  | 33 ++++++++++++++++++++++++++++++++
>>   4 files changed, 50 insertions(+)
>>   create mode 100644 arch/powerpc/include/uapi/asm/kvm_perf.h
>>   create mode 100644 tools/perf/arch/powerpc/util/kvm-stat.c
>>
>> diff --git a/arch/powerpc/include/uapi/asm/kvm_perf.h b/arch/powerpc/include/uapi/asm/kvm_perf.h
>> new file mode 100644
>> index 0000000..30fa670
>> --- /dev/null
>> +++ b/arch/powerpc/include/uapi/asm/kvm_perf.h
>> @@ -0,0 +1,15 @@
>> +#ifndef _ASM_POWERPC_KVM_PERF_H
>> +#define _ASM_POWERPC_KVM_PERF_H
>> +
>> +#include <asm/trace_book3s.h>
>> +#include <asm/kvm.h>
>> +
>> +#define DECODE_STR_LEN 20
>> +
>> +#define VCPU_ID "vcpu_id"
>> +
>> +#define KVM_ENTRY_TRACE "kvm_hv:kvm_guest_enter"
>> +#define KVM_EXIT_TRACE "kvm_hv:kvm_guest_exit"
>> +#define KVM_EXIT_REASON "trap"
>> +
>> +#endif /* _ASM_POWERPC_KVM_PERF_H */
> Please make sure that anything book3s-specific is named that way.

Are you suggesting to name it to something like _ASM_POWERPC_BOOK3S_PERF_H ?

> And shouldn't this be part of the arch/powerpc-side patchset?

It should. Thanks, will move this to arch/powerpc side patchset.

>> diff --git a/tools/perf/arch/powerpc/Makefile b/tools/perf/arch/powerpc/Makefile
>> index 7fbca17..21322e0 100644
>> --- a/tools/perf/arch/powerpc/Makefile
>> +++ b/tools/perf/arch/powerpc/Makefile
>> @@ -1,3 +1,4 @@
>>   ifndef NO_DWARF
>>   PERF_HAVE_DWARF_REGS := 1
>>   endif
>> +HAVE_KVM_STAT_SUPPORT := 1
> Does this stuff fail gracefully if used on a PPC target that doesn't
> support this?

Yes, it does.

> -Scott
>
>
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev

-- 
Thanks,
Hemant Kumar


  reply	other threads:[~2015-05-12 16:16 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-08  1:07 [PATCH v3 1/2] perf/kvm: Port perf kvm to powerpc Hemant Kumar
2015-05-08  1:19 ` Hemant Kumar
2015-05-08  1:07 ` Hemant Kumar
2015-05-08  1:07 ` [PATCH v3 2/2] perf/kvm: Support HCALL events Hemant Kumar
2015-05-08  1:19   ` Hemant Kumar
2015-05-08  1:07   ` Hemant Kumar
2015-05-08  4:28 ` [PATCH v3 1/2] perf/kvm: Port perf kvm to powerpc Ingo Molnar
2015-05-08  4:28   ` Ingo Molnar
2015-05-08  4:28   ` Ingo Molnar
2015-05-08  6:16   ` Hemant Kumar
2015-05-08  6:28     ` Hemant Kumar
2015-05-08  6:16     ` Hemant Kumar
2015-05-08  6:18     ` Ingo Molnar
2015-05-08  6:18       ` Ingo Molnar
2015-05-08  6:18       ` Ingo Molnar
2015-05-11 22:08 ` Scott Wood
2015-05-11 22:08   ` Scott Wood
2015-05-11 22:08   ` Scott Wood
2015-05-12 16:04   ` Hemant Kumar [this message]
2015-05-12 16:16     ` Hemant Kumar
2015-05-12 16:04     ` Hemant Kumar
2015-05-13  3:22     ` Scott Wood
2015-05-13  3:22       ` Scott Wood
2015-05-13  3:22       ` Scott Wood
2015-05-21  4:03       ` Hemant Kumar
2015-05-21  4:15         ` Hemant Kumar

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=555224A4.5050502@linux.vnet.ibm.com \
    --to=hemant@linux.vnet.ibm.com \
    --cc=acme@kernel.org \
    --cc=agraf@suse.de \
    --cc=kvm-ppc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=maddy@linux.vnet.ibm.com \
    --cc=mingo@redhat.com \
    --cc=paulus@samba.org \
    --cc=peterz@infradead.org \
    --cc=scottwood@freescale.com \
    --cc=srikar@linux.vnet.ibm.com \
    --cc=warrier@linux.vnet.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.