From patchwork Tue Jul 10 01:52:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Gibson X-Patchwork-Id: 10516055 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 60A5B604D4 for ; Tue, 10 Jul 2018 01:54:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4DA3428CF5 for ; Tue, 10 Jul 2018 01:54:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3EE0728CF8; Tue, 10 Jul 2018 01:54:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id DDE2C28CF5 for ; Tue, 10 Jul 2018 01:54:10 +0000 (UTC) Received: from localhost ([::1]:45327 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fchr0-0008P4-0D for patchwork-qemu-devel@patchwork.kernel.org; Mon, 09 Jul 2018 21:54:10 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53208) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fchpy-0007fl-Qo for qemu-devel@nongnu.org; Mon, 09 Jul 2018 21:53:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fchpv-0007Mj-Pc for qemu-devel@nongnu.org; Mon, 09 Jul 2018 21:53:06 -0400 Received: from ozlabs.org ([203.11.71.1]:52671) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fchpv-0007M7-DL; Mon, 09 Jul 2018 21:53:03 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 41Plb05vpmz9s1R; Tue, 10 Jul 2018 11:53:00 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1531187580; bh=CzDIru3fTMMBp2YXxOpUuHz87/YuzznoI2FWbrxgiu4=; h=From:To:Cc:Subject:Date:From; b=RH28tJ+e2p1UZZZcQ6WkjIxhJ6NnKf2XBBWWTQT4vuumTPfmfZo9qML/8xlVUMaj0 kHkhwt1rISs1o1ggBqQLSxpStE7EleVAQcon7ypeHkhZRIXktFsREL8EQ2cI3XkpSs GyjDynKee8SEaMRNh+H5XNcQXYOjMJCAA1JjmZv8= From: David Gibson To: imammedo@redhat.com Date: Tue, 10 Jul 2018 11:52:57 +1000 Message-Id: <20180710015257.12083-1-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.17.1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 203.11.71.1 Subject: [Qemu-devel] [PATCH] spapr: Correct inverted test in spapr_pc_dimm_node() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Gibson , qemu-ppc@nongnu.org, ehabkost@redhat.com, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP This function was introduced between v2.11 and v2.12 to replace obsolete ways of specifying the NUMA nodes for DIMMs. It's used to find the correct node for an LMB, by locating which DIMM object it lies within. Unfortunately, one of the checks is inverted, so we check whether the address is less than two different things, rather than actually checking a range. This introduced a regression, meaning that after a reboot qemu will advertise incorrect node information for memory to the guest. Signed-off-by: David Gibson Reviewed-by: Greg Kurz Reviewed-by: Igor Mammedov --- hw/ppc/spapr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 3f5e1d3ec2..421b2dd09b 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -665,7 +665,7 @@ static uint32_t spapr_pc_dimm_node(MemoryDeviceInfoList *list, ram_addr_t addr) if (value && value->type == MEMORY_DEVICE_INFO_KIND_DIMM) { PCDIMMDeviceInfo *pcdimm_info = value->u.dimm.data; - if (pcdimm_info->addr >= addr && + if (addr >= pcdimm_info->addr && addr < (pcdimm_info->addr + pcdimm_info->size)) { return pcdimm_info->node; }