From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ABDCE82877; Wed, 7 Aug 2024 16:21:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723047694; cv=none; b=mmkgjV4aX7349hZ/mBPxYkoJ2zbd63C++1KPae5Iwa+D/n4AROJiA6pzJQOF66/kaRclyxFqXsEVHZNgalK+To2N8DpVsXrPQrWUv/XLDugvOEnLjGTyqZf/WDOUWkirw/dqA/qeKcfwwRE+q4dChnZZ5XcMHWk8D3y35I7XFTw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723047694; c=relaxed/simple; bh=/QJ5VFSjKpMLHmOJsztpGK8KSxLg9wchOl64nmQ6D4k=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=pZo6yrQWETh7q0Ufe4pmBFAIhCegoZtt3oXKiOIm9upA4qIYeMQ6v60NI3JWiobu7Hakm66w+u0eQ/OOUTwY6LG+Dnntu75epgsJraij741S6dRWXHS0EnlbjmK9vmckeSuZVJE+KzZlJXPfkBQLcXknPK8E+jejp3ihMPMLYBw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 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 Cc: Paolo Bonzini , Marc Zyngier , Oliver Upton , Tianrui Zhao , Bibo Mao , Huacai Chen , Michael Ellerman , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou , Christian Borntraeger , Janosch Frank , Claudio Imbrenda , kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, loongarch@lists.linux.dev, linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, David Matlack , David Stevens 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> Precedence: bulk X-Mailing-List: linux-mips@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240726235234.228822-3-seanjc@google.com> 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