Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1460992 > unrolled thread
| Started by | Jisheng Zhang <jszhang@marvell.com> |
|---|---|
| First post | 2016-08-12 10:10 +0200 |
| Last post | 2016-08-15 08:50 +0200 |
| Articles | 7 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH v3 0/4] arm64: put objects into proper sections Jisheng Zhang <jszhang@marvell.com> - 2016-08-12 10:10 +0200
[PATCH v3 1/4] arm64: vdso: add __init section marker to alloc_vectors_page Jisheng Zhang <jszhang@marvell.com> - 2016-08-12 10:10 +0200
[PATCH v3 3/4] arm64: kaslr: Fix incorrect placement of __initdata and __read_mostly Jisheng Zhang <jszhang@marvell.com> - 2016-08-12 10:10 +0200
Re: [PATCH v3 3/4] arm64: kaslr: Fix incorrect placement of __initdata and __read_mostly Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2016-08-12 14:10 +0200
Re: [PATCH v3 3/4] arm64: kaslr: Fix incorrect placement of __initdata and __read_mostly Jisheng Zhang <jszhang@marvell.com> - 2016-08-15 07:00 +0200
Re: [PATCH v3 3/4] arm64: kaslr: Fix incorrect placement of __initdata and __read_mostly Jisheng Zhang <jszhang@marvell.com> - 2016-08-15 08:10 +0200
Re: [PATCH v3 3/4] arm64: kaslr: Fix incorrect placement of __initdata and __read_mostly Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2016-08-15 08:50 +0200
| From | Jisheng Zhang <jszhang@marvell.com> |
|---|---|
| Date | 2016-08-12 10:10 +0200 |
| Subject | [PATCH v3 0/4] arm64: put objects into proper sections |
| Message-ID | <s5fHr-7yv-5@gated-at.bofh.it> |
This series tries to put some objects into proper sections.
patch1 puts alloc_vectors_page() into .init section. This is a clean up
patch.
patch2 constify vm_special_mapping used for aarch32 vectors page.
patch3 fix the incorrect placement of __initdata and __read_mostly
patch4 apply __ro_after_init to some objects
Previously I only want to mark vdso_pages, vdso_spec, vectors_page and
cpu_ops as __read_mostly for performance reason. Then inspired by
Kees's patch[1], I think __ro_after_init is better.
[1] http://www.spinics.net/lists/arm-kernel/msg523188.html
Changes since v2:
- include <linux/cache.h> for __ro_after_init, thank Mark's suggestions
- make vdso_spec[0].pages and vdso_spec[1].pages assignment style
consistent, thank Mark for pointing it out.
Changes since v1:
- use __ro_after_init instead of __read_mostly
- find more objects to be suitable for __ro_after_init
- add one more patch to fix the incorrect placement of __initdata and
__read_mostly
Jisheng Zhang (4):
arm64: vdso: add __init section marker to alloc_vectors_page
arm64: vdso: constify vm_special_mapping used for aarch32 vectors page
arm64: kaslr: Fix incorrect placement of __initdata and __read_mostly
arm64: apply __ro_after_init to some objects
arch/arm64/kernel/cpu_ops.c | 2 +-
arch/arm64/kernel/kaslr.c | 4 ++--
arch/arm64/kernel/vdso.c | 32 ++++++++++++++++----------------
arch/arm64/mm/dma-mapping.c | 2 +-
arch/arm64/mm/init.c | 4 ++--
arch/arm64/mm/mmu.c | 2 +-
6 files changed, 23 insertions(+), 23 deletions(-)
--
2.8.1
[toc] | [next] | [standalone]
| From | Jisheng Zhang <jszhang@marvell.com> |
|---|---|
| Date | 2016-08-12 10:10 +0200 |
| Subject | [PATCH v3 1/4] arm64: vdso: add __init section marker to alloc_vectors_page |
| Message-ID | <s5fHs-7yv-17@gated-at.bofh.it> |
| In reply to | #1460992 |
It is not needed after booting, this patch moves the alloc_vectors_page
function to the __init section.
Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
---
arch/arm64/kernel/vdso.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm64/kernel/vdso.c b/arch/arm64/kernel/vdso.c
index 076312b..e320e8f 100644
--- a/arch/arm64/kernel/vdso.c
+++ b/arch/arm64/kernel/vdso.c
@@ -55,7 +55,7 @@ struct vdso_data *vdso_data = &vdso_data_store.data;
*/
static struct page *vectors_page[1];
-static int alloc_vectors_page(void)
+static int __init alloc_vectors_page(void)
{
extern char __kuser_helper_start[], __kuser_helper_end[];
extern char __aarch32_sigret_code_start[], __aarch32_sigret_code_end[];
--
2.8.1
[toc] | [prev] | [next] | [standalone]
| From | Jisheng Zhang <jszhang@marvell.com> |
|---|---|
| Date | 2016-08-12 10:10 +0200 |
| Subject | [PATCH v3 3/4] arm64: kaslr: Fix incorrect placement of __initdata and __read_mostly |
| Message-ID | <s5fHs-7yv-19@gated-at.bofh.it> |
| In reply to | #1460992 |
__initdata and __read_mostly should be placed after the variable name
for the variable to be placed in the intended section.
Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
---
arch/arm64/kernel/kaslr.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm64/kernel/kaslr.c b/arch/arm64/kernel/kaslr.c
index b054691..8ebabc4 100644
--- a/arch/arm64/kernel/kaslr.c
+++ b/arch/arm64/kernel/kaslr.c
@@ -20,8 +20,8 @@
#include <asm/pgtable.h>
#include <asm/sections.h>
-u64 __read_mostly module_alloc_base;
-u16 __initdata memstart_offset_seed;
+u64 module_alloc_base __read_mostly;
+u16 memstart_offset_seed __initdata;
static __init u64 get_kaslr_seed(void *fdt)
{
--
2.8.1
[toc] | [prev] | [next] | [standalone]
| From | Ard Biesheuvel <ard.biesheuvel@linaro.org> |
|---|---|
| Date | 2016-08-12 14:10 +0200 |
| Subject | Re: [PATCH v3 3/4] arm64: kaslr: Fix incorrect placement of __initdata and __read_mostly |
| Message-ID | <s5jrI-1rH-15@gated-at.bofh.it> |
| In reply to | #1460994 |
Hi Jisheng,
On 12 August 2016 at 10:01, Jisheng Zhang <jszhang@marvell.com> wrote:
> __initdata and __read_mostly should be placed after the variable name
> for the variable to be placed in the intended section.
>
Why?
> Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
> ---
> arch/arm64/kernel/kaslr.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm64/kernel/kaslr.c b/arch/arm64/kernel/kaslr.c
> index b054691..8ebabc4 100644
> --- a/arch/arm64/kernel/kaslr.c
> +++ b/arch/arm64/kernel/kaslr.c
> @@ -20,8 +20,8 @@
> #include <asm/pgtable.h>
> #include <asm/sections.h>
>
> -u64 __read_mostly module_alloc_base;
> -u16 __initdata memstart_offset_seed;
> +u64 module_alloc_base __read_mostly;
> +u16 memstart_offset_seed __initdata;
>
> static __init u64 get_kaslr_seed(void *fdt)
> {
> --
> 2.8.1
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
[toc] | [prev] | [next] | [standalone]
| From | Jisheng Zhang <jszhang@marvell.com> |
|---|---|
| Date | 2016-08-15 07:00 +0200 |
| Subject | Re: [PATCH v3 3/4] arm64: kaslr: Fix incorrect placement of __initdata and __read_mostly |
| Message-ID | <s6iad-We-1@gated-at.bofh.it> |
| In reply to | #1461138 |
Hi Ard,
On Fri, 12 Aug 2016 14:02:40 +0200 Ard Biesheuvel wrote:
> Hi Jisheng,
>
> On 12 August 2016 at 10:01, Jisheng Zhang <jszhang@marvell.com> wrote:
> > __initdata and __read_mostly should be placed after the variable name
> > for the variable to be placed in the intended section.
> >
>
> Why?
include/linux/init.h says something as:
* For initialized data:
* You should insert __initdata or __initconst between the variable name
* and equal sign followed by value, e.g.:
*
* static int init_variable __initdata = 0;
* static const char linux_logo[] __initconst = { 0x32, 0x36, ... };
and examples in gcc manual also put __attribute__ (...) after variable name.
https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html#Common-Variable-Attributes
Then I grep the source, found most lines (especially arch/arm64/*) put the
__initdata and __read_mostly after the variable name.
However, I built the code with three different gcc, the result looks identical
no matter where these markers put. So the commit msg looks wrong, what about
changes it as
"put __initdata and __read_mostly after the variable name
to keep the style consistent"?
Thanks,
Jisheng
>
> > Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
> > ---
> > arch/arm64/kernel/kaslr.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/arch/arm64/kernel/kaslr.c b/arch/arm64/kernel/kaslr.c
> > index b054691..8ebabc4 100644
> > --- a/arch/arm64/kernel/kaslr.c
> > +++ b/arch/arm64/kernel/kaslr.c
> > @@ -20,8 +20,8 @@
> > #include <asm/pgtable.h>
> > #include <asm/sections.h>
> >
> > -u64 __read_mostly module_alloc_base;
> > -u16 __initdata memstart_offset_seed;
> > +u64 module_alloc_base __read_mostly;
> > +u16 memstart_offset_seed __initdata;
> >
> > static __init u64 get_kaslr_seed(void *fdt)
> > {
> > --
> > 2.8.1
> >
> >
> > _______________________________________________
> > linux-arm-kernel mailing list
> > linux-arm-kernel@lists.infradead.org
> > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
[toc] | [prev] | [next] | [standalone]
| From | Jisheng Zhang <jszhang@marvell.com> |
|---|---|
| Date | 2016-08-15 08:10 +0200 |
| Subject | Re: [PATCH v3 3/4] arm64: kaslr: Fix incorrect placement of __initdata and __read_mostly |
| Message-ID | <s6jfY-1SV-13@gated-at.bofh.it> |
| In reply to | #1462547 |
Hi Ard,
On Mon, 15 Aug 2016 12:52:14 +0800 Jisheng Zhang wrote:
> Hi Ard,
>
> On Fri, 12 Aug 2016 14:02:40 +0200 Ard Biesheuvel wrote:
>
> > Hi Jisheng,
> >
> > On 12 August 2016 at 10:01, Jisheng Zhang <jszhang@marvell.com> wrote:
> > > __initdata and __read_mostly should be placed after the variable name
> > > for the variable to be placed in the intended section.
> > >
> >
> > Why?
>
> include/linux/init.h says something as:
>
> * For initialized data:
> * You should insert __initdata or __initconst between the variable name
> * and equal sign followed by value, e.g.:
> *
> * static int init_variable __initdata = 0;
> * static const char linux_logo[] __initconst = { 0x32, 0x36, ... };
>
> and examples in gcc manual also put __attribute__ (...) after variable name.
>
> https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html#Common-Variable-Attributes
>
> Then I grep the source, found most lines (especially arch/arm64/*) put the
> __initdata and __read_mostly after the variable name.
>
> However, I built the code with three different gcc, the result looks identical
> no matter where these markers put. So the commit msg looks wrong, what about
> changes it as
>
> "put __initdata and __read_mostly after the variable name
> to keep the style consistent"?
After some consideration, I want to drop this patch in newer version since
it's not a bug, just "style"
Thanks for your reviewing,
Jisheng
[toc] | [prev] | [next] | [standalone]
| From | Ard Biesheuvel <ard.biesheuvel@linaro.org> |
|---|---|
| Date | 2016-08-15 08:50 +0200 |
| Subject | Re: [PATCH v3 3/4] arm64: kaslr: Fix incorrect placement of __initdata and __read_mostly |
| Message-ID | <s6jSF-25y-1@gated-at.bofh.it> |
| In reply to | #1462563 |
On 15 August 2016 at 07:57, Jisheng Zhang <jszhang@marvell.com> wrote:
> Hi Ard,
>
> On Mon, 15 Aug 2016 12:52:14 +0800 Jisheng Zhang wrote:
>
>> Hi Ard,
>>
>> On Fri, 12 Aug 2016 14:02:40 +0200 Ard Biesheuvel wrote:
>>
>> > Hi Jisheng,
>> >
>> > On 12 August 2016 at 10:01, Jisheng Zhang <jszhang@marvell.com> wrote:
>> > > __initdata and __read_mostly should be placed after the variable name
>> > > for the variable to be placed in the intended section.
>> > >
>> >
>> > Why?
>>
>> include/linux/init.h says something as:
>>
>> * For initialized data:
>> * You should insert __initdata or __initconst between the variable name
>> * and equal sign followed by value, e.g.:
>> *
>> * static int init_variable __initdata = 0;
>> * static const char linux_logo[] __initconst = { 0x32, 0x36, ... };
>>
>> and examples in gcc manual also put __attribute__ (...) after variable name.
>>
>> https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html#Common-Variable-Attributes
>>
>> Then I grep the source, found most lines (especially arch/arm64/*) put the
>> __initdata and __read_mostly after the variable name.
>>
>> However, I built the code with three different gcc, the result looks identical
>> no matter where these markers put. So the commit msg looks wrong, what about
>> changes it as
>>
>> "put __initdata and __read_mostly after the variable name
>> to keep the style consistent"?
>
> After some consideration, I want to drop this patch in newer version since
> it's not a bug, just "style"
>
OK, thanks for clearing that up. I don't object to the patch, but I
wanted to get confirmation that the current code is also correct.
Thanks,
Ard.
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web