Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp5994863ybe; Tue, 10 Sep 2019 11:53:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqzBdMczotBn1trRd9wOMOahxSm5QS9A4DEbmV9I7i9ir4IwiNwC+upCEgIUExLiX/KH/WsP X-Received: by 2002:a05:6402:b29:: with SMTP id bo9mr32352129edb.10.1568141634846; Tue, 10 Sep 2019 11:53:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568141634; cv=none; d=google.com; s=arc-20160816; b=oFOct+IRch7Zi066RRwaR5B9NhT3DDgXO/0jLteVDDZNggZ1gG3i4Uv407ABZ0W0Dz 9wi4CgAmwP4M9xWoC6yolvX23DeaxryjS7IYghAV3UUKqBDdKJi48VUKANgdzquqKX5U PdnkYgGfD0WbhmbQBRlLH3nM9xeJUd0XKSz8qXbc5lVZF84LaSYCphUIOy6HtkbVrREY nBF4T2I7u/BADmNif/DePBVghsGUBjA4uNbT7mZIdUWynXYRvmtReUzG/F6fW8y6QAwi IC6CiqDq/9yd5Be3Ae3wl8RD1XXjPYXZlcBT6PJlCTyHljLXXv3/h1tip6VO9ZlJm3y5 VzuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=3mnueqhN7Kkwa8MkKe0Ckxy5QE6yv9lhd/uQxARTM74=; b=lwnpB7ikC0kvpXE0QDOLZmcsepTZU82fmVPH2bdi48f4vhZXZ8abO3ruKS23Y0ME/y ONMUpp9hXdPpNwlJKTeL+FripSu6bS66gyVnnQ4jGzkt76f9+aoPStyNzDvgJ1vfW0N5 +cVKrU/yGqF3TuPmvBV5d+HOvvu16W31rHM/2iadhN8ZdYhnsoHMQhZq6ju9bFO3Tsk+ 3urYw7DLyqpdrjt14H3Z8RQUi4dTy/4Ss64YHrfdRfnFKPClfeS5q8TPYapJcVv/yIF8 Q0dGYV+NYnKz6aSfXs4wn4m4m0T9kROz5QyIfdikX5Kl/Cic1/I1UDAk4VaEL270Xm8t Q8aA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@brainfault-org.20150623.gappssmtp.com header.s=20150623 header.b=CZSjIHEG; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v24si10952231edq.156.2019.09.10.11.53.31; Tue, 10 Sep 2019 11:53:54 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@brainfault-org.20150623.gappssmtp.com header.s=20150623 header.b=CZSjIHEG; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391784AbfIJJ4w (ORCPT + 99 others); Tue, 10 Sep 2019 05:56:52 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:37289 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727557AbfIJJ4v (ORCPT ); Tue, 10 Sep 2019 05:56:51 -0400 Received: by mail-wr1-f68.google.com with SMTP id i1so18268731wro.4 for ; Tue, 10 Sep 2019 02:56:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brainfault-org.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=3mnueqhN7Kkwa8MkKe0Ckxy5QE6yv9lhd/uQxARTM74=; b=CZSjIHEGio5Scyxy58ejHSD/34oFT3vJzyxbfFG0kjwe/cmnHTIzWUhhCbpjiKyvfm rc2BXgizDrNN5aKGj6aSjNdt7DGdPdbd+k+KErsQwst2FYGWk3gwJh7abEZl2CosOA8u /DN2IHkIbVx7rlKZNKX+QceItJrOmv21RsJE7o3/iXrqKF/kejtx5kKl4++0M7QBLuus gor9HR1IzHLkdjvHZZbV8KFEFmxx4bDtIk6x5QnO+BDiw7t3MUzoy8WMwlnBB79M6F9Y 0sSTsIyKUvx5zuThviGyd1U1mZQMZAjiIeqsXQoIJsWi854CL70C/t7fctYucbhg9nsb ZlUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=3mnueqhN7Kkwa8MkKe0Ckxy5QE6yv9lhd/uQxARTM74=; b=pNgyApzmJDXrKGw5RrbI2NsEhISqXhbPvzOaLupODo6UxHqEKVuvyhD0epNkod4+zT ZZw9t1+iGLNYBjAIo7sZ8HDFmoFFw1TfaHOlrIqmzCEjcYDhbJEVKtKhx7FdIj4mPcus ZtHTNf+VmS/t60agDkHFzo9LAXwqeVjT/qaVXFF40utXM6pAXwp5Xozc+FGWPp88uVFq mRhkhzgeFRHH5SR7IkYTZ55ZJIiMLPq5yrv2SLNUGemcTlwvI8SuBRSh4A+8PfFj28c2 tVqQiVQYqUb0m8rio2sDDtdalNgCidDHPMRSJYlm4/nfXPEWlzNUBVGiIboClHZSVjHx DmTQ== X-Gm-Message-State: APjAAAX+ZCerVtiFjnC8hDsh0HzNcNJoTCreEYhVT49aK3cfr3wfh3f9 OJ7DMIMmhtRkbav9qa/TfadQ6hjDe+06ASo2KYKQzhfp X-Received: by 2002:a5d:4ac5:: with SMTP id y5mr19528470wrs.179.1568109409582; Tue, 10 Sep 2019 02:56:49 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Anup Patel Date: Tue, 10 Sep 2019 15:26:39 +0530 Message-ID: Subject: Re: [PATCH] arch/riscv: disable too many harts before pick main boot hart To: Xiang Wang Cc: "paul.walmsley@sifive.com" , "palmer@sifive.com" , "aou@eecs.berkeley.edu" , "linux-riscv@lists.infradead.org" , "linux-kernel@vger.kernel.org" , "citypw@hardenedlinux.org" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 6, 2019 at 12:26 PM Xiang Wang wrote: > > From 12300865d1103618c9d4c375f7d7fbe601b6618c Mon Sep 17 00:00:00 2001 > From: Xiang Wang > Date: Fri, 6 Sep 2019 11:56:09 +0800 > Subject: [PATCH] arch/riscv: disable too many harts before pick main boot hart > > These harts with id greater than or equal to CONFIG_NR_CPUS need to be disabled. > But pick the main Hart can choose any one. So, before pick the main hart, you > need to disable the hart with id greater than or equal to CONFIG_NR_CPUS. > > Signed-off-by: Xiang Wang > --- > arch/riscv/kernel/head.S | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) > > diff --git a/arch/riscv/kernel/head.S b/arch/riscv/kernel/head.S > index 0f1ba17e476f..cfffea38eb17 100644 > --- a/arch/riscv/kernel/head.S > +++ b/arch/riscv/kernel/head.S > @@ -63,6 +63,11 @@ _start_kernel: > li t0, SR_FS > csrc sstatus, t0 > > +#ifdef CONFIG_SMP > + li t0, CONFIG_NR_CPUS > + bgeu a0, t0, .Lsecondary_park > +#endif > + > /* Pick one hart to run the main boot sequence */ > la a3, hart_lottery > li a2, 1 > @@ -154,9 +159,6 @@ relocate: > > .Lsecondary_start: > #ifdef CONFIG_SMP > - li a1, CONFIG_NR_CPUS > - bgeu a0, a1, .Lsecondary_park > - > /* Set trap vector to spin forever to help debug */ > la a3, .Lsecondary_park > csrw CSR_STVEC, a3 > -- > 2.20.1 > > > > > > > Looks good to me. Reviewed-by: Anup Patel Regards, Anup