From nobody Mon Apr 29 03:02:17 2024 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=temperror (zoho.com: Error in retrieving data from DNS) 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 1512144066066216.39671749229888; Fri, 1 Dec 2017 08:01:06 -0800 (PST) Received: from localhost ([::1]:58315 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eKnk9-0004G2-29 for importer@patchew.org; Fri, 01 Dec 2017 11:00:49 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44506) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eKnX4-0007cu-2K for qemu-devel@nongnu.org; Fri, 01 Dec 2017 10:47:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eKnWR-0007YX-Vh for qemu-devel@nongnu.org; Fri, 01 Dec 2017 10:47:17 -0500 Received: from ozlabs.org ([103.22.144.67]:59095) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eKnWR-0007UY-El; Fri, 01 Dec 2017 10:46:39 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3yp36p06q7z9t3v; Fri, 1 Dec 2017 16:41:37 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1512106898; bh=fEmzVlFP/Oa4ga7pk2RFJHhXjnIEIiCG4WAyV42erqc=; h=From:To:Cc:Subject:Date:From; b=An4sZUVWmwneVIYUR1IFHxL9DCbrpvi3VH4PGH1lEtJWX2CF0OKnf3ka+O8sDbulP Ul1KzIEYPFx4nw6jk2XZ3GlOIis2TlC1oTocYGE8tmsEpPRqEk3xm3XtlXu2QJIj3C CITS6h5bweeQm0ffHaM99UaiXtYg3tEUvSNIHCoI= From: David Gibson To: groug@kaod.org, lvivier@redhat.com, spopovyc@redhat.com Date: Fri, 1 Dec 2017 16:41:25 +1100 Message-Id: <20171201054125.25749-1-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.14.3 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PATCH for-2.11] spapr: Include "pre-plugged" DIMMS in ram size calculation at reset 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: 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-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_6 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" At guest reset time, we allocate a hash page table (HPT) for the guest based on the guest's RAM size. If dynamic HPT resizing is not available we use the maximum RAM size, if it is we use the current RAM size. But the "current RAM size" calculation is incorrect - we just use the "base" ram_size from the machine structure. This doesn't include any pluggable DIMMs that are already plugged at reset time. This means that if you try to start a 'pseries' machine with a DIMM specified on the command line that's much larger than the "base" RAM size, then the guest will get a woefully inadequate HPT. This can lead to a guest freeze during boot as it runs out of HPT space during initial MMU setup. Signed-off-by: David Gibson Reviewed-by: Greg Kurz Tested-by: Greg Kurz --- hw/ppc/spapr.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index a471de6cab..1ac7eb0f8c 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -1386,7 +1386,10 @@ void spapr_setup_hpt_and_vrma(sPAPRMachineState *spa= pr) && !spapr_ovec_test(spapr->ov5_cas, OV5_HPT_RESIZE))) { hpt_shift =3D spapr_hpt_shift_for_ramsize(MACHINE(spapr)->maxram_s= ize); } else { - hpt_shift =3D spapr_hpt_shift_for_ramsize(MACHINE(spapr)->ram_size= ); + uint64_t current_ram_size; + + current_ram_size =3D MACHINE(spapr)->ram_size + get_plugged_memory= _size(); + hpt_shift =3D spapr_hpt_shift_for_ramsize(current_ram_size); } spapr_reallocate_hpt(spapr, hpt_shift, &error_fatal); =20 --=20 2.14.3