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 04652C3DA7F for ; Thu, 15 Aug 2024 12:32:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:MIME-Version: References:In-Reply-To:Subject:Cc:To:From:Message-ID:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=5W+MkcdkXaWcUuNyfTXNIZeJam8X626ev4Hy7K+Rp6U=; b=a2MXRUEG3zzv98BfNczCCn4qqt ptZRjkeaM36Sl+4IC65bWPiASoiApZJe09W4S/xQB2rFZWGuJiVs2YQoIAvPIHB6qDXVm0zoqlWrZ NkE571ZQuu/Wb9JqsJElvdH4/2i0OHQyzXmETLKuhEVEFT1iCGSPySupjQ751RdoTQ18vPBpw1fo3 FW0thb4u/UJ63vemBXzpAk9Aq67geudHe0Ht4jABOmRsXusooEKX7gzBmlnIYrkA/1wjLKTXzdE4V 0TDIVWotqwxAokCf84v5iLuN0aXGHEy+DuYwv9acoybon2jtp6ArJCnJM5+fhivaNJ+4s/HY8bgjR +IzPqGug==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1seZei-00000009u9x-1188; Thu, 15 Aug 2024 12:32:40 +0000 Received: from sin.source.kernel.org ([145.40.73.55]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1seZe5-00000009u4b-0hpx for linux-arm-kernel@lists.infradead.org; Thu, 15 Aug 2024 12:32:02 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 8E635CE1BFD; Thu, 15 Aug 2024 12:31:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BFE79C32786; Thu, 15 Aug 2024 12:31:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1723725116; bh=oZnzMPk6h7KYBtLyeUsPubLvH0QSgdeFqgi/X9WK814=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=WN2C5akuUhnXfOZ0cfuxYOw8LeRyQQYcb2NRwpFLnijK4/NlCUizVTyQHswSZ3slz V1Df44Qw7GojbBj4gH8pDLnSDR1RrGMXlXGtI6g7UVCSTdeCWLWCkbF6Vlewx6xr67 Z8VCRxBRn3JeD0ZuJSfjcqiPI1NpwK4zDqNHTBwfsjjQC9TAPPPZ+fUWnhTc7L/8vA LvYk5ouje/UkP6ATrLngQtUgonV/wZtE+YjecD1qxTw1RMgGvmD4DcCkFGjo34Whsg zIp/8jov/gRlQSxItzWBBDemEz87yXEaevtv7HQ8SZfcZz0deLQEEluUtpY+/dxyON PIuqCENc4Adnw== Received: from sofa.misterjones.org ([185.219.108.64] helo=goblin-girl.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1seZdy-003xLX-C4; Thu, 15 Aug 2024 13:31:54 +0100 Date: Thu, 15 Aug 2024 13:31:54 +0100 Message-ID: <86o75uynk5.wl-maz@kernel.org> From: Marc Zyngier To: Will Deacon Cc: linux-arm-kernel@lists.infradead.org, Oliver Upton , Fuad Tabba , kvmarm@lists.linux.dev Subject: Re: [PATCH 2/2] KVM: arm64: Ensure TLBI uses correct VMID after changing context In-Reply-To: <20240815120803.GA21444@willie-the-truck> References: <20240814123429.20457-1-will@kernel.org> <20240814123429.20457-3-will@kernel.org> <86ttfnz0xe.wl-maz@kernel.org> <20240815120803.GA21444@willie-the-truck> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/29.4 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: will@kernel.org, linux-arm-kernel@lists.infradead.org, oliver.upton@linux.dev, tabba@google.com, kvmarm@lists.linux.dev X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240815_053201_403886_C629112B X-CRM114-Status: GOOD ( 23.04 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, 15 Aug 2024 13:08:03 +0100, Will Deacon wrote: > > > Is there an actual path within pKVM that causes a guest TLBI to be > > followed by a host __kvm_tlb_flush_vmid() *without* a CSE? I can't > > convinced myself that such a path exist in the current upstream code > > base. > > I think you're right that this can't happen upstream. We see the issue > in Android when reclaiming pages from a guest during teardown. That > amounts to unmapping pages from the guest, poisoning them and mapping > them back into the host. Mapping them into the host can then trigger > table -> block conversion and the associated TLB invalidation wasn't > effective because it was still using the guest VMID. > > We can carry this patch in Android if you prefer, but given that > {enter,exit}_vmid_context() are upstream, it would be nice to land the > fix so that we don't run into this bug again in future (it took some > debugging!). I think it is definitely worth addressing, and given that this is nVHE only, an extra CSE isn't going to show on the radar. The question is more whether this is 6.11 or 6.12 material. If that's not an immediate fix for upstream, I'm tempted to queue it for 6.12. Does this work for you? M. -- Without deviation from the norm, progress is not possible.