From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42734) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W8qLv-0003Tu-Pv for qemu-devel@nongnu.org; Thu, 30 Jan 2014 07:04:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W8qLn-0006VT-I9 for qemu-devel@nongnu.org; Thu, 30 Jan 2014 07:04:15 -0500 Received: from e23smtp07.au.ibm.com ([202.81.31.140]:41952) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W8qLm-0006V0-O2 for qemu-devel@nongnu.org; Thu, 30 Jan 2014 07:04:07 -0500 Received: from /spool/local by e23smtp07.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 30 Jan 2014 22:03:57 +1000 Received: from d23relay03.au.ibm.com (d23relay03.au.ibm.com [9.190.235.21]) by d23dlp01.au.ibm.com (Postfix) with ESMTP id 3C0682CE8056 for ; Thu, 30 Jan 2014 23:03:55 +1100 (EST) Received: from d23av04.au.ibm.com (d23av04.au.ibm.com [9.190.235.139]) by d23relay03.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id s0UC3fqT11993346 for ; Thu, 30 Jan 2014 23:03:42 +1100 Received: from d23av04.au.ibm.com (localhost [127.0.0.1]) by d23av04.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id s0UC3sh1023610 for ; Thu, 30 Jan 2014 23:03:54 +1100 From: Alexey Kardashevskiy Date: Thu, 30 Jan 2014 23:03:50 +1100 Message-Id: <1391083430-25332-1-git-send-email-aik@ozlabs.ru> Subject: [Qemu-devel] [PATCH] 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 , Paolo Bonzini , Juan Quintela 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 --- 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 33c8acc..6e83772 100644 --- a/include/exec/ram_addr.h +++ b/include/exec/ram_addr.h @@ -92,7 +92,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.4.rc4