From nobody Tue Feb 10 01:36:00 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1605556880; cv=none; d=zohomail.com; s=zohoarc; b=BC/JzvmgPgR3mn3KvSQuxkfvnW1x+razqdpuHYNQUSQDw+vPzbqHMcPBpuxYice0DE95Of2uQkUoUp64bjo6w/RrYlPrOTUBwX94N19PfpVuygUOUOBj02fAvGtzzp7rrsBZB5PAfnFJpIZSq0RKhF4GF8SEm38kd6qszjnDxyw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605556880; 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=V0786/vOvgHEBpgfXjgeCuSnzS82fexkT8gf6hqUsYM=; b=C8YO6jPFQQQM97wXjaE7UKVb5V6df2cjM5DUxWIrvnrvkV9+31l48gcXYIlm7twzT82js9RV01fF4WM3SsXpjMMF8XaiJnHegU8/CxJtm+h/L9FnINSxifMU++lrUBed2JK8xG+Xu+purBolrN/ZPAhsqbmbouAIZhmp1+JE9tU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass 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 1605556880285219.0184314895664; Mon, 16 Nov 2020 12:01:20 -0800 (PST) Received: from localhost ([::1]:47510 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kekgh-0003pU-69 for importer@patchew.org; Mon, 16 Nov 2020 15:01:19 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59882) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1keke9-000216-1p for qemu-devel@nongnu.org; Mon, 16 Nov 2020 14:58:41 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:47461) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1keke5-0002CU-Qe for qemu-devel@nongnu.org; Mon, 16 Nov 2020 14:58:40 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-384-5AcyXsCIOgKZI7S3YS3tkA-1; Mon, 16 Nov 2020 14:58:33 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B32A41074653; Mon, 16 Nov 2020 19:58:32 +0000 (UTC) Received: from virtlab511.virt.lab.eng.bos.redhat.com (virtlab511.virt.lab.eng.bos.redhat.com [10.19.152.198]) by smtp.corp.redhat.com (Postfix) with ESMTP id 35F8F19D6C; Mon, 16 Nov 2020 19:58:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605556717; 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=V0786/vOvgHEBpgfXjgeCuSnzS82fexkT8gf6hqUsYM=; b=D8h76p9+WiajcjU4wJiQUidb58+kXGgNGRHCmmNGI9VNyz6Y3maMuAeQvkA7Ko2y5BZPjQ pZKa8gUT4398NPXxfgO9d2u8GFCuQOH29fpUTMYl73DJNvn0lOy0VKI8tZYW14oV0zL5dW fRNH4UqOSYt/JQtvO7D5ZirFbLUuh18= X-MC-Unique: 5AcyXsCIOgKZI7S3YS3tkA-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 5/5] memory: Skip dirty tracking for un-migratable memory regions Date: Mon, 16 Nov 2020 14:58:15 -0500 Message-Id: <20201116195815.48264-6-pbonzini@redhat.com> In-Reply-To: <20201116195815.48264-1-pbonzini@redhat.com> References: <20201116195815.48264-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=pbonzini@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=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/16 04:46:27 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=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: Zenghui Yu , Cornelia Huck Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Zenghui Yu It makes no sense to track dirty pages for those un-migratable memory regions (e.g., Memory BAR region of the VFIO PCI device) and doing so will potentially lead to some unpleasant issues during migration [1]. Skip dirty tracking for those regions by evaluating if the region is migratable before setting dirty_log_mask (DIRTY_MEMORY_MIGRATION). [1] https://lists.gnu.org/archive/html/qemu-devel/2020-11/msg03757.html Signed-off-by: Zenghui Yu Message-Id: <20201116132210.1730-1-yuzenghui@huawei.com> Reviewed-by: Cornelia Huck Signed-off-by: Paolo Bonzini --- softmmu/memory.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/softmmu/memory.c b/softmmu/memory.c index 71951fe4dc..aa393f1bb0 100644 --- a/softmmu/memory.c +++ b/softmmu/memory.c @@ -1806,7 +1806,10 @@ bool memory_region_is_ram_device(MemoryRegion *mr) uint8_t memory_region_get_dirty_log_mask(MemoryRegion *mr) { uint8_t mask =3D mr->dirty_log_mask; - if (global_dirty_log && (mr->ram_block || memory_region_is_iommu(mr)))= { + RAMBlock *rb =3D mr->ram_block; + + if (global_dirty_log && ((rb && qemu_ram_is_migratable(rb)) || + memory_region_is_iommu(mr))) { mask |=3D (1 << DIRTY_MEMORY_MIGRATION); } return mask; --=20 2.26.2