Received: by 2002:a17:90a:728b:0:0:0:0 with SMTP id e11csp2419100pjg; Thu, 30 Apr 2020 11:25:32 -0700 (PDT) X-Google-Smtp-Source: APiQypLp8aCCdjHwuzjnWVZlABTxVa7jVw/5NS3iaYBV3OvHddWwI6522WFVhibUP2D53aZvyhQA X-Received: by 2002:a05:6402:887:: with SMTP id e7mr298641edy.178.1588271131800; Thu, 30 Apr 2020 11:25:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588271131; cv=none; d=google.com; s=arc-20160816; b=SkEqqulrBAPI98BtSU/OOe1lfwoWgWxV2UlCf9tR6amB88D+VsdjDQ+fDbZQN8GuqG kYz5pzLgpMFtCExATZj6NY36Q9fjaYGqnZ12nEG1xuTnmNZimmVHILm1h0EqYdb8Acdg kqHMQuUrsG3Y1WYlAADPnNK5E4LRN2x3AatYoY2yll1yFKKyLUB5im9vV6jZtN3leVIN IJH01jsyefQtjxkBTLsCt0ryae1KRnhDtfwOX+y+RP2PCc2pB5tO6M3tt22bIcmJ7FEe 9j4Qg3s5iGCe5mxKwb85pPMtB/rOp1NIWJOHCl/XCz65QMebAuxBunHC71z4LHOCsZot auVg== 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=vzID6dyyEtHnb8W3jUC+1MMjyOI0QnfADZmAC1ounFo=; b=F6EvtZ0+1LGRPzrTF1de+ys8cVaO5LYxTCYIe2ozdfv/GzhrTqhA6Z3hTv9Dknc7IM G51MpR959CU3a8bfPZ1iJ0eCqoQDWMkyLP0eoeWrqWcCn5kqSH15jibjYnK96HBdFpBb +ARm64dxos52FlvO/dR+aXdbjp9i5Ojg0KptjhAjaVLL2+paMDeFmYbt3FN3eVNui915 C6PLnE+b08M+5QVaw8xfRHd9HpH6V6dMSlAkHiIdA/Au7YVxJbVYlTaOsIGd5GHOMH5p 6c90ZV3tbPtma1yUWGhnWrhpgnOWnQK/xJMYQ9XIS7VW87sPtTUon1dlDvxCdBqk/Mgw yV6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@atishpatra.org header.s=google header.b=FSwI7Ok+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y15si295378ejp.5.2020.04.30.11.25.07; Thu, 30 Apr 2020 11:25:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@atishpatra.org header.s=google header.b=FSwI7Ok+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726574AbgD3SXm (ORCPT + 99 others); Thu, 30 Apr 2020 14:23:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41410 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1725844AbgD3SXm (ORCPT ); Thu, 30 Apr 2020 14:23:42 -0400 Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1983BC035494 for ; Thu, 30 Apr 2020 11:23:42 -0700 (PDT) Received: by mail-wm1-x344.google.com with SMTP id y24so3138801wma.4 for ; Thu, 30 Apr 2020 11:23:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=atishpatra.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=vzID6dyyEtHnb8W3jUC+1MMjyOI0QnfADZmAC1ounFo=; b=FSwI7Ok+WljTVqHuemSfgBv/l0IPhqe998/WQWww0qZd4jkx/oFKkGXTNi4jWZwtti MRho365ZHO1V33E5E1q6Y2VY+PO5wNd5GVfdPXWEK/V8/zY2Owg+oW/HR3pGcU30Mq/Z vo3ZN2VBw7fklcpV/jZgKkSyrG8KCx4b6K10I= 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=vzID6dyyEtHnb8W3jUC+1MMjyOI0QnfADZmAC1ounFo=; b=n1ip5uU4w+NUkMJdazY8NPzx4U0zh+xGrz31g/Q2jteT3UngT7b/XcxTsyO+otTt/c y43ORDZ5f191Xw2eb7wvXn9rvFSbhziN8dUT9F9Rw4fZMkUmvBCQjZpzOeLuQyu+/d13 INBTn1C4HfnLBXBIO7ZtxxFXvwKB7nhBe9jaVp6V85YQOsOEJ52cClNxYz1STe9K57Z+ iNf0BdiTsGflu2FbQ5QXD7zPaad/URUx/6GtzsPIfwgeff/mVgbovg0x3TwjwLPxo41h +Mlf+FeIiBGblfARPVaL6k/jkoRCCtEzX06bITAn0oxZQ+dzMIws3B3zn8uNnorx4R4k S59Q== X-Gm-Message-State: AGi0PuaP8u2BUpwXFbl+fMxfhcnJVmyVOOSohAlcg+ikcXOqawFJfd5v CwoOo2U6ck2jhpO5Oh6+jkE9hU87o8mRFQLomHqJlX0= X-Received: by 2002:a7b:c38b:: with SMTP id s11mr4348218wmj.55.1588270990928; Thu, 30 Apr 2020 11:23:10 -0700 (PDT) MIME-Version: 1.0 References: <20200430095325.111441-1-zong.li@sifive.com> In-Reply-To: <20200430095325.111441-1-zong.li@sifive.com> From: Atish Patra Date: Thu, 30 Apr 2020 11:22:59 -0700 Message-ID: Subject: Re: [PATCH] riscv: force __cpu_up_ variables to put in data section To: Zong Li Cc: Paul Walmsley , Palmer Dabbelt , linux-riscv , "linux-kernel@vger.kernel.org List" 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 Thu, Apr 30, 2020 at 2:53 AM Zong Li wrote: > > Put __cpu_up_stack_pointer and __cpu_up_task_pointer in data section. > Currently, these two variables are put in bss section, there is a > potential risk that secondary harts get the uninitialized value before > main hart finishing the bss clearing. In this case, all secondary > harts would go through the waiting loop and enable the MMU before > main hart set up the page table. > That would be only true if you are using random booting protocol with SBI v0.1 implementation. With HSM extension in place, all the secondary cores are waiting in firmware. The booting core will bring them up one by one from cpu_up method. The HSM extension is already available in OpenSBI v0.7 and Linux kernel 5.7-rc1 onwards. > Signed-off-by: Zong Li > --- > arch/riscv/kernel/cpu_ops.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/arch/riscv/kernel/cpu_ops.c b/arch/riscv/kernel/cpu_ops.c > index c4c33bf02369..0ec22354018c 100644 > --- a/arch/riscv/kernel/cpu_ops.c > +++ b/arch/riscv/kernel/cpu_ops.c > @@ -15,8 +15,8 @@ > > const struct cpu_operations *cpu_ops[NR_CPUS] __ro_after_init; > > -void *__cpu_up_stack_pointer[NR_CPUS]; > -void *__cpu_up_task_pointer[NR_CPUS]; > +void *__cpu_up_stack_pointer[NR_CPUS] __section(.data); > +void *__cpu_up_task_pointer[NR_CPUS] __section(.data); > > extern const struct cpu_operations cpu_ops_sbi; > extern const struct cpu_operations cpu_ops_spinwait; > -- > 2.26.1 > > -- Regards, Atish