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 lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (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 07BB7C3DA7F for ; Wed, 7 Aug 2024 16:22:14 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4WfFnK3mxGz3dDp for ; Thu, 8 Aug 2024 02:22:13 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=kernel.org (client-ip=145.40.73.55; helo=sin.source.kernel.org; envelope-from=cmarinas@kernel.org; receiver=lists.ozlabs.org) Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4WfFmf36Pqz3cdn for ; Thu, 8 Aug 2024 02:21:38 +1000 (AEST) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 88FCBCE0C56; Wed, 7 Aug 2024 16:21:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3D649C32781; Wed, 7 Aug 2024 16:21:29 +0000 (UTC) Date: Wed, 7 Aug 2024 17:21:27 +0100 From: Catalin Marinas To: Sean Christopherson Subject: Re: [PATCH v12 02/84] KVM: arm64: Disallow copying MTE to guest memory while KVM is dirty logging Message-ID: References: <20240726235234.228822-1-seanjc@google.com> <20240726235234.228822-3-seanjc@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240726235234.228822-3-seanjc@google.com> X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, David Matlack , linux-riscv@lists.infradead.org, Claudio Imbrenda , Janosch Frank , Marc Zyngier , Huacai Chen , Christian Borntraeger , Albert Ou , Bibo Mao , loongarch@lists.linux.dev, Paul Walmsley , kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-mips@vger.kernel.org, Oliver Upton , Palmer Dabbelt , David Stevens , kvm-riscv@lists.infradead.org, Anup Patel , Paolo Bonzini , Tianrui Zhao , linuxppc-dev@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On Fri, Jul 26, 2024 at 04:51:11PM -0700, Sean Christopherson wrote: > Disallow copying MTE tags to guest memory while KVM is dirty logging, as > writing guest memory without marking the gfn as dirty in the memslot could > result in userspace failing to migrate the updated page. Ideally (maybe?), > KVM would simply mark the gfn as dirty, but there is no vCPU to work with, > and presumably the only use case for copy MTE tags _to_ the guest is when > restoring state on the target. > > Fixes: f0376edb1ddc ("KVM: arm64: Add ioctl to fetch/store tags in a guest") > Signed-off-by: Sean Christopherson > --- > arch/arm64/kvm/guest.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/arch/arm64/kvm/guest.c b/arch/arm64/kvm/guest.c > index e1f0ff08836a..962f985977c2 100644 > --- a/arch/arm64/kvm/guest.c > +++ b/arch/arm64/kvm/guest.c > @@ -1045,6 +1045,11 @@ int kvm_vm_ioctl_mte_copy_tags(struct kvm *kvm, > > mutex_lock(&kvm->slots_lock); > > + if (write && atomic_read(&kvm->nr_memslots_dirty_logging)) { > + ret = -EBUSY; > + goto out; > + } There are ways to actually log the page dirtying but I don't think it's worth it. AFAICT, reading the tags still works and that's what's used during migration (on the VM where dirty tracking takes place). Reviewed-by: Catalin Marinas