From nobody Sat May 4 11:28:14 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1490009124670811.0775407136547; Mon, 20 Mar 2017 04:25:24 -0700 (PDT) Received: from localhost ([::1]:60407 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cpvRD-0007JL-9X for importer@patchew.org; Mon, 20 Mar 2017 07:25:23 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46594) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cpvQR-0007IB-NT for qemu-devel@nongnu.org; Mon, 20 Mar 2017 07:24:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cpvQN-00020t-Oh for qemu-devel@nongnu.org; Mon, 20 Mar 2017 07:24:35 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54322) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cpvQN-00020W-JZ; Mon, 20 Mar 2017 07:24:31 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DFF9B15D9; Mon, 20 Mar 2017 11:24:30 +0000 (UTC) Received: from thinkpad.redhat.com (ovpn-116-101.ams2.redhat.com [10.36.116.101]) by smtp.corp.redhat.com (Postfix) with ESMTP id 05D1219C87; Mon, 20 Mar 2017 11:24:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com DFF9B15D9 Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=lvivier@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com DFF9B15D9 From: Laurent Vivier To: Eduardo Habkost Date: Mon, 20 Mar 2017 12:24:26 +0100 Message-Id: <20170320112426.4030-1-lvivier@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Mon, 20 Mar 2017 11:24:31 +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 Subject: [Qemu-devel] [PATCH] numa, spapr: align default numa node memory size to 256MB 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: Laurent Vivier , Thomas Huth , qemu-ppc@nongnu.org, qemu-devel@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Since commit 224245b ("spapr: Add LMB DR connectors"), NUMA node memory size must be aligned to 256MB (SPAPR_MEMORY_BLOCK_SIZE). But when "-numa" option is provided without "mem" parameter, the memory is equally divided between nodes, but 8MB aligned. This can be not valid for pseries. In that case we can have: $ ./ppc64-softmmu/qemu-system-ppc64 -m 4G -numa node -numa node -numa node qemu-system-ppc64: Node 0 memory size 0x55000000 is not aligned to 256 MiB With this patch, we have: (qemu) info numa 3 nodes node 0 cpus: 0 node 0 size: 1280 MB node 1 cpus: node 1 size: 1280 MB node 2 cpus: node 2 size: 1536 MB Signed-off-by: Laurent Vivier --- dtc | 2 +- numa.c | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/dtc b/dtc index 558cd81..fa8bc7f 160000 --- a/dtc +++ b/dtc @@ -1 +1 @@ -Subproject commit 558cd81bdd432769b59bff01240c44f82cfb1a9d +Subproject commit fa8bc7f928ac25f23532afc8beb2073efc8fb063 diff --git a/numa.c b/numa.c index e01cb54..a911284 100644 --- a/numa.c +++ b/numa.c @@ -337,15 +337,19 @@ void parse_numa_opts(MachineClass *mc) } if (i =3D=3D nb_numa_nodes) { uint64_t usedmem =3D 0; - - /* On Linux, each node's border has to be 8MB aligned, - * the final node gets the rest. - */ +#if defined(TARGET_PPC64) + /* pseries requests each node's border has to be 256 MB aligne= d */ + const uint64_t numa_mem_align_mask =3D ~((1 << 28UL) - 1); +#else + /* On Linux, each node's border has to be 8MB aligned */ + const uint64_t numa_mem_align_mask =3D ~((1 << 23UL) - 1); +#endif for (i =3D 0; i < nb_numa_nodes - 1; i++) { numa_info[i].node_mem =3D (ram_size / nb_numa_nodes) & - ~((1 << 23UL) - 1); + numa_mem_align_mask; usedmem +=3D numa_info[i].node_mem; } + /* the final node gets the rest. */ numa_info[i].node_mem =3D ram_size - usedmem; } =20 --=20 2.9.3