From patchwork Thu Jun 2 14:07:37 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bharata B Rao X-Patchwork-Id: 9150033 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 309F260751 for ; Thu, 2 Jun 2016 14:09:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 202D920120 for ; Thu, 2 Jun 2016 14:09:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1273428294; Thu, 2 Jun 2016 14:09:07 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI 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 837E820120 for ; Thu, 2 Jun 2016 14:09:06 +0000 (UTC) Received: from localhost ([::1]:47372 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b8TJ3-0001A1-Ik for patchwork-qemu-devel@patchwork.kernel.org; Thu, 02 Jun 2016 10:09:05 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39213) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b8TIf-00018B-8o for qemu-devel@nongnu.org; Thu, 02 Jun 2016 10:08:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b8TIb-0004Bi-NT for qemu-devel@nongnu.org; Thu, 02 Jun 2016 10:08:41 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:14134) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b8TIb-0004Ae-DI for qemu-devel@nongnu.org; Thu, 02 Jun 2016 10:08:37 -0400 Received: from pps.filterd (m0082756.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.11/8.16.0.11) with SMTP id u52E6A8S038604 for ; Thu, 2 Jun 2016 10:08:34 -0400 Received: from e23smtp09.au.ibm.com (e23smtp09.au.ibm.com [202.81.31.142]) by mx0a-001b2d01.pphosted.com with ESMTP id 23ag2mb9up-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 02 Jun 2016 10:08:34 -0400 Received: from localhost by e23smtp09.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 3 Jun 2016 00:08:32 +1000 Received: from d23dlp03.au.ibm.com (202.81.31.214) by e23smtp09.au.ibm.com (202.81.31.206) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 3 Jun 2016 00:08:30 +1000 X-IBM-Helo: d23dlp03.au.ibm.com X-IBM-MailFrom: bharata@linux.vnet.ibm.com X-IBM-RcptTo: qemu-devel@nongnu.org;qemu-ppc@nongnu.org Received: from d23relay08.au.ibm.com (d23relay08.au.ibm.com [9.185.71.33]) by d23dlp03.au.ibm.com (Postfix) with ESMTP id 383AD357805D; Fri, 3 Jun 2016 00:08:30 +1000 (EST) Received: from d23av06.au.ibm.com (d23av06.au.ibm.com [9.190.235.151]) by d23relay08.au.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u52E8Gld11206916; Fri, 3 Jun 2016 00:08:16 +1000 Received: from d23av06.au.ibm.com (localhost [127.0.0.1]) by d23av06.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id u52E80Up026631; Fri, 3 Jun 2016 00:08:01 +1000 Received: from in.ibm.com ([9.124.221.106]) by d23av06.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id u52E7bxe026191 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA256 bits=256 verify=NO); Fri, 3 Jun 2016 00:07:58 +1000 Date: Thu, 2 Jun 2016 19:37:37 +0530 From: Bharata B Rao To: Thomas Huth References: <201606010952.u519n6ri025307@mx0a-001b2d01.pphosted.com> <574EB66E.1040805@redhat.com> <20160602004222.GE15455@voom.fritz.box> <201606020440.u524ZiVe027809@mx0a-001b2d01.pphosted.com> <574FDA33.3040001@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <574FDA33.3040001@redhat.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16060214-0052-0000-0000-0000019C7370 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16060214-0053-0000-0000-0000061CD845 Message-Id: <20160602140737.GB18628@in.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-06-02_05:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1604210000 definitions=main-1606020165 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 148.163.156.1 Subject: Re: [Qemu-devel] [RFC PATCH v0 0/2] Increase max memslots to 512 for PowerPC 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: , Reply-To: bharata@linux.vnet.ibm.com Cc: imammedo@redhat.com, pbonzini@redhat.com, qemu-ppc@nongnu.org, qemu-devel@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP On Thu, Jun 02, 2016 at 09:03:15AM +0200, Thomas Huth wrote: > On 02.06.2016 06:39, Bharata B Rao wrote: > ... > > Agreed. Here is the updated patch: > > > > spapr: Increase hotpluggable memory slots to 256 > > > > From: Bharata B Rao > > > > KVM now supports 512 memslots on PowerPC (earlier it was 32). Allow half > > of it (256) to be used as hotpluggable memory slots. > > > > Instead of hard coding the max value, use the KVM supplied value if KVM > > is enabled. Otherwise resort to the default value of 32. > > > > Signed-off-by: Bharata B Rao > > --- > > hw/ppc/spapr.c | 15 +++++++++++++-- > > 1 file changed, 13 insertions(+), 2 deletions(-) > > > > diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c > > index 44e401a..c82adef 100644 > > --- a/hw/ppc/spapr.c > > +++ b/hw/ppc/spapr.c > > @@ -1816,11 +1816,22 @@ static void ppc_spapr_init(MachineState *machine) > > /* initialize hotplug memory address space */ > > if (machine->ram_size < machine->maxram_size) { > > ram_addr_t hotplug_mem_size = machine->maxram_size - machine->ram_size; > > + /* > > + * Number of memslots supported by KVM on PowerPC was increased > > + * from 32 to 512. Let us limit the number of hotpluggable slots > > + * to half of that (256). However ensure that number of slots > > + * doesn't drop below 32 on older hosts. > > + */ > > Using "hard-coded" information like "increased to 512" in comments is > true for the current state, but this has a risk of being out of date > soon. Once we change the memslots in the kernel, this comment is not > true anymore and might cause confusion. Better talk about leaving half > of the kernel memslots for PCI and other devices, or so. Just want to note that even though we are limiting hotpluggable memory slots to half of max, it is always possible for other devices to eat into the memory hotplug slots, right ? David - here is the patch updated with comments as suggested by Thomas. If you need a separate post, let me know. spapr: Increase hotpluggable memory slots to 256 From: Bharata B Rao KVM now supports 512 memslots on PowerPC (earlier it was 32). Allow half of it (256) to be used as hotpluggable memory slots. Instead of hard coding the max value, use the KVM supplied value if KVM is enabled. Otherwise resort to the default value of 32. Signed-off-by: Bharata B Rao Reviewed-by: Thomas Huth --- hw/ppc/spapr.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 44e401a..14cc6ae 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -1816,11 +1816,21 @@ static void ppc_spapr_init(MachineState *machine) /* initialize hotplug memory address space */ if (machine->ram_size < machine->maxram_size) { ram_addr_t hotplug_mem_size = machine->maxram_size - machine->ram_size; + /* + * Limit the number of hotpluggable memory slots to half the number + * slots that KVM supports, leaving the other half for PCI and other + * devices. However ensure that number of slots doesn't drop below 32. + */ + int max_memslots = kvm_enabled() ? kvm_get_max_memslots() / 2 : + SPAPR_MAX_RAM_SLOTS; - if (machine->ram_slots > SPAPR_MAX_RAM_SLOTS) { + if (max_memslots < SPAPR_MAX_RAM_SLOTS) { + max_memslots = SPAPR_MAX_RAM_SLOTS; + } + if (machine->ram_slots > max_memslots) { error_report("Specified number of memory slots %" PRIu64" exceeds max supported %d", - machine->ram_slots, SPAPR_MAX_RAM_SLOTS); + machine->ram_slots, max_memslots); exit(1); }