linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Oliver Upton <oliver.upton@linux.dev>
To: Marc Zyngier <maz@kernel.org>
Cc: kvmarm@lists.linux.dev, kvm@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	James Morse <james.morse@arm.com>,
	Suzuki K Poulose <suzuki.poulose@arm.com>,
	Zenghui Yu <yuzenghui@huawei.com>, Fuad Tabba <tabba@google.com>
Subject: Re: [PATCH] KVM: arm64: Move management of __hyp_running_vcpu to load/put on VHE
Date: Thu, 2 May 2024 09:50:36 -0700	[thread overview]
Message-ID: <ZjPEXPO0PNq4PQQ8@linux.dev> (raw)
In-Reply-To: <20240502154030.3011995-1-maz@kernel.org>

On Thu, May 02, 2024 at 04:40:30PM +0100, Marc Zyngier wrote:
> The per-CPU host context structure contains a __hyp_running_vcpu that
> serves as a replacement for kvm_get_current_vcpu() in contexts where
> we cannot make direct use of it (such as in the nVHE hypervisor).
> Since there is a lot of common code between nVHE and VHE, the latter
> also populates this field even if kvm_get_running_vcpu() always works.
> 
> We currently pretty inconsistent when populating __hyp_running_vcpu
> to point to the currently running vcpu:
> 
> - on {n,h}VHE, we set __hyp_running_vcpu on entry to __kvm_vcpu_run
>   and clear it on exit.
> 
> - on VHE, we set __hyp_running_vcpu on entry to __kvm_vcpu_run_vhe
>   and never clear it, effectively leaving a dangling pointer...
> 
> VHE is obviously the odd one here. Although we could make it behave
> just like nVHE, this wouldn't match the behaviour of KVM with VHE,
> where the load phase is where most of the context-switch gets done.
> 
> So move all the __hyp_running_vcpu management to the VHE-specific
> load/put phases, giving us a bit more sanity and matching the
> behaviour of kvm_get_running_vcpu().
> 
> Signed-off-by: Marc Zyngier <maz@kernel.org>

Reviewed-by: Oliver Upton <oliver.upton@linux.dev>

-- 
Thanks,
Oliver

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2024-05-02 16:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-02 15:40 [PATCH] KVM: arm64: Move management of __hyp_running_vcpu to load/put on VHE Marc Zyngier
2024-05-02 16:50 ` Oliver Upton [this message]
2024-05-03 13:35 ` Marc Zyngier

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=ZjPEXPO0PNq4PQQ8@linux.dev \
    --to=oliver.upton@linux.dev \
    --cc=james.morse@arm.com \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.linux.dev \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=maz@kernel.org \
    --cc=suzuki.poulose@arm.com \
    --cc=tabba@google.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 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).