From patchwork Thu Apr 21 17:03:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Palmer Dabbelt X-Patchwork-Id: 12822063 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 321ADC433EF for ; Thu, 21 Apr 2022 17:06:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:To:From:Cc:MIME-Version:Message-Id:Date :Subject:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=NyCuaRpqXqUwmHRpKxGncBFtmxqnMiqYDfdZxk4mOgU=; b=auYaDS9zjhnlwQ rQ62bFRtlYyffMf8uJtBGueAA9Yk3MvsxORwfcWEnzjqplKjCy9lPNud14+aNVTOYVZlwomvUPFV8 ErWK5e2NhMQqrAZsKH7fsrs3js4jLgYEY8aNWvv28A9qDnWqkQC5KLLFd/WsA6zY7hDUADYEf7wPo WqPoDCjyW3fjOyq7OtmS2MWVDS1hLYVXuQC87+221os7xpmpy8F3erov/WoKtN2vyW1t61KMd67IE BDcoVA9YIyGyZcsgo7yXKnjmvoh5pN2DcR7tyE2s2gKk4jazwY21B4D8y3sbHflFJ9FOf8FLtUCQn SPmbmg6GFkkhZoJ5XEwg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nhaFW-00ENha-2f; Thu, 21 Apr 2022 17:05:46 +0000 Received: from mail-pj1-x102b.google.com ([2607:f8b0:4864:20::102b]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nhaFR-00ENfw-Qd for linux-arm-kernel@lists.infradead.org; Thu, 21 Apr 2022 17:05:43 +0000 Received: by mail-pj1-x102b.google.com with SMTP id md20-20020a17090b23d400b001cb70ef790dso8270718pjb.5 for ; Thu, 21 Apr 2022 10:05:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; h=subject:date:message-id:mime-version:content-transfer-encoding:cc :from:to; bh=VAtOPkJ1SY/tzMbGCTKTKv8dG7z23I5mteO8idQRNqw=; b=F03wFIkvH5mHwPm9Vdu97iKnCWlemvMdFvOppF2ZHGD8qtffYcRETG3VtVhIj4qvYx XWmKJ/KsFbZPc1kUl1FxRWXZr5+5Vn5eHGrysqnfIv3aZFgOr4xeSn3fDvZQG9uLzcMQ M/9UffPcFn07CYsjM+L2p5OHf9tHrF5TTki3qW1CH4jL0aF8veH/OpcovTFTbw2NpU3+ 0w3kbZmQ1MT0WHZoHPveAXxJmj6KLpBbvQvXnpN51UYFdvkEMfI1ozg8XM9sEgA33H1f KB577+f/yUEmDZQCuJmDNEJ/9zZ3H9cfwN3Q/rDUZlUDARsAPSs1PEcRG2meHbtvi8Pg RvWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:date:message-id:mime-version :content-transfer-encoding:cc:from:to; bh=VAtOPkJ1SY/tzMbGCTKTKv8dG7z23I5mteO8idQRNqw=; b=h36a4J/dUKjeTz3hJq2Ungf+FfI8s88GZrt5SUlkShpNxDJt9ggEm60m6nqW3KHKSM Pz3gUlUb9zKc94V3TNaNgSZQZYxtMow8Iht2lo0nzyVCTqZl269xyO6WmEFPR2tynN/x 6EV071AXAd0YjBsPSzZbCqWI1KEEPfwKAvyXI1Az+2TRynxKbu5tZ+P3WcKvYN8Ckzik DN8BzeK88ux7VlgWJSLuV4e0kI5TiLiOsVo9T2zHuuDVB2ILw5sFrlVgiVk/YDCJwXr2 cE4F56nQ6MuJFBa8MULkBKATWB2ZEZMvm7rSaPd6xNw9ZUHNdFLAzzcNVKX8A9dxJRDR +V6Q== X-Gm-Message-State: AOAM530Kq27Nc3BxnaQnBGl8Usl5c/6AOmXOT2HfInuDUFoSvmR54NW7 ip36kCVfN1BAeIle38UmEaZyrQ== X-Google-Smtp-Source: ABdhPJyjqlvEcnOu/+Sk4eVZPHB9SHCOwWZKtrj2V0KbAODClpJDnwpOm1MZqxewG78k6bjgkizydQ== X-Received: by 2002:a17:90b:384e:b0:1d2:798d:6f42 with SMTP id nl14-20020a17090b384e00b001d2798d6f42mr635645pjb.5.1650560740380; Thu, 21 Apr 2022 10:05:40 -0700 (PDT) Received: from localhost ([12.3.194.138]) by smtp.gmail.com with ESMTPSA id j6-20020a63b606000000b003808b0ea96fsm23186858pgf.66.2022.04.21.10.05.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Apr 2022 10:05:39 -0700 (PDT) Subject: [PATCH v1] RISC-V: Only default to spinwait on SBI-0.1 and M-mode Date: Thu, 21 Apr 2022 10:03:55 -0700 Message-Id: <20220421170354.10555-1-palmer@rivosinc.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Cc: Paul Walmsley , Palmer Dabbelt , aou@eecs.berkeley.edu, atishp@atishpatra.org, anup@brainfault.org, Will Deacon , mark.rutland@arm.com, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux@rivosinc.com, Palmer Dabbelt From: Palmer Dabbelt To: linux-riscv@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220421_100542_087759_59E7C878 X-CRM114-Status: GOOD ( 16.28 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Palmer Dabbelt The spinwait boot method has been superseeded by the SBI HSM extension for some time now, but it still enabled by default. This causes some issues on large hart count systems, which will hang if a physical hart exists that is larger than NR_CPUS. Users on modern SBI implemenation don't need spinwait, and while it's probably possible to deal with some of the spinwait issues let's just restrict the default to systems that are likely to actually use it. Signed-off-by: Palmer Dabbelt Reviewed-by: Atish Patra Reviewed-by: Anup Patel --- This seems to be the source of many of my new hangs when trying to test the NR_CPUS=512 support. It's not really related, just fallout from testing different setups. --- arch/riscv/Kconfig | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index 00fd9c548f26..dd5e975abe37 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -359,7 +359,7 @@ config RISCV_SBI_V01 config RISCV_BOOT_SPINWAIT bool "Spinwait booting method" depends on SMP - default y + default y if RISCV_SBI_V01 || RISCV_M_MODE help This enables support for booting Linux via spinwait method. In the spinwait method, all cores randomly jump to Linux. One of the cores @@ -370,6 +370,12 @@ config RISCV_BOOT_SPINWAIT rely on ordered booting via SBI HSM extension which gets chosen dynamically at runtime if the firmware supports it. + Since spinwait is incompatible with sparse hart IDs, it requires + NR_CPUS be large enough to contain the physical hart ID of the first + hart to enter Linux. + + If unsure what to do here, say N. + config KEXEC bool "Kexec system call" select KEXEC_CORE