Re: [PATCH v2, part3 02/12] mm/ARM64: kill poison_init_mem()

2013-03-18 Thread Jiang Liu
On 03/18/2013 05:46 AM, Will Deacon wrote:
> On Sat, Mar 16, 2013 at 05:03:23PM +, Jiang Liu wrote:
>> Use free_reserved_area() to kill poison_init_mem() on ARM64.
>>
>> Signed-off-by: Jiang Liu 
>> Cc: Catalin Marinas 
>> Cc: Will Deacon 
>> Cc: linux-arm-ker...@lists.infradead.org
>> Cc: linux-kernel@vger.kernel.org
>> ---
>>  arch/arm64/mm/init.c |   17 +++--
>>  1 file changed, 3 insertions(+), 14 deletions(-)
>>
>> diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
>> index e58dd7f..b87bdb8 100644
>> --- a/arch/arm64/mm/init.c
>> +++ b/arch/arm64/mm/init.c
>> @@ -197,14 +197,6 @@ void __init bootmem_init(void)
>>  max_pfn = max_low_pfn = max;
>>  }
>>  
>> -/*
>> - * Poison init memory with an undefined instruction (0x0).
>> - */
>> -static inline void poison_init_mem(void *s, size_t count)
>> -{
>> -memset(s, 0, count);
>> -}
>> -
>>  #ifndef CONFIG_SPARSEMEM_VMEMMAP
>>  static inline void free_memmap(unsigned long start_pfn, unsigned long 
>> end_pfn)
>>  {
>> @@ -386,8 +378,7 @@ void __init mem_init(void)
>>  
>>  void free_initmem(void)
>>  {
>> -poison_init_mem(__init_begin, __init_end - __init_begin);
>> - free_initmem_default(-1);
>> +free_initmem_default(0);
> 
> This change looks unrelated to $subject. We should probably just poison with
> 0 from the outset, when free_initmem_default is introduced.
Hi Will,
As you have suggested, this patch should be merged into patchset which
introduces free_initmem_default(). I have a plan to merge it in v3, but the v2
patchset has been merged into -mm tree, so I generated another patch against the
mm tree.
free_initmem_default(-1) doesn't poison the freed memory and 
free_initmem_default(0) poisons the freed memory with 0, so it's needed to
kill poison_init_mem().

regards!
Gerry

> 
> Will
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2, part3 02/12] mm/ARM64: kill poison_init_mem()

2013-03-18 Thread Jiang Liu
On 03/18/2013 05:46 AM, Will Deacon wrote:
 On Sat, Mar 16, 2013 at 05:03:23PM +, Jiang Liu wrote:
 Use free_reserved_area() to kill poison_init_mem() on ARM64.

 Signed-off-by: Jiang Liu jiang@huawei.com
 Cc: Catalin Marinas catalin.mari...@arm.com
 Cc: Will Deacon will.dea...@arm.com
 Cc: linux-arm-ker...@lists.infradead.org
 Cc: linux-kernel@vger.kernel.org
 ---
  arch/arm64/mm/init.c |   17 +++--
  1 file changed, 3 insertions(+), 14 deletions(-)

 diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
 index e58dd7f..b87bdb8 100644
 --- a/arch/arm64/mm/init.c
 +++ b/arch/arm64/mm/init.c
 @@ -197,14 +197,6 @@ void __init bootmem_init(void)
  max_pfn = max_low_pfn = max;
  }
  
 -/*
 - * Poison init memory with an undefined instruction (0x0).
 - */
 -static inline void poison_init_mem(void *s, size_t count)
 -{
 -memset(s, 0, count);
 -}
 -
  #ifndef CONFIG_SPARSEMEM_VMEMMAP
  static inline void free_memmap(unsigned long start_pfn, unsigned long 
 end_pfn)
  {
 @@ -386,8 +378,7 @@ void __init mem_init(void)
  
  void free_initmem(void)
  {
 -poison_init_mem(__init_begin, __init_end - __init_begin);
 - free_initmem_default(-1);
 +free_initmem_default(0);
 
 This change looks unrelated to $subject. We should probably just poison with
 0 from the outset, when free_initmem_default is introduced.
Hi Will,
As you have suggested, this patch should be merged into patchset which
introduces free_initmem_default(). I have a plan to merge it in v3, but the v2
patchset has been merged into -mm tree, so I generated another patch against the
mm tree.
free_initmem_default(-1) doesn't poison the freed memory and 
free_initmem_default(0) poisons the freed memory with 0, so it's needed to
kill poison_init_mem().

regards!
Gerry

 
 Will
 --
 To unsubscribe from this list: send the line unsubscribe linux-kernel in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html
 Please read the FAQ at  http://www.tux.org/lkml/
 

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2, part3 02/12] mm/ARM64: kill poison_init_mem()

2013-03-17 Thread Will Deacon
On Sat, Mar 16, 2013 at 05:03:23PM +, Jiang Liu wrote:
> Use free_reserved_area() to kill poison_init_mem() on ARM64.
> 
> Signed-off-by: Jiang Liu 
> Cc: Catalin Marinas 
> Cc: Will Deacon 
> Cc: linux-arm-ker...@lists.infradead.org
> Cc: linux-kernel@vger.kernel.org
> ---
>  arch/arm64/mm/init.c |   17 +++--
>  1 file changed, 3 insertions(+), 14 deletions(-)
> 
> diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
> index e58dd7f..b87bdb8 100644
> --- a/arch/arm64/mm/init.c
> +++ b/arch/arm64/mm/init.c
> @@ -197,14 +197,6 @@ void __init bootmem_init(void)
>   max_pfn = max_low_pfn = max;
>  }
>  
> -/*
> - * Poison init memory with an undefined instruction (0x0).
> - */
> -static inline void poison_init_mem(void *s, size_t count)
> -{
> - memset(s, 0, count);
> -}
> -
>  #ifndef CONFIG_SPARSEMEM_VMEMMAP
>  static inline void free_memmap(unsigned long start_pfn, unsigned long 
> end_pfn)
>  {
> @@ -386,8 +378,7 @@ void __init mem_init(void)
>  
>  void free_initmem(void)
>  {
> - poison_init_mem(__init_begin, __init_end - __init_begin);
> - free_initmem_default(-1);
> + free_initmem_default(0);

This change looks unrelated to $subject. We should probably just poison with
0 from the outset, when free_initmem_default is introduced.

Will
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2, part3 02/12] mm/ARM64: kill poison_init_mem()

2013-03-17 Thread Will Deacon
On Sat, Mar 16, 2013 at 05:03:23PM +, Jiang Liu wrote:
 Use free_reserved_area() to kill poison_init_mem() on ARM64.
 
 Signed-off-by: Jiang Liu jiang@huawei.com
 Cc: Catalin Marinas catalin.mari...@arm.com
 Cc: Will Deacon will.dea...@arm.com
 Cc: linux-arm-ker...@lists.infradead.org
 Cc: linux-kernel@vger.kernel.org
 ---
  arch/arm64/mm/init.c |   17 +++--
  1 file changed, 3 insertions(+), 14 deletions(-)
 
 diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
 index e58dd7f..b87bdb8 100644
 --- a/arch/arm64/mm/init.c
 +++ b/arch/arm64/mm/init.c
 @@ -197,14 +197,6 @@ void __init bootmem_init(void)
   max_pfn = max_low_pfn = max;
  }
  
 -/*
 - * Poison init memory with an undefined instruction (0x0).
 - */
 -static inline void poison_init_mem(void *s, size_t count)
 -{
 - memset(s, 0, count);
 -}
 -
  #ifndef CONFIG_SPARSEMEM_VMEMMAP
  static inline void free_memmap(unsigned long start_pfn, unsigned long 
 end_pfn)
  {
 @@ -386,8 +378,7 @@ void __init mem_init(void)
  
  void free_initmem(void)
  {
 - poison_init_mem(__init_begin, __init_end - __init_begin);
 - free_initmem_default(-1);
 + free_initmem_default(0);

This change looks unrelated to $subject. We should probably just poison with
0 from the outset, when free_initmem_default is introduced.

Will
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2, part3 02/12] mm/ARM64: kill poison_init_mem()

2013-03-16 Thread Jiang Liu
Use free_reserved_area() to kill poison_init_mem() on ARM64.

Signed-off-by: Jiang Liu 
Cc: Catalin Marinas 
Cc: Will Deacon 
Cc: linux-arm-ker...@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 arch/arm64/mm/init.c |   17 +++--
 1 file changed, 3 insertions(+), 14 deletions(-)

diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
index e58dd7f..b87bdb8 100644
--- a/arch/arm64/mm/init.c
+++ b/arch/arm64/mm/init.c
@@ -197,14 +197,6 @@ void __init bootmem_init(void)
max_pfn = max_low_pfn = max;
 }
 
-/*
- * Poison init memory with an undefined instruction (0x0).
- */
-static inline void poison_init_mem(void *s, size_t count)
-{
-   memset(s, 0, count);
-}
-
 #ifndef CONFIG_SPARSEMEM_VMEMMAP
 static inline void free_memmap(unsigned long start_pfn, unsigned long end_pfn)
 {
@@ -386,8 +378,7 @@ void __init mem_init(void)
 
 void free_initmem(void)
 {
-   poison_init_mem(__init_begin, __init_end - __init_begin);
-   free_initmem_default(-1);
+   free_initmem_default(0);
 }
 
 #ifdef CONFIG_BLK_DEV_INITRD
@@ -396,10 +387,8 @@ static int keep_initrd;
 
 void free_initrd_mem(unsigned long start, unsigned long end)
 {
-   if (!keep_initrd) {
-   poison_init_mem((void *)start, PAGE_ALIGN(end) - start);
-   free_reserved_area(start, end, -1, "initrd");
-   }
+   if (!keep_initrd)
+   free_reserved_area(start, end, 0, "initrd");
 }
 
 static int __init keepinitrd_setup(char *__unused)
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2, part3 02/12] mm/ARM64: kill poison_init_mem()

2013-03-16 Thread Jiang Liu
Use free_reserved_area() to kill poison_init_mem() on ARM64.

Signed-off-by: Jiang Liu jiang@huawei.com
Cc: Catalin Marinas catalin.mari...@arm.com
Cc: Will Deacon will.dea...@arm.com
Cc: linux-arm-ker...@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 arch/arm64/mm/init.c |   17 +++--
 1 file changed, 3 insertions(+), 14 deletions(-)

diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
index e58dd7f..b87bdb8 100644
--- a/arch/arm64/mm/init.c
+++ b/arch/arm64/mm/init.c
@@ -197,14 +197,6 @@ void __init bootmem_init(void)
max_pfn = max_low_pfn = max;
 }
 
-/*
- * Poison init memory with an undefined instruction (0x0).
- */
-static inline void poison_init_mem(void *s, size_t count)
-{
-   memset(s, 0, count);
-}
-
 #ifndef CONFIG_SPARSEMEM_VMEMMAP
 static inline void free_memmap(unsigned long start_pfn, unsigned long end_pfn)
 {
@@ -386,8 +378,7 @@ void __init mem_init(void)
 
 void free_initmem(void)
 {
-   poison_init_mem(__init_begin, __init_end - __init_begin);
-   free_initmem_default(-1);
+   free_initmem_default(0);
 }
 
 #ifdef CONFIG_BLK_DEV_INITRD
@@ -396,10 +387,8 @@ static int keep_initrd;
 
 void free_initrd_mem(unsigned long start, unsigned long end)
 {
-   if (!keep_initrd) {
-   poison_init_mem((void *)start, PAGE_ALIGN(end) - start);
-   free_reserved_area(start, end, -1, initrd);
-   }
+   if (!keep_initrd)
+   free_reserved_area(start, end, 0, initrd);
 }
 
 static int __init keepinitrd_setup(char *__unused)
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/