From patchwork Wed Dec 6 12:00:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Borntraeger X-Patchwork-Id: 845160 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=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3ysHJ22gTqz9sPk for ; Wed, 6 Dec 2017 23:00:49 +1100 (AEDT) Received: from localhost ([::1]:55100 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eMYNV-0003U2-QS for incoming@patchwork.ozlabs.org; Wed, 06 Dec 2017 07:00:41 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54045) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eMYNA-0003Tf-MI for qemu-devel@nongnu.org; Wed, 06 Dec 2017 07:00:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eMYN0-0002bv-TK for qemu-devel@nongnu.org; Wed, 06 Dec 2017 07:00:20 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:58902 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eMYN0-0002a1-Nn for qemu-devel@nongnu.org; Wed, 06 Dec 2017 07:00:10 -0500 Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id vB6BxFR8004167 for ; Wed, 6 Dec 2017 07:00:08 -0500 Received: from e06smtp14.uk.ibm.com (e06smtp14.uk.ibm.com [195.75.94.110]) by mx0b-001b2d01.pphosted.com with ESMTP id 2epdk6860x-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Wed, 06 Dec 2017 07:00:07 -0500 Received: from localhost by e06smtp14.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 6 Dec 2017 12:00:05 -0000 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp14.uk.ibm.com (192.168.101.144) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 6 Dec 2017 12:00:02 -0000 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id vB6C01qH49283116; Wed, 6 Dec 2017 12:00:01 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A6DFAAE053; Wed, 6 Dec 2017 11:52:58 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9ED9CAE045; Wed, 6 Dec 2017 11:52:58 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Wed, 6 Dec 2017 11:52:58 +0000 (GMT) Received: by tuxmaker.boeblingen.de.ibm.com (Postfix, from userid 25651) id 076E320F649; Wed, 6 Dec 2017 13:00:01 +0100 (CET) From: Christian Borntraeger To: Cornelia Huck Date: Wed, 6 Dec 2017 13:00:00 +0100 X-Mailer: git-send-email 2.9.4 X-TM-AS-GCONF: 00 x-cbid: 17120612-0016-0000-0000-00000509E54D X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17120612-0017-0000-0000-00002845E368 Message-Id: <20171206120000.63822-1-borntraeger@de.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-12-06_05:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=2 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1712060175 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.158.5 Subject: [Qemu-devel] [PATCH/RFC] s390x: split memory into 4TB chunks 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: Alexander Graf , Thomas Huth , David Hildenbrand , Halil Pasic , qemu-devel , Christian Borntraeger , qemu-s390x , Richard Henderson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" KVM does not allow memory regions > KVM_MEM_MAX_NR_PAGES, basically limiting the memory per slot to 7.999TB. Lets split the base memory into 4TB chunks to allow go beyond 8TB for a guest. With that (and optimistic overcommitment in the kernel) I was able to start a 59TB guest on a 1TB system. Signed-off-by: Christian Borntraeger --- hw/s390x/s390-virtio-ccw.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c index 8425534..6735bbb 100644 --- a/hw/s390x/s390-virtio-ccw.c +++ b/hw/s390x/s390-virtio-ccw.c @@ -157,11 +157,25 @@ static void virtio_ccw_register_hcalls(void) static void s390_memory_init(ram_addr_t mem_size) { MemoryRegion *sysmem = get_system_memory(); - MemoryRegion *ram = g_new(MemoryRegion, 1); + ram_addr_t chunk, offset; + gchar *name; /* allocate RAM for core */ - memory_region_allocate_system_memory(ram, NULL, "s390.ram", mem_size); - memory_region_add_subregion(sysmem, 0, ram); + offset = 0; + while (mem_size) { + MemoryRegion *ram = g_new(MemoryRegion, 1); + chunk = mem_size; + /* KVM does not allow memslots >= 8 TB. Lets split into 4TB chunks */ + if (chunk > 4UL * 1024 * 1024 * 1024 * 1024) { + chunk = 4UL * 1024 * 1024 * 1024 * 1024; + } + name = g_strdup_printf("s390.ram[0x%lx]", offset); + memory_region_allocate_system_memory(ram, NULL, name, chunk); + memory_region_add_subregion(sysmem, offset, ram); + mem_size -= chunk; + offset += chunk; + g_free(name); + } /* Initialize storage key device */ s390_skeys_init();