Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1516550 > unrolled thread

[PATCH] tile: handle RO_AFTER_INIT_DATA

Started byChris Metcalf <cmetcalf@mellanox.com>
First post2016-11-07 21:00 +0100
Last post2016-11-08 08:20 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] tile: handle RO_AFTER_INIT_DATA Chris Metcalf <cmetcalf@mellanox.com> - 2016-11-07 21:00 +0100
    Re: [PATCH] tile: handle RO_AFTER_INIT_DATA Heiko Carstens <heiko.carstens@de.ibm.com> - 2016-11-08 08:20 +0100

#1516550 — [PATCH] tile: handle RO_AFTER_INIT_DATA

FromChris Metcalf <cmetcalf@mellanox.com>
Date2016-11-07 21:00 +0100
Subject[PATCH] tile: handle RO_AFTER_INIT_DATA
Message-ID<sAYff-7Eq-33@gated-at.bofh.it>
This is the minimal change to handle RO_AFTER_INIT_DATA.
The tile architecture already marks RO_DATA as read-only in
the kernel, so grouping RO_AFTER_INIT_DATA with RO_DATA, as is
done by default, means the kernel faults in init when it tries
to write to RO_AFTER_INIT_DATA.  For now, just move it past the
end of the RODATA section so it is not specially treated.
---
This is just to fix 4.9; I will post a more complete fix shortly
targeting 4.10.

 arch/tile/kernel/vmlinux.lds.S | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/tile/kernel/vmlinux.lds.S b/arch/tile/kernel/vmlinux.lds.S
index e1baf094fba4..dcd7445c31a2 100644
--- a/arch/tile/kernel/vmlinux.lds.S
+++ b/arch/tile/kernel/vmlinux.lds.S
@@ -1,3 +1,6 @@
+/* Handle ro_after_init data on our own. */
+#define RO_AFTER_INIT_DATA
+
 #include <asm-generic/vmlinux.lds.h>
 #include <asm/page.h>
 #include <asm/cache.h>
@@ -87,6 +90,7 @@ SECTIONS
 
   _sdata = .;                   /* Start of data section */
   RO_DATA_SECTION(PAGE_SIZE)
+  RO_AFTER_INIT_DATA
   RW_DATA_SECTION(L2_CACHE_BYTES, PAGE_SIZE, THREAD_SIZE)
   _edata = .;
 
-- 
2.7.2

[toc] | [next] | [standalone]


#1516895

FromHeiko Carstens <heiko.carstens@de.ibm.com>
Date2016-11-08 08:20 +0100
Message-ID<sB8Rj-6fz-1@gated-at.bofh.it>
In reply to#1516550
On Mon, Nov 07, 2016 at 02:50:27PM -0500, Chris Metcalf wrote:
> This is the minimal change to handle RO_AFTER_INIT_DATA.
> The tile architecture already marks RO_DATA as read-only in
> the kernel, so grouping RO_AFTER_INIT_DATA with RO_DATA, as is
> done by default, means the kernel faults in init when it tries
> to write to RO_AFTER_INIT_DATA.  For now, just move it past the
> end of the RODATA section so it is not specially treated.
> ---
> This is just to fix 4.9; I will post a more complete fix shortly
> targeting 4.10.
> 
>  arch/tile/kernel/vmlinux.lds.S | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/arch/tile/kernel/vmlinux.lds.S b/arch/tile/kernel/vmlinux.lds.S
> index e1baf094fba4..dcd7445c31a2 100644
> --- a/arch/tile/kernel/vmlinux.lds.S
> +++ b/arch/tile/kernel/vmlinux.lds.S
> @@ -1,3 +1,6 @@
> +/* Handle ro_after_init data on our own. */
> +#define RO_AFTER_INIT_DATA
> +
>  #include <asm-generic/vmlinux.lds.h>
>  #include <asm/page.h>
>  #include <asm/cache.h>
> @@ -87,6 +90,7 @@ SECTIONS
> 
>    _sdata = .;                   /* Start of data section */
>    RO_DATA_SECTION(PAGE_SIZE)
> +  RO_AFTER_INIT_DATA
>    RW_DATA_SECTION(L2_CACHE_BYTES, PAGE_SIZE, THREAD_SIZE)
>    _edata = .;

imho, the minimal fix would be to just

#define __ro_after_init __read_mostly

within arch/tile/include/asm/cache.h. That's also what parisc currently
has.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web