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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7D5ACC433FE for ; Fri, 11 Nov 2022 15:20:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234454AbiKKPUF (ORCPT ); Fri, 11 Nov 2022 10:20:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42212 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234446AbiKKPTk (ORCPT ); Fri, 11 Nov 2022 10:19:40 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6990D814C6 for ; Fri, 11 Nov 2022 07:19:10 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1B516B82648 for ; Fri, 11 Nov 2022 15:19:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AACABC43470; Fri, 11 Nov 2022 15:19:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668179947; bh=Myih+8eSXLKw3bm/7g/0UFkXRjh+SapEsLznCy0f9CI=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=dVcPkuhWLZcqwcllPFPJ1OK1KqydWxpSIA33Nh7cJaW/Q6wTeT77ronYe0J4TUpUB /ndiA/6wu3YBHOsS5XTg4Zx04bhlC39whiL+oNms3WyYvmXlRYXagsxlT5MxMEgcbG 04gwZmRCuBmaiLWeC3NVJEwOV9lAoRPTfC3KAP7+s9EzR3KVIunpSwlAFkNRxJRXMf QeJNNF/auixMZfG6iCdqQA8Nq+taeG2Jq/1RHgl+qR70QbruE+ylatjc/q19EPhi/q iKHmWVazlYj9dIlebQhOZOpfeZ7E2lY50ggMzDS/PxpVed+eFTGO/iTwN/SuIu6tb0 Hdwh7iCvZ3V9A== 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 1otVo9-005SPW-7g; Fri, 11 Nov 2022 15:19:05 +0000 Date: Fri, 11 Nov 2022 15:19:04 +0000 Message-ID: <86h6z5plhz.wl-maz@kernel.org> From: Marc Zyngier To: Gavin Shan Cc: Sean Christopherson , kvmarm@lists.linux.dev, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, shuah@kernel.org, catalin.marinas@arm.com, andrew.jones@linux.dev, ajones@ventanamicro.com, bgardon@google.com, dmatlack@google.com, will@kernel.org, suzuki.poulose@arm.com, alexandru.elisei@arm.com, pbonzini@redhat.com, peterx@redhat.com, oliver.upton@linux.dev, zhenyzha@redhat.com, shan.gavin@gmail.com Subject: Re: [PATCH v10 3/7] KVM: Support dirty ring in conjunction with bitmap In-Reply-To: <1cfa0286-9a42-edd9-beab-02f95fc440ad@redhat.com> References: <20221110104914.31280-1-gshan@redhat.com> <20221110104914.31280-4-gshan@redhat.com> <1cfa0286-9a42-edd9-beab-02f95fc440ad@redhat.com> 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/27.1 (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: gshan@redhat.com, seanjc@google.com, kvmarm@lists.linux.dev, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, shuah@kernel.org, catalin.marinas@arm.com, andrew.jones@linux.dev, ajones@ventanamicro.com, bgardon@google.com, dmatlack@google.com, will@kernel.org, suzuki.poulose@arm.com, alexandru.elisei@arm.com, pbonzini@redhat.com, peterx@redhat.com, oliver.upton@linux.dev, zhenyzha@redhat.com, shan.gavin@gmail.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org On Thu, 10 Nov 2022 23:47:41 +0000, Gavin Shan wrote: > > commit b05377ecbe003f12c8b79846fa3a300401dcab68 (HEAD -> kvm/arm64_dirtyring) > Author: Gavin Shan > Date: Fri Nov 11 07:13:12 2022 +0800 > > KVM: Push dirty information unconditionally to backup bitmap > In mark_page_dirty_in_slot(), we bail out when no running vcpu > exists and > a running vcpu context is strictly required by architecture. It may cause > backwards compatible issue. Currently, saving vgic/its tables is the only > case where no running vcpu context is required. We may have other unknown > cases where no running vcpu context exists and it's reported by the warning > message. For this, the application is going to enable the backup bitmap for > the unknown cases. However, the dirty information can't be pushed to the > backup bitmap even though the backup bitmap has been enabled, until the > unknown cases are added to the allowed list of non-running vcpu context > with extra code changes to the host kernel. > In order to make the new application, where the backup bitmap > has been > enabled, to work with the unchanged host, we continue to push the dirty > information to the backup bitmap instead of bailing out early. > Suggested-by: Sean Christopherson > Signed-off-by: Gavin Shan > > diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c > index 2719e10dd37d..03e6a38094c1 100644 > --- a/virt/kvm/kvm_main.c > +++ b/virt/kvm/kvm_main.c > @@ -3308,8 +3308,7 @@ void mark_page_dirty_in_slot(struct kvm *kvm, > if (WARN_ON_ONCE(vcpu && vcpu->kvm != kvm)) > return; > - if > (WARN_ON_ONCE(!kvm_arch_allow_write_without_running_vcpu(kvm) && > !vcpu)) > - return; > + WARN_ON_ONCE(!vcpu && !kvm_arch_allow_write_without_running_vcpu(kvm)); I'm happy with this. > #endif > if (memslot && kvm_slot_dirty_track_enabled(memslot)) { > @@ -3318,7 +3317,7 @@ void mark_page_dirty_in_slot(struct kvm *kvm, > if (kvm->dirty_ring_size && vcpu) > kvm_dirty_ring_push(vcpu, slot, rel_gfn); > - else > + else if (memslot->dirty_bitmap) > set_bit_le(rel_gfn, memslot->dirty_bitmap); But that I don't get. Or rather, I don't get the commit message that matches this hunk. Do we want to catch the case where all of the following are true: - we don't have a vcpu, - we're allowed to log non-vcpu dirtying - we *only* have the ring? If so, can we please capture that in the commit message? Thanks, M. -- Without deviation from the norm, progress is not possible.