Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1922378ybz; Thu, 30 Apr 2020 07:49:03 -0700 (PDT) X-Google-Smtp-Source: APiQypKbaXdp1EP+N2VJQ8llZfjhk6I/9f4Gyr/gWd91qwRrp3WRhoX/ZB6g0AovN8rGEz78J3FU X-Received: by 2002:a17:906:c44b:: with SMTP id ck11mr3149060ejb.110.1588258143201; Thu, 30 Apr 2020 07:49:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588258143; cv=none; d=google.com; s=arc-20160816; b=qMUCexTZkHOjK2l1Alm6SnfkiXTBp6TBA/NI783XeAnhH/ZORwepku7uGAZkuKMHFS /i1kZNmsBYWAGnmgQjfS7CtWunLjReTOTliJ/Db9hbrqahjvH2GahqBdEPN8MFx2VyJj D62sEwbHGR4awd/lm01V5XzwAAekG6JPNSWpeTczKn+YYO6wypNsP46LJ59phZv0f8BI 7mS5zmi0MHoQl75EuZEZURsyKFl6QIDFM86oiyHr63AhXeDXFJ61anaqooMOTkeO5qcG pX3Sw9VxKfwnR1mdpSp2SdfdMvHEvmP10qageF3rNEIyuNGv5G4MWlTtLNUzdYJrBp3F UYOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=VQZ8f3nWspkcMVyQxaM9lki0jYoUn+ENmpwlQM54tJI=; b=cxMEAnlptlrj2fMSwkXExUXv7lcj9Tcy4MgxzFoCN8DriWvh5nnFT7JsjZnF5+l1QA f/m9bw7EK1ebvdbK5vMcEbXl/8rMOJc7k4rqjJko8FkU6GKmaACYubOMCzN8+ptWgugZ mnwZqmkO2F1mnB5K1eB/DUJ2wxmMxkONImW6QjD2yXk0nKCEAMbDUW//hO5c9gj4FK02 kno8TVB2KNntf7bmsmE9sx+F8UStnAeAqMHrxpWtFdyGr97kBQJAEIFcllMm5nCmRxD5 7G/eZKZCUhehKUMQTE2ZCaO+WkJIGUVvs+6atfGBuwmSuNGgy1eTnOBJ4xeZiWS5ElWv bbzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=FxZt9q69; 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 gt7si5709724ejb.360.2020.04.30.07.48.34; Thu, 30 Apr 2020 07:49:03 -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=FxZt9q69; 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 S1727908AbgD3OrI (ORCPT + 99 others); Thu, 30 Apr 2020 10:47:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35346 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726867AbgD3OrI (ORCPT ); Thu, 30 Apr 2020 10:47:08 -0400 Received: from mail-qk1-x744.google.com (mail-qk1-x744.google.com [IPv6:2607:f8b0:4864:20::744]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1BB9DC035494 for ; Thu, 30 Apr 2020 07:47:08 -0700 (PDT) Received: by mail-qk1-x744.google.com with SMTP id c63so5942000qke.2 for ; Thu, 30 Apr 2020 07:47:08 -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:content-transfer-encoding; bh=VQZ8f3nWspkcMVyQxaM9lki0jYoUn+ENmpwlQM54tJI=; b=FxZt9q69WeDISYW/u+FapX+g4AcoQ60SHR3rObRVjDCxZJ6UlTOi0dDCo80/JgOZxn DXt30paSE9HJByZpd9MN/9bqoaSpWnTTzk8huYKSl43IenhzSPYC/6nqzrHL/ZM7l3m0 ZYx4yU6m6RbIlqhaO29As71mAiNpfB+eFLqeN8uhtMe8aNYNMnCt2+mMYYBBP3BK56ls 5xIIg/Rbx93ERJ0KI+y9BtFSxWflV/zzBmS6MLyPYWkeJj0lVjQfi/iAxyBdd07EIs6i MUrvs4ayiVBB0q/LP8J/0bQNgyfH/yXLTdnOQbJAEkTzD6vHAusumKAYkH7MyPfImSVN UqAw== 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:content-transfer-encoding; bh=VQZ8f3nWspkcMVyQxaM9lki0jYoUn+ENmpwlQM54tJI=; b=BXgwSZcNnTFpJ2B73aXx2pdspg4UXrj+KeWZEU3zlvTx8TmInV0H3iE5EPfgDffqMX Qj2HQtvSwW0650BcL3rJGKsTmC39H3Kg00TFxgYBivPoJqUMqKrhbfAgmYCxan7qANYe PrldHEx5w1/Pjg+1DSfRo7uW9tSHz8K+3nSV/tQt7A1JEwH4gb87imQoDltQNwxb8Zkc yBgHe3xHWj26XpV92X3Tv19kV4MqpMExKfQbzSZOwAzBFVbZnfQdeuXVGNmCYY5NAs5N Zl4dZg6DcL4grfUlKmMXJWHDEmXbcr7jouosczr0Lk2BogfbJTcks3U0xYdLPEirVwuU wTRg== X-Gm-Message-State: AGi0PuYhFbvRIrCvk5HvB9mvGZhED7X8BrGIT0Zg4bbszqqEUfCeFeIs hpfRflVdzJLwBzPIatcCnCAjSEtgWZxNInZGyTgJALlOmxQ= X-Received: by 2002:a37:4792:: with SMTP id u140mr2610211qka.327.1588258027121; Thu, 30 Apr 2020 07:47:07 -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: Greentime Hu Date: Thu, 30 Apr 2020 22:45:47 +0800 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 Mailing List Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Zong Li =E6=96=BC 2020=E5=B9=B44=E6=9C=8830=E6=97=A5 = =E9=80=B1=E5=9B=9B =E4=B8=8B=E5=8D=885:53=E5=AF=AB=E9=81=93=EF=BC=9A > > 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. > > 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; Reviewed-by: Greentime Hu