From: Dave Martin <Dave.Martin@arm.com>
To: Andrew Scull <ascull@google.com>
Cc: maz@kernel.org, kernel-team@android.com, kvmarm@lists.cs.columbia.edu
Subject: Re: [PATCH v2 1/4] KVM: arm64: Leave KVM_ARM64_DEBUG_DIRTY updates to the host
Date: Wed, 22 Jul 2020 17:24:23 +0100 [thread overview]
Message-ID: <20200722162423.GO30452@arm.com> (raw)
In-Reply-To: <20200713210505.2959828-2-ascull@google.com>
On Mon, Jul 13, 2020 at 10:05:02PM +0100, Andrew Scull wrote:
> Move the clearing of KVM_ARM64_DEBUG_DIRTY from being one of the last
> things hyp does before exiting to the host to being one of the first
> things the host does after hyp exits.
>
> This means the host always manages the state of the bit and hyp simply
> respects that in the context switch.
>
> No functional change.
>
> Signed-off-by: Andrew Scull <ascull@google.com>
Seems reasonable, though we have to map the vcpu arch flags into hyp
anyway. For FPSIMD we do maintain these flags from hyp, in order to
void mapping in host-specific stuff (the thread flags).
So maybe this change isn't that useful?
I don't have a strong opinion though. If this change fits in better
with the broader KVM work you're doing, I don't see a problem with it.
So, FWIW:
Reviewed-by: Dave Martin <Dave.Martin@arm.com>
> ---
> arch/arm64/include/asm/kvm_host.h | 2 +-
> arch/arm64/kvm/debug.c | 2 ++
> arch/arm64/kvm/hyp/include/hyp/debug-sr.h | 2 --
> 3 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h
> index e1a32c0707bb..b06f24b5f443 100644
> --- a/arch/arm64/include/asm/kvm_host.h
> +++ b/arch/arm64/include/asm/kvm_host.h
> @@ -404,7 +404,7 @@ struct kvm_vcpu_arch {
> })
>
> /* vcpu_arch flags field values: */
> -#define KVM_ARM64_DEBUG_DIRTY (1 << 0)
> +#define KVM_ARM64_DEBUG_DIRTY (1 << 0) /* vcpu is using debug */
> #define KVM_ARM64_FP_ENABLED (1 << 1) /* guest FP regs loaded */
> #define KVM_ARM64_FP_HOST (1 << 2) /* host FP regs loaded */
> #define KVM_ARM64_HOST_SVE_IN_USE (1 << 3) /* backup for host TIF_SVE */
> diff --git a/arch/arm64/kvm/debug.c b/arch/arm64/kvm/debug.c
> index 7a7e425616b5..e9932618a362 100644
> --- a/arch/arm64/kvm/debug.c
> +++ b/arch/arm64/kvm/debug.c
> @@ -209,6 +209,8 @@ void kvm_arm_clear_debug(struct kvm_vcpu *vcpu)
> {
> trace_kvm_arm_clear_debug(vcpu->guest_debug);
>
> + vcpu->arch.flags &= ~KVM_ARM64_DEBUG_DIRTY;
> +
> if (vcpu->guest_debug) {
> restore_guest_debug_regs(vcpu);
>
> diff --git a/arch/arm64/kvm/hyp/include/hyp/debug-sr.h b/arch/arm64/kvm/hyp/include/hyp/debug-sr.h
> index 0297dc63988c..50ca5d048017 100644
> --- a/arch/arm64/kvm/hyp/include/hyp/debug-sr.h
> +++ b/arch/arm64/kvm/hyp/include/hyp/debug-sr.h
> @@ -161,8 +161,6 @@ static inline void __debug_switch_to_host_common(struct kvm_vcpu *vcpu)
>
> __debug_save_state(guest_dbg, guest_ctxt);
> __debug_restore_state(host_dbg, host_ctxt);
> -
> - vcpu->arch.flags &= ~KVM_ARM64_DEBUG_DIRTY;
> }
>
> #endif /* __ARM64_KVM_HYP_DEBUG_SR_H__ */
> --
> 2.27.0.383.g050319c2ae-goog
>
> _______________________________________________
> kvmarm mailing list
> kvmarm@lists.cs.columbia.edu
> https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
_______________________________________________
kvmarm mailing list
kvmarm@lists.cs.columbia.edu
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
next prev parent reply other threads:[~2020-07-22 16:24 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-13 21:05 [PATCH v2 0/4] Manage vcpu flags from the host Andrew Scull
2020-07-13 21:05 ` [PATCH v2 1/4] KVM: arm64: Leave KVM_ARM64_DEBUG_DIRTY updates to " Andrew Scull
2020-07-22 16:24 ` Dave Martin [this message]
2020-07-13 21:05 ` [PATCH v2 2/4] KVM: arm64: Predicate FPSIMD vcpu flags on feature support Andrew Scull
2020-07-22 16:23 ` Dave Martin
2020-07-13 21:05 ` [PATCH v2 3/4] KVM: arm64: Leave vcpu FPSIMD synchronization in host Andrew Scull
2020-07-22 16:24 ` Dave Martin
2020-07-13 21:05 ` [PATCH v2 4/4] KVM: arm64: Stop mapping host task thread flags to hyp Andrew Scull
2020-07-22 16:24 ` Dave Martin
2020-07-22 16:24 ` [PATCH v2 0/4] Manage vcpu flags from the host Dave Martin
2020-07-22 16:36 ` Marc Zyngier
2020-07-22 16:40 ` Dave Martin
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=20200722162423.GO30452@arm.com \
--to=dave.martin@arm.com \
--cc=ascull@google.com \
--cc=kernel-team@android.com \
--cc=kvmarm@lists.cs.columbia.edu \
--cc=maz@kernel.org \
/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.