Skip to contentSkip to conversation

xen: correct size of level2_kernel_pgt

PATCH In review Ian Campbell 3 participants 6 messages Oct 29, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen: correct size of level2_kernel_pgt

sizeof(pmd_t *) is 4 bytes on PAE leading to an allocation of only 2048 bytes. The correct size is sizeof(pmd_t) giving us a full page allocation.

Cc Jeremy Fitzhardinge <[email protected]>

---

Applies to mainline since 2.6.36 and to xen.git 2.6.32 based trees

 arch/x86/xen/mmu.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/x86/xen/mmu.c +1 -1
index c237b81..21ed8d7 100644
@@ -2126,7 +2126,7 @@ __init pgd_t *xen_setup_kernel_pagetable(pgd_t *pgd,
 {
 	pmd_t *kernel_pmd;
 
-	level2_kernel_pgt = extend_brk(sizeof(pmd_t *) * PTRS_PER_PMD, PAGE_SIZE);
+	level2_kernel_pgt = extend_brk(sizeof(pmd_t) * PTRS_PER_PMD, PAGE_SIZE);
 
 	max_pfn_mapped = PFN_DOWN(__pa(xen_start_info->pt_base) +
 				  xen_start_info->nr_pt_frames * PAGE_SIZE +
Signature · 1 line
1.5.6.5
#1 lore raw
Quoted 3 lines · Ian Campbell

sizeof(pmd_t *) is 4 bytes on PAE leading to an allocation of only 2048 bytes. The correct size is sizeof(pmd_t) giving us a full page allocation.

Oooooh. Nasty.

J

Quoted 22 lines
Cc Jeremy Fitzhardinge <[email protected]>

---

Applies to mainline since 2.6.36 and to xen.git 2.6.32 based trees

 arch/x86/xen/mmu.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/x86/xen/mmu.c +1 -1
index c237b81..21ed8d7 100644
@@ -2126,7 +2126,7 @@ __init pgd_t *xen_setup_kernel_pagetable(pgd_t *pgd,
 {
 	pmd_t *kernel_pmd;
 
-	level2_kernel_pgt = extend_brk(sizeof(pmd_t *) * PTRS_PER_PMD, PAGE_SIZE);
+	level2_kernel_pgt = extend_brk(sizeof(pmd_t) * PTRS_PER_PMD, PAGE_SIZE);
 
 	max_pfn_mapped = PFN_DOWN(__pa(xen_start_info->pt_base) +
 				  xen_start_info->nr_pt_frames * PAGE_SIZE +
#2 lore raw
In reply to Ian Campbell
Quoted 9 lines · Ian Campbell

sizeof(pmd_t *) is 4 bytes on PAE leading to an allocation of only 2048 bytes. The correct size is sizeof(pmd_t) giving us a full page allocation.

Cc Jeremy Fitzhardinge <[email protected]>

---

Applies to mainline since 2.6.36 and to xen.git 2.6.32 based trees

This is just for 2.6.37?

J

Quoted 16 lines
 arch/x86/xen/mmu.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/x86/xen/mmu.c +1 -1
index c237b81..21ed8d7 100644
@@ -2126,7 +2126,7 @@ __init pgd_t *xen_setup_kernel_pagetable(pgd_t *pgd,
 {
 	pmd_t *kernel_pmd;
 
-	level2_kernel_pgt = extend_brk(sizeof(pmd_t *) * PTRS_PER_PMD, PAGE_SIZE);
+	level2_kernel_pgt = extend_brk(sizeof(pmd_t) * PTRS_PER_PMD, PAGE_SIZE);
 
 	max_pfn_mapped = PFN_DOWN(__pa(xen_start_info->pt_base) +
 				  xen_start_info->nr_pt_frames * PAGE_SIZE +
#3 lore raw
Quoted 5 lines · Jeremy Fitzhardinge
Quoted 4 lines · Ian Campbell

sizeof(pmd_t *) is 4 bytes on PAE leading to an allocation of only 2048 bytes. The correct size is sizeof(pmd_t) giving us a full page allocation.

Quoted 7 lines
Quoted 5 lines
Cc Jeremy Fitzhardinge <[email protected]>

---

Applies to mainline since 2.6.36 and to xen.git 2.6.32 based trees

This is just for 2.6.37?

2.6.36.stable too, I think. I added [email protected] to my patch header but didn't "guilt refresh" so it didn't show up here.

Ian.

Quoted 20 lines

J

Quoted 16 lines
 arch/x86/xen/mmu.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/x86/xen/mmu.c +1 -1
index c237b81..21ed8d7 100644
@@ -2126,7 +2126,7 @@ __init pgd_t *xen_setup_kernel_pagetable(pgd_t *pgd,
 {
 	pmd_t *kernel_pmd;
 
-	level2_kernel_pgt = extend_brk(sizeof(pmd_t *) * PTRS_PER_PMD, PAGE_SIZE);
+	level2_kernel_pgt = extend_brk(sizeof(pmd_t) * PTRS_PER_PMD, PAGE_SIZE);
 
 	max_pfn_mapped = PFN_DOWN(__pa(xen_start_info->pt_base) +
 				  xen_start_info->nr_pt_frames * PAGE_SIZE +
#4 lore raw
Quoted 6 lines · Ian Campbell
Quoted 5 lines · Jeremy Fitzhardinge
Quoted 4 lines · Ian Campbell

sizeof(pmd_t *) is 4 bytes on PAE leading to an allocation of only 2048 bytes. The correct size is sizeof(pmd_t) giving us a full page allocation.

Quoted 8 lines
Quoted 6 lines
Quoted 5 lines
Cc Jeremy Fitzhardinge <[email protected]>

---

Applies to mainline since 2.6.36 and to xen.git 2.6.32 based trees

This is just for 2.6.37?

2.6.36.stable too, I think. I added [email protected] to my patch header but didn't "guilt refresh" so it didn't show up here.

The extend_brk() stuff was all merged this merge window. I checked out .36 to confirm, and there's nothing there for your patch to apply to...

J

#5 lore raw
Quoted 11 lines · Jeremy Fitzhardinge
Quoted 10 lines · Ian Campbell
Quoted 9 lines · Jeremy Fitzhardinge
Quoted 8 lines · Ian Campbell

sizeof(pmd_t *) is 4 bytes on PAE leading to an allocation of only 2048 bytes. The correct size is sizeof(pmd_t) giving us a full page allocation.

Cc Jeremy Fitzhardinge <[email protected]>

---

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
Quoted 1 line

Applies to mainline since 2.6.36 and to xen.git 2.6.32 based trees

This is just for 2.6.37?

2.6.36.stable too, I think. I added [email protected] to my patch header but didn't "guilt refresh" so it didn't show up here.

The extend_brk() stuff was all merged this merge window. I checked out .36 to confirm, and there's nothing there for your patch to apply to...

Ah, I was suffering the classic confusion regarding a branch from before a release getting merged after. Thanks!

Ian.