From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53169) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yc7jN-0007l1-K3 for qemu-devel@nongnu.org; Sun, 29 Mar 2015 03:34:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yc7jI-0004cp-KB for qemu-devel@nongnu.org; Sun, 29 Mar 2015 03:34:01 -0400 Received: from mail-wg0-x22c.google.com ([2a00:1450:400c:c00::22c]:34632) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yc7jI-0004cj-EU for qemu-devel@nongnu.org; Sun, 29 Mar 2015 03:33:56 -0400 Received: by wgbdm7 with SMTP id dm7so33160107wgb.1 for ; Sun, 29 Mar 2015 00:33:55 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <5517AADF.4080509@redhat.com> Date: Sun, 29 Mar 2015 09:33:51 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1427391520-29497-1-git-send-email-pbonzini@redhat.com> <1427391520-29497-6-git-send-email-pbonzini@redhat.com> <20150328194809-mutt-send-email-mst@redhat.com> In-Reply-To: <20150328194809-mutt-send-email-mst@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 05/22] memory: return bitmap from memory_region_is_logging List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" Cc: qemu-devel@nongnu.org On 28/03/2015 19:54, Michael S. Tsirkin wrote: > This API is pretty easy to misuse, and return > value is completely undocumented. In fact, if I see > "is" I assume a boolean return type. > > As you are touching all users anyway, how about > wrappers that answer specific questions: > memory_region_is_logging_dirty_memory_vga > memory_region_is_logging_dirty_memory_migration > memory_region_is_logging_dirty_memory_except_migration > ? The full return value is used later in the series. I'll add a "client" argument to memory_region_is_logging (so that the compiler will catch anything I forger) and add memory_region_get_dirty_log_mask for the other users. Regarding memory_region_is_logging_dirty_memory_except_migration, it will go away once migration stops being special cased via log_global_start/log_global_stop. Paolo > As a bonus, compiler will catch you if you forget to > change some caller. > >> diff --git a/xen-hvm.c b/xen-hvm.c >> index 315864c..acd89c8 100644 >> --- a/xen-hvm.c >> +++ b/xen-hvm.c >> @@ -488,7 +488,8 @@ static void xen_set_memory(struct MemoryListener *listener, >> XenIOState *state = container_of(listener, XenIOState, memory_listener); >> hwaddr start_addr = section->offset_within_address_space; >> ram_addr_t size = int128_get64(section->size); >> - bool log_dirty = memory_region_is_logging(section->mr); >> + bool log_dirty = >> + memory_region_is_logging(section->mr) & ~(1 << DIRTY_MEMORY_MIGRATION); >> hvmmem_type_t mem_type; >> >> if (section->mr == &ram_memory) { >> -- >> 2.3.3 >> > >