From: Mark Rutland <mark.rutland@arm.com>
To: Christoffer Dall <christoffer.dall@linaro.org>,
Marc Zyngier <marc.zyngier@arm.com>,
Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will.deacon@arm.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
"kvmarm@lists.cs.columbia.edu" <kvmarm@lists.cs.columbia.edu>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
Andre Przywara <Andre.Przywara@arm.com>
Subject: Re: [GIT PULL 03/36] arm/arm64: KVM: add tracing support for arm64 exit handler
Date: Fri, 23 Jan 2015 11:35:15 +0000 [thread overview]
Message-ID: <20150123113515.GF23493@leverpostej> (raw)
In-Reply-To: <1422007385-14730-4-git-send-email-christoffer.dall@linaro.org>
Hi Christoffer,
On Fri, Jan 23, 2015 at 10:02:32AM +0000, Christoffer Dall wrote:
> From: Wei Huang <wei@redhat.com>
>
> arm64 uses its own copy of exit handler (arm64/kvm/handle_exit.c).
> Currently this file doesn't hook up with any trace points. As a result
> users might not see certain events (e.g. HVC & WFI) while using ftrace
> with arm64 KVM. This patch fixes this issue by adding a new trace file
> and defining two trace events (one of which is shared by wfi and wfe)
> for arm64. The new trace points are then linked with related functions
> in handle_exit.c.
Stephen Rothwell reported a couple of conflicts between this patch and
my ESR rework in -next:
https://lkml.org/lkml/2015/1/22/7
https://lkml.org/lkml/2015/1/22/8
I'd hoped we'd be able to fix that before this went further upstream.
The easiest way I could see to do that was to merge my esr branch (which
is stable and Catalin has pulled) branch into the kvm-arm tree, and fix
the conflicts there.
Is there any chance we can fix that now?
Thanks,
Mark.
>
> Signed-off-by: Wei Huang <wei@redhat.com>
> Signed-off-by: Andre Przywara <andre.przywara@arm.com>
> Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
> ---
> arch/arm64/include/asm/kvm_arm.h | 2 ++
> arch/arm64/include/asm/kvm_emulate.h | 5 ++++
> arch/arm64/kvm/handle_exit.c | 13 +++++++--
> arch/arm64/kvm/trace.h | 55 ++++++++++++++++++++++++++++++++++++
> 4 files changed, 73 insertions(+), 2 deletions(-)
> create mode 100644 arch/arm64/kvm/trace.h
>
> diff --git a/arch/arm64/include/asm/kvm_arm.h b/arch/arm64/include/asm/kvm_arm.h
> index 8afb863..3da2d3a 100644
> --- a/arch/arm64/include/asm/kvm_arm.h
> +++ b/arch/arm64/include/asm/kvm_arm.h
> @@ -257,4 +257,6 @@
>
> #define ESR_EL2_EC_WFI_ISS_WFE (1 << 0)
>
> +#define ESR_EL2_HVC_IMM_MASK ((1UL << 16) - 1)
> +
> #endif /* __ARM64_KVM_ARM_H__ */
> diff --git a/arch/arm64/include/asm/kvm_emulate.h b/arch/arm64/include/asm/kvm_emulate.h
> index 8127e45..a6fa2d2 100644
> --- a/arch/arm64/include/asm/kvm_emulate.h
> +++ b/arch/arm64/include/asm/kvm_emulate.h
> @@ -126,6 +126,11 @@ static inline phys_addr_t kvm_vcpu_get_fault_ipa(const struct kvm_vcpu *vcpu)
> return ((phys_addr_t)vcpu->arch.fault.hpfar_el2 & HPFAR_MASK) << 8;
> }
>
> +static inline u32 kvm_vcpu_hvc_get_imm(const struct kvm_vcpu *vcpu)
> +{
> + return kvm_vcpu_get_hsr(vcpu) & ESR_EL2_HVC_IMM_MASK;
> +}
> +
> static inline bool kvm_vcpu_dabt_isvalid(const struct kvm_vcpu *vcpu)
> {
> return !!(kvm_vcpu_get_hsr(vcpu) & ESR_EL2_ISV);
> diff --git a/arch/arm64/kvm/handle_exit.c b/arch/arm64/kvm/handle_exit.c
> index 34b8bd0..6a7eb3c 100644
> --- a/arch/arm64/kvm/handle_exit.c
> +++ b/arch/arm64/kvm/handle_exit.c
> @@ -26,12 +26,18 @@
> #include <asm/kvm_mmu.h>
> #include <asm/kvm_psci.h>
>
> +#define CREATE_TRACE_POINTS
> +#include "trace.h"
> +
> typedef int (*exit_handle_fn)(struct kvm_vcpu *, struct kvm_run *);
>
> static int handle_hvc(struct kvm_vcpu *vcpu, struct kvm_run *run)
> {
> int ret;
>
> + trace_kvm_hvc_arm64(*vcpu_pc(vcpu), *vcpu_reg(vcpu, 0),
> + kvm_vcpu_hvc_get_imm(vcpu));
> +
> ret = kvm_psci_call(vcpu);
> if (ret < 0) {
> kvm_inject_undefined(vcpu);
> @@ -61,10 +67,13 @@ static int handle_smc(struct kvm_vcpu *vcpu, struct kvm_run *run)
> */
> static int kvm_handle_wfx(struct kvm_vcpu *vcpu, struct kvm_run *run)
> {
> - if (kvm_vcpu_get_hsr(vcpu) & ESR_EL2_EC_WFI_ISS_WFE)
> + if (kvm_vcpu_get_hsr(vcpu) & ESR_EL2_EC_WFI_ISS_WFE) {
> + trace_kvm_wfx_arm64(*vcpu_pc(vcpu), true);
> kvm_vcpu_on_spin(vcpu);
> - else
> + } else {
> + trace_kvm_wfx_arm64(*vcpu_pc(vcpu), false);
> kvm_vcpu_block(vcpu);
> + }
>
> kvm_skip_instr(vcpu, kvm_vcpu_trap_il_is32bit(vcpu));
>
> diff --git a/arch/arm64/kvm/trace.h b/arch/arm64/kvm/trace.h
> new file mode 100644
> index 0000000..157416e9
> --- /dev/null
> +++ b/arch/arm64/kvm/trace.h
> @@ -0,0 +1,55 @@
> +#if !defined(_TRACE_ARM64_KVM_H) || defined(TRACE_HEADER_MULTI_READ)
> +#define _TRACE_ARM64_KVM_H
> +
> +#include <linux/tracepoint.h>
> +
> +#undef TRACE_SYSTEM
> +#define TRACE_SYSTEM kvm
> +
> +TRACE_EVENT(kvm_wfx_arm64,
> + TP_PROTO(unsigned long vcpu_pc, bool is_wfe),
> + TP_ARGS(vcpu_pc, is_wfe),
> +
> + TP_STRUCT__entry(
> + __field(unsigned long, vcpu_pc)
> + __field(bool, is_wfe)
> + ),
> +
> + TP_fast_assign(
> + __entry->vcpu_pc = vcpu_pc;
> + __entry->is_wfe = is_wfe;
> + ),
> +
> + TP_printk("guest executed wf%c at: 0x%08lx",
> + __entry->is_wfe ? 'e' : 'i', __entry->vcpu_pc)
> +);
> +
> +TRACE_EVENT(kvm_hvc_arm64,
> + TP_PROTO(unsigned long vcpu_pc, unsigned long r0, unsigned long imm),
> + TP_ARGS(vcpu_pc, r0, imm),
> +
> + TP_STRUCT__entry(
> + __field(unsigned long, vcpu_pc)
> + __field(unsigned long, r0)
> + __field(unsigned long, imm)
> + ),
> +
> + TP_fast_assign(
> + __entry->vcpu_pc = vcpu_pc;
> + __entry->r0 = r0;
> + __entry->imm = imm;
> + ),
> +
> + TP_printk("HVC at 0x%08lx (r0: 0x%08lx, imm: 0x%lx)",
> + __entry->vcpu_pc, __entry->r0, __entry->imm)
> +);
> +
> +#endif /* _TRACE_ARM64_KVM_H */
> +
> +#undef TRACE_INCLUDE_PATH
> +#define TRACE_INCLUDE_PATH .
> +#undef TRACE_INCLUDE_FILE
> +#define TRACE_INCLUDE_FILE trace
> +
> +/* This part must be outside protection */
> +#include <trace/define_trace.h>
> --
> 2.1.2.330.g565301e.dirty
>
> _______________________________________________
> kvmarm mailing list
> kvmarm@lists.cs.columbia.edu
> https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
>
next prev parent reply other threads:[~2015-01-23 11:35 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-23 10:02 [GIT PULL 00/36] KVM/ARM changes for 3.20 Christoffer Dall
2015-01-23 10:02 ` [GIT PULL 01/36] KVM: arm/arm64: vgic: vgic_init returns -ENODEV when no online vcpu Christoffer Dall
2015-01-23 10:02 ` [GIT PULL 02/36] KVM: arm/arm64: vgic: add init entry to VGIC KVM device Christoffer Dall
2015-01-23 10:02 ` [GIT PULL 03/36] arm/arm64: KVM: add tracing support for arm64 exit handler Christoffer Dall
2015-01-23 11:35 ` Mark Rutland [this message]
2015-01-23 12:01 ` Paolo Bonzini
2015-01-23 12:49 ` Paolo Bonzini
2015-01-23 12:55 ` Christoffer Dall
2015-01-23 13:41 ` Mark Rutland
2015-01-23 10:02 ` [GIT PULL 04/36] ARM: KVM: extend WFI tracepoint to differentiate between wfi and wfe Christoffer Dall
2015-01-23 10:02 ` [GIT PULL 05/36] KVM: Add architecture-defined TLB flush support Christoffer Dall
2015-01-23 10:02 ` [GIT PULL 06/36] KVM: Add generic support for dirty page logging Christoffer Dall
2015-01-23 10:02 ` [GIT PULL 07/36] KVM: x86: switch to kvm_get_dirty_log_protect Christoffer Dall
2015-01-23 10:02 ` [GIT PULL 08/36] KVM: arm: Add ARMv7 API to flush TLBs Christoffer Dall
2015-01-23 10:02 ` [GIT PULL 09/36] KVM: arm: Add initial dirty page locking support Christoffer Dall
2015-01-23 10:02 ` [GIT PULL 10/36] KVM: arm: dirty logging write protect support Christoffer Dall
2015-01-23 10:02 ` [GIT PULL 11/36] KVM: arm: page logging 2nd stage fault handling Christoffer Dall
2015-01-23 10:02 ` [GIT PULL 12/36] KVM: arm64: ARMv8 header changes for page logging Christoffer Dall
2015-01-23 10:02 ` [GIT PULL 13/36] KVM: arm64: Add HYP interface to flush VM Stage 1/2 TLB entries Christoffer Dall
2015-01-23 10:02 ` [GIT PULL 14/36] KVM: arm/arm64: Enable Dirty Page logging for ARMv8 Christoffer Dall
2015-01-23 10:02 ` [GIT PULL 15/36] arm/arm64: KVM: rework MPIDR assignment and add accessors Christoffer Dall
2015-01-23 10:02 ` [GIT PULL 16/36] arm/arm64: KVM: pass down user space provided GIC type into vGIC code Christoffer Dall
2015-01-23 10:02 ` [GIT PULL 17/36] arm/arm64: KVM: refactor vgic_handle_mmio() function Christoffer Dall
2015-01-23 10:02 ` [GIT PULL 18/36] arm/arm64: KVM: wrap 64 bit MMIO accesses with two 32 bit ones Christoffer Dall
2015-01-23 10:02 ` [GIT PULL 19/36] arm/arm64: KVM: introduce per-VM ops Christoffer Dall
2015-01-23 10:02 ` [GIT PULL 20/36] arm/arm64: KVM: move kvm_register_device_ops() into vGIC probing Christoffer Dall
2015-01-23 10:02 ` [GIT PULL 21/36] arm/arm64: KVM: dont rely on a valid GICH base address Christoffer Dall
2015-01-23 10:02 ` [GIT PULL 22/36] arm/arm64: KVM: make the maximum number of vCPUs a per-VM value Christoffer Dall
2015-01-23 10:02 ` [GIT PULL 23/36] arm/arm64: KVM: make the value of ICC_SRE_EL1 a per-VM variable Christoffer Dall
2015-01-23 10:02 ` [GIT PULL 24/36] arm/arm64: KVM: refactor MMIO accessors Christoffer Dall
2015-01-23 10:02 ` [GIT PULL 25/36] arm/arm64: KVM: refactor/wrap vgic_set/get_attr() Christoffer Dall
2015-01-23 10:02 ` [GIT PULL 26/36] arm/arm64: KVM: add vgic.h header file Christoffer Dall
2015-01-23 10:02 ` [GIT PULL 27/36] arm/arm64: KVM: split GICv2 specific emulation code from vgic.c Christoffer Dall
2015-01-23 10:02 ` [GIT PULL 28/36] arm/arm64: KVM: add opaque private pointer to MMIO data Christoffer Dall
2015-01-23 10:02 ` [GIT PULL 29/36] arm/arm64: KVM: add virtual GICv3 distributor emulation Christoffer Dall
2015-01-23 10:02 ` [GIT PULL 30/36] arm64: GICv3: introduce symbolic names for GICv3 ICC_SGI1R_EL1 fields Christoffer Dall
2015-01-23 10:03 ` [GIT PULL 31/36] arm64: KVM: add SGI generation register emulation Christoffer Dall
2015-01-23 10:03 ` [GIT PULL 32/36] arm/arm64: KVM: enable kernel side of GICv3 emulation Christoffer Dall
2015-01-23 10:03 ` [GIT PULL 33/36] arm/arm64: KVM: allow userland to request a virtual GICv3 Christoffer Dall
2015-01-23 10:03 ` [GIT PULL 34/36] arm/arm64: KVM: force alignment of VGIC dist/CPU/redist addresses Christoffer Dall
2015-01-23 10:03 ` [GIT PULL 35/36] arm/arm64: KVM: Fixup incorrect config symbol in comment Christoffer Dall
2015-01-23 10:03 ` [GIT PULL 36/36] KVM: Remove unused config symbol Christoffer Dall
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=20150123113515.GF23493@leverpostej \
--to=mark.rutland@arm.com \
--cc=Andre.Przywara@arm.com \
--cc=catalin.marinas@arm.com \
--cc=christoffer.dall@linaro.org \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.cs.columbia.edu \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=marc.zyngier@arm.com \
--cc=pbonzini@redhat.com \
--cc=will.deacon@arm.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