Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1420481ybz; Fri, 1 May 2020 23:02:40 -0700 (PDT) X-Google-Smtp-Source: APiQypIedhajEjoqGvw4sdXb3p8YRJWm6GfqxMkAov4FzVMdmg0anmVmhxe+lP1jkU0k0sw+qau/ X-Received: by 2002:a17:906:6811:: with SMTP id k17mr6432120ejr.351.1588399360729; Fri, 01 May 2020 23:02:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588399360; cv=none; d=google.com; s=arc-20160816; b=cKuyL62Q0454hYWtKIecTRYM0VdKWQMXyY9vJ0uMTxDUUbH5rNqeX/oE5FQ+W0UxaT ODyQQRIGZZrav9FBK8F9FB+iAI6TOc0YO72sbEOb7MCSGA8rtqs9PftutfLAbE2VrjIx 93v6VxwMugYjfXpdgRmm7Spk285ScF8RlkEzN6wW25Cg4qQ21JU5HOAPcJMpI/YXe9qw tb+4Vfsl77ar8g3xMIZLj/bCB3EtS0bkCHB5NxnCAIzclPvU8wuvb976a8WwAvCzz4YY lMSnlTQo+cAEa1xYGTSHHkgipc/nmC+E0rJvLVFfgG9Bc9K3qyudx7QZlUGQJvE48tV+ vg2A== 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=FDF1hXWC/s7Oyy2jCdyRcsT8e8W6WSRCRNbuadBXFl8=; b=n2xUHXObf4MU6HTBDX0HphtDtWBVzEUocFnxLwFMeIZZd8jdAefSG8+F3e972yRoZ2 1FfTmbjfYH9tpMC4+WejGt6/u3VCp+2X/mi+V1jeN74Dtxc5ZbxHVNEnWf1W4+Hzt+cl 3RVUskbRe4tPv1fjFDLChPU1LNlfAnje6Cw8N87dnltcXIyK1ysycTilIKhNBVE4oMsi 8/d+R/c5QtqrcoEcKfCFWaysWK83xLebsMoQcpEihVtUpL9tXUkUx9pdrS1RPz4ZTmbJ 6auxQCuiOpTRHRu4tQExHdSsmpGPXoHaHWw2Gw2iwcwluAM9rO71FjC72WPnD29XuIGg isKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=VCV6t+Im; 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 v2si3013728ejx.85.2020.05.01.23.02.17; Fri, 01 May 2020 23:02:40 -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=@sifive.com header.s=google header.b=VCV6t+Im; 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 S1727869AbgEBGAm (ORCPT + 99 others); Sat, 2 May 2020 02:00:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36208 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726468AbgEBGAl (ORCPT ); Sat, 2 May 2020 02:00:41 -0400 Received: from mail-ot1-x344.google.com (mail-ot1-x344.google.com [IPv6:2607:f8b0:4864:20::344]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F0519C061A0C for ; Fri, 1 May 2020 23:00:40 -0700 (PDT) Received: by mail-ot1-x344.google.com with SMTP id g19so4335194otk.5 for ; Fri, 01 May 2020 23:00:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=FDF1hXWC/s7Oyy2jCdyRcsT8e8W6WSRCRNbuadBXFl8=; b=VCV6t+ImMO4jEWjNslBlWz6cqKNFoWc1JEfu0tDDfCA+eT7hh2yuSCB54TtP6xxjSy iA97AiXBxF+nbZJvS1AgfB9CH5pNpqtWcJrDLd0g90OsTa1PMGzV2nQTaOP0hL7Mslua NoKFwMCB6ImBjqf82Ewqrdw8Xk2ZM8V+uzpDevZPEcgXEWolO0k2lPMmckoRjtyg28+j vxDQG5ZJSnaKapXWPaqHpwArQlqcnzD/ZjyUyf9r5QrbPknlKYmQjV4iGmhm+4rz1w9b taVGGvk7nT30weXhFMZWP8YQ4svB1Cs0ZZijIB680tai7aNcKj5Z08OBq0rFT7VZc6TB 6VyQ== 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=FDF1hXWC/s7Oyy2jCdyRcsT8e8W6WSRCRNbuadBXFl8=; b=VoXz4pBUDaN6j2irC1+F2doZNnIp8XaP+tSjaFo5J6sAbGH2DUsZ48dC5sEut/C8R9 RkXnIra/EwJ8upBWxHCnGhZ6vtrIN8GhXN2Z0uZ0y1/ilQDiJ59jxt0srUIu5DEPeFYt 51/T6FC6YGl7k0iJBZ3GEarMUNvDX0YcEzkxGxygqEy7VtS3C4P/izLOkkgIGhmD8VY5 IFbeGA6c54SOv85farjiaixApZUwvyzq4SbFonhX+YbeGJo5VHvbWGQTypxAZ113Tmzo VuUyowU7EGDTSFe34VEDxP46DiVKYQ0dcFSuJLqHwB9rUtKc77zUAD60UdHs+Aq2Sffv IVkQ== X-Gm-Message-State: AGi0PubSlb2m+4NFlyoP1it5dg9dzPn0Utyp5gANPqDOT6V/FCFYliba BFAPnFLVeU97s40NBxoP5azpNOiah+vR3cbb6OYIuA== X-Received: by 2002:a9d:7dd8:: with SMTP id k24mr6410161otn.33.1588399240219; Fri, 01 May 2020 23:00:40 -0700 (PDT) MIME-Version: 1.0 References: <20200430095325.111441-1-zong.li@sifive.com> In-Reply-To: From: Zong Li Date: Sat, 2 May 2020 14:00:30 +0800 Message-ID: Subject: Re: [PATCH] riscv: force __cpu_up_ variables to put in data section To: Atish Patra 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 Fri, May 1, 2020 at 2:23 AM Atish Patra wrote: > > 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. If I understand correctly, the newest kernel still works with earlier OpenSBI than v0.7 or BBL. It seems to me that we need to consider the use cases if we don't limit it to up to OpenSBI v0.7. > > > 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