2015-07-12 12:15:13

by Minfei Huang

[permalink] [raw]
Subject: [PATCH] x86/mm: Assign the initail value to the pmd_idx

From: Minfei Huang <[email protected]>

The variable pmd_idx is undefined, when we try to start the loop to
calculate the page.

Assign the proper value which indexes the start address to make it work
well.

Signed-off-by: Minfei Huang <[email protected]>
---
arch/x86/mm/init_32.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c
index 8340e45..68aec42 100644
--- a/arch/x86/mm/init_32.c
+++ b/arch/x86/mm/init_32.c
@@ -137,6 +137,7 @@ page_table_range_init_count(unsigned long start, unsigned long end)

vaddr = start;
pgd_idx = pgd_index(vaddr);
+ pmd_idx = pmd_index(vaddr);

for ( ; (pgd_idx < PTRS_PER_PGD) && (vaddr != end); pgd_idx++) {
for (; (pmd_idx < PTRS_PER_PMD) && (vaddr != end);
--
2.2.2


2015-07-20 07:26:35

by Minfei Huang

[permalink] [raw]
Subject: Re: [PATCH] x86/mm: Assign the initail value to the pmd_idx

ping.

Can someone help review this patch?

Thanks
Minfei

On 07/12/15 at 08:18P, Minfei Huang wrote:
> From: Minfei Huang <[email protected]>
>
> The variable pmd_idx is undefined, when we try to start the loop to
> calculate the page.
>
> Assign the proper value which indexes the start address to make it work
> well.
>
> Signed-off-by: Minfei Huang <[email protected]>
> ---
> arch/x86/mm/init_32.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c
> index 8340e45..68aec42 100644
> --- a/arch/x86/mm/init_32.c
> +++ b/arch/x86/mm/init_32.c
> @@ -137,6 +137,7 @@ page_table_range_init_count(unsigned long start, unsigned long end)
>
> vaddr = start;
> pgd_idx = pgd_index(vaddr);
> + pmd_idx = pmd_index(vaddr);
>
> for ( ; (pgd_idx < PTRS_PER_PGD) && (vaddr != end); pgd_idx++) {
> for (; (pmd_idx < PTRS_PER_PMD) && (vaddr != end);
> --
> 2.2.2
>

2015-07-20 18:28:55

by Yinghai Lu

[permalink] [raw]
Subject: Re: [PATCH] x86/mm: Assign the initail value to the pmd_idx

On Sun, Jul 12, 2015 at 5:18 AM, Minfei Huang <[email protected]> wrote:
> From: Minfei Huang <[email protected]>
>
> The variable pmd_idx is undefined, when we try to start the loop to
> calculate the page.
>
> Assign the proper value which indexes the start address to make it work
> well.
>
> Signed-off-by: Minfei Huang <[email protected]>
> ---
> arch/x86/mm/init_32.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c
> index 8340e45..68aec42 100644
> --- a/arch/x86/mm/init_32.c
> +++ b/arch/x86/mm/init_32.c
> @@ -137,6 +137,7 @@ page_table_range_init_count(unsigned long start, unsigned long end)
>
> vaddr = start;
> pgd_idx = pgd_index(vaddr);
> + pmd_idx = pmd_index(vaddr);
>
> for ( ; (pgd_idx < PTRS_PER_PGD) && (vaddr != end); pgd_idx++) {
> for (; (pmd_idx < PTRS_PER_PMD) && (vaddr != end);

Reviewed-by: Yinghai Lu <[email protected]>

Subject: [tip:x86/mm] x86/mm: Initialize pmd_idx in page_table_range_init_count()

Commit-ID: 9962eea9e55f797f05f20ba6448929cab2a9f018
Gitweb: http://git.kernel.org/tip/9962eea9e55f797f05f20ba6448929cab2a9f018
Author: Minfei Huang <[email protected]>
AuthorDate: Sun, 12 Jul 2015 20:18:42 +0800
Committer: Thomas Gleixner <[email protected]>
CommitDate: Mon, 20 Jul 2015 23:14:47 +0200

x86/mm: Initialize pmd_idx in page_table_range_init_count()

The variable pmd_idx is not initialized for the first iteration of the
for loop.

Assign the proper value which indexes the start address.

Fixes: 719272c45b82 'x86, mm: only call early_ioremap_page_table_range_init() once'
Signed-off-by: Minfei Huang <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Reviewed-by: [email protected]
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Thomas Gleixner <[email protected]>
---
arch/x86/mm/init_32.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c
index c8140e1..c23ab1e 100644
--- a/arch/x86/mm/init_32.c
+++ b/arch/x86/mm/init_32.c
@@ -137,6 +137,7 @@ page_table_range_init_count(unsigned long start, unsigned long end)

vaddr = start;
pgd_idx = pgd_index(vaddr);
+ pmd_idx = pmd_index(vaddr);

for ( ; (pgd_idx < PTRS_PER_PGD) && (vaddr != end); pgd_idx++) {
for (; (pmd_idx < PTRS_PER_PMD) && (vaddr != end);