From patchwork Wed Jan 31 02:49:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ani Sinha X-Patchwork-Id: 1893194 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=OX9PbEge; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TPmjx0q2hz23g7 for ; Wed, 31 Jan 2024 13:50:27 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rV0fK-0005Iz-By; Tue, 30 Jan 2024 21:49:30 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rV0fJ-0005Io-KZ for qemu-devel@nongnu.org; Tue, 30 Jan 2024 21:49:29 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rV0fH-0001dT-UL for qemu-devel@nongnu.org; Tue, 30 Jan 2024 21:49:29 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1706669367; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=N0AJ102jtErZTJA9mx62jPE91IUOMdlW43jTKvY76KU=; b=OX9PbEgeBP7Mh1dEYbyhnEN4DxIY3AjHYxJg07Azg8i4XRlYbqeW+MViKmetNY3Gjk6uqu ZwL4UvKj/t4obR9nCeAmK8yKLcCzmDvPeMlO8bRGsHI+LuEX7HUJPcgCYyVy9cWREFTE8H AkFNjhy1EoDox8aAcYMhP+iWm+vtfNI= Received: from mail-oi1-f197.google.com (mail-oi1-f197.google.com [209.85.167.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-250-EjagI91lOoSCF2N8Op4KPw-1; Tue, 30 Jan 2024 21:49:24 -0500 X-MC-Unique: EjagI91lOoSCF2N8Op4KPw-1 Received: by mail-oi1-f197.google.com with SMTP id 5614622812f47-3bdf776ae4cso5578022b6e.1 for ; Tue, 30 Jan 2024 18:49:24 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706669364; x=1707274164; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=N0AJ102jtErZTJA9mx62jPE91IUOMdlW43jTKvY76KU=; b=dfVOWjaLyNByjhr28RqfjV6ylzr4KaGZ/Fl9ggsEzevVF/qbvw9HQovlIcXNwKf02v wjjcBZk3ZL0Yhjqobotew4f022ph1prYJa+h67vDJGHtSd9Kc2xgFnTOZmfj+TgpqSBQ fWSeTB1YIjQ7hYEuZahUpyA86Z4d3x71h2iFnan0b/3RUpEFDnqWs8/rsHzAkHsmrKSd 80sA0BBo19yi6kcWO38VT9AmpiDG0CLG2sk/8DKolFhwgOGQ0wluv0uEMmFUvN3pWFCk M3gaU0/naPeH/U6hND+bd79pJlnF8zGK5N80oRyGnQR25M9pkN6p+AUgEJvgnnoUU+PY +9zQ== X-Gm-Message-State: AOJu0YwTryCxsi3ZnrXDef8/3pLS8A59mCGyoSdwxjXJAvxbiQCLeMyz qdkuRp64Vjo9R/dwlf6h9/daE9irzY3QmHeSpuV86YyFd8Kl4a27bryEXAlM3aTZNm785e0Qx23 CTSHcNsCNjhx/b/45k9fOdq5il2J7AIXs1UHIPbHTZkqmBJBL4it9 X-Received: by 2002:aca:2b17:0:b0:3bd:631e:5562 with SMTP id i23-20020aca2b17000000b003bd631e5562mr552033oik.15.1706669363937; Tue, 30 Jan 2024 18:49:23 -0800 (PST) X-Google-Smtp-Source: AGHT+IGl+pV0YhMkdImtv7qH4su/PefmcHybXS2fXt+ft8ge0WAHcfY73+DOLB9EI54HssAGNZvirQ== X-Received: by 2002:aca:2b17:0:b0:3bd:631e:5562 with SMTP id i23-20020aca2b17000000b003bd631e5562mr552021oik.15.1706669363616; Tue, 30 Jan 2024 18:49:23 -0800 (PST) Received: from localhost.localdomain ([203.163.243.223]) by smtp.googlemail.com with ESMTPSA id p16-20020a63e650000000b005d553239b16sm9008227pgj.20.2024.01.30.18.49.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 18:49:23 -0800 (PST) From: Ani Sinha To: Paolo Bonzini , Richard Henderson , Eduardo Habkost , "Michael S. Tsirkin" , Marcel Apfelbaum Cc: Ani Sinha , =?utf-8?q?Daniel_P_=2E_Berrang=C3=A9?= , Igor Mammedov , Julia Suvorova , kraxel@redhat.com, qemu-devel@nongnu.org Subject: [PATCH v2] pc: q35: Bump max_cpus to 1856 vcpus Date: Wed, 31 Jan 2024 08:19:06 +0530 Message-ID: <20240131024906.3920-1-anisinha@redhat.com> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.133.124; envelope-from=anisinha@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.292, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_SORBS_WEB=1.5, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Since commit f10a570b093e6 ("KVM: x86: Add CONFIG_KVM_MAX_NR_VCPUS to allow up to 4096 vCPUs") Linux kernel can support upto a maximum number of 4096 vCPUS when MAXSMP is enabled in the kernel. At present, QEMU has been tested to correctly boot a linux guest with 1856 vcpus and no more both with edk2 and seabios firmwares. If an additional vcpu is added, that is with 1857 vcpus, edk2 currently fails with the following error messages: AllocatePages failed: No 0x400 Pages is available. There is only left 0x2BF pages memory resource to be allocated. ERROR: Out of aligned pages ASSERT /builddir/build/BUILD/edk2-ba91d0292e/MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c(814): BigPageAddress != 0 This error exists only with edk2. Seabios currently can boot a linux guest fine with 4096 vcpus. Since the lowest common denominator for a working VM for both edk2 and seabios is 1856 vcpus, bump up the value max_cpus to 1856 for q35 machines versions 9 and newer. Q35 machines versions 8.2 and older continue to support 1024 maximum vcpus as before for compatibility reasons. If KVM is not able to support the specified number of vcpus, QEMU would return the following error messages: $ ./qemu-system-x86_64 -cpu host -accel kvm -machine q35 -smp 1728 qemu-system-x86_64: -accel kvm: warning: Number of SMP cpus requested (1728) exceeds the recommended cpus supported by KVM (12) qemu-system-x86_64: -accel kvm: warning: Number of hotpluggable cpus requested (1728) exceeds the recommended cpus supported by KVM (12) Number of SMP cpus requested (1728) exceeds the maximum cpus supported by KVM (1024) Cc: Daniel P. Berrangé Cc: Igor Mammedov Cc: Michael S. Tsirkin Cc: Julia Suvorova Cc: kraxel@redhat.com Signed-off-by: Ani Sinha --- hw/i386/pc_q35.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) Changelog: v2: bump up the vcpu number to 1856. Add failure messages from ekd2 in the commit description. See also RH Jira https://issues.redhat.com/browse/RHEL-22202 diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index f43d5142b8..f9c4b6594d 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -375,7 +375,7 @@ static void pc_q35_machine_options(MachineClass *m) m->default_nic = "e1000e"; m->default_kernel_irqchip_split = false; m->no_floppy = 1; - m->max_cpus = 1024; + m->max_cpus = 1856; m->no_parallel = !module_object_class_by_name(TYPE_ISA_PARALLEL); machine_class_allow_dynamic_sysbus_dev(m, TYPE_AMD_IOMMU_DEVICE); machine_class_allow_dynamic_sysbus_dev(m, TYPE_INTEL_IOMMU_DEVICE); @@ -396,6 +396,7 @@ static void pc_q35_8_2_machine_options(MachineClass *m) { pc_q35_9_0_machine_options(m); m->alias = NULL; + m->max_cpus = 1024; compat_props_add(m->compat_props, hw_compat_8_2, hw_compat_8_2_len); compat_props_add(m->compat_props, pc_compat_8_2, pc_compat_8_2_len); }