Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1003620pxf; Thu, 1 Apr 2021 21:10:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzaKC7/b9Zy7zXdN4Tc47Pu0JvzhQnzQE72Fm09v1KTZTLy7yphxLzNmFGOPhifLjlKVgfY X-Received: by 2002:a92:c5c6:: with SMTP id s6mr9419891ilt.186.1617336627524; Thu, 01 Apr 2021 21:10:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617336627; cv=none; d=google.com; s=arc-20160816; b=WJGKhuSJt0Uz7ZQd9nSr9jIgFImPeawcPKVht+mmmZ3eQ68cHVUsUgrIP/oGeBQ5CD lAsE7PF+VU3dtXod3cqQYJ4x9/6jdnoaN3fNGWrSjGiKbs7QawPlBW6rqLVHWLgZmTvJ Spz1Du4QMwqHE+hgWTUnxXTUW0ulOYiMwIr4NTr2n/S3rAj50OSzu7jh6yO6whcWyFbr 4uNM6Q3gsu2Kz5ii1ohFv2yYNU8Bb8H/w47KkmyiZ0/7ZjJGFJofn5j7aeezrSVa7wky JmBHPp1gANdadmKuxi7RxtawmAR66dWz+KicwA7AEmNK2Jh/xF+2EqnqgxxIwucQJXD2 QYOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=meCY3g4ZddcaVFsiixJeKxINO9meMOC/HmZiu7pSnis=; b=hblopwXxp3wvxfZyLJ7nJqlZYOJ9yJ1Uv3Y8iM9f3UqP5zEUAKi2asLpl7J4WrHw0V GgrG4dlYcndzX5MzTyqP3B9sKqLQnmmBsALw/ywUeOFKeZCzNtNJ82xpMrJQzAnN4Hz2 +ec4wdZbFNCceS24U+jxA87XgmAeajUETzOIw8Ve3hBE++JGCrfIa16rTUz6yBYMR6Fj Mlf42IDaIL1tVCxMW1gh5m6o1QnEiMwZAunDYz5imSrtkEHTzmzzK9oC85/WbDVHWihf bIqCBFLbPEVutFqDoJVFR0rzTDsEUPKUnp/OkKGoQcwIL8TwRaSGRfFpNQsg961dvdbk y/dA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@brainfault-org.20150623.gappssmtp.com header.s=20150623 header.b=JbBObYJH; 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 w19si6177690iot.31.2021.04.01.21.10.13; Thu, 01 Apr 2021 21:10:27 -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=@brainfault-org.20150623.gappssmtp.com header.s=20150623 header.b=JbBObYJH; 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 S229532AbhDBEJq (ORCPT + 99 others); Fri, 2 Apr 2021 00:09:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53492 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229685AbhDBEJp (ORCPT ); Fri, 2 Apr 2021 00:09:45 -0400 Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 47950C06178A for ; Thu, 1 Apr 2021 21:09:45 -0700 (PDT) Received: by mail-wr1-x435.google.com with SMTP id o16so3693843wrn.0 for ; Thu, 01 Apr 2021 21:09:45 -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=meCY3g4ZddcaVFsiixJeKxINO9meMOC/HmZiu7pSnis=; b=JbBObYJHzVzwWjRYrtVEvwWuBeATrp4It6u7NUrI90LOdM+HfoHmV+3Cvi1sb96OPI D21x4RUhRG7GTbRhJYZBSUERMEl5wYrQteEPDtOz8xReUQwRPvrq956//qiakIsVMpjE GuLs/mIehb/szAS4EHzdm089SS4+pgmwOJX0XG4qSmZU+qMtvrJkQ8/i8EsJyqZBeYj3 mSNZOrkFdJE4wskQEjbVErZtcpMueMUg/RsR35auYUwjCIwe1iu0aL+Dy4e34WVban3h OduQYY0kFjCT1ETwZQgfn0o5ZeDeDbiAOgNHue6+HuvvRkuKfN5NM3fq+4p392TL+Cu4 sr9Q== 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=meCY3g4ZddcaVFsiixJeKxINO9meMOC/HmZiu7pSnis=; b=ttE9RFf59dABnE4rN05kV/hABYzmKXN9fX9+w6F+E+GEXlR1ar2xw/rnvIweA626Ek kCmBsU+S35Rp56wLV/N21MajiLwvj2Ut0j9JiFe12G4t+gL7Snz2xvSfcw1c5TgWlt8e JXaTqjtz0Y5XwT/k8C2KMHW8f9feCtwQCzKsIIlUIT4Owv21WQDz0QvKXi4eOUDtp5C1 /nHZ3dAJ2iVE1XBWr4l6/AuGtGdtMKY5pNMXJnv0dYQykiKqKZco1CqN7GzBhpm3cWpP 1U5zDDE6lpF9PRbP11Kjbj30BEEGP6IYV33uNJEuH2dSRlpnmUa6rUYOgXpqt5MeYUEh X7+w== X-Gm-Message-State: AOAM530qZzAHeMfNxjUQkck3jiFDO9dYDIvL3ZlgBwjXUViT42b0kc+J StCtsg4/SQpr3vF4bDpQitbAnZcNi2lz9UJZnqK/xA== X-Received: by 2002:adf:9544:: with SMTP id 62mr12946985wrs.128.1617336583795; Thu, 01 Apr 2021 21:09:43 -0700 (PDT) MIME-Version: 1.0 References: <20210401002442.2fe56b88@xhacker> <20210401002551.0ddbacf9@xhacker> In-Reply-To: <20210401002551.0ddbacf9@xhacker> From: Anup Patel Date: Fri, 2 Apr 2021 09:39:32 +0530 Message-ID: Subject: Re: [PATCH v2 2/9] riscv: Mark some global variables __ro_after_init To: Jisheng Zhang Cc: Paul Walmsley , Palmer Dabbelt , Albert Ou , Andrey Ryabinin , Alexander Potapenko , Andrey Konovalov , Dmitry Vyukov , =?UTF-8?B?QmrDtnJuIFTDtnBlbA==?= , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Song Liu , Yonghong Song , John Fastabend , KP Singh , Luke Nelson , Xi Wang , linux-riscv , "linux-kernel@vger.kernel.org List" , kasan-dev@googlegroups.com, netdev@vger.kernel.org, bpf@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 31, 2021 at 10:01 PM Jisheng Zhang wrote: > > From: Jisheng Zhang > > All of these are never modified after init, so they can be > __ro_after_init. > > Signed-off-by: Jisheng Zhang Looks good to me. Reviewed-by: Anup Patel Regards, Anup > --- > arch/riscv/kernel/sbi.c | 8 ++++---- > arch/riscv/kernel/smp.c | 4 ++-- > arch/riscv/kernel/time.c | 2 +- > arch/riscv/kernel/vdso.c | 4 ++-- > arch/riscv/mm/init.c | 6 +++--- > 5 files changed, 12 insertions(+), 12 deletions(-) > > diff --git a/arch/riscv/kernel/sbi.c b/arch/riscv/kernel/sbi.c > index d3bf756321a5..cbd94a72eaa7 100644 > --- a/arch/riscv/kernel/sbi.c > +++ b/arch/riscv/kernel/sbi.c > @@ -11,14 +11,14 @@ > #include > > /* default SBI version is 0.1 */ > -unsigned long sbi_spec_version = SBI_SPEC_VERSION_DEFAULT; > +unsigned long sbi_spec_version __ro_after_init = SBI_SPEC_VERSION_DEFAULT; > EXPORT_SYMBOL(sbi_spec_version); > > -static void (*__sbi_set_timer)(uint64_t stime); > -static int (*__sbi_send_ipi)(const unsigned long *hart_mask); > +static void (*__sbi_set_timer)(uint64_t stime) __ro_after_init; > +static int (*__sbi_send_ipi)(const unsigned long *hart_mask) __ro_after_init; > static int (*__sbi_rfence)(int fid, const unsigned long *hart_mask, > unsigned long start, unsigned long size, > - unsigned long arg4, unsigned long arg5); > + unsigned long arg4, unsigned long arg5) __ro_after_init; > > struct sbiret sbi_ecall(int ext, int fid, unsigned long arg0, > unsigned long arg1, unsigned long arg2, > diff --git a/arch/riscv/kernel/smp.c b/arch/riscv/kernel/smp.c > index ea028d9e0d24..504284d49135 100644 > --- a/arch/riscv/kernel/smp.c > +++ b/arch/riscv/kernel/smp.c > @@ -30,7 +30,7 @@ enum ipi_message_type { > IPI_MAX > }; > > -unsigned long __cpuid_to_hartid_map[NR_CPUS] = { > +unsigned long __cpuid_to_hartid_map[NR_CPUS] __ro_after_init = { > [0 ... NR_CPUS-1] = INVALID_HARTID > }; > > @@ -85,7 +85,7 @@ static void ipi_stop(void) > wait_for_interrupt(); > } > > -static struct riscv_ipi_ops *ipi_ops; > +static struct riscv_ipi_ops *ipi_ops __ro_after_init; > > void riscv_set_ipi_ops(struct riscv_ipi_ops *ops) > { > diff --git a/arch/riscv/kernel/time.c b/arch/riscv/kernel/time.c > index 1b432264f7ef..8217b0f67c6c 100644 > --- a/arch/riscv/kernel/time.c > +++ b/arch/riscv/kernel/time.c > @@ -11,7 +11,7 @@ > #include > #include > > -unsigned long riscv_timebase; > +unsigned long riscv_timebase __ro_after_init; > EXPORT_SYMBOL_GPL(riscv_timebase); > > void __init time_init(void) > diff --git a/arch/riscv/kernel/vdso.c b/arch/riscv/kernel/vdso.c > index 3f1d35e7c98a..25a3b8849599 100644 > --- a/arch/riscv/kernel/vdso.c > +++ b/arch/riscv/kernel/vdso.c > @@ -20,8 +20,8 @@ > > extern char vdso_start[], vdso_end[]; > > -static unsigned int vdso_pages; > -static struct page **vdso_pagelist; > +static unsigned int vdso_pages __ro_after_init; > +static struct page **vdso_pagelist __ro_after_init; > > /* > * The vDSO data page. > diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c > index 76bf2de8aa59..719ec72ef069 100644 > --- a/arch/riscv/mm/init.c > +++ b/arch/riscv/mm/init.c > @@ -149,11 +149,11 @@ void __init setup_bootmem(void) > } > > #ifdef CONFIG_MMU > -static struct pt_alloc_ops pt_ops; > +static struct pt_alloc_ops pt_ops __ro_after_init; > > -unsigned long va_pa_offset; > +unsigned long va_pa_offset __ro_after_init; > EXPORT_SYMBOL(va_pa_offset); > -unsigned long pfn_base; > +unsigned long pfn_base __ro_after_init; > EXPORT_SYMBOL(pfn_base); > > pgd_t swapper_pg_dir[PTRS_PER_PGD] __page_aligned_bss; > -- > 2.31.0 > > > > _______________________________________________ > linux-riscv mailing list > linux-riscv@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-riscv