From: Marc Zyngier <maz@kernel.org>
To: Oliver Upton <oliver.upton@linux.dev>
Cc: kvmarm@lists.linux.dev, Joey Gouly <joey.gouly@arm.com>,
Suzuki K Poulose <suzuki.poulose@arm.com>,
Zenghui Yu <yuzenghui@huawei.com>,
Mingwei Zhang <mizhang@google.com>,
Colton Lewis <coltonlewis@google.com>,
Raghavendra Rao Ananta <rananta@google.com>,
James Clark <james.clark@linaro.org>
Subject: Re: [PATCH v3 10/16] KVM: arm64: Use debug_owner to track if debug regs need save/restore
Date: Wed, 18 Dec 2024 18:11:54 +0000 [thread overview]
Message-ID: <86frmkrhcl.wl-maz@kernel.org> (raw)
In-Reply-To: <20241209180926.2161373-11-oliver.upton@linux.dev>
On Mon, 09 Dec 2024 18:09:20 +0000,
Oliver Upton <oliver.upton@linux.dev> wrote:
>
> diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c
> index f84306b11261..5b8982bcc0bb 100644
> --- a/arch/arm64/kvm/sys_regs.c
> +++ b/arch/arm64/kvm/sys_regs.c
> @@ -621,40 +621,12 @@ static bool trap_dbgauthstatus_el1(struct kvm_vcpu *vcpu,
> }
> }
>
> -/*
> - * We want to avoid world-switching all the DBG registers all the
> - * time:
> - *
> - * - If we've touched any debug register, it is likely that we're
> - * going to touch more of them. It then makes sense to disable the
> - * traps and start doing the save/restore dance
> - * - If debug is active (DBG_MDSCR_KDE or DBG_MDSCR_MDE set), it is
> - * then mandatory to save/restore the registers, as the guest
> - * depends on them.
> - *
> - * For this, we use a DIRTY bit, indicating the guest has modified the
> - * debug registers, used as follow:
> - *
> - * On guest entry:
> - * - If the dirty bit is set (because we're coming back from trapping),
> - * disable the traps, save host registers, restore guest registers.
> - * - If debug is actively in use (DBG_MDSCR_KDE or DBG_MDSCR_MDE set),
> - * set the dirty bit, disable the traps, save host registers,
> - * restore guest registers.
> - * - Otherwise, enable the traps
> - *
> - * On guest exit:
> - * - If the dirty bit is set, save guest registers, restore host
> - * registers and clear the dirty bit. This ensure that the host can
> - * now use the debug registers.
> - */
> static bool trap_debug_regs(struct kvm_vcpu *vcpu,
> struct sys_reg_params *p,
> const struct sys_reg_desc *r)
> {
> access_rw(vcpu, p, r);
> if (p->is_write)
> - vcpu_set_flag(vcpu, DEBUG_DIRTY);
>
> kvm_debug_set_guest_ownership(vcpu);
> return true;
Sorry for stating the same thing again, but this is a repeat of [1].
Should I add this on top?
diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c
index 55c49150fac40..92e2c4c12f0dc 100644
--- a/arch/arm64/kvm/sys_regs.c
+++ b/arch/arm64/kvm/sys_regs.c
@@ -619,8 +619,6 @@ static bool trap_debug_regs(struct kvm_vcpu *vcpu,
const struct sys_reg_desc *r)
{
access_rw(vcpu, p, r);
- if (p->is_write)
-
kvm_debug_set_guest_ownership(vcpu);
return true;
}
M.
[1] https://lore.kernel.org/r/Zy_0T00hOjVfmKTz@linux.dev
--
Without deviation from the norm, progress is not possible.
next prev parent reply other threads:[~2024-12-18 18:11 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-09 18:09 [PATCH v3 00/16] KVM: arm64: Debug cleanups Oliver Upton
2024-12-09 18:09 ` [PATCH v3 01/16] KVM: arm64: Drop MDSCR_EL1_DEBUG_MASK Oliver Upton
2024-12-09 18:09 ` [PATCH v3 02/16] KVM: arm64: Get rid of __kvm_get_mdcr_el2() and related warts Oliver Upton
2024-12-09 18:09 ` [PATCH v3 03/16] KVM: arm64: Track presence of SPE/TRBE in kvm_host_data instead of vCPU Oliver Upton
2024-12-09 18:09 ` [PATCH v3 04/16] KVM: arm64: Move host SME/SVE tracking flags to host data Oliver Upton
2024-12-09 18:09 ` [PATCH v3 05/16] KVM: arm64: Evaluate debug owner at vcpu_load() Oliver Upton
2024-12-09 18:09 ` [PATCH v3 06/16] KVM: arm64: Clean up KVM_SET_GUEST_DEBUG handler Oliver Upton
2024-12-09 18:09 ` [PATCH v3 07/16] KVM: arm64: Select debug state to save/restore based on debug owner Oliver Upton
2024-12-09 18:09 ` [PATCH v3 08/16] KVM: arm64: Remove debug tracepoints Oliver Upton
2024-12-09 18:09 ` [PATCH v3 09/16] KVM: arm64: Remove vestiges of debug_ptr Oliver Upton
2024-12-09 18:09 ` [PATCH v3 10/16] KVM: arm64: Use debug_owner to track if debug regs need save/restore Oliver Upton
2024-12-18 18:11 ` Marc Zyngier [this message]
2024-12-18 20:36 ` Oliver Upton
2024-12-09 18:09 ` [PATCH v3 11/16] KVM: arm64: Reload vCPU for accesses to OSLAR_EL1 Oliver Upton
2024-12-09 18:09 ` [PATCH v3 12/16] KVM: arm64: Compute MDCR_EL2 at vcpu_load() Oliver Upton
2024-12-18 18:40 ` Marc Zyngier
2024-12-19 18:00 ` Oliver Upton
2024-12-19 18:16 ` Marc Zyngier
2024-12-09 18:09 ` [PATCH v3 13/16] KVM: arm64: Don't hijack guest context MDSCR_EL1 Oliver Upton
2024-12-09 18:09 ` [PATCH v3 14/16] KVM: arm64: Manage software step state at load/put Oliver Upton
2024-12-09 18:09 ` [PATCH v3 15/16] KVM: arm64: nv: Honor MDCR_EL2.TDE routing for debug exceptions Oliver Upton
2024-12-09 18:09 ` [PATCH v3 16/16] KVM: arm64: Avoid reading ID_AA64DFR0_EL1 for debug save/restore Oliver Upton
2024-12-10 10:30 ` [PATCH v3 00/16] KVM: arm64: Debug cleanups James Clark
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=86frmkrhcl.wl-maz@kernel.org \
--to=maz@kernel.org \
--cc=coltonlewis@google.com \
--cc=james.clark@linaro.org \
--cc=joey.gouly@arm.com \
--cc=kvmarm@lists.linux.dev \
--cc=mizhang@google.com \
--cc=oliver.upton@linux.dev \
--cc=rananta@google.com \
--cc=suzuki.poulose@arm.com \
--cc=yuzenghui@huawei.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.