From patchwork Thu Sep 15 21:16:49 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Walle X-Patchwork-Id: 114837 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 3A3A0B70BD for ; Fri, 16 Sep 2011 07:17:06 +1000 (EST) Received: from localhost ([::1]:54244 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R4JIt-0004iJ-GJ for incoming@patchwork.ozlabs.org; Thu, 15 Sep 2011 17:17:03 -0400 Received: from eggs.gnu.org ([140.186.70.92]:41945) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R4JIo-0004i8-8h for qemu-devel@nongnu.org; Thu, 15 Sep 2011 17:16:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R4JIn-0007dM-27 for qemu-devel@nongnu.org; Thu, 15 Sep 2011 17:16:58 -0400 Received: from mail.serverraum.org ([78.47.150.89]:35613) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R4JIm-0007cg-Tn for qemu-devel@nongnu.org; Thu, 15 Sep 2011 17:16:57 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.serverraum.org (Postfix) with ESMTP id 061353EF44; Thu, 15 Sep 2011 23:22:06 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at mail.serverraum.org Received: from mail.serverraum.org ([127.0.0.1]) by localhost (web.serverraum.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id fxnYfoDdUNsu; Thu, 15 Sep 2011 23:22:05 +0200 (CEST) Received: from thanatos.fritz.box (95-89-251-205-dynip.superkabel.de [95.89.251.205]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.serverraum.org (Postfix) with ESMTPSA id C0F833EF1D; Thu, 15 Sep 2011 23:22:05 +0200 (CEST) From: Michael Walle To: qemu-devel@nongnu.org Date: Thu, 15 Sep 2011 23:16:49 +0200 Message-Id: <1316121409-9086-1-git-send-email-michael@walle.cc> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <4E65D0BD.4010700@redhat.com> References: <4E65D0BD.4010700@redhat.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 78.47.150.89 Cc: Michael Walle , Avi Kivity Subject: [Qemu-devel] [PATCH] memory: fix subregion collision warning X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Instead of the offset property use the proper addr property to calculate the offsets. Additionally, be a little more verbose on the warning and print the subregion name. Signed-off-by: Michael Walle --- memory.c | 13 ++++++++----- 1 files changed, 8 insertions(+), 5 deletions(-) diff --git a/memory.c b/memory.c index 101b67c..ba74435 100644 --- a/memory.c +++ b/memory.c @@ -1190,16 +1190,19 @@ static void memory_region_add_subregion_common(MemoryRegion *mr, if (subregion->may_overlap || other->may_overlap) { continue; } - if (offset >= other->offset + other->size - || offset + subregion->size <= other->offset) { + if (offset >= other->addr + other->size + || offset + subregion->size <= other->addr) { continue; } #if 0 - printf("warning: subregion collision %llx/%llx vs %llx/%llx\n", + printf("warning: subregion collision %llx/%llx (%s) " + "vs %llx/%llx (%s)\n", (unsigned long long)offset, (unsigned long long)subregion->size, - (unsigned long long)other->offset, - (unsigned long long)other->size); + subregion->name, + (unsigned long long)other->addr, + (unsigned long long)other->size, + other->name); #endif } QTAILQ_FOREACH(other, &mr->subregions, subregions_link) {