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 X-Spam-Level: X-Spam-Status: No, score=-8.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7F75DC55ABD for ; Mon, 16 Nov 2020 08:18:00 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D78C222240 for ; Mon, 16 Nov 2020 08:17:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D78C222240 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:37482 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1keZi2-0001S5-Lm for qemu-devel@archiver.kernel.org; Mon, 16 Nov 2020 03:17:58 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54208) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1keZhA-0000fh-QT; Mon, 16 Nov 2020 03:17:04 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:2524) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1keZh8-0005j1-96; Mon, 16 Nov 2020 03:17:04 -0500 Received: from DGGEMS411-HUB.china.huawei.com (unknown [172.30.72.60]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4CZMNn14dWzhb6w; Mon, 16 Nov 2020 16:16:41 +0800 (CST) Received: from [10.174.185.179] (10.174.185.179) by DGGEMS411-HUB.china.huawei.com (10.3.19.211) with Microsoft SMTP Server id 14.3.487.0; Mon, 16 Nov 2020 16:16:45 +0800 Subject: Re: [RFC] vfio-pci/migration: Dirty logging of the Memory BAR region? To: Paolo Bonzini , , References: <2825e816-9ade-07f9-19e3-ccfd57ffb568@redhat.com> From: Zenghui Yu Message-ID: <8f19cf24-8844-fa9b-a462-a55cf718002e@huawei.com> Date: Mon, 16 Nov 2020 16:16:45 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 MIME-Version: 1.0 In-Reply-To: <2825e816-9ade-07f9-19e3-ccfd57ffb568@redhat.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.185.179] X-CFilter-Loop: Reflected Received-SPF: pass client-ip=45.249.212.191; envelope-from=yuzenghui@huawei.com; helo=szxga05-in.huawei.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/16 03:16:54 X-ACL-Warn: Detected OS = Linux 3.1-3.10 [fuzzy] X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, NICE_REPLY_A=-0.001, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H2=-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: wanghaibin.wang@huawei.com, Alex Williamson , Cornelia Huck , Kirti Wankhede , kvmarm@lists.cs.columbia.edu Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" On 2020/11/15 23:03, Paolo Bonzini wrote: > On 15/11/20 15:31, Zenghui Yu wrote: >> diff --git a/softmmu/memory.c b/softmmu/memory.c >> index 71951fe4dc..0958db1a08 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 = mr->dirty_log_mask; >> - if (global_dirty_log && (mr->ram_block || >> memory_region_is_iommu(mr))) { >> + RAMBlock *rb = mr->ram_block; >> + >> + if (global_dirty_log && ((rb && qemu_ram_is_migratable(rb)) || >> + memory_region_is_iommu(mr))) { >> mask |= (1 << DIRTY_MEMORY_MIGRATION); >> } >> return mask; > > Yes, this makes sense. Please send it as a patch, thanks! Sure, I'm going to write a commit message for it. Thanks for your review. Zenghui