Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp1085449pxb; Wed, 6 Apr 2022 08:22:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyT1HsVeu2N4h53HonrfdiMCjpIor9cLD7eHZ9Z7QfM4xipIgpMZzJXyNNjo26K3dIS00ns X-Received: by 2002:a17:902:c94c:b0:154:45c6:fbea with SMTP id i12-20020a170902c94c00b0015445c6fbeamr9217677pla.117.1649258530034; Wed, 06 Apr 2022 08:22:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649258530; cv=none; d=google.com; s=arc-20160816; b=lmCCWiu24SWJjIAs8QaquiqNjNS0C7EtVBKEEHW4HDN9U8mQSi/p2fz47duCHrdNzJ 0wFXmQ7bZDkjAS/3uJjbfaKMjQ+JMUOX6an/cWJnGhsNmVZKrPL0IK1Z9WJ1zzcyrf4a 98NF5ZJ4Qs7B/5kJEdooosiDxMAoO0IsmqrhS5GBHHhpb052PUfROJoxkhSkpZjl02/C r/oEFmu4vMl0NzEOH3Nh1RWICVp2OB/fM5hxpJzyD9OqI1T5eNgzTktzDZayV2sBGYbd X4j+IhPzQy5tbYCEFi3KFk+CzXL7AhGufndLxGnPwk6EHAOpj+Z42bn/IlpBSXQ3kuHr wnNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=q5bDixyu2P+1amMqXVInPRQZcEo1D+KNKXvuVBZxtRQ=; b=j5VQQYcI8IbvjXtlf2+NUpsYNNZv82SjSXyJE002XLsV0ZQV+K0NkqZ+jvDAVEN+7J sjkjQ72nGF+q0UwPlU6IIEBDxPIi7HHpHuTmYMURZGafApsfuFBsq1GLdswmk8PQKJmg NrnQF9OEn1EAuHxSVLGMsjUHFK774XrK3+yAHx9icrYo01WmKT0ybCS1+Ak1j6966Omf UznmsWEHoOsyHx512jGIlYsOEJEXm972HpiO2tS5V1h9GL6Umc1fQD2JW3eiuYJQKFne TeyRljZqguG73YfJWjVRCrkG7lgCaDNZqNNH7Ve0ys15oDWZL76aQOLFvdILF3w/3Xsd lm0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=OAKVuoE8; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id w63-20020a628242000000b004fa3a8e002csi14828081pfd.227.2022.04.06.08.22.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 08:22:10 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=OAKVuoE8; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 79F662C6708; Wed, 6 Apr 2022 06:21:27 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233314AbiDFNWU (ORCPT + 99 others); Wed, 6 Apr 2022 09:22:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57536 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233217AbiDFNWK (ORCPT ); Wed, 6 Apr 2022 09:22:10 -0400 Received: from mail-lf1-x12e.google.com (mail-lf1-x12e.google.com [IPv6:2a00:1450:4864:20::12e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9262025DA91 for ; Wed, 6 Apr 2022 03:10:58 -0700 (PDT) Received: by mail-lf1-x12e.google.com with SMTP id h7so3252325lfl.2 for ; Wed, 06 Apr 2022 03:10:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=q5bDixyu2P+1amMqXVInPRQZcEo1D+KNKXvuVBZxtRQ=; b=OAKVuoE8oiVQ4UPGV07GOSeUOsXTrgaJRg7NWGdn7EbTAlaFUO1pkDW2WiLN3fiwBZ 6ol1TcyZnld8fKDdQMPzHG6sMXb4L17Z3i+HSVZKoEhe0JhYHDBZAg3Ds8PWOqeFN8te mU4w5+5R52iiY+9uwvnHVdXDTwsVPWp3pryhsJSOhDCk1TftYIVSbp5OS3pXslJ7JIFL 8g8T48WPe0jThVfCVYYcXR0IebOR4rDs5+vDRJDbBRkzB11UhGchhHwjylruuwFwOolO LY14zHVmw/F6nrj9qYMu+V+RKnkijG6QDsrKcSLHNKdApUeZ3wcDcjih57jBwz25xuym OxYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=q5bDixyu2P+1amMqXVInPRQZcEo1D+KNKXvuVBZxtRQ=; b=MhvfZsYFZI8hi0dDzLSIAw6RLuPihEmTMm10PLjVr6yEqK8wtaawISI+H6iAZEircA mD4N82dJ+M392hKeKwQ61DynA9aueqIPxzGLGgFAh/6MpdiSwH3UjrT2poSHp2GNLf7l 9Je+0f+QSMFSwF2CGtyysKMkVyeeWLx4XjQDdRjZQowdiF9mhapmfFIGU5bWofrJ8Dj7 onmOu1cT4RVvVM/XJjgrBJo0gh/gFNFtVquAUowfljPUwoV9M7fp4pldqIXZnxzH6vrw I9jDv61UgAjwpdjnwcaN1B76ZRcU00AWJBUwpzdLpR1qbGpRfZomQ8qWEddAEqvPfthk m06Q== X-Gm-Message-State: AOAM530ZVq0MUPIxKVoMsFfVoacu3rB5PVhpDIFB1a5fLGnUDeUpnm3b //AkFVZynohxdIsP1RfEomfY4dBhgvB1eD/vvccugg== X-Received: by 2002:a05:6512:e89:b0:44a:86e0:2294 with SMTP id bi9-20020a0565120e8900b0044a86e02294mr5737802lfb.130.1649239812934; Wed, 06 Apr 2022 03:10:12 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Anup Patel Date: Wed, 6 Apr 2022 15:40:01 +0530 Message-ID: Subject: Re: [PATCH v2] RISC-V: Increase range and default value of NR_CPUS To: Heinrich Schuchardt Cc: Palmer Dabbelt , Paul Walmsley , Arnd Bergmann , Atish Patra , Alistair Francis , Anup Patel , linux-riscv , "linux-kernel@vger.kernel.org List" Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 6, 2022 at 3:25 PM Heinrich Schuchardt wrote: > > On 3/31/22 21:42, Palmer Dabbelt wrote: > > On Sat, 19 Mar 2022 05:12:06 PDT (-0700), apatel@ventanamicro.com wrote: > >> Currently, the range and default value of NR_CPUS is too restrictive > >> for high-end RISC-V systems with large number of HARTs. The latest > >> QEMU virt machine supports upto 512 CPUs so the current NR_CPUS is > >> restrictive for QEMU as well. Other major architectures (such as > >> ARM64, x86_64, MIPS, etc) have a much higher range and default > >> value of NR_CPUS. > >> > >> This patch increases NR_CPUS range to 2-512 and default value to > >> XLEN (i.e. 32 for RV32 and 64 for RV64). > >> > >> Signed-off-by: Anup Patel > >> --- > >> Changes since v1: > >> - Updated NR_CPUS range to 2-512 which reflects maximum number of > >> CPUs supported by QEMU virt machine. > >> --- > >> arch/riscv/Kconfig | 7 ++++--- > >> 1 file changed, 4 insertions(+), 3 deletions(-) > >> > >> diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig > >> index 5adcbd9b5e88..423ac17f598c 100644 > >> --- a/arch/riscv/Kconfig > >> +++ b/arch/riscv/Kconfig > >> @@ -274,10 +274,11 @@ config SMP > >> If you don't know what to do here, say N. > >> > >> config NR_CPUS > >> - int "Maximum number of CPUs (2-32)" > >> - range 2 32 > >> + int "Maximum number of CPUs (2-512)" > >> + range 2 512 > > For SBI_V01=y there seems to be a hard constraint to XLEN bits. > See __sbi_v01_cpumask_to_hartmask() in rch/riscv/kernel/sbi.c. > > So shouldn't this be something like: > > range 2 512 !SBI_V01 > range 2 32 SBI_V01 && 32BIT > range 2 64 SBI_V01 && 64BIT This is just making it unnecessarily complicated for supporting SBI v0.1 How about removing SBI v0.1 support and the spin-wait CPU operations from arch/riscv ? > > >> depends on SMP > >> - default "8" > >> + default "32" if 32BIT > >> + default "64" if 64BIT > >> > >> config HOTPLUG_CPU > >> bool "Support for hot-pluggable CPUs" > > > > I'm getting all sorts of boot issues with more than 32 CPUs, even on the > > latest QEMU master. I'm not opposed to increasing the CPU count in > > theory, but if we're going to have a setting that goes up to a huge > > number it needs to at least boot. I've got 64 host threads, so it > > shouldn't just be a scheduling thing. > > Currently high performing hardware for RISC-V is missing. So it makes > sense to build software via QEMU on x86_64 or arm64 with as many > hardware threads as available (128 is not uncommon). > > OpenSBI currently is limited to 128 threads: > include/sbi/sbi_hartmask.h:22: > #define SBI_HARTMASK_MAX_BITS 128 > This is just an arbitrary value we can be modified. Yes, this limit will be gradually increased with some improvements to optimize runtime memory used by OpenSBI. > > U-Boot v2022.04 qemu-riscv64_smode_defconfig has a value of > CONFIG_SYS_MALLOC_F_LEN that is to low. This leads to a boot failure for > more than 16 harts. A patch to correct this is pending: > [PATCH v2 1/1] riscv: alloc space exhausted > https://lore.kernel.org/u-boot/CAN5B=eKt=tFLZ2z3aNHJqsnJzpdA0oikcrC2i1_=ZDD=f+M0jA@mail.gmail.com/T/#t > > With QEMU 7.0 and the U-Boot fix booting into a 5.17 defconfig kernel > with 64 virtual cores worked fine for me. Thanks for trying this patch. Regards, Anup > > Best regards > > Heinrich > > > > > If there was some hardware that actually boots on these I'd be happy to > > take it, but given that it's just QEMU I'd prefer to sort out the bugs > > first. It's probably just latent bugs somewhere, but allowing users to > > turn on configs we know don't work just seems like the wrong way to go. > > > > _______________________________________________ > > linux-riscv mailing list > > linux-riscv@lists.infradead.org > > http://lists.infradead.org/mailman/listinfo/linux-riscv > > >