From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4935BC04FFE for ; Thu, 2 May 2024 16:51:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Cj2fCAQlVc0AIQSvnMt7EIM6YwZDSxFxXrDh9hulqVA=; b=mKUpRyfy3ek39v VjgjG2YtgjKFcvAJ99i3kzH8vFo5I7SPbz5MXy5IJwfEXp4yjuChhc6DPWyq4e0FSP4hrkRO3kz9m 2nboxd46kjPGxXMjiqUG3wSXpjjK4QMVSNwPbUYtkpMnLRfDMiBhPkFss7LV/PoyQyAt8vKum7GJR kAm8tuafKlDRWxnjkx5iVKd6SoLkllS7yJb13gQq3bKrXOtWSZyWxMfgTkWs/5KfXdUWffXkDaFHL L3k2tI6C1YkrMoIi1YQ6Q8qGvnOZgQsBrqhnz6Jx9y8fEHS87DnDtPci2p+9grdksDkYwpg6B+x0R WIYeD9jo6es1nyneU1cA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s2Ze2-0000000DLOG-03Bb; Thu, 02 May 2024 16:50:54 +0000 Received: from out-186.mta1.migadu.com ([2001:41d0:203:375::ba]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s2Zdy-0000000DLLg-3z8h for linux-arm-kernel@lists.infradead.org; Thu, 02 May 2024 16:50:52 +0000 Date: Thu, 2 May 2024 09:50:36 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1714668640; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=hpWKZwA6w6835XfJyp6UfuhrR8rSmcgdYf8EdTGLeNg=; b=BvG9lA4HVdECQeHpOpwA4LdgmpttMCCCpaxWuj4MU5PyRhJ8bhYMHiaDPH4q49R9IJ65C2 tpTyvXvGO2vSsDCWoZNQeehpNllwQBBBK+LYKPg3VeaK34agor/o4/i759vUfkyfNWkfVK Lw4r449xMSGTeOVGNbjpFfK+/+fqWto= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Oliver Upton To: Marc Zyngier Cc: kvmarm@lists.linux.dev, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, James Morse , Suzuki K Poulose , Zenghui Yu , Fuad Tabba Subject: Re: [PATCH] KVM: arm64: Move management of __hyp_running_vcpu to load/put on VHE Message-ID: References: <20240502154030.3011995-1-maz@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20240502154030.3011995-1-maz@kernel.org> X-Migadu-Flow: FLOW_OUT X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240502_095051_152457_3C66FC26 X-CRM114-Status: GOOD ( 16.05 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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 Reviewed-by: Oliver Upton -- Thanks, Oliver _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel