From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60705) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WAkz0-00042G-ER for qemu-devel@nongnu.org; Tue, 04 Feb 2014 13:44:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WAkyv-0005tl-Ab for qemu-devel@nongnu.org; Tue, 04 Feb 2014 13:44:30 -0500 Received: from mx1.redhat.com ([209.132.183.28]:62174) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WAiLg-0002t9-JI for qemu-devel@nongnu.org; Tue, 04 Feb 2014 10:55:44 -0500 From: Juan Quintela Date: Tue, 4 Feb 2014 16:55:28 +0100 Message-Id: <1391529334-30526-3-git-send-email-quintela@redhat.com> In-Reply-To: <1391529334-30526-1-git-send-email-quintela@redhat.com> References: <1391529334-30526-1-git-send-email-quintela@redhat.com> Subject: [Qemu-devel] [PATCH 2/8] exec: fix ram_list dirty map optimization List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Alexey Kardashevskiy , peter.maydell@linaro.org, anthony@codemonkey.ws From: Alexey Kardashevskiy The ae2810c4bb3b383176e8e1b33931b16c01483aab patch introduced optimization for ram_list.dirty_memory update. However it can only work correctly if hpratio is 1 as the @bitmap parameter stores 1 bits per system page size (may vary, 4K or 64K on PPC64) and ram_list.dirty_memory stores 1 bit per TARGET_PAGE_SIZE (which is hardcoded to 4K). This fixes hpratio!=1 case to fall back to the slow path. Signed-off-by: Alexey Kardashevskiy Signed-off-by: Juan Quintela --- include/exec/ram_addr.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/exec/ram_addr.h b/include/exec/ram_addr.h index 481a447..2edfa96 100644 --- a/include/exec/ram_addr.h +++ b/include/exec/ram_addr.h @@ -93,7 +93,8 @@ static inline void cpu_physical_memory_set_dirty_lebitmap(unsigned long *bitmap, unsigned long page = BIT_WORD(start >> TARGET_PAGE_BITS); /* start address is aligned at the start of a word? */ - if (((page * BITS_PER_LONG) << TARGET_PAGE_BITS) == start) { + if ((((page * BITS_PER_LONG) << TARGET_PAGE_BITS) == start) && + (hpratio == 1)) { long k; long nr = BITS_TO_LONGS(pages); -- 1.8.5.3