From patchwork Tue Oct 15 21:37:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 1177442 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com 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 ozlabs.org (Postfix) with ESMTPS id 46t8CF42lzz9sPF for ; Wed, 16 Oct 2019 08:46:49 +1100 (AEDT) Received: from localhost ([::1]:60086 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iKUeV-0007lB-18 for incoming@patchwork.ozlabs.org; Tue, 15 Oct 2019 17:46:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60052) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iKUWo-0006Oh-Pl for qemu-devel@nongnu.org; Tue, 15 Oct 2019 17:38:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iKUWn-0006to-Ax for qemu-devel@nongnu.org; Tue, 15 Oct 2019 17:38:50 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49900) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iKUWn-0006tL-5R for qemu-devel@nongnu.org; Tue, 15 Oct 2019 17:38:49 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 298D982DA; Tue, 15 Oct 2019 21:38:47 +0000 (UTC) Received: from localhost (ovpn-116-20.phx2.redhat.com [10.3.116.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3797F5C231; Tue, 15 Oct 2019 21:38:44 +0000 (UTC) From: Eduardo Habkost To: Paolo Bonzini , Marcel Apfelbaum , Peter Maydell , Igor Mammedov , Richard Henderson , qemu-devel@nongnu.org Subject: [PULL 13/18] memory-device: break the loop if tmp exceed the hinted range Date: Tue, 15 Oct 2019 18:37:40 -0300 Message-Id: <20191015213745.22174-14-ehabkost@redhat.com> In-Reply-To: <20191015213745.22174-1-ehabkost@redhat.com> References: <20191015213745.22174-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Tue, 15 Oct 2019 21:38:47 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 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: Wei Yang , David Hildenbrand Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Wei Yang The memory-device list built by memory_device_build_list is ordered by its address, this means if the tmp range exceed the hinted range, all the following range will not overlap with it. And this won't change default pc-dimm mapping and address assignment stay the same as before this change. Signed-off-by: Wei Yang Message-Id: <20190730003740.20694-3-richardw.yang@linux.intel.com> Reviewed-by: David Hildenbrand Reviewed-by: Igor Mammedov Signed-off-by: Eduardo Habkost --- hw/mem/memory-device.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/mem/memory-device.c b/hw/mem/memory-device.c index 5029890e06..aef148c1d7 100644 --- a/hw/mem/memory-device.c +++ b/hw/mem/memory-device.c @@ -179,6 +179,8 @@ static uint64_t memory_device_get_free_addr(MachineState *ms, range_make_empty(&new); break; } + } else if (range_lob(&tmp) > range_upb(&new)) { + break; } }