From nobody Mon Dec 15 02:54:45 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1615408883; cv=none; d=zohomail.com; s=zohoarc; b=l3aPXB2DX1aFNjdWmlMnt5pNdjpw0crVI4bNvPsz/huwynXYoQRDFlU/Owrc6Efk0z3CSUBzNRB+9Yn8e5WL1a95P/n1HvO0M8oZyHAQ2EGPzTyGIDTSD9X0yod8km/N1ZMjolKrXDH7QYu6KDefjQdYrZ4sukV97FPR7q+6+kw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615408883; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=rc8/S0CxImyM7JcvYL6r6zrwC2hxrA9qeeZBCUuAeK0=; b=MEfztQj4RkR4hyeKYyLaV4eLDWsOZ6e3aLqfa0owqApGeyUdDyE75K/1HiTN5+JzXsEG0e693sFaebQVLKrT1LP4nBGNPTcppv4kjcgEcMNQLKRTLo5f7b2CaFwy38BY1d+iIrz/bTEiIlE1eYF0RHeEFXJSH0NnFfKCiwswY4s= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 161540888355957.82678971498899; Wed, 10 Mar 2021 12:41:23 -0800 (PST) Received: from localhost ([::1]:53678 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lK5dy-0005cR-Am for importer@patchew.org; Wed, 10 Mar 2021 15:41:22 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:36242) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lK5WD-00060g-Dn for qemu-devel@nongnu.org; Wed, 10 Mar 2021 15:33:21 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:49138) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lK5W6-0000eI-9J for qemu-devel@nongnu.org; Wed, 10 Mar 2021 15:33:21 -0500 Received: from mail-qv1-f71.google.com (mail-qv1-f71.google.com [209.85.219.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-250-Tk0WQsF2OeyBc0haIW7OeA-1; Wed, 10 Mar 2021 15:33:11 -0500 Received: by mail-qv1-f71.google.com with SMTP id j3so13625069qvo.1 for ; Wed, 10 Mar 2021 12:33:11 -0800 (PST) Received: from xz-x1.redhat.com ([142.126.89.138]) by smtp.gmail.com with ESMTPSA id z89sm306746qtd.5.2021.03.10.12.33.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Mar 2021 12:33:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615408393; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rc8/S0CxImyM7JcvYL6r6zrwC2hxrA9qeeZBCUuAeK0=; b=Zx+jALfn/YL0Qa0pZbd/qFg0cF5WHLeFKBOXTOPQoBpqrmecV/CVKhTIZqMrJw9TrPQF7t M85w9+WUWdY0/4PYWqtJObB5byA00UY7fEmYAP+da8tsohIXOMISNesU49uaaMcI8MBB2V ucHP/SXAcnDU7Ejyam5qWTDDPNixwV8= X-MC-Unique: Tk0WQsF2OeyBc0haIW7OeA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=rc8/S0CxImyM7JcvYL6r6zrwC2hxrA9qeeZBCUuAeK0=; b=DyXR57PUmM5QvpVbpT8ZQOUH8YyZP7S3rOtiCc7PtGgwShdeouVhi2l3kCeBQPzbrB 6frK1APxpyMRqz/QqbWwO6HqavAbjQ3eEbAUtm00WilaFxcB9227QJuSp6JlVuQNiviE kk2wLla46nq2zQlAiTYIkjX6NOM55HzFm5nkY+QTaUQxBwVWjCVk8ADSgl1Y5hCcs2wB pqqyszExY57hK3KZUEOG9NvkMPCNVrzMhrV+annHrsUbKpCbmIb6TLEmHVcE0Y+5cAvh Xb8kN9ZBDzF1/I5meevhm2FEI5V6rHV0DDvPMktQrU53Z07eC8f3OdlBOM3Kf0qlQMJ8 zuHA== X-Gm-Message-State: AOAM531PhqoHmH4UDMpHpyAyNhLO6AzlLLzEOhxhjUzf30wCUABkVTJi x/0zAsyaJsjYzuSYXXJ3PNK4Zn4ICkQ6VyfXTpBzwwbrs1x/wt39yOVpfg0haw/7dOQWF69juHi ntAJh6Tz11Xpcpr2/R9ueIj5JPKQ/23l47tIl0gLkCfqRUe2kzpOun1qELgDVv8NU X-Received: by 2002:ac8:4783:: with SMTP id k3mr4531830qtq.231.1615408390378; Wed, 10 Mar 2021 12:33:10 -0800 (PST) X-Google-Smtp-Source: ABdhPJzr/jt3kfH0jZgvaUpSMwGBYeTAg+qb+Rgwme0L2RMp5KkPViMfDBu8b571u34SvFsUiC/sUA== X-Received: by 2002:ac8:4783:: with SMTP id k3mr4531802qtq.231.1615408390050; Wed, 10 Mar 2021 12:33:10 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Subject: [PATCH v5 06/10] KVM: Simplify dirty log sync in kvm_set_phys_mem Date: Wed, 10 Mar 2021 15:32:57 -0500 Message-Id: <20210310203301.194842-7-peterx@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210310203301.194842-1-peterx@redhat.com> References: <20210310203301.194842-1-peterx@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=peterx@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=63.128.21.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.243, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Hyman , "Dr . David Alan Gilbert" , peterx@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" kvm_physical_sync_dirty_bitmap() on the whole section is inaccurate, because the section can be a superset of the memslot that we're working on. The re= sult is that if the section covers multiple kvm memslots, we could be doing the synchronization for multiple times for each kvmslot in the section. With the two helpers that we just introduced, it's very easy to do it right= now by calling the helpers. Signed-off-by: Peter Xu --- accel/kvm/kvm-all.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c index 65dc00b0a61..20f852a990b 100644 --- a/accel/kvm/kvm-all.c +++ b/accel/kvm/kvm-all.c @@ -1170,7 +1170,8 @@ static void kvm_set_phys_mem(KVMMemoryListener *kml, goto out; } if (mem->flags & KVM_MEM_LOG_DIRTY_PAGES) { - kvm_physical_sync_dirty_bitmap(kml, section); + kvm_slot_get_dirty_log(kvm_state, mem); + kvm_slot_sync_dirty_pages(mem); } =20 /* unregister the slot */ --=20 2.26.2