x86: Use BRK to pre mapping page table to make xen happy
cover x86: Use BRK to pre mapping page table to make xen happy
on top of current linus/master and tip/x86/mm2, but please zap last patch in that branch.
1. use brk to mapping first PMD_SIZE range under end of ram.
2. top down to initialize page table range by range.
3. get rid of calculate_page_table, and find_early_page_table.
4. remove early_ioremap in page table accessing.
5. remove workaround in xen to mark page RO.
v2: changes, update xen interface about pagetable_reserve, so not
use pgt_buf_* in xen code directly.
v3: use range top-down to initialize page table, so will not use
calculating/find early table anymore.
also reorder the patches sequence.
v4: add mapping_mark_page_ro to fix xen, also move pgt_buf_* to init.c
and merge alloc_low_page(), and for 32bit need to add alloc_low_pages to fix 32bit kmap setting.
v5: remove mark_page_ro workaround.
Add another 5 cleanup patches.
could be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/yinghai/linux-yinghai.git for-x86-mm
Yinghai Lu (19):
x86, mm: Align start address to correct big page size
x86, mm: Use big page size for small memory range
x86, mm: Don't clear page table if range is ram
x86, mm: only keep initial mapping for ram
x86, mm: Break down init_all_memory_mapping
x86, mm: setup page table in top-down
x86, mm: Remove early_memremap workaround for page table accessing on 64bit x86, mm: Remove parameter in alloc_low_page for 64bit
x86, mm: Merge alloc_low_page between 64bit and 32bit
x86, mm: Move min_pfn_mapped back to mm/init.c
x86, mm, xen: Remove mapping_pagatable_reserve
x86, mm: Add alloc_low_pages(num)
x86, mm: only call early_ioremap_page_table_range_init() once x86, mm: Move back pgt_buf_* to mm/init.c
x86, mm: Move init_gbpages() out of setup.c
x86, mm: change low/hignmem_pfn_init to static on 32bit
x86, mm: Move function declaration into mm_internal.h
x86, mm: Let "memmap=" take more entries one time
x86, mm: Add check before clear pte above max_low_pfn on 32bit
arch/x86/include/asm/init.h | 20 +-- arch/x86/include/asm/pgtable.h | 1 + arch/x86/include/asm/pgtable_types.h | 1 - arch/x86/include/asm/x86_init.h | 12 -- arch/x86/kernel/e820.c | 16 ++- arch/x86/kernel/setup.c | 17 +-- arch/x86/kernel/x86_init.c | 4 - arch/x86/mm/init.c | 355 +++++++++++++++++----------------- arch/x86/mm/init_32.c | 85 ++++++--- arch/x86/mm/init_64.c | 119 +++-------- arch/x86/mm/mm_internal.h | 17 ++ arch/x86/xen/mmu.c | 28 --- 12 files changed, 308 insertions(+), 367 deletions(-) create mode 100644 arch/x86/mm/mm_internal.h
Signature · 1 line
1.7.7
PATCH 1/3 ACPI: Introduce a new acpi handle to determine HID match.
From: Tang Chen <[email protected]>
We need to find out if one handle is for root bridge, and install notify handler for it to handle pci root bus hot add.
At that time, root bridge acpi device is not created yet.
So acpi_match_device_ids() will not work.
This patch add a function to check if new acpi handle's HID matches a list of IDs. The new api use acpi_device_info instead acpi_device.
-v2: updated changelog, also check length for string info...
change checking sequence by moving string comaring close to for loop.
- Yinghai
--- drivers/acpi/scan.c | 33 +++++++++++++++++++++++++++++++++ include/acpi/acpi_bus.h | 2 ++ 2 files changed, 35 insertions(+), 0 deletions(-)
drivers/acpi/scan.c +33 -0
@@ -312,6 +312,39 @@ int acpi_match_device_ids(struct acpi_device *device, }EXPORT_SYMBOL (acpi_match_device_ids); +int acpi_match_object_info_ids (struct acpi_device_info *info, +const struct acpi_device_id *ids) +{ +const struct acpi_device_id *id; +char *str; +u32 len; +int i; + + len = info->hardware_id.length; +if (len) { + str = info->hardware_id.string; +if (str) +for (id = ids; id->id[0 ]; id++) +if (!strcmp ((char *)id->id, str)) +return 0 ; + } + +for (i =0 ; i < info->compatible_id_list.count; i++) { + len = info->compatible_id_list.ids[i].length; +if (!len) +continue ; + str = info->compatible_id_list.ids[i].string; +if (!str) +continue ; +for (id = ids; id->id[0 ]; id++) +if (!strcmp ((char *)id->id, str)) +return 0 ; + } + +return -ENOENT ; +} +EXPORT_SYMBOL (acpi_match_object_info_ids); +static void acpi_free_ids (struct acpi_device *device) {struct acpi_hardware_id *id, *tmp;
include/acpi/acpi_bus.h +2 -0
@@ -374,6 +374,8 @@ int acpi_bus_start(struct acpi_device *device);acpi_status acpi_bus_get_ejd (acpi_handle handle,acpi_handle * ejd);int acpi_match_device_ids (struct acpi_device *device,const struct acpi_device_id *ids); +int acpi_match_object_info_ids (struct acpi_device_info *info, +const struct acpi_device_id *ids);int acpi_create_dir (struct acpi_device *);void acpi_remove_dir (struct acpi_device *);
Signature · 1 line
1.7.7
Re: [PATCH 1/3] ACPI: Introduce a new acpi handle to determine HID match.
Quoted 54 lines · Yinghai Lu
From: Tang Chen <[email protected]>
We need to find out if one handle is for root bridge, and install notify handler for it to handle pci root bus hot add.
At that time, root bridge acpi device is not created yet.So
acpi_match_device_ids()will not work.This patch add a function to check if new acpi handle's HID matches a list of IDs. The new api use
acpi_device_infoinsteadacpi_device.-v2: updated changelog, also check length for string info...
change checking sequence by moving string comaring close to for loop.
- YinghaiSigned-off-by Tang Chen <[email protected]>Signed-off-by Yinghai Lu <[email protected]>Cc Len Brown <[email protected]>--- drivers/acpi/scan.c | 33 +++++++++++++++++++++++++++++++++ include/acpi/acpi_bus.h | 2 ++ 2 files changed, 35 insertions(+), 0 deletions(-)drivers/acpi/scan.c +22
-0@@ -312,6 +312,39 @@ int acpi_match_device_ids(struct acpi_device *device, }EXPORT_SYMBOL (acpi_match_device_ids); +int acpi_match_object_info_ids (struct acpi_device_info *info, +const struct acpi_device_id *ids) +{ +const struct acpi_device_id *id; +char *str; +u32 len; +int i; + + len = info->hardware_id.length; +if (len) { + str = info->hardware_id.string; +if (str) +for (id = ids; id->id[0 ]; id++) +if (!strcmp ((char *)id->id, str)) +return 0 ; + } + +for (i =0 ; i < info->compatible_id_list.count; i++) { + len = info->compatible_id_list.ids[i].length; +if (!len) +continue ; + str = info->compatible_id_list.ids[i].string;
drivers/acpi/scan.c int acpi_match_device_ids(struct acpi_device *device, · line 346
Quoted 10 lines
drivers/acpi/scan.c +10
-0+if (!str) +continue ; +for (id = ids; id->id[0 ]; id++) +if (!strcmp ((char *)id->id, str)) +return 0 ; + } + +return -ENOENT ; +} +EXPORT_SYMBOL (acpi_match_object_info_ids);
EXPORT_SYMBOL_GPL, please?
Quoted 9 lines
drivers/acpi/scan.c +1
-0+static void acpi_free_ids (struct acpi_device *device) {struct acpi_hardware_id *id, *tmp;include/acpi/acpi_bus.h +0
-0
include/acpi/acpi_bus.h int acpi_bus_start(struct acpi_device *device); · line 380
Quoted 7 lines
include/acpi/acpi_bus.h +2
-0@@ -374,6 +374,8 @@ int acpi_bus_start(struct acpi_device *device);acpi_status acpi_bus_get_ejd (acpi_handle handle,acpi_handle * ejd);int acpi_match_device_ids (struct acpi_device *device,const struct acpi_device_id *ids); +int acpi_match_object_info_ids (struct acpi_device_info *info, +const struct acpi_device_id *ids);int acpi_create_dir (struct acpi_device *);void acpi_remove_dir (struct acpi_device *);
I wonder which code path(s) is(are) going to use the new routine?
Rafael
Signature · 2 lines
I speak only for myself. Rafael J. Wysocki, Intel Open Source Technology Center.
Re: [PATCH 1/3] ACPI: Introduce a new acpi handle to determine HID match.
Quoted 59 lines · Rafael J. Wysocki
Quoted 58 lines · Yinghai Lu
From: Tang Chen <[email protected]>
We need to find out if one handle is for root bridge, and install notify handler for it to handle pci root bus hot add.
At that time, root bridge acpi device is not created yet.So
acpi_match_device_ids()will not work.This patch add a function to check if new acpi handle's HID matches a list of IDs. The new api use
acpi_device_infoinsteadacpi_device.-v2: updated changelog, also check length for string info...
change checking sequence by moving string comaring close to for loop.
- YinghaiSigned-off-by Tang Chen <[email protected]>Signed-off-by Yinghai Lu <[email protected]>Cc Len Brown <[email protected]>--- drivers/acpi/scan.c | 33 +++++++++++++++++++++++++++++++++ include/acpi/acpi_bus.h | 2 ++ 2 files changed, 35 insertions(+), 0 deletions(-)drivers/acpi/scan.c +26
-0@@ -312,6 +312,39 @@ int acpi_match_device_ids(struct acpi_device *device, }EXPORT_SYMBOL (acpi_match_device_ids); +int acpi_match_object_info_ids (struct acpi_device_info *info, +const struct acpi_device_id *ids) +{ +const struct acpi_device_id *id; +char *str; +u32 len; +int i; + + len = info->hardware_id.length; +if (len) { + str = info->hardware_id.string; +if (str) +for (id = ids; id->id[0 ]; id++) +if (!strcmp ((char *)id->id, str)) +return 0 ; + } + +for (i =0 ; i < info->compatible_id_list.count; i++) { + len = info->compatible_id_list.ids[i].length; +if (!len) +continue ; + str = info->compatible_id_list.ids[i].string; +if (!str) +continue ; +for (id = ids; id->id[0 ]; id++) +if (!strcmp ((char *)id->id, str))
Quoted 8 lines
drivers/acpi/scan.c int acpi_match_device_ids(struct acpi_device *device, · line 346
Quoted 6 lines
drivers/acpi/scan.c +6
-0+return 0 ; + } + +return -ENOENT ; +} +EXPORT_SYMBOL (acpi_match_object_info_ids);
EXPORT_SYMBOL_GPL, please?
yes, will change that while sending next version..
Quoted 11 lines
Quoted 11 lines
drivers/acpi/scan.c +1
-0+static void acpi_free_ids (struct acpi_device *device) {struct acpi_hardware_id *id, *tmp;include/acpi/acpi_bus.h +0
-0@@ -374,6 +374,8 @@ int acpi_bus_start(struct acpi_device *device);acpi_status acpi_bus_get_ejd (acpi_handle handle,acpi_handle * ejd);
Quoted 8 lines
include/acpi/acpi_bus.h int acpi_bus_start(struct acpi_device *device); · line 380
Quoted 6 lines
include/acpi/acpi_bus.h +2
-0int acpi_match_device_ids (struct acpi_device *device,const struct acpi_device_id *ids); +int acpi_match_object_info_ids (struct acpi_device_info *info, +const struct acpi_device_id *ids);int acpi_create_dir (struct acpi_device *);void acpi_remove_dir (struct acpi_device *);I wonder which code path(s) is(are) going to use the new routine?
that is for installing handler for pci root bus removal. will resend them in batch 3.
http://git.kernel.org/?p=linux/kernel/git/yinghai/linux-yinghai.git;a=commitdiff;h=b3752f4571a3db1bbbaf204a6cb85aadbd40b19d
PCI, acpiphp: Separate out hot-add support of pci host bridge
http://git.kernel.org/?p=linux/kernel/git/yinghai/linux-yinghai.git;a=commitdiff;h=bda84c28ae8e00315fcc7dffceb301e082369c3e
PCI: correctly detect ACPI PCI host bridge objects
PATCH 1/19 x86, mm: Align start address to correct big page size
In reply to Yinghai LuWe are going to use buffer in BRK to pre-map page table buffer.
Page table buffer could be only page aligned, but range around it are ram too, we could use bigger page to map it to avoid small pages.
We will adjust page_size_mask in next patch to use big page size for small ram range.
Before that, this patch will make start address to be aligned down according to bigger page size, otherwise entry in page page will not have correct value.
--- arch/x86/mm/init_32.c | 1 + arch/x86/mm/init_64.c | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-)
arch/x86/mm/init_32.c +1 -0
@@ -310,6 +310,7 @@ repeat:__pgprot (PTE_IDENT_ATTR | _PAGE_PSE); + pfn &=PMD_MASK >>PAGE_SHIFT ; addr2 = (pfn +PTRS_PER_PTE -1 ) *PAGE_SIZE +PAGE_OFFSET +PAGE_SIZE -1 ;
arch/x86/mm/init_64.c +3 -2
@@ -461,7 +461,7 @@ phys_pmd_init(pmd_t *pmd_page, unsigned long address, unsigned long end, pages++;spin_lock (&init_mm.page_table_lock);set_pte ((pte_t *)pmd, -pfn_pte (address >>PAGE_SHIFT , +pfn_pte ((address &PMD_MASK ) >>PAGE_SHIFT ,__pgprot (pgprot_val (prot) | _PAGE_PSE)));spin_unlock (&init_mm.page_table_lock); last_map_addr = next;
@@ -536,7 +536,8 @@ phys_pud_init(pud_t *pud_page, unsigned long addr, unsigned long end, pages++;spin_lock (&init_mm.page_table_lock);set_pte ((pte_t *)pud, -pfn_pte (addr >>PAGE_SHIFT ,PAGE_KERNEL_LARGE )); +pfn_pte ((addr &PUD_MASK ) >>PAGE_SHIFT , +PAGE_KERNEL_LARGE ));spin_unlock (&init_mm.page_table_lock); last_map_addr = next;continue ;
Signature · 1 line
1.7.7
Re: [PATCH 01/19] x86, mm: Align start address to correct big page size
Quoted 1 line · Yinghai Lu
I am pretty sure I gave you some ideas of how to fix up the commit description in earlier reviews, but it looks like you missed them.
Let me write them here once more.
Quoted 1 line
We are going to use buffer in BRK to pre-map page table buffer.
What buffer? Is buffer the same thing as page table?
Quoted 2 lines
Page table buffer could be only page aligned, but range around it are
.. ranges
Quoted 3 lines
ram too, we could use bigger page to map it to avoid small pages.
We will adjust
page_size_maskin next patch to use big page size for
Instead of saying "next patch" - include the title of the patch so that one can search for it.
Quoted 3 lines
small ram range.
Before that, this patch will make start address to be aligned down
s/will make/made/
Quoted 2 lines
according to bigger page size, otherwise entry in page page will not have correct value.
I would structure this git commit description to first introduce the problem.
Say at the start of the patch:
"Before this patch, the start address was aligned down according to bigger a page size (1GB, 2MB). This is a problem b/c an entry in the page table will not have correct value. "
Here can you explain why it does not have the correct value?
Quoted 51 lines
Signed-off-by Yinghai Lu <[email protected]>--- arch/x86/mm/init_32.c | 1 + arch/x86/mm/init_64.c | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-)arch/x86/mm/init_32.c +1
-0@@ -310,6 +310,7 @@ repeat:__pgprot (PTE_IDENT_ATTR | _PAGE_PSE); + pfn &=PMD_MASK >>PAGE_SHIFT ; addr2 = (pfn +PTRS_PER_PTE -1 ) *PAGE_SIZE +PAGE_OFFSET +PAGE_SIZE -1 ;arch/x86/mm/init_64.c +3
-2@@ -461,7 +461,7 @@ phys_pmd_init(pmd_t *pmd_page, unsigned long address, unsigned long end, pages++;spin_lock (&init_mm.page_table_lock);set_pte ((pte_t *)pmd, -pfn_pte (address >>PAGE_SHIFT , +pfn_pte ((address &PMD_MASK ) >>PAGE_SHIFT ,__pgprot (pgprot_val (prot) | _PAGE_PSE)));spin_unlock (&init_mm.page_table_lock); last_map_addr = next;@@ -536,7 +536,8 @@ phys_pud_init(pud_t *pud_page, unsigned long addr, unsigned long end, pages++;spin_lock (&init_mm.page_table_lock);set_pte ((pte_t *)pud, -pfn_pte (addr >>PAGE_SHIFT ,PAGE_KERNEL_LARGE )); +pfn_pte ((addr &PUD_MASK ) >>PAGE_SHIFT , +PAGE_KERNEL_LARGE ));spin_unlock (&init_mm.page_table_lock); last_map_addr = next;continue ;Signature · 7 lines
1.7.7 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 01/19] x86, mm: Align start address to correct big page size
Quoted 42 lines · Konrad Rzeszutek Wilk
Quoted 1 line · Yinghai Lu
I am pretty sure I gave you some ideas of how to fix up the commit description in earlier reviews, but it looks like you missed them.
Let me write them here once more.
Quoted 1 line
We are going to use buffer in BRK to pre-map page table buffer.
What buffer? Is buffer the same thing as page table?
Quoted 2 lines
Page table buffer could be only page aligned, but range around it are
.. ranges
Quoted 3 lines
ram too, we could use bigger page to map it to avoid small pages.
We will adjust
page_size_maskin next patch to use big page size forInstead of saying "next patch" - include the title of the patch so that one can search for it.
Quoted 3 lines
small ram range.
Before that, this patch will make start address to be aligned down
s/will make/made/
Quoted 2 lines
according to bigger page size, otherwise entry in page page will not have correct value.
I would structure this git commit description to first introduce the problem.
Say at the start of the patch:
"Before this patch, the start address was aligned down according to bigger a page size (1GB, 2MB). This is a problem b/c an entry in the page table will not have correct value. "
Here can you explain why it does not have the correct value?
Quoted 15 lines
Quoted 5 lines
arch/x86/mm/init_64.c +1
-0+pfn_pte ((address &PMD_MASK ) >>PAGE_SHIFT , __pgprot(pgprot_val(prot) | _PAGE_PSE)));spin_unlock (&init_mm.page_table_lock); last_map_addr = next;arch/x86/mm/init_64.c phys_pud_init(pud_t *pud_page, unsigned long addr, unsigned long end,
Quoted 10 lines
arch/x86/mm/init_64.c +2
-2@@ -536,7 +536,8 @@ phys_pud_init(pud_t *pud_page, unsigned long addr, unsigned long end, pages++;spin_lock (&init_mm.page_table_lock);set_pte ((pte_t *)pud, -pfn_pte (addr >>PAGE_SHIFT ,PAGE_KERNEL_LARGE )); +pfn_pte ((addr &PUD_MASK ) >>PAGE_SHIFT , +PAGE_KERNEL_LARGE ));spin_unlock (&init_mm.page_table_lock); last_map_addr = next;continue ; --
will update commit log to:
----
We are going to use buffer in BRK to map small range just under memory top, and use those new mapped ram to map low ram range under it.
The ram range that will be mapped at fist could be only page aligned, but ranges around it are ram too, we could use bigger page to map it to avoid small pages.
We will adjust page_size_mask in following patch:
x86, mm: Use big page size for small memory range
to use big page size for small ram range.
Before that patch, this patch will make sure start address to be aligned down according to bigger page size, otherwise entry in page page will not have correct value.
---
PATCH 2/19 x86, mm: Use big page size for small memory range
In reply to Yinghai LuWe could map small range in the middle of big range at first, so should use big page size at first to avoid using small page size to break down page table.
Only can set big page bit when that range has ram area around it.
-v2: fix 32bit boundary checking. We can not count ram above max_low_pfn
for 32 bit.
--- arch/x86/mm/init.c | 37 +++++++++++++++++++++++++++++++++++++ 1 files changed, 37 insertions(+), 0 deletions(-)
arch/x86/mm/init.c +37 -0
@@ -88,6 +88,40 @@ static int __meminit save_mr(struct map_range *mr, int nr_range,return nr_range; } +/* +* adjust the page_size_mask for small range to go with +* big page size instead small one if nearby are ram too. +*/ +static void __init_refok adjust_range_page_size_mask(struct map_range *mr, +int nr_range) +{ +int i; + +for (i =0 ; i < nr_range; i++) { +if ((page_size_mask & (1 <<PG_LEVEL_2M )) && + !(mr[i].page_size_mask & (1 <<PG_LEVEL_2M ))) { +unsigned long start =round_down (mr[i].start,PMD_SIZE ); +unsigned long end =round_up (mr[i].end,PMD_SIZE ); + +#ifdef CONFIG_X86_32 +if ((end >>PAGE_SHIFT ) > max_low_pfn) +continue ; +#endif + +if (memblock_is_region_memory (start, end - start)) + mr[i].page_size_mask |=1 <<PG_LEVEL_2M ; + } +if ((page_size_mask & (1 <<PG_LEVEL_1G )) && + !(mr[i].page_size_mask & (1 <<PG_LEVEL_1G ))) { +unsigned long start =round_down (mr[i].start,PUD_SIZE ); +unsigned long end =round_up (mr[i].end,PUD_SIZE ); + +if (memblock_is_region_memory (start, end - start)) + mr[i].page_size_mask |=1 <<PG_LEVEL_1G ; + } + } +} +static int __meminit split_mem_range (struct map_range *mr,int nr_range,unsigned long start,unsigned long end)
@@ -182,6 +216,9 @@ static int __meminit split_mem_range(struct map_range *mr, int nr_range, nr_range--; } +if (!after_bootmem) +adjust_range_page_size_mask (mr, nr_range); +for (i =0 ; i < nr_range; i++) printk(KERN_DEBUG " [mem %#010lx-%#010lx] page %s\n", mr[i].start, mr[i].end - 1,
Signature · 1 line
1.7.7
Re: [PATCH 02/19] x86, mm: Use big page size for small memory range
Quoted 4 lines · Yinghai Lu
We could map small range in the middle of big range at first, so should use big page size at first to avoid using small page size to break down page table.
Only can set big page bit when that range has ram area around it.
The code looks good.
I would alter the description to say:
(Describe the problem)
"We are wasting entries in the page-table b/c are not taking advantage of the fact that adjoining ranges could be of the same type and coalescing them together. Instead we end up using the small size type."
(Explain your patch).
"We fix this by iterating over the ranges, detecting whether the ranges that are next to each other are of the same type - and if so set them to our type."
Quoted 73 lines
-v2: fix 32bit boundary checking. We can not count ram above
max_low_pfnfor 32 bit.Signed-off-by Yinghai Lu <[email protected]>--- arch/x86/mm/init.c | 37 +++++++++++++++++++++++++++++++++++++ 1 files changed, 37 insertions(+), 0 deletions(-)arch/x86/mm/init.c +37
-0@@ -88,6 +88,40 @@ static int __meminit save_mr(struct map_range *mr, int nr_range,return nr_range; } +/* +* adjust the page_size_mask for small range to go with +* big page size instead small one if nearby are ram too. +*/ +static void __init_refok adjust_range_page_size_mask(struct map_range *mr, +int nr_range) +{ +int i; + +for (i =0 ; i < nr_range; i++) { +if ((page_size_mask & (1 <<PG_LEVEL_2M )) && + !(mr[i].page_size_mask & (1 <<PG_LEVEL_2M ))) { +unsigned long start =round_down (mr[i].start,PMD_SIZE ); +unsigned long end =round_up (mr[i].end,PMD_SIZE ); + +#ifdef CONFIG_X86_32 +if ((end >>PAGE_SHIFT ) > max_low_pfn) +continue ; +#endif + +if (memblock_is_region_memory (start, end - start)) + mr[i].page_size_mask |=1 <<PG_LEVEL_2M ; + } +if ((page_size_mask & (1 <<PG_LEVEL_1G )) && + !(mr[i].page_size_mask & (1 <<PG_LEVEL_1G ))) { +unsigned long start =round_down (mr[i].start,PUD_SIZE ); +unsigned long end =round_up (mr[i].end,PUD_SIZE ); + +if (memblock_is_region_memory (start, end - start)) + mr[i].page_size_mask |=1 <<PG_LEVEL_1G ; + } + } +} +static int __meminit split_mem_range (struct map_range *mr,int nr_range,unsigned long start,unsigned long end)@@ -182,6 +216,9 @@ static int __meminit split_mem_range(struct map_range *mr, int nr_range, nr_range--; } +if (!after_bootmem) +adjust_range_page_size_mask (mr, nr_range); +for (i =0 ; i < nr_range; i++) printk(KERN_DEBUG " [mem %#010lx-%#010lx] page %s\n", mr[i].start, mr[i].end - 1,Signature · 7 lines
1.7.7 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 02/19] x86, mm: Use big page size for small memory range
Quoted 16 lines · Konrad Rzeszutek Wilk
Quoted 4 lines · Yinghai Lu
We could map small range in the middle of big range at first, so should use big page size at first to avoid using small page size to break down page table.
Only can set big page bit when that range has ram area around it.
The code looks good.
I would alter the description to say:
(Describe the problem)
"We are wasting entries in the page-table b/c are not taking advantage of the fact that adjoining ranges could be of the same type and coalescing them together. Instead we end up using the small size type."
Quoted 5 lines
(Explain your patch).
"We fix this by iterating over the ranges, detecting whether the ranges that are next to each other are of the same type - and if so set them to our type."
I think my commit change log is clear enough, and will not update it.
PATCH 3/19 x86, mm: Don't clear page table if range is ram
In reply to Yinghai LuAfter we add code use buffer in BRK to pre-map page table, it should be safe to remove early_memmap for page table accessing. Instead we get panic with that.
It turns out we clear the initial page table wrongly for next range that is separated by holes.
And it only happens when we are trying to map range one by one range separately.
We need to check if the range is ram before clearing page table.
--- arch/x86/mm/init_64.c | 37 ++++++++++++++++--------------------- 1 files changed, 16 insertions(+), 21 deletions(-)
arch/x86/mm/init_64.c +16 -21
@@ -363,20 +363,19 @@ static unsigned long __meminit phys_pte_init(pte_t *pte_page, unsigned long addr, unsigned long end, pgprot_t prot) { -unsigned pages =0 ; +unsigned long pages =0 , next;unsigned long last_map_addr = end;int i;pte_t *pte = pte_page +pte_index (addr); -for (i =pte_index (addr); i <PTRS_PER_PTE ; i++, addr +=PAGE_SIZE , pte++) { - +for (i =pte_index (addr); i <PTRS_PER_PTE ; i++, addr = next, pte++) { + next = (addr &PAGE_MASK ) +PAGE_SIZE ;if (addr >= end) { -if (!after_bootmem) { -for (; i <PTRS_PER_PTE ; i++, pte++) -set_pte (pte,__pte (0 )); - } -break ; +if (!after_bootmem && + !e820_any_mapped (addr &PAGE_MASK , next,0 )) +set_pte (pte,__pte (0 )); +continue ; }/*
@@ -418,16 +417,14 @@ phys_pmd_init(pmd_t *pmd_page, unsigned long address, unsigned long end,pte_t *pte;pgprot_t new_prot = prot; + next = (address &PMD_MASK ) +PMD_SIZE ;if (address >= end) { -if (!after_bootmem) { -for (; i <PTRS_PER_PMD ; i++, pmd++) -set_pmd (pmd,__pmd (0 )); - } -break ; +if (!after_bootmem && + !e820_any_mapped (address &PMD_MASK , next,0 )) +set_pmd (pmd,__pmd (0 )); +continue ; } - next = (address &PMD_MASK ) +PMD_SIZE ; -if (pmd_val (*pmd)) {if (!pmd_large (*pmd)) {spin_lock (&init_mm.page_table_lock);
@@ -494,13 +491,11 @@ phys_pud_init(pud_t *pud_page, unsigned long addr, unsigned long end,pmd_t *pmd;pgprot_t prot =PAGE_KERNEL ; -if (addr >= end) -break ; - next = (addr &PUD_MASK ) +PUD_SIZE ; - -if (!after_bootmem && !e820_any_mapped (addr, next,0 )) { -set_pud (pud,__pud (0 )); +if (addr >= end) { +if (!after_bootmem && + !e820_any_mapped (addr &PUD_MASK , next,0 )) +set_pud (pud,__pud (0 ));continue ; }
Signature · 1 line
1.7.7
Re: [PATCH 03/19] x86, mm: Don't clear page table if range is ram
Quoted 1 line · Yinghai Lu
After we add code use buffer in BRK to pre-map page table,
^- to
So .. which patch is that? Can you include the title of the patch here?
Quoted 4 lines
it should be safe to remove
early_memmapfor page table accessing. Instead we get panic with that.It turns out we clear the initial page table wrongly for next range that is
^- that
Quoted 2 lines
separated by holes.
And it only happens when we are trying to map range one by one range separately.
^-s
Quoted 2 lines
We need to check if the range is ram before clearing page table.
Ok, so that sounds like a bug-fix... but
Quoted 25 lines
Signed-off-by Yinghai Lu <[email protected]>--- arch/x86/mm/init_64.c | 37 ++++++++++++++++--------------------- 1 files changed, 16 insertions(+), 21 deletions(-)arch/x86/mm/init_64.c +3
-3@@ -363,20 +363,19 @@ static unsigned long __meminit phys_pte_init(pte_t *pte_page, unsigned long addr, unsigned long end, pgprot_t prot) { -unsigned pages =0 ; +unsigned long pages =0 , next;unsigned long last_map_addr = end;int i;pte_t *pte = pte_page +pte_index (addr); -for (i =pte_index (addr); i <PTRS_PER_PTE ; i++, addr +=PAGE_SIZE , pte++) { - +for (i =pte_index (addr); i <PTRS_PER_PTE ; i++, addr = next, pte++) { + next = (addr &PAGE_MASK ) +PAGE_SIZE ;
arch/x86/mm/init_64.c static unsigned long __meminit · line 378
Quoted 10 lines
arch/x86/mm/init_64.c +4
-5if (addr >= end) { -if (!after_bootmem) { -for (; i <PTRS_PER_PTE ; i++, pte++) -set_pte (pte,__pte (0 )); - } -break ; +if (!after_bootmem && + !e820_any_mapped (addr &PAGE_MASK , next,0 )) +set_pte (pte,__pte (0 )); +continue ;
.. Interestingly, you also removed the extra loop. How come? Why not retain the little loop? (which could call e820_any_mapped?) Is that an improvement and cleanup? If so, I would think you should at least explain in the git commit:
"And while we are at it, also axe the extra loop and instead depend on the top loop which we can safely piggyback on."
Quoted 52 lines
arch/x86/mm/init_64.c +9
-13}/* @@ -418,16 +417,14 @@ phys_pmd_init(pmd_t *pmd_page, unsigned long address, unsigned long end,pte_t *pte;pgprot_t new_prot = prot; + next = (address &PMD_MASK ) +PMD_SIZE ;if (address >= end) { -if (!after_bootmem) { -for (; i <PTRS_PER_PMD ; i++, pmd++) -set_pmd (pmd,__pmd (0 )); - } -break ; +if (!after_bootmem && + !e820_any_mapped (address &PMD_MASK , next,0 )) +set_pmd (pmd,__pmd (0 )); +continue ; } - next = (address &PMD_MASK ) +PMD_SIZE ; -if (pmd_val (*pmd)) {if (!pmd_large (*pmd)) {spin_lock (&init_mm.page_table_lock);@@ -494,13 +491,11 @@ phys_pud_init(pud_t *pud_page, unsigned long addr, unsigned long end,pmd_t *pmd;pgprot_t prot =PAGE_KERNEL ; -if (addr >= end) -break ; - next = (addr &PUD_MASK ) +PUD_SIZE ; - -if (!after_bootmem && !e820_any_mapped (addr, next,0 )) { -set_pud (pud,__pud (0 )); +if (addr >= end) { +if (!after_bootmem && + !e820_any_mapped (addr &PUD_MASK , next,0 )) +set_pud (pud,__pud (0 ));continue ; }Signature · 7 lines
1.7.7 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 03/19] x86, mm: Don't clear page table if range is ram
Quoted 53 lines · Konrad Rzeszutek Wilk
Quoted 1 line · Yinghai Lu
After we add code use buffer in BRK to pre-map page table,
^- toSo .. which patch is that? Can you include the title of the patch here?
Quoted 4 lines
it should be safe to remove
early_memmapfor page table accessing. Instead we get panic with that.It turns out we clear the initial page table wrongly for next range that is
^- thatQuoted 2 lines
separated by holes.
And it only happens when we are trying to map range one by one range separately.^-sQuoted 2 lines
We need to check if the range is ram before clearing page table.
Ok, so that sounds like a bug-fix... but
Quoted 32 lines
Signed-off-by Yinghai Lu <[email protected]>--- arch/x86/mm/init_64.c | 37 ++++++++++++++++--------------------- 1 files changed, 16 insertions(+), 21 deletions(-)arch/x86/mm/init_64.c +4
-8@@ -363,20 +363,19 @@ static unsigned long __meminit phys_pte_init(pte_t *pte_page, unsigned long addr, unsigned long end, pgprot_t prot) { -unsigned pages =0 ; +unsigned long pages =0 , next;unsigned long last_map_addr = end;int i;pte_t *pte = pte_page +pte_index (addr); -for (i =pte_index (addr); i <PTRS_PER_PTE ; i++, addr +=PAGE_SIZE , pte++) { - +for (i =pte_index (addr); i <PTRS_PER_PTE ; i++, addr = next, pte++) { + next = (addr &PAGE_MASK ) +PAGE_SIZE ;if (addr >= end) { -if (!after_bootmem) { -for (; i <PTRS_PER_PTE ; i++, pte++) -set_pte (pte,__pte (0 )); - } -break ; + if (!after_bootmem &&
Quoted 8 lines
arch/x86/mm/init_64.c static unsigned long __meminit · line 378
Quoted 3 lines
arch/x86/mm/init_64.c +3
-0+ !e820_any_mapped(addr & PAGE_MASK, next, 0)) +set_pte (pte,__pte (0 )); +continue ;.. Interestingly, you also removed the extra loop. How come? Why not retain the little loop? (which could call
e820_any_mapped?) Is that an improvement and cleanup? If so, I would think you should at least explain in the git commit:
Merge that loop to top loop, and we need to use "next" from the top loop.
Quoted 3 lines
"And while we are at it, also axe the extra loop and instead depend on the top loop which we can safely piggyback on."
update commit change log to:
---
After we add code use buffer in BRK to pre-map buf for page table in following patch:
x86, mm: setup page table in top-down
it should be safe to remove early_memmap for page table accessing. Instead we get panic with that.
It turns out that we clear the initial page table wrongly for next range that is separated by holes.
And it only happens when we are trying to map ram range one by one.
We need to check if the range is ram before clearing page table.
We change the loop structure to remove the extra little loop and use one loop only, and in that loop will caculate next at first, and check if [addr,next) is covered by E820_RAM.
---
PATCH 2/3 PCI: correctly detect ACPI PCI host bridge objects
In reply to Yinghai LuFrom: Jiang Liu <[email protected]>
The code in pci_root_hp.c depends on function acpi_is_root_bridge() to check whether an ACPI object is a PCI host bridge or not. If an ACPI device hasn't been created for the ACPI object yet, function acpi_is_root_bridge() will return false even if the object is a PCI host bridge object. That behavior will cause two issues:
1) No ACPI notification handler installed for PCI host bridges absent at startup, so hotplug events for those bridges won't be handled.
2) rescan_root_bridge() can't reenumerate offlined PCI host bridges because the ACPI devices have been already destroyed.
So use acpi_match_object_info_ids() to correctly detect PCI host bridges.
-v2: update to use acpi_match_object_info_ids() from Tang Chen - Yinghai
--- drivers/acpi/pci_root_hp.c | 25 ++++++++++++++++++++++++- 1 files changed, 24 insertions(+), 1 deletions(-)
drivers/acpi/pci_root_hp.c +24 -1
@@ -19,6 +19,12 @@ struct acpi_root_bridge {u32 flags; }; +static const struct acpi_device_id root_device_ids[] = { + {"PNP0A03" ,0 }, + {"PNP0A08" ,0 }, + {"" ,0 }, +}; +/* bridge flags */ #define ROOT_BRIDGE_HAS_EJ0 (0x00000002)#define ROOT_BRIDGE_HAS_PS3 (0x00000080)
@@ -256,6 +262,23 @@ static void handle_hotplug_event_root(acpi_handle handle, u32 type, _handle_hotplug_event_root); } +static bool acpi_is_root_bridge_object (acpi_handle handle) +{ +struct acpi_device_info *info =NULL ; +acpi_status status; +bool ret; + + status =acpi_get_object_info (handle, &info); +if (ACPI_FAILURE (status)) +return false; + + ret = !acpi_match_object_info_ids (info, root_device_ids); + +kfree (info); + +return ret; +} +static acpi_status __init find_root_bridges (acpi_handle handle,u32 lvl,void *context,void **rv) {
@@ -264,7 +287,7 @@ find_root_bridges(acpi_handle handle, u32 lvl, void *context, void **rv) .pointer = objname };int *count = (int *)context; -if (!acpi_is_root_bridge (handle)) +if (!acpi_is_root_bridge_object (handle))return AE_OK ; (*count)++;
Signature · 1 line
1.7.7
Bjorn Helgaas
maintainerRe: [PATCH 2/3] PCI: correctly detect ACPI PCI host bridge objects
Quoted 29 lines · Yinghai Lu
From: Jiang Liu <[email protected]>
The code in
pci_root_hp.cdepends on functionacpi_is_root_bridge()to check whether an ACPI object is a PCI host bridge or not. If an ACPI device hasn't been created for the ACPI object yet, functionacpi_is_root_bridge()will return false even if the object is a PCI host bridge object. That behavior will cause two issues:
1) No ACPI notification handler installed for PCI host bridges absent at startup, so hotplug events for those bridges won't be handled.
2)rescan_root_bridge()can't reenumerate offlined PCI host bridges because the ACPI devices have been already destroyed.So use
acpi_match_object_info_ids()to correctly detect PCI host bridges.-v2: update to use
acpi_match_object_info_ids()from Tang Chen - YinghaiSigned-off-by Jiang Liu <[email protected]>Signed-off-by Yinghai Lu <[email protected]>Cc Len Brown <[email protected]>--- drivers/acpi/pci_root_hp.c | 25 ++++++++++++++++++++++++- 1 files changed, 24 insertions(+), 1 deletions(-)drivers/acpi/pci_root_hp.c +0
-0
drivers/acpi/pci_root_hp.c struct acpi_root_bridge { · line 24
Quoted 6 lines
drivers/acpi/pci_root_hp.c +3
-0@@ -19,6 +19,12 @@ struct acpi_root_bridge {u32 flags; }; +static const struct acpi_device_id root_device_ids[] = { + {"PNP0A03" ,0 }, + {"PNP0A08" ,0 },
Why do we need PNP0A08 here?
Per the PCI Firmware Spec, sec 4.1.5, PNP0A08 identifies a PCI Express or a PCI-X Mode 2 host bridge, and such a device is required to include PNP0A03 in _CID. Therefore, it should be sufficient to look only for PNP0A03.
That raises the question of why the spec defined PNP0A08 in the first place. It looks like PNP0A08 is intended specifically to indicate support for extended config space (offsets 256-4095), per sec 4.1.5 (Note 1) and sec 4.3.1.
I don't think Linux currently does anything differently with PNP0A08, so if the spec authors thought it was important to add PNP0A08, maybe Linux is missing something. For example, maybe we should be limiting config space size to 256 unless we're below a PNP0A08 device. I don't know what that could *fix*, unless it would allow us to get rid of some quirks or something, but usually spec authors don't add things unless they think there's a reason it's needed.
Quoted 46 lines
drivers/acpi/pci_root_hp.c +21
-2+ {"", 0}, +}; +/* bridge flags */ #define ROOT_BRIDGE_HAS_EJ0 (0x00000002)#define ROOT_BRIDGE_HAS_PS3 (0x00000080)@@ -256,6 +262,23 @@ static void handle_hotplug_event_root(acpi_handle handle, u32 type, _handle_hotplug_event_root); } +static bool acpi_is_root_bridge_object (acpi_handle handle) +{ +struct acpi_device_info *info =NULL ; +acpi_status status; +bool ret; + + status =acpi_get_object_info (handle, &info); +if (ACPI_FAILURE (status)) +return false; + + ret = !acpi_match_object_info_ids (info, root_device_ids); + +kfree (info); + +return ret; +} +static acpi_status __init find_root_bridges (acpi_handle handle,u32 lvl,void *context,void **rv) {@@ -264,7 +287,7 @@ find_root_bridges(acpi_handle handle, u32 lvl, void *context, void **rv) .pointer = objname };int *count = (int *)context; -if (!acpi_is_root_bridge (handle)) +if (!acpi_is_root_bridge_object (handle))return AE_OK ; (*count)++; --1.7.7
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/3] PCI: correctly detect ACPI PCI host bridge objects
Quoted 6 lines · Bjorn Helgaas
drivers/acpi/pci_root_hp.c struct acpi_root_bridge { · line 24
Quoted 4 lines · Yinghai Lu
drivers/acpi/pci_root_hp.c +3
-0+static const struct acpi_device_id root_device_ids[] = { + {"PNP0A03" ,0 }, + {"PNP0A08" ,0 },
Quoted 6 lines
Why do we need PNP0A08 here?
Per the PCI Firmware Spec, sec 4.1.5, PNP0A08 identifies a PCI Express or a PCI-X Mode 2 host bridge, and such a device is required to include PNP0A03 in
_CID. Therefore, it should be sufficient to look only for PNP0A03.
good, I removed that line and updated for-pci-split-pci-root-hp-2 branch.
Thanks
Yinghai
PATCH 4/19 x86, mm: only keep initial mapping for ram
In reply to Yinghai Lu0 mean any e820 type, for any range is overlapped with any entry in e820, kernel will keep it's initial page table mapping.
What we want is only keeping initial page table for ram range.
Change to E820_RAM and E820_RESERVED_KERN.
--- arch/x86/mm/init_64.c | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-)
arch/x86/mm/init_64.c +6 -3
@@ -373,7 +373,8 @@ phys_pte_init(pte_t *pte_page, unsigned long addr, unsigned long end, next = (addr &PAGE_MASK ) +PAGE_SIZE ;if (addr >= end) {if (!after_bootmem && - !e820_any_mapped (addr &PAGE_MASK , next,0 )) + !e820_any_mapped (addr &PAGE_MASK , next,E820_RAM ) && + !e820_any_mapped (addr &PAGE_MASK , next,E820_RESERVED_KERN ))set_pte (pte,__pte (0 ));continue ; }
@@ -420,7 +421,8 @@ phys_pmd_init(pmd_t *pmd_page, unsigned long address, unsigned long end, next = (address &PMD_MASK ) +PMD_SIZE ;if (address >= end) {if (!after_bootmem && - !e820_any_mapped (address &PMD_MASK , next,0 )) + !e820_any_mapped (address &PMD_MASK , next,E820_RAM ) && + !e820_any_mapped (address &PMD_MASK , next,E820_RESERVED_KERN ))set_pmd (pmd,__pmd (0 ));continue ; }
@@ -494,7 +496,8 @@ phys_pud_init(pud_t *pud_page, unsigned long addr, unsigned long end, next = (addr &PUD_MASK ) +PUD_SIZE ;if (addr >= end) {if (!after_bootmem && - !e820_any_mapped (addr &PUD_MASK , next,0 )) + !e820_any_mapped (addr &PUD_MASK , next,E820_RAM ) && + !e820_any_mapped (addr &PUD_MASK , next,E820_RESERVED_KERN ))set_pud (pud,__pud (0 ));continue ; }
Signature · 1 line
1.7.7
Re: [PATCH 04/19] x86, mm: only keep initial mapping for ram
Quoted 4 lines · Yinghai Lu
0 mean any e820 type, for any range is overlapped with any entry in e820, kernel will keep it's initial page table mapping.
What we want is only keeping initial page table for ram range.
Can you squash it in the previous patch then pls? It seems like this is a bug-fix to a bug-fix. And since this patchset is still out-side the Linus's tree you have the option of squashing/rebasing.
Quoted 51 lines
Change to
E820_RAMandE820_RESERVED_KERN.Signed-off-by Yinghai Lu <[email protected]>--- arch/x86/mm/init_64.c | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-)arch/x86/mm/init_64.c +6
-3@@ -373,7 +373,8 @@ phys_pte_init(pte_t *pte_page, unsigned long addr, unsigned long end, next = (addr &PAGE_MASK ) +PAGE_SIZE ;if (addr >= end) {if (!after_bootmem && - !e820_any_mapped (addr &PAGE_MASK , next,0 )) + !e820_any_mapped (addr &PAGE_MASK , next,E820_RAM ) && + !e820_any_mapped (addr &PAGE_MASK , next,E820_RESERVED_KERN ))set_pte (pte,__pte (0 ));continue ; }@@ -420,7 +421,8 @@ phys_pmd_init(pmd_t *pmd_page, unsigned long address, unsigned long end, next = (address &PMD_MASK ) +PMD_SIZE ;if (address >= end) {if (!after_bootmem && - !e820_any_mapped (address &PMD_MASK , next,0 )) + !e820_any_mapped (address &PMD_MASK , next,E820_RAM ) && + !e820_any_mapped (address &PMD_MASK , next,E820_RESERVED_KERN ))set_pmd (pmd,__pmd (0 ));continue ; }@@ -494,7 +496,8 @@ phys_pud_init(pud_t *pud_page, unsigned long addr, unsigned long end, next = (addr &PUD_MASK ) +PUD_SIZE ;if (addr >= end) {if (!after_bootmem && - !e820_any_mapped (addr &PUD_MASK , next,0 )) + !e820_any_mapped (addr &PUD_MASK , next,E820_RAM ) && + !e820_any_mapped (addr &PUD_MASK , next,E820_RESERVED_KERN ))set_pud (pud,__pud (0 ));continue ; }Signature · 7 lines
1.7.7 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 04/19] x86, mm: only keep initial mapping for ram
Quoted 9 lines · Konrad Rzeszutek Wilk
Quoted 4 lines · Yinghai Lu
0 mean any e820 type, for any range is overlapped with any entry in e820, kernel will keep it's initial page table mapping.
What we want is only keeping initial page table for ram range.
Can you squash it in the previous patch then pls? It seems like this is a bug-fix to a bug-fix. And since this patchset is still out-side the Linus's tree you have the option of squashing/rebasing.
ok.
PATCH 5/19 x86, mm: Break down init_all_memory_mapping
In reply to Yinghai LuWill replace that with top-down page table initialization. New API need to take range: init_range_memory_mapping()
--- arch/x86/mm/init.c | 45 +++++++++++++++++++++------------------------ 1 files changed, 21 insertions(+), 24 deletions(-)
arch/x86/mm/init.c +21 -24
@@ -398,40 +398,30 @@ unsigned long __init_refok init_memory_mapping(unsigned long start,* Depending on the alignment of E820 ranges, this may possibly result in using * smaller size (i.e. 4K instead of 2M or 1G) page tables. */ -static void __init init_all_memory_mapping (void ) +static void __init init_range_memory_mapping (unsigned long range_start, +unsigned long range_end) {unsigned long start_pfn, end_pfn;int i; -/* the ISA range is always mapped regardless of memory holes */ -init_memory_mapping (0 ,ISA_END_ADDRESS ); -for_each_mem_pfn_range (i,MAX_NUMNODES , &start_pfn, &end_pfn,NULL ) { -u64 start = start_pfn <<PAGE_SHIFT ; -u64 end = end_pfn <<PAGE_SHIFT ; +u64 start = (u64 )start_pfn <<PAGE_SHIFT ; +u64 end = (u64 )end_pfn <<PAGE_SHIFT ; -if (end <=ISA_END_ADDRESS ) +if (end <= range_start)continue ; -if (start <ISA_END_ADDRESS ) - start =ISA_END_ADDRESS ; -#ifdef CONFIG_X86_32 -/* on 32 bit, we only map up to max_low_pfn */ -if ((start >>PAGE_SHIFT ) >= max_low_pfn) +if (start < range_start) + start = range_start; + +if (start >= range_end)continue ; -if ((end >>PAGE_SHIFT ) > max_low_pfn) - end = max_low_pfn <<PAGE_SHIFT ; -#endif -init_memory_mapping (start, end); - } +if (end > range_end) + end = range_end; -#ifdef CONFIG_X86_64 -if (max_pfn > max_low_pfn) { -/* can we preseve max_low_pfn ?*/ - max_low_pfn = max_pfn; +init_memory_mapping (start, end); } -#endif }void __init init_mem_mapping (void )
@@ -461,8 +451,15 @@ void __init init_mem_mapping(void) (pgt_buf_top << PAGE_SHIFT) - 1); max_pfn_mapped =0 ;/* will get exact value next */ -init_all_memory_mapping (); - +/* the ISA range is always mapped regardless of memory holes */ +init_memory_mapping (0 ,ISA_END_ADDRESS ); +init_range_memory_mapping (ISA_END_ADDRESS , end); +#ifdef CONFIG_X86_64 +if (max_pfn > max_low_pfn) { +/* can we preseve max_low_pfn ?*/ + max_low_pfn = max_pfn; + } +#endif /* * Reserve the kernel pagetable pages we used (pgt_buf_start - * pgt_buf_end) and free the other ones (pgt_buf_end - pgt_buf_top)
Signature · 1 line
1.7.7
PATCH 3/3 PCI, ACPI: debug print for installation of acpi root bridge's notifier
In reply to Yinghai LuFrom: Tang Chen <[email protected]>
acpi_install_notify_handler() could fail. So check the exit status and give a better debug info.
--- drivers/acpi/pci_root_hp.c | 12 +++++++++--- 1 files changed, 9 insertions(+), 3 deletions(-)
drivers/acpi/pci_root_hp.c +9 -3
@@ -282,6 +282,7 @@ static bool acpi_is_root_bridge_object(acpi_handle handle)static acpi_status __init find_root_bridges (acpi_handle handle,u32 lvl,void *context,void **rv) { +acpi_status status;char objname[64 ];struct acpi_buffer buffer = { .length =sizeof (objname), .pointer = objname };
@@ -294,9 +295,14 @@ find_root_bridges(acpi_handle handle, u32 lvl, void *context, void **rv)acpi_get_name (handle,ACPI_FULL_PATHNAME , &buffer); -acpi_install_notify_handler (handle,ACPI_SYSTEM_NOTIFY , - handle_hotplug_event_root,NULL ); -printk (KERN_DEBUG "acpi root: %s notify handler installed\n" , objname); + status =acpi_install_notify_handler (handle,ACPI_SYSTEM_NOTIFY , + handle_hotplug_event_root,NULL ); +if (ACPI_FAILURE (status)) +printk (KERN_DEBUG "acpi root: %s notify handler is not installed, exit status: %u\n" , + objname, (unsigned int )status); +else +printk (KERN_DEBUG "acpi root: %s notify handler is installed\n" , + objname);add_acpi_root_bridge (handle);
Signature · 1 line
1.7.7
PATCH 6/19 x86, mm: setup page table in top-down
In reply to Yinghai LuGet pgt_buf early from BRK, and use it to map PMD_SIZE from top at first. then use mapped pages to map more range below, and keep looping until all pages get mapped.
alloc_low_page will use page from BRK at first, after that buff is used up, will use memblock to find and reserve page for page table usage.
At last we could get rid of calculation and find early pgt related code.
-v2: update to after fix_xen change,
also use MACRO for initial pgt_buf size and add comments with it.
-v3: skip big reserved range in memblock.reserved near end. -v4: don't need fix_xen change now.
--- arch/x86/include/asm/page_types.h | 1 + arch/x86/include/asm/pgtable.h | 1 + arch/x86/kernel/setup.c | 3 + arch/x86/mm/init.c | 207 ++++++++++-------------------------- arch/x86/mm/init_32.c | 17 +++- arch/x86/mm/init_64.c | 17 +++- 6 files changed, 91 insertions(+), 155 deletions(-)
arch/x86/include/asm/page_types.h +1 -0
@@ -45,6 +45,7 @@ extern int devmem_is_allowed(unsigned long pagenr);extern unsigned long max_low_pfn_mapped;extern unsigned long max_pfn_mapped; +extern unsigned long min_pfn_mapped;static inline phys_addr_t get_max_mapped (void ) {
arch/x86/include/asm/pgtable.h +1 -0
@@ -603,6 +603,7 @@ static inline int pgd_none(pgd_t pgd)extern int direct_gbpages;void init_mem_mapping (void ); +void early_alloc_pgt_buf (void );/* local pte updates need not use xchg for locking */ static inline pte_t native_local_ptep_get_and_clear (pte_t *ptep)
arch/x86/kernel/setup.c +3 -0
@@ -124,6 +124,7 @@*/ unsigned long max_low_pfn_mapped;unsigned long max_pfn_mapped; +unsigned long min_pfn_mapped;#ifdef CONFIG_DMI RESERVE_BRK (dmi_alloc,65536 );
@@ -897,6 +898,8 @@ void __init setup_arch(char **cmdline_p)reserve_ibft_region (); +early_alloc_pgt_buf (); +/* * Need to conclude brk, before memblock_x86_fill() * it could use memblock_find_in_range, could overlap with
arch/x86/mm/init.c +58 -149
257 lines not on this page · raw message
arch/x86/mm/init_32.c +14 -3
@@ -61,11 +61,22 @@ bool __read_mostly __vmalloc_start_set = false;static __init void *alloc_low_page (void ) { -unsigned long pfn = pgt_buf_end++; +unsigned long pfn;void *adr; -if (pfn >= pgt_buf_top) -panic ("alloc_low_page: ran out of memory" ); +if ((pgt_buf_end +1 ) >= pgt_buf_top) { +unsigned long ret; +if (min_pfn_mapped >= max_pfn_mapped) +panic ("alloc_low_page: ran out of memory" ); + ret =memblock_find_in_range (min_pfn_mapped <<PAGE_SHIFT , + max_pfn_mapped <<PAGE_SHIFT , +PAGE_SIZE ,PAGE_SIZE ); +if (!ret) +panic ("alloc_low_page: can not alloc memory" ); +memblock_reserve (ret,PAGE_SIZE ); + pfn = ret >>PAGE_SHIFT ; + }else + pfn = pgt_buf_end++; adr =__va (pfn *PAGE_SIZE );clear_page (adr);
arch/x86/mm/init_64.c +14 -3
@@ -316,7 +316,7 @@ void __init cleanup_highmap(void)static __ref void *alloc_low_page (unsigned long *phys) { -unsigned long pfn = pgt_buf_end++; +unsigned long pfn;void *adr;if (after_bootmem) {
@@ -326,8 +326,19 @@ static __ref void *alloc_low_page(unsigned long *phys)return adr; } -if (pfn >= pgt_buf_top) -panic ("alloc_low_page: ran out of memory" ); +if ((pgt_buf_end +1 ) >= pgt_buf_top) { +unsigned long ret; +if (min_pfn_mapped >= max_pfn_mapped) +panic ("alloc_low_page: ran out of memory" ); + ret =memblock_find_in_range (min_pfn_mapped <<PAGE_SHIFT , + max_pfn_mapped <<PAGE_SHIFT , +PAGE_SIZE ,PAGE_SIZE ); +if (!ret) +panic ("alloc_low_page: can not alloc memory" ); +memblock_reserve (ret,PAGE_SIZE ); + pfn = ret >>PAGE_SHIFT ; + }else + pfn = pgt_buf_end++; adr =early_memremap (pfn *PAGE_SIZE ,PAGE_SIZE );clear_page (adr);
Signature · 1 line
1.7.7
Re: [PATCH 06/19] x86, mm: setup page table in top-down
Quoted 14 lines · Yinghai Lu
Get
pgt_bufearly from BRK, and use it to mapPMD_SIZEfrom top at first. then use mapped pages to map more range below, and keep looping until all pages get mapped.
alloc_low_pagewill use page from BRK at first, after that buff is used up, will use memblock to find and reserve page for page table usage.At last we could get rid of calculation and find early pgt related code.
(quoted diff) +0
-3-v2: update to after fix_xen change, also use MACRO for initial pgt_buf size and add comments with it. -v3: skip big reserved range in memblock.reserved near end. -v4: don't need fix_xen change now.
Quoted 2 lines
Suggested-by "H. Peter Anvin" <[email protected]>Signed-off-by Yinghai Lu <[email protected]>
The series is starting to get in good shape!
I tested it on a 2G and an 8G VM and it seems to be working fine.
The most important thing to do now is testing it on different machines (with and without xen) and writing better commit messages. We can help you with the testing but you really need to write better docs.
In particular you should state in clear letters that alloc_low_page is always going to return a page that is already mapped. You should write it both in the commit message and in the code as a comment. This is particularly important because it is going to become part of the interface between the common x86 code and the other x86 subsystems like Xen.
Also, it wouldn't hurt to explain the overall design at the beginning of the series: I shouldn't have to read your code to understand what you are doing. I should read the description of the patch, understand what you are doing, then go and check if the code actually does what you say it does.
Quoted 386 lines
arch/x86/include/asm/page_types.h | 1 + arch/x86/include/asm/pgtable.h | 1 + arch/x86/kernel/setup.c | 3 + arch/x86/mm/init.c | 207 ++++++++++-------------------------- arch/x86/mm/init_32.c | 17 +++- arch/x86/mm/init_64.c | 17 +++- 6 files changed, 91 insertions(+), 155 deletions(-)arch/x86/include/asm/page_types.h +1
-0@@ -45,6 +45,7 @@ extern int devmem_is_allowed(unsigned long pagenr);extern unsigned long max_low_pfn_mapped;extern unsigned long max_pfn_mapped; +extern unsigned long min_pfn_mapped;static inline phys_addr_t get_max_mapped (void ) {arch/x86/include/asm/pgtable.h +1
-0@@ -603,6 +603,7 @@ static inline int pgd_none(pgd_t pgd)extern int direct_gbpages;void init_mem_mapping (void ); +void early_alloc_pgt_buf (void );/* local pte updates need not use xchg for locking */ static inline pte_t native_local_ptep_get_and_clear (pte_t *ptep)arch/x86/kernel/setup.c +3
-0@@ -124,6 +124,7 @@*/ unsigned long max_low_pfn_mapped;unsigned long max_pfn_mapped; +unsigned long min_pfn_mapped;#ifdef CONFIG_DMI RESERVE_BRK (dmi_alloc,65536 );@@ -897,6 +898,8 @@ void __init setup_arch(char **cmdline_p)reserve_ibft_region (); +early_alloc_pgt_buf (); +/* * Need to conclude brk, before memblock_x86_fill() * it could use memblock_find_in_range, could overlap with arch/x86/mm/init.c +58
-149@@ -21,6 +21,21 @@ unsigned long __initdata pgt_buf_start;unsigned long __meminitdata pgt_buf_end;unsigned long __meminitdata pgt_buf_top; +/* need 4 4k for initial PMD_SIZE, 4k for 0-ISA_END_ADDRESS */ +#define INIT_PGT_BUF_SIZE (5 * PAGE_SIZE) +RESERVE_BRK (early_pgt_alloc,INIT_PGT_BUF_SIZE ); +void __init early_alloc_pgt_buf (void ) +{ +unsigned long tables =INIT_PGT_BUF_SIZE ; +phys_addr_t base; + + base =__pa (extend_brk (tables,PAGE_SIZE )); + + pgt_buf_start = base >>PAGE_SHIFT ; + pgt_buf_end = pgt_buf_start; + pgt_buf_top = pgt_buf_start + (tables >>PAGE_SHIFT ); +} +int after_bootmem;int direct_gbpages@@ -228,105 +243,6 @@ static int __meminit split_mem_range(struct map_range *mr, int nr_range,return nr_range; } -static unsigned long __init calculate_table_space_size (unsigned long start, -unsigned long end) -{ -unsigned long puds =0 , pmds =0 , ptes =0 , tables; -struct map_range mr[NR_RANGE_MR ]; -int nr_range, i; - -pr_info ("calculate_table_space_size: [mem %#010lx-%#010lx]\n" , - start, end -1 ); - -memset (mr,0 ,sizeof (mr)); - nr_range =0 ; - nr_range =split_mem_range (mr, nr_range, start, end); - -for (i =0 ; i < nr_range; i++) { -unsigned long range, extra; - - range = mr[i].end - mr[i].start; - puds += (range +PUD_SIZE -1 ) >>PUD_SHIFT ; - -if (mr[i].page_size_mask & (1 <<PG_LEVEL_1G )) { - extra = range - ((range >>PUD_SHIFT ) <<PUD_SHIFT ); - pmds += (extra +PMD_SIZE -1 ) >>PMD_SHIFT ; - }else - pmds += (range +PMD_SIZE -1 ) >>PMD_SHIFT ; - -if (mr[i].page_size_mask & (1 <<PG_LEVEL_2M )) { - extra = range - ((range >>PMD_SHIFT ) <<PMD_SHIFT ); -#ifdef CONFIG_X86_32 - extra +=PMD_SIZE ; -#endif -/* The first 2/4M doesn't use large pages. */ -if (mr[i].start <PMD_SIZE ) - extra +=PMD_SIZE - mr[i].start; - - ptes += (extra +PAGE_SIZE -1 ) >>PAGE_SHIFT ; - }else - ptes += (range +PAGE_SIZE -1 ) >>PAGE_SHIFT ; - } - - tables =roundup (puds *sizeof (pud_t),PAGE_SIZE ); - tables +=roundup (pmds *sizeof (pmd_t),PAGE_SIZE ); - tables +=roundup (ptes *sizeof (pte_t),PAGE_SIZE ); - -#ifdef CONFIG_X86_32 -/* for fixmap */ - tables +=roundup (__end_of_fixed_addresses *sizeof (pte_t),PAGE_SIZE ); -#endif - -return tables; -} - -static unsigned long __init calculate_all_table_space_size (void ) -{ -unsigned long start_pfn, end_pfn; -unsigned long tables; -int i; - -/* the ISA range is always mapped regardless of memory holes */ - tables =calculate_table_space_size (0 ,ISA_END_ADDRESS ); - -for_each_mem_pfn_range (i,MAX_NUMNODES , &start_pfn, &end_pfn,NULL ) { -u64 start = start_pfn <<PAGE_SHIFT ; -u64 end = end_pfn <<PAGE_SHIFT ; - -if (end <=ISA_END_ADDRESS ) -continue ; - -if (start <ISA_END_ADDRESS ) - start =ISA_END_ADDRESS ; -#ifdef CONFIG_X86_32 -/* on 32 bit, we only map up to max_low_pfn */ -if ((start >>PAGE_SHIFT ) >= max_low_pfn) -continue ; - -if ((end >>PAGE_SHIFT ) > max_low_pfn) - end = max_low_pfn <<PAGE_SHIFT ; -#endif - tables +=calculate_table_space_size (start, end); - } - -return tables; -} - -static void __init find_early_table_space (unsigned long start, -unsigned long good_end, -unsigned long tables) -{ -phys_addr_t base; - - base =memblock_find_in_range (start, good_end, tables,PAGE_SIZE ); -if (!base) -panic ("Cannot find space for the kernel page tables" ); - - pgt_buf_start = base >>PAGE_SHIFT ; - pgt_buf_end = pgt_buf_start; - pgt_buf_top = pgt_buf_start + (tables >>PAGE_SHIFT ); -} -static struct range pfn_mapped[E820_X_MAX ];static int nr_pfn_mapped;@@ -391,17 +307,14 @@ unsigned long __init_refok init_memory_mapping(unsigned long start, }/* -* Iterate through E820 memory map and create direct mappings for only E820_RAM -* regions. We cannot simply create direct mappings for all pfns from -* [0 to max_low_pfn) and [4GB to max_pfn) because of possible memory holes in -* high addresses that cannot be marked as UC by fixed/variable range MTRRs. -* Depending on the alignment of E820 ranges, this may possibly result in using -* smaller size (i.e. 4K instead of 2M or 1G) page tables. +* this one could take range with hole in it */ -static void __init init_range_memory_mapping (unsigned long range_start, +static unsigned long __init init_range_memory_mapping ( +unsigned long range_start,unsigned long range_end) {unsigned long start_pfn, end_pfn; +unsigned long mapped_ram_size =0 ;int i;for_each_mem_pfn_range (i,MAX_NUMNODES , &start_pfn, &end_pfn,NULL ) {@@ -421,71 +334,67 @@ static void __init init_range_memory_mapping(unsigned long range_start, end = range_end;init_memory_mapping (start, end); + + mapped_ram_size += end - start; } + +return mapped_ram_size; }void __init init_mem_mapping (void ) { -unsigned long tables, good_end, end; +unsigned long end, real_end, start, last_start; +unsigned long step_size; +unsigned long addr; +unsigned long mapped_ram_size =0 ; +unsigned long new_mapped_ram_size;probe_page_size_mask (); -/* -* Find space for the kernel direct mapping tables. -* -* Later we should allocate these tables in the local node of the -* memory mapped. Unfortunately this is done currently before the -* nodes are discovered. -*/ #ifdef CONFIG_X86_64 end = max_pfn <<PAGE_SHIFT ; - good_end = end;#else end = max_low_pfn <<PAGE_SHIFT ; - good_end = max_pfn_mapped <<PAGE_SHIFT ;#endif - tables =calculate_all_table_space_size (); -find_early_table_space (0 , good_end, tables); -printk (KERN_DEBUG "kernel direct mapping tables up to %#lx @ [mem %#010lx-%#010lx] prealloc\n" , - end -1 , pgt_buf_start <<PAGE_SHIFT , - (pgt_buf_top <<PAGE_SHIFT ) -1 ); - max_pfn_mapped =0 ;/* will get exact value next */ /* the ISA range is always mapped regardless of memory holes */ init_memory_mapping (0 ,ISA_END_ADDRESS ); -init_range_memory_mapping (ISA_END_ADDRESS , end); + +/* xen has big range in reserved near end of ram, skip it at first */ + addr =memblock_find_in_range (ISA_END_ADDRESS , end,PMD_SIZE , +PAGE_SIZE ); + real_end = addr +PMD_SIZE ; + +/* step_size need to be small so pgt_buf from BRK could cover it */ + step_size =PMD_SIZE ; + max_pfn_mapped =0 ;/* will get exact value next */ + min_pfn_mapped = real_end >>PAGE_SHIFT ; + last_start = start = real_end; +while (last_start >ISA_END_ADDRESS ) { +if (last_start > step_size) { + start =round_down (last_start -1 , step_size); +if (start <ISA_END_ADDRESS ) + start =ISA_END_ADDRESS ; + }else + start =ISA_END_ADDRESS ; + new_mapped_ram_size =init_range_memory_mapping (start, + last_start); + last_start = start; + min_pfn_mapped = last_start >>PAGE_SHIFT ; +if (new_mapped_ram_size > mapped_ram_size) + step_size <<=5 ; + mapped_ram_size += new_mapped_ram_size; + } + +if (real_end < end) +init_range_memory_mapping (real_end, end); +#ifdef CONFIG_X86_64 if (max_pfn > max_low_pfn) {/* can we preseve max_low_pfn ?*/ max_low_pfn = max_pfn; }#endif -/* -* Reserve the kernel pagetable pages we used (pgt_buf_start - -* pgt_buf_end) and free the other ones (pgt_buf_end - pgt_buf_top) -* so that they can be reused for other purposes. -* -* On native it just means calling memblock_reserve, on Xen it also -* means marking RW the pagetable pages that we allocated before -* but that haven't been used. -* -* In fact on xen we mark RO the whole range pgt_buf_start - -* pgt_buf_top, because we have to make sure that when -* init_memory_mapping reaches the pagetable pages area, it maps -* RO all the pagetable pages, including the ones that are beyond -* pgt_buf_end at that time. -*/ -if (pgt_buf_end > pgt_buf_start) { -printk (KERN_DEBUG "kernel direct mapping tables up to %#lx @ [mem %#010lx-%#010lx] final\n" , - end -1 , pgt_buf_start <<PAGE_SHIFT , - (pgt_buf_end <<PAGE_SHIFT ) -1 ); - x86_init.mapping.pagetable_reserve (PFN_PHYS (pgt_buf_start), -PFN_PHYS (pgt_buf_end)); - } - -/* stop the wrong using */ - pgt_buf_top =0 ; -early_memtest (0 , max_pfn_mapped <<PAGE_SHIFT ); }arch/x86/mm/init_32.c +14
-3@@ -61,11 +61,22 @@ bool __read_mostly __vmalloc_start_set = false;static __init void *alloc_low_page (void ) { -unsigned long pfn = pgt_buf_end++; +unsigned long pfn;void *adr; -if (pfn >= pgt_buf_top) -panic ("alloc_low_page: ran out of memory" ); +if ((pgt_buf_end +1 ) >= pgt_buf_top) { +unsigned long ret; +if (min_pfn_mapped >= max_pfn_mapped) +panic ("alloc_low_page: ran out of memory" ); + ret =memblock_find_in_range (min_pfn_mapped <<PAGE_SHIFT , + max_pfn_mapped <<PAGE_SHIFT , +PAGE_SIZE ,PAGE_SIZE ); +if (!ret) +panic ("alloc_low_page: can not alloc memory" ); +memblock_reserve (ret,PAGE_SIZE ); + pfn = ret >>PAGE_SHIFT ; + }else + pfn = pgt_buf_end++; adr =__va (pfn *PAGE_SIZE );clear_page (adr);arch/x86/mm/init_64.c +14
-4@@ -316,7 +316,7 @@ void __init cleanup_highmap(void)static __ref void *alloc_low_page (unsigned long *phys) { -unsigned long pfn = pgt_buf_end++; +unsigned long pfn;void *adr;if (after_bootmem) {@@ -326,8 +326,19 @@ static __ref void *alloc_low_page(unsigned long *phys)return adr; } -if (pfn >= pgt_buf_top) -panic ("alloc_low_page: ran out of memory" ); +if ((pgt_buf_end +1 ) >= pgt_buf_top) { +unsigned long ret; +if (min_pfn_mapped >= max_pfn_mapped) +panic ("alloc_low_page: ran out of memory" ); + ret =memblock_find_in_range (min_pfn_mapped <<PAGE_SHIFT , + max_pfn_mapped <<PAGE_SHIFT , +PAGE_SIZE ,PAGE_SIZE ); +if (!ret) +panic ("alloc_low_page: can not alloc memory" ); +memblock_reserve (ret,PAGE_SIZE ); + pfn = ret >>PAGE_SHIFT ; + }else + pfn = pgt_buf_end++; adr =early_memremap (pfn *PAGE_SIZE ,PAGE_SIZE );clear_page (adr); --1.7.7
Re: [PATCH 06/19] x86, mm: setup page table in top-down
Quoted 15 lines · Stefano Stabellini
Quoted 14 lines · Yinghai Lu
Get
pgt_bufearly from BRK, and use it to mapPMD_SIZEfrom top at first. then use mapped pages to map more range below, and keep looping until all pages get mapped.
alloc_low_pagewill use page from BRK at first, after that buff is used up, will use memblock to find and reserve page for page table usage.At last we could get rid of calculation and find early pgt related code.
(quoted diff) +0
-3-v2: update to after fix_xen change, also use MACRO for initial pgt_buf size and add comments with it. -v3: skip big reserved range in memblock.reserved near end. -v4: don't need fix_xen change now.
Quoted 5 lines
Quoted 2 lines
Suggested-by "H. Peter Anvin" <[email protected]>Signed-off-by Yinghai Lu <[email protected]>The series is starting to get in good shape!
I tested it on a 2G and an 8G VM and it seems to be working fine.
domU on 32bit and 64bit?
Quoted 6 lines
The most important thing to do now is testing it on different machines (with and without xen) and writing better commit messages. We can help you with the testing but you really need to write better docs.
I tested on native one on 32bit, and 64bit.
Also xen dom0 32bit and 64bit.
Changelog is always problem now. Looks like everyone is complaining about that.
Actually I already tried my best on that, really don't know what to do next.
Quoted 7 lines
In particular you should state in clear letters that
alloc_low_pageis always going to return a page that is already mapped. You should write it both in the commit message and in the code as a comment. This is particularly important because it is going to become part of the interface between the common x86 code and the other x86 subsystems like Xen.
alloc_low_page() is used in arch/x86/mm/init*.c. How come it becomes interface to
other subsystem?
I'm not sure if we really need that comment in code for that:
---
the page that alloc_low_page return is directed mapped already, could use virtual address
to access it.
---
Quoted 6 lines
Also, it wouldn't hurt to explain the overall design at the beginning of the series: I shouldn't have to read your code to understand what you are doing. I should read the description of the patch, understand what you are doing, then go and check if the code actually does what you say it does.
Actually I really don't like to read too long change log in commit. Changelog should be concise and precise.
code change is more straightforward to me.
Thanks
Yinghai
Re: [PATCH 06/19] x86, mm: setup page table in top-down
Quoted 17 lines · Yinghai Lu
Quoted 15 lines · Stefano Stabellini
Quoted 14 lines · Yinghai Lu
Get
pgt_bufearly from BRK, and use it to mapPMD_SIZEfrom top at first. then use mapped pages to map more range below, and keep looping until all pages get mapped.
alloc_low_pagewill use page from BRK at first, after that buff is used up, will use memblock to find and reserve page for page table usage.At last we could get rid of calculation and find early pgt related code.
(quoted diff) +0
-3-v2: update to after fix_xen change, also use MACRO for initial pgt_buf size and add comments with it. -v3: skip big reserved range in memblock.reserved near end. -v4: don't need fix_xen change now.
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
Suggested-by "H. Peter Anvin" <[email protected]>Signed-off-by Yinghai Lu <[email protected]>The series is starting to get in good shape!
I tested it on a 2G and an 8G VM and it seems to be working fine.domU on 32bit and 64bit?
domU 64bit
Quoted 8 lines
Quoted 4 lines
The most important thing to do now is testing it on different machines (with and without xen) and writing better commit messages. We can help you with the testing but you really need to write better docs.
I tested on native one on 32bit, and 64bit.
Also xen dom0 32bit and 64bit.
Good, thanks!
Quoted 12 lines
Changelog is always problem now. Looks like everyone is complaining about that.
Actually I already tried my best on that, really don't know what to do next.
Quoted 7 lines
In particular you should state in clear letters that
alloc_low_pageis always going to return a page that is already mapped. You should write it both in the commit message and in the code as a comment. This is particularly important because it is going to become part of the interface between the common x86 code and the other x86 subsystems like Xen.
Quoted 3 lines
alloc_low_page()is used inarch/x86/mm/init*.c. How come it becomes interface to
other subsystem?
I chose the wrong words.
I meant that always allocating pages from areas that are already mapped, will become an assumption for other x86 subsystems like Xen. One shouldn't just go ahead and change this assumption without changing the subsystems too.
Quoted 6 lines
I'm not sure if we really need that comment in code for that:
---
the page thatalloc_low_pagereturn is directed mapped already, could use virtual address
to access it.
---
I just want to make sure that 3 years from now, when somebody comes up with a new great idea to improve the intial pagetable allocation, he doesn't forget that changing alloc_low_page might break other subsystems.
So I think that a comment is required here and should explicitly mention why it is important that alloc_low_page returns a mapped page.
Quoted 9 lines
Quoted 5 lines
Also, it wouldn't hurt to explain the overall design at the beginning of the series: I shouldn't have to read your code to understand what you are doing. I should read the description of the patch, understand what you are doing, then go and check if the code actually does what you say it does.
Actually I really don't like to read too long change log in commit. Changelog should be concise and precise.
code change is more straightforward to me.
Many people don't think like that.
Of course you shouldn't document line by line changes in the commit message but you should include a full explanation of your changes, like I wrote before.
Re: [PATCH 06/19] x86, mm: setup page table in top-down
Quoted 5 lines · Stefano Stabellini
Quoted 4 lines
Quoted 2 lines
The series is starting to get in good shape!
I tested it on a 2G and an 8G VM and it seems to be working fine.domU on 32bit and 64bit?
domU 64bit
Can you test domU 32bit too?
I did not test that, and looks like Jacob only test 64 bit domU too.
Quoted 10 lines
Quoted 3 lines
alloc_low_page()is used inarch/x86/mm/init*.c. How come it becomes interface to
other subsystem?I chose the wrong words.
I meant that always allocating pages from areas that are already mapped, will become an assumption for other x86 subsystems like Xen. One shouldn't just go ahead and change this assumption without changing the subsystems too.
that looks like xen's problem, it should let us know what kind of assumption that is there for xen.
We can not go deep to xen find those.
Quoted 6 lines
I just want to make sure that 3 years from now, when somebody comes up with a new great idea to improve the intial pagetable allocation, he doesn't forget that changing
alloc_low_pagemight break other subsystems.So I think that a comment is required here and should explicitly mention why it is important that
alloc_low_pagereturns a mapped page.
How about put sth:
---
Xen mmu requires pages from this function should be directly mapped already.
---
or you can introduce some doc tag specially that we can out those assumption easily?
Thanks
Yinghai
Re: [PATCH 06/19] x86, mm: setup page table in top-down
Quoted 9 lines · Yinghai Lu
On Mon, Oct 22, 2012 at 6:19 AM, Stefano Stabellini
How about put sth:
---
Xen mmu requires pages from this function should be directly mapped already.
---or you can introduce some doc tag specially that we can out those assumption easily?
I add
/* Xen requires pages from this function should be directly mapped already */
in [PATCH] x86, mm: Add alloc_low_pages(num)
hope you are happy with that.
Re: [PATCH 06/19] x86, mm: setup page table in top-down
Quoted 11 lines · Yinghai Lu
Quoted 9 lines · Yinghai Lu
On Mon, Oct 22, 2012 at 6:19 AM, Stefano Stabellini
How about put sth:
---
Xen mmu requires pages from this function should be directly mapped already.
---or you can introduce some doc tag specially that we can out those assumption easily?
Quoted 8 lines
I add
/* Xen requires pages from this function should be directly mapped already */
in [PATCH] x86, mm: Add
alloc_low_pages(num)hope you are happy with that.
It is not bad, but let's just fix the English a bit and give more context:
/* Pages returned by this function are already directly mapped.
*
* Changing that is likely to break Xen, see commit
* 279b706bf800b5967037f492dbe4fc5081ad5d0f for more information on the
* subject.
*/
Re: [PATCH 06/19] x86, mm: setup page table in top-down
Quoted 24 lines · Stefano Stabellini
Quoted 11 lines · Yinghai Lu
Quoted 9 lines · Yinghai Lu
On Mon, Oct 22, 2012 at 6:19 AM, Stefano Stabellini
How about put sth:
---
Xen mmu requires pages from this function should be directly mapped already.
---or you can introduce some doc tag specially that we can out those assumption easily?
Quoted 8 lines
I add
/* Xen requires pages from this function should be directly mapped already */
in [PATCH] x86, mm: Add
alloc_low_pages(num)hope you are happy with that.
It is not bad, but let's just fix the English a bit and give more context:
Quoted 6 lines
/* Pages returned by this function are already directly mapped.
*
* Changing that is likely to break Xen, see commit
*279b706bf800b5967037f492dbe4fc5081ad5d0ffor more information on the
* subject.
*/
I put your change in separate patch.
Quoted 1 line
From
bc6e8a77f049f3ecaad291329238367af044aa57Mon Sep 17 00:00:00 2001
From: Stefano Stabellini <[email protected]>
Date: Tue, 23 Oct 2012 11:24:07 -0700
Subject: [PATCH] x86, mm: Add pointer about Xen mmu requirement for
alloc_low_pages
--- arch/x86/mm/init.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-)
arch/x86/mm/init.c +7 -0
@@ -25,6 +25,13 @@ unsigned long __meminitdata pgt_buf_top;static unsigned long min_pfn_mapped; +/* +* Pages returned are already directly mapped. +* +* Changing that is likely to break Xen, see commit +* 279b706bf800b5967037f492dbe4fc5081ad5d0f for more information on the +* subject. +*/ __ref void *alloc_low_pages (unsigned int num) {unsigned long pfn;
Signature · 1 line
1.7.7.6
Re: [PATCH 06/19] x86, mm: setup page table in top-down
In reply to Yinghai LuQuoted 11 lines · Yinghai Lu
Quoted 5 lines · Stefano Stabellini
Quoted 4 lines
Quoted 2 lines
The series is starting to get in good shape!
I tested it on a 2G and an 8G VM and it seems to be working fine.domU on 32bit and 64bit?
domU 64bit
Can you test domU 32bit too?
I did not test that, and looks like Jacob only test 64 bit domU too.
Sure. It works fine.
Re: [PATCH 06/19] x86, mm: setup page table in top-down
Quoted 5 lines · Stefano Stabellini
Quoted 2 lines · Yinghai Lu
Can you test domU 32bit too?
I did not test that, and looks like Jacob only test 64 bit domU too.Sure. It works fine.
great.
Do you know any simple way to test xen domU after pxe booting xen/dom0 via pxe?
Quoted 1 line
From kvm, it is simple with pxe:
1. build kernel and iso at the same time., initrd is converted from opensuse rescue initramfs.
2. copy kernel and iso into boot server
3. network boot the kernel
4. mount nfs dir so could access iso, and qemu-kvm.
5. qemu-kvm to load the iso.
Re: [PATCH 06/19] x86, mm: setup page table in top-down
Quoted 12 lines · Yinghai Lu
Quoted 5 lines · Stefano Stabellini
Quoted 2 lines · Yinghai Lu
Can you test domU 32bit too?
I did not test that, and looks like Jacob only test 64 bit domU too.Sure. It works fine.
great.
Do you know any simple way to test xen domU after pxe booting xen/dom0 via pxe?
Quoted 7 lines
Quoted 1 line
From kvm, it is simple with pxe:
1. build kernel and iso at the same time., initrd is converted from opensuse rescue initramfs.
2. copy kernel and iso into boot server
3. network boot the kernel
4. mount nfs dir so could access iso, and qemu-kvm.
5. qemu-kvm to load the iso.
After building and installing the Xen tools in Dom0 (basically everything that comes out a xen-unstable build), you can use "xl" to create VMs:
1) build and install xen and tools in dom0 (make; make install) If you are running dom0 out of his initramfs you might have to add them to it. But I guess that you can also make them available to your dom0 via nfs share.
2) copy your domU kernel and initrd to dom0
3) Write a simple config file in dom0 with the path to the kernel and initrd
name = "linux"
kernel = "/path/to/vmlinuz"
ramdisk = "/path/to/initrd"
memory = 1024
vcpus = 4
vif = [ 'bridge=xenbr0' ]
disk = [ '/path/to/debian_squeeze_amd64_standard.raw,raw,xvda,w' ] extra = 'textmode=1 xencons=xvc0'
root = "/dev/xvda1"
4) create the VM
xl create -c /path/to/config_file
As an alternative you can get an account on Amazon EC2 for few cents per hour and test your kernel over there ;)
Re: [PATCH 06/19] x86, mm: setup page table in top-down
In reply to Yinghai LuQuoted 3 lines
Changelog is always problem now. Looks like everyone is complaining about that.
Actually I already tried my best on that, really don't know what to do next.
Read on. I've some advice.
Quoted 21 lines
Quoted 8 lines
In particular you should state in clear letters that
alloc_low_pageis always going to return a page that is already mapped. You should write it both in the commit message and in the code as a comment. This is particularly important because it is going to become part of the interface between the common x86 code and the other x86 subsystems like Xen.
alloc_low_page()is used inarch/x86/mm/init*.c. How come it becomes interface to
other subsystem?I'm not sure if we really need that comment in code for that:
---
the page thatalloc_low_pagereturn is directed mapped already, could use virtual address
to access it.
---Quoted 1 line
Quoted 8 lines
Quoted 5 lines
Also, it wouldn't hurt to explain the overall design at the beginning of the series: I shouldn't have to read your code to understand what you are doing. I should read the description of the patch, understand what you are doing, then go and check if the code actually does what you say it does.
Actually I really don't like to read too long change log in commit. Changelog should be concise and precise.
They depend on the patch in question. If it is something simple (fix compile warning) sure. But for something that is deep in the bowels of complicated code - then it should have a good explanation that follows roughly these steps:
1). Introduce the problem. Explain what is wrong with the existing
code.
2). Explain how your patch fixes it.
3). Explain (if there are any) alternative solutions.
Then re-read it and look at the verb tense. It should be the same tense - so don't mix them.
Re: [PATCH 06/19] x86, mm: setup page table in top-down
In reply to Yinghai LuQuoted 2 lines · Yinghai Lu
Get
pgt_bufearly from BRK, and use it to mapPMD_SIZEfrom top at first. then use mapped pages to map more range below, and keep looping until
^Then ^-s
Quoted 3 lines
all pages get mapped.
alloc_low_pagewill use page from BRK at first, after that buff is used up,
^^^^ buffer
Quoted 1 line
will use memblock to find and reserve page for page table usage.
^^^^ - pages
You might want to mention how 'memblock' searches for regions. Presumarily it is from top to bottom.
And also explain the granularity of what the size you are mapping _after_ you are done with the PMD_SIZE.
Quoted 2 lines
At last we could get rid of calculation and find early pgt related code.
^^^^^ - can
Quoted 22 lines
(quoted diff) +0
-3-v2: update to after fix_xen change, also use MACRO for initial pgt_buf size and add comments with it. -v3: skip big reserved range in memblock.reserved near end. -v4: don't need fix_xen change now.Suggested-by "H. Peter Anvin" <[email protected]>Signed-off-by Yinghai Lu <[email protected]>--- arch/x86/include/asm/page_types.h | 1 + arch/x86/include/asm/pgtable.h | 1 + arch/x86/kernel/setup.c | 3 + arch/x86/mm/init.c | 207 ++++++++++-------------------------- arch/x86/mm/init_32.c | 17 +++- arch/x86/mm/init_64.c | 17 +++- 6 files changed, 91 insertions(+), 155 deletions(-)arch/x86/include/asm/page_types.h +0
-0
arch/x86/include/asm/page_types.h extern int devmem_is_allowed(unsigned long pagenr); · line 48
Quoted 4 lines
arch/x86/include/asm/page_types.h +1
-0@@ -45,6 +45,7 @@ extern int devmem_is_allowed(unsigned long pagenr);extern unsigned long max_low_pfn_mapped;extern unsigned long max_pfn_mapped; +extern unsigned long min_pfn_mapped;
Why not call it 'last_min_pfn_mapped'? It looks to be keyed of the last 'start' of memory we mapped and keeps on decreasing.
Quoted 169 lines
arch/x86/include/asm/page_types.h +0
-0static inline phys_addr_t get_max_mapped (void ) {arch/x86/include/asm/pgtable.h +1
-0@@ -603,6 +603,7 @@ static inline int pgd_none(pgd_t pgd)extern int direct_gbpages;void init_mem_mapping (void ); +void early_alloc_pgt_buf (void );/* local pte updates need not use xchg for locking */ static inline pte_t native_local_ptep_get_and_clear (pte_t *ptep)arch/x86/kernel/setup.c +3
-0@@ -124,6 +124,7 @@*/ unsigned long max_low_pfn_mapped;unsigned long max_pfn_mapped; +unsigned long min_pfn_mapped;#ifdef CONFIG_DMI RESERVE_BRK (dmi_alloc,65536 );@@ -897,6 +898,8 @@ void __init setup_arch(char **cmdline_p)reserve_ibft_region (); +early_alloc_pgt_buf (); +/* * Need to conclude brk, before memblock_x86_fill() * it could use memblock_find_in_range, could overlap with arch/x86/mm/init.c +15
-99@@ -21,6 +21,21 @@ unsigned long __initdata pgt_buf_start;unsigned long __meminitdata pgt_buf_end;unsigned long __meminitdata pgt_buf_top; +/* need 4 4k for initial PMD_SIZE, 4k for 0-ISA_END_ADDRESS */ +#define INIT_PGT_BUF_SIZE (5 * PAGE_SIZE) +RESERVE_BRK (early_pgt_alloc,INIT_PGT_BUF_SIZE ); +void __init early_alloc_pgt_buf (void ) +{ +unsigned long tables =INIT_PGT_BUF_SIZE ; +phys_addr_t base; + + base =__pa (extend_brk (tables,PAGE_SIZE )); + + pgt_buf_start = base >>PAGE_SHIFT ; + pgt_buf_end = pgt_buf_start; + pgt_buf_top = pgt_buf_start + (tables >>PAGE_SHIFT ); +} +int after_bootmem;int direct_gbpages@@ -228,105 +243,6 @@ static int __meminit split_mem_range(struct map_range *mr, int nr_range,return nr_range; } -static unsigned long __init calculate_table_space_size (unsigned long start, -unsigned long end) -{ -unsigned long puds =0 , pmds =0 , ptes =0 , tables; -struct map_range mr[NR_RANGE_MR ]; -int nr_range, i; - -pr_info ("calculate_table_space_size: [mem %#010lx-%#010lx]\n" , - start, end -1 ); - -memset (mr,0 ,sizeof (mr)); - nr_range =0 ; - nr_range =split_mem_range (mr, nr_range, start, end); - -for (i =0 ; i < nr_range; i++) { -unsigned long range, extra; - - range = mr[i].end - mr[i].start; - puds += (range +PUD_SIZE -1 ) >>PUD_SHIFT ; - -if (mr[i].page_size_mask & (1 <<PG_LEVEL_1G )) { - extra = range - ((range >>PUD_SHIFT ) <<PUD_SHIFT ); - pmds += (extra +PMD_SIZE -1 ) >>PMD_SHIFT ; - }else - pmds += (range +PMD_SIZE -1 ) >>PMD_SHIFT ; - -if (mr[i].page_size_mask & (1 <<PG_LEVEL_2M )) { - extra = range - ((range >>PMD_SHIFT ) <<PMD_SHIFT ); -#ifdef CONFIG_X86_32 - extra +=PMD_SIZE ; -#endif -/* The first 2/4M doesn't use large pages. */ -if (mr[i].start <PMD_SIZE ) - extra +=PMD_SIZE - mr[i].start; - - ptes += (extra +PAGE_SIZE -1 ) >>PAGE_SHIFT ; - }else - ptes += (range +PAGE_SIZE -1 ) >>PAGE_SHIFT ; - } - - tables =roundup (puds *sizeof (pud_t),PAGE_SIZE ); - tables +=roundup (pmds *sizeof (pmd_t),PAGE_SIZE ); - tables +=roundup (ptes *sizeof (pte_t),PAGE_SIZE ); - -#ifdef CONFIG_X86_32 -/* for fixmap */ - tables +=roundup (__end_of_fixed_addresses *sizeof (pte_t),PAGE_SIZE ); -#endif - -return tables; -} - -static unsigned long __init calculate_all_table_space_size (void ) -{ -unsigned long start_pfn, end_pfn; -unsigned long tables; -int i; - -/* the ISA range is always mapped regardless of memory holes */ - tables =calculate_table_space_size (0 ,ISA_END_ADDRESS ); - -for_each_mem_pfn_range (i,MAX_NUMNODES , &start_pfn, &end_pfn,NULL ) { -u64 start = start_pfn <<PAGE_SHIFT ; -u64 end = end_pfn <<PAGE_SHIFT ; - -if (end <=ISA_END_ADDRESS ) -continue ; - -if (start <ISA_END_ADDRESS ) - start =ISA_END_ADDRESS ; -#ifdef CONFIG_X86_32 -/* on 32 bit, we only map up to max_low_pfn */ -if ((start >>PAGE_SHIFT ) >= max_low_pfn) -continue ; - -if ((end >>PAGE_SHIFT ) > max_low_pfn) - end = max_low_pfn <<PAGE_SHIFT ; -#endif - tables +=calculate_table_space_size (start, end); - } - -return tables; -} - -static void __init find_early_table_space (unsigned long start, -unsigned long good_end, -unsigned long tables) -{ -phys_addr_t base; - - base =memblock_find_in_range (start, good_end, tables,PAGE_SIZE ); -if (!base) -panic ("Cannot find space for the kernel page tables" ); - - pgt_buf_start = base >>PAGE_SHIFT ; - pgt_buf_end = pgt_buf_start; - pgt_buf_top = pgt_buf_start + (tables >>PAGE_SHIFT ); -} -static struct range pfn_mapped[E820_X_MAX ];static int nr_pfn_mapped;
arch/x86/mm/init.c unsigned long __init_refok init_memory_mapping(unsigned long start, · line 310
Quoted 10 lines
arch/x86/mm/init.c +1
-6@@ -391,17 +307,14 @@ unsigned long __init_refok init_memory_mapping(unsigned long start, }/* -* Iterate through E820 memory map and create direct mappings for only E820_RAM -* regions. We cannot simply create direct mappings for all pfns from -* [0 to max_low_pfn) and [4GB to max_pfn) because of possible memory holes in -* high addresses that cannot be marked as UC by fixed/variable range MTRRs. -* Depending on the alignment of E820 ranges, this may possibly result in using -* smaller size (i.e. 4K instead of 2M or 1G) page tables. +* this one could take range with hole in it
You forgot a period at the end.
Quoted 49 lines
arch/x86/mm/init.c +12
-13*/ -static void __init init_range_memory_mapping (unsigned long range_start, +static unsigned long __init init_range_memory_mapping ( +unsigned long range_start,unsigned long range_end) {unsigned long start_pfn, end_pfn; +unsigned long mapped_ram_size =0 ;int i;for_each_mem_pfn_range (i,MAX_NUMNODES , &start_pfn, &end_pfn,NULL ) {@@ -421,71 +334,67 @@ static void __init init_range_memory_mapping(unsigned long range_start, end = range_end;init_memory_mapping (start, end); + + mapped_ram_size += end - start; } + +return mapped_ram_size; }void __init init_mem_mapping (void ) { -unsigned long tables, good_end, end; +unsigned long end, real_end, start, last_start; +unsigned long step_size; +unsigned long addr; +unsigned long mapped_ram_size =0 ; +unsigned long new_mapped_ram_size;probe_page_size_mask (); -/* -* Find space for the kernel direct mapping tables. -* -* Later we should allocate these tables in the local node of the -* memory mapped. Unfortunately this is done currently before the -* nodes are discovered. -*/ #ifdef CONFIG_X86_64 end = max_pfn <<PAGE_SHIFT ; - good_end = end;#else end = max_low_pfn <<PAGE_SHIFT ; - good_end = max_pfn_mapped <<PAGE_SHIFT ;#endif - tables =calculate_all_table_space_size (); -find_early_table_space (0 , good_end, tables);
arch/x86/mm/init.c static void __init init_range_memory_mapping(unsigned long range_start, · line 363
Quoted 10 lines
arch/x86/mm/init.c +2
-5-printk (KERN_DEBUG "kernel direct mapping tables up to %#lx @ [mem %#010lx-%#010lx] prealloc\n" , - end -1 , pgt_buf_start <<PAGE_SHIFT , - (pgt_buf_top <<PAGE_SHIFT ) -1 ); - max_pfn_mapped =0 ;/* will get exact value next */ /* the ISA range is always mapped regardless of memory holes */ init_memory_mapping (0 ,ISA_END_ADDRESS ); -init_range_memory_mapping (ISA_END_ADDRESS , end); + +/* xen has big range in reserved near end of ram, skip it at first */
How does feeding ISA_END_ADDRESS in to the memblock_find_in_range skip it?
arch/x86/mm/init.c static void __init init_range_memory_mapping(unsigned long range_start, · line 370
Quoted 7 lines
arch/x86/mm/init.c +7
-0+ addr =memblock_find_in_range (ISA_END_ADDRESS , end,PMD_SIZE , +PAGE_SIZE ); + real_end = addr +PMD_SIZE ; + +/* step_size need to be small so pgt_buf from BRK could cover it */ + step_size =PMD_SIZE ; + max_pfn_mapped =0 ;/* will get exact value next */
next in the init_rnage_memory_mapping? Might want to spell that out.
arch/x86/mm/init.c static void __init init_range_memory_mapping(unsigned long range_start, · line 372
Quoted 2 lines
arch/x86/mm/init.c +2
-0+ min_pfn_mapped = real_end >>PAGE_SHIFT ; + last_start = start = real_end;
Might want to add a comment here saying:
"We are looping from the top to the bottom."
arch/x86/mm/init.c static void __init init_range_memory_mapping(unsigned long range_start, · line 385
Quoted 13 lines
arch/x86/mm/init.c +13
-0+while (last_start >ISA_END_ADDRESS ) { +if (last_start > step_size) { + start =round_down (last_start -1 , step_size); +if (start <ISA_END_ADDRESS ) + start =ISA_END_ADDRESS ; + }else + start =ISA_END_ADDRESS ; + new_mapped_ram_size =init_range_memory_mapping (start, + last_start); + last_start = start; + min_pfn_mapped = last_start >>PAGE_SHIFT ; +if (new_mapped_ram_size > mapped_ram_size) + step_size <<=5 ;
Should '5' have a #define value?
arch/x86/mm/init.c static void __init init_range_memory_mapping(unsigned long range_start, · line 387
Quoted 2 lines
arch/x86/mm/init.c +2
-0+ mapped_ram_size += new_mapped_ram_size; + }
It looks like the step_size would keep on increasing on every loop. First it would be 2MB, 64MB, then 2GB, and so - until the amount of memory that has been mapped is greater then unmapped. Is that right?
I am basing that assumption on that the "new_mapped_ram_size" would return the size of the newly mapped region (start, last_start) in bytes. And the 'mapped_ram_size' is the size of the previously mapped region plus all the other ones.
The logic being that at the start of execution you start with a 2MB, compare it to 0, and increase step_size up to 64MB. Then start at real_end-2MB-step_size -> real_end-2MB-1. That gets you a 64MB chunk.
Since new_mapped_ram_size (64MB) > mapped_ram_sized (2MB) you increase step_size once more.
If so, you should also explain that in the git commit description and in the loop logic..
Quoted 113 lines
arch/x86/mm/init.c +4
-26+ +if (real_end < end) +init_range_memory_mapping (real_end, end); +#ifdef CONFIG_X86_64 if (max_pfn > max_low_pfn) {/* can we preseve max_low_pfn ?*/ max_low_pfn = max_pfn; }#endif -/* -* Reserve the kernel pagetable pages we used (pgt_buf_start - -* pgt_buf_end) and free the other ones (pgt_buf_end - pgt_buf_top) -* so that they can be reused for other purposes. -* -* On native it just means calling memblock_reserve, on Xen it also -* means marking RW the pagetable pages that we allocated before -* but that haven't been used. -* -* In fact on xen we mark RO the whole range pgt_buf_start - -* pgt_buf_top, because we have to make sure that when -* init_memory_mapping reaches the pagetable pages area, it maps -* RO all the pagetable pages, including the ones that are beyond -* pgt_buf_end at that time. -*/ -if (pgt_buf_end > pgt_buf_start) { -printk (KERN_DEBUG "kernel direct mapping tables up to %#lx @ [mem %#010lx-%#010lx] final\n" , - end -1 , pgt_buf_start <<PAGE_SHIFT , - (pgt_buf_end <<PAGE_SHIFT ) -1 ); - x86_init.mapping.pagetable_reserve (PFN_PHYS (pgt_buf_start), -PFN_PHYS (pgt_buf_end)); - } - -/* stop the wrong using */ - pgt_buf_top =0 ; -early_memtest (0 , max_pfn_mapped <<PAGE_SHIFT ); }arch/x86/mm/init_32.c +14
-3@@ -61,11 +61,22 @@ bool __read_mostly __vmalloc_start_set = false;static __init void *alloc_low_page (void ) { -unsigned long pfn = pgt_buf_end++; +unsigned long pfn;void *adr; -if (pfn >= pgt_buf_top) -panic ("alloc_low_page: ran out of memory" ); +if ((pgt_buf_end +1 ) >= pgt_buf_top) { +unsigned long ret; +if (min_pfn_mapped >= max_pfn_mapped) +panic ("alloc_low_page: ran out of memory" ); + ret =memblock_find_in_range (min_pfn_mapped <<PAGE_SHIFT , + max_pfn_mapped <<PAGE_SHIFT , +PAGE_SIZE ,PAGE_SIZE ); +if (!ret) +panic ("alloc_low_page: can not alloc memory" ); +memblock_reserve (ret,PAGE_SIZE ); + pfn = ret >>PAGE_SHIFT ; + }else + pfn = pgt_buf_end++; adr =__va (pfn *PAGE_SIZE );clear_page (adr);arch/x86/mm/init_64.c +14
-3@@ -316,7 +316,7 @@ void __init cleanup_highmap(void)static __ref void *alloc_low_page (unsigned long *phys) { -unsigned long pfn = pgt_buf_end++; +unsigned long pfn;void *adr;if (after_bootmem) {@@ -326,8 +326,19 @@ static __ref void *alloc_low_page(unsigned long *phys)return adr; } -if (pfn >= pgt_buf_top) -panic ("alloc_low_page: ran out of memory" ); +if ((pgt_buf_end +1 ) >= pgt_buf_top) { +unsigned long ret; +if (min_pfn_mapped >= max_pfn_mapped) +panic ("alloc_low_page: ran out of memory" ); + ret =memblock_find_in_range (min_pfn_mapped <<PAGE_SHIFT , + max_pfn_mapped <<PAGE_SHIFT , +PAGE_SIZE ,PAGE_SIZE ); +if (!ret) +panic ("alloc_low_page: can not alloc memory" ); +memblock_reserve (ret,PAGE_SIZE ); + pfn = ret >>PAGE_SHIFT ; + }else + pfn = pgt_buf_end++; adr =early_memremap (pfn *PAGE_SIZE ,PAGE_SIZE );clear_page (adr);Signature · 7 lines
1.7.7 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 06/19] x86, mm: setup page table in top-down
Quoted 4 lines · Konrad Rzeszutek Wilk
On Thu, Oct 18, 2012 at 01:50:17PM -0700, Yinghai Lu wrote:
You might want to mention how 'memblock' searches for regions. Presumarily it is from top to bottom.
that is not related. Will add explanation about min_pfn_mapped.
Quoted 4 lines
And also explain the granularity of what the size you are mapping _after_ you are done with the
PMD_SIZE.
will add reason for step_size
Quoted 5 lines
arch/x86/mm/init.c static void __init init_range_memory_mapping(unsigned long range_start, · line 370
Quoted 3 lines
arch/x86/mm/init.c +3
-0+/* step_size need to be small so pgt_buf from BRK could cover it */ + step_size =PMD_SIZE ; + max_pfn_mapped =0 ;/* will get exact value next */ next in the
init_rnage_memory_mapping? Might want to spell that out.
the loop and
init_range_memory_mapping==>init_memory_mapping ==> add_pfn_range_mapped
Quoted 22 lines
arch/x86/mm/init.c static void __init init_range_memory_mapping(unsigned long range_start, · line 372
Quoted 3 lines
arch/x86/mm/init.c +2
-0+ min_pfn_mapped = real_end >>PAGE_SHIFT ; + last_start = start = real_end;Might want to add a comment here saying:
"We are looping from the top to the bottom."
arch/x86/mm/init.c static void __init init_range_memory_mapping(unsigned long range_start, · line 385
Quoted 13 lines
arch/x86/mm/init.c +13
-0+while (last_start >ISA_END_ADDRESS ) { +if (last_start > step_size) { + start =round_down (last_start -1 , step_size); +if (start <ISA_END_ADDRESS ) + start =ISA_END_ADDRESS ; + }else + start =ISA_END_ADDRESS ; + new_mapped_ram_size =init_range_memory_mapping (start, + last_start); + last_start = start; + min_pfn_mapped = last_start >>PAGE_SHIFT ; +if (new_mapped_ram_size > mapped_ram_size) + step_size <<=5 ;
Quoted 1 line
Should '5' have a #define value?
yes.
Quoted 18 lines
arch/x86/mm/init.c static void __init init_range_memory_mapping(unsigned long range_start, · line 387
Quoted 3 lines
arch/x86/mm/init.c +2
-0+ mapped_ram_size += new_mapped_ram_size; + }It looks like the
step_sizewould keep on increasing on every loop. First it would be 2MB, 64MB, then 2GB, and so - until the amount of memory that has been mapped is greater then unmapped. Is that right?I am basing that assumption on that the "
new_mapped_ram_size" would return the size of the newly mapped region (start,last_start) in bytes. And the 'mapped_ram_size' is the size of the previously mapped region plus all the other ones.The logic being that at the start of execution you start with a 2MB, compare it to 0, and increase
step_sizeup to 64MB. Then start at real_end-2MB-step_size -> real_end-2MB-1. That gets you a 64MB chunk.
Quoted 5 lines
Since
new_mapped_ram_size(64MB) >mapped_ram_sized(2MB) you increasestep_sizeonce more.If so, you should also explain that in the git commit description and in the loop logic..
that logic is hard to understand from code?
updated changelog:
---
Get pgt_buf early from BRK, and use it to map PMD_SIZE from top at first. Then use mapped pages to map more ranges below, and keep looping until all pages get mapped.
alloc_low_page will use page from BRK at first, after that buffer is used up, will use memblock to find and reserve pages for page table usage.
Introduce min_pfn_mapped to make sure find new pages from mapped ranges, that will be updated when lower pages get mapped.
Also add step_size to make sure that don't try to map too big range with limited mapped pages initially, and increase the step_size when we have more mapped pages on hand.
At last we can get rid of calculation and find early pgt related code.
---
PATCH 7/19 x86, mm: Remove early_memremap workaround for page table accessing on 64bit
In reply to Yinghai LuWe do not need that workaround anymore after patches that pre-map page table buf and do not clear initial page table wrongly.
--- arch/x86/mm/init_64.c | 38 ++++---------------------------------- 1 files changed, 4 insertions(+), 34 deletions(-)
arch/x86/mm/init_64.c +4 -34
@@ -340,36 +340,12 @@ static __ref void *alloc_low_page(unsigned long *phys) }else pfn = pgt_buf_end++; - adr =early_memremap (pfn *PAGE_SIZE ,PAGE_SIZE ); + adr =__va (pfn *PAGE_SIZE );clear_page (adr); *phys = pfn *PAGE_SIZE ;return adr; } -static __ref void *map_low_page (void *virt) -{ -void *adr; -unsigned long phys, left; - -if (after_bootmem) -return virt; - - phys =__pa (virt); - left = phys & (PAGE_SIZE -1 ); - adr =early_memremap (phys &PAGE_MASK ,PAGE_SIZE ); - adr = (void *)(((unsigned long )adr) | left); - -return adr; -} - -static __ref void unmap_low_page (void *adr) -{ -if (after_bootmem) -return ; - -early_iounmap ((void *)((unsigned long )adr &PAGE_MASK ),PAGE_SIZE ); -} -static unsigned long __meminit phys_pte_init (pte_t *pte_page,unsigned long addr,unsigned long end,pgprot_t prot)
@@ -441,10 +417,9 @@ phys_pmd_init(pmd_t *pmd_page, unsigned long address, unsigned long end,if (pmd_val (*pmd)) {if (!pmd_large (*pmd)) {spin_lock (&init_mm.page_table_lock); - pte =map_low_page ((pte_t *)pmd_page_vaddr (*pmd)); + pte = (pte_t *)pmd_page_vaddr (*pmd); last_map_addr =phys_pte_init (pte, address, end, prot); -unmap_low_page (pte);spin_unlock (&init_mm.page_table_lock);continue ; }
@@ -480,7 +455,6 @@ phys_pmd_init(pmd_t *pmd_page, unsigned long address, unsigned long end, pte =alloc_low_page (&pte_phys); last_map_addr =phys_pte_init (pte, address, end, new_prot); -unmap_low_page (pte);spin_lock (&init_mm.page_table_lock);pmd_populate_kernel (&init_mm, pmd,__va (pte_phys));
@@ -515,10 +489,9 @@ phys_pud_init(pud_t *pud_page, unsigned long addr, unsigned long end,if (pud_val (*pud)) {if (!pud_large (*pud)) { - pmd =map_low_page (pmd_offset (pud,0 )); + pmd =pmd_offset (pud,0 ); last_map_addr =phys_pmd_init (pmd, addr, end, page_size_mask, prot); -unmap_low_page (pmd);__flush_tlb_all ();continue ; }
@@ -555,7 +528,6 @@ phys_pud_init(pud_t *pud_page, unsigned long addr, unsigned long end, pmd =alloc_low_page (&pmd_phys); last_map_addr =phys_pmd_init (pmd, addr, end, page_size_mask, prot); -unmap_low_page (pmd);spin_lock (&init_mm.page_table_lock);pud_populate (&init_mm, pud,__va (pmd_phys));
@@ -591,17 +563,15 @@ kernel_physical_mapping_init(unsigned long start, next = end;if (pgd_val (*pgd)) { - pud =map_low_page ((pud_t *)pgd_page_vaddr (*pgd)); + pud = (pud_t *)pgd_page_vaddr (*pgd); last_map_addr =phys_pud_init (pud,__pa (start),__pa (end), page_size_mask); -unmap_low_page (pud);continue ; } pud =alloc_low_page (&pud_phys); last_map_addr =phys_pud_init (pud,__pa (start),__pa (next), page_size_mask); -unmap_low_page (pud);spin_lock (&init_mm.page_table_lock);pgd_populate (&init_mm, pgd,__va (pud_phys));
Signature · 1 line
1.7.7
Re: [PATCH 07/19] x86, mm: Remove early_memremap workaround for page table accessing on 64bit
Quoted 2 lines · Yinghai Lu
We do not need that workaround anymore after patches that pre-map page table buf and do not clear initial page table wrongly.
.. and somewhere during the v2 posting we had a discussion about why this work-around came about. You should include a bit about that and copy-n-paste some of that here please.
Quoted 116 lines
Signed-off-by Yinghai Lu <[email protected]>--- arch/x86/mm/init_64.c | 38 ++++---------------------------------- 1 files changed, 4 insertions(+), 34 deletions(-)arch/x86/mm/init_64.c +4
-34@@ -340,36 +340,12 @@ static __ref void *alloc_low_page(unsigned long *phys) }else pfn = pgt_buf_end++; - adr =early_memremap (pfn *PAGE_SIZE ,PAGE_SIZE ); + adr =__va (pfn *PAGE_SIZE );clear_page (adr); *phys = pfn *PAGE_SIZE ;return adr; } -static __ref void *map_low_page (void *virt) -{ -void *adr; -unsigned long phys, left; - -if (after_bootmem) -return virt; - - phys =__pa (virt); - left = phys & (PAGE_SIZE -1 ); - adr =early_memremap (phys &PAGE_MASK ,PAGE_SIZE ); - adr = (void *)(((unsigned long )adr) | left); - -return adr; -} - -static __ref void unmap_low_page (void *adr) -{ -if (after_bootmem) -return ; - -early_iounmap ((void *)((unsigned long )adr &PAGE_MASK ),PAGE_SIZE ); -} -static unsigned long __meminit phys_pte_init (pte_t *pte_page,unsigned long addr,unsigned long end,pgprot_t prot)@@ -441,10 +417,9 @@ phys_pmd_init(pmd_t *pmd_page, unsigned long address, unsigned long end,if (pmd_val (*pmd)) {if (!pmd_large (*pmd)) {spin_lock (&init_mm.page_table_lock); - pte =map_low_page ((pte_t *)pmd_page_vaddr (*pmd)); + pte = (pte_t *)pmd_page_vaddr (*pmd); last_map_addr =phys_pte_init (pte, address, end, prot); -unmap_low_page (pte);spin_unlock (&init_mm.page_table_lock);continue ; }@@ -480,7 +455,6 @@ phys_pmd_init(pmd_t *pmd_page, unsigned long address, unsigned long end, pte =alloc_low_page (&pte_phys); last_map_addr =phys_pte_init (pte, address, end, new_prot); -unmap_low_page (pte);spin_lock (&init_mm.page_table_lock);pmd_populate_kernel (&init_mm, pmd,__va (pte_phys));@@ -515,10 +489,9 @@ phys_pud_init(pud_t *pud_page, unsigned long addr, unsigned long end,if (pud_val (*pud)) {if (!pud_large (*pud)) { - pmd =map_low_page (pmd_offset (pud,0 )); + pmd =pmd_offset (pud,0 ); last_map_addr =phys_pmd_init (pmd, addr, end, page_size_mask, prot); -unmap_low_page (pmd);__flush_tlb_all ();continue ; }@@ -555,7 +528,6 @@ phys_pud_init(pud_t *pud_page, unsigned long addr, unsigned long end, pmd =alloc_low_page (&pmd_phys); last_map_addr =phys_pmd_init (pmd, addr, end, page_size_mask, prot); -unmap_low_page (pmd);spin_lock (&init_mm.page_table_lock);pud_populate (&init_mm, pud,__va (pmd_phys));@@ -591,17 +563,15 @@ kernel_physical_mapping_init(unsigned long start, next = end;if (pgd_val (*pgd)) { - pud =map_low_page ((pud_t *)pgd_page_vaddr (*pgd)); + pud = (pud_t *)pgd_page_vaddr (*pgd); last_map_addr =phys_pud_init (pud,__pa (start),__pa (end), page_size_mask); -unmap_low_page (pud);continue ; } pud =alloc_low_page (&pud_phys); last_map_addr =phys_pud_init (pud,__pa (start),__pa (next), page_size_mask); -unmap_low_page (pud);spin_lock (&init_mm.page_table_lock);pgd_populate (&init_mm, pgd,__va (pud_phys));Signature · 7 lines
1.7.7 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 07/19] x86, mm: Remove early_memremap workaround for page table accessing on 64bit
Quoted 8 lines · Konrad Rzeszutek Wilk
Quoted 2 lines · Yinghai Lu
We do not need that workaround anymore after patches that pre-map page table buf and do not clear initial page table wrongly.
.. and somewhere during the v2 posting we had a discussion about why this work-around came about. You should include a bit about that and copy-n-paste some of that here please.
Not sure which one that you are referring.
anyway I update the changelog to:
---
We try to put page table high to make room for kdump, and at that time those ranges are not mapped yet, and have to use ioremap to access it.
Now after patch that pre-map page table top down.
x86, mm: setup page table in top-down
We do not need that workaround anymore.
Just use __va to return directly mapping address.
---
PATCH 8/19 x86, mm: Remove parameter in alloc_low_page for 64bit
In reply to Yinghai LuNow all page table buf are pre-mapped, and could use virtual address directly. So don't need to remember physics address anymore.
Remove that phys pointer in alloc_low_page(), and that will allow us to merge alloc_low_page between 64bit and 32bit.
--- arch/x86/mm/init_64.c | 19 +++++++------------ 1 files changed, 7 insertions(+), 12 deletions(-)
arch/x86/mm/init_64.c +7 -12
@@ -314,14 +314,13 @@ void __init cleanup_highmap(void) } } -static __ref void *alloc_low_page (unsigned long *phys) +static __ref void *alloc_low_page (void ) {unsigned long pfn;void *adr;if (after_bootmem) { adr = (void *)get_zeroed_page (GFP_ATOMIC | __GFP_NOTRACK); - *phys =__pa (adr);return adr; }
@@ -342,7 +341,6 @@ static __ref void *alloc_low_page(unsigned long *phys) adr =__va (pfn *PAGE_SIZE );clear_page (adr); - *phys = pfn *PAGE_SIZE ;return adr; }
@@ -400,7 +398,6 @@ phys_pmd_init(pmd_t *pmd_page, unsigned long address, unsigned long end,int i =pmd_index (address);for (; i <PTRS_PER_PMD ; i++, address = next) { -unsigned long pte_phys;pmd_t *pmd = pmd_page +pmd_index (address);pte_t *pte;pgprot_t new_prot = prot;
@@ -453,11 +450,11 @@ phys_pmd_init(pmd_t *pmd_page, unsigned long address, unsigned long end,continue ; } - pte =alloc_low_page (&pte_phys); + pte =alloc_low_page (); last_map_addr =phys_pte_init (pte, address, end, new_prot);spin_lock (&init_mm.page_table_lock); -pmd_populate_kernel (&init_mm, pmd,__va (pte_phys)); +pmd_populate_kernel (&init_mm, pmd, pte);spin_unlock (&init_mm.page_table_lock); }update_page_count (PG_LEVEL_2M , pages);
@@ -473,7 +470,6 @@ phys_pud_init(pud_t *pud_page, unsigned long addr, unsigned long end,int i =pud_index (addr);for (; i <PTRS_PER_PUD ; i++, addr = next) { -unsigned long pmd_phys;pud_t *pud = pud_page +pud_index (addr);pmd_t *pmd;pgprot_t prot =PAGE_KERNEL ;
@@ -525,12 +521,12 @@ phys_pud_init(pud_t *pud_page, unsigned long addr, unsigned long end,continue ; } - pmd =alloc_low_page (&pmd_phys); + pmd =alloc_low_page (); last_map_addr =phys_pmd_init (pmd, addr, end, page_size_mask, prot);spin_lock (&init_mm.page_table_lock); -pud_populate (&init_mm, pud,__va (pmd_phys)); +pud_populate (&init_mm, pud, pmd);spin_unlock (&init_mm.page_table_lock); }__flush_tlb_all ();
@@ -555,7 +551,6 @@ kernel_physical_mapping_init(unsigned long start,for (; start < end; start = next) {pgd_t *pgd =pgd_offset_k (start); -unsigned long pud_phys;pud_t *pud; next = (start +PGDIR_SIZE ) &PGDIR_MASK ;
@@ -569,12 +564,12 @@ kernel_physical_mapping_init(unsigned long start,continue ; } - pud =alloc_low_page (&pud_phys); + pud =alloc_low_page (); last_map_addr =phys_pud_init (pud,__pa (start),__pa (next), page_size_mask);spin_lock (&init_mm.page_table_lock); -pgd_populate (&init_mm, pgd,__va (pud_phys)); +pgd_populate (&init_mm, pgd, pud);spin_unlock (&init_mm.page_table_lock); pgd_changed = true; }
Signature · 1 line
1.7.7
Re: [PATCH 08/19] x86, mm: Remove parameter in alloc_low_page for 64bit
Quoted 1 line · Yinghai Lu
Now all page table buf are pre-mapped, and could use virtual address directly.
^^ buffers ^^^^ -> can
Quoted 1 line
So don't need to remember physics address anymore.
^^ We
physics? Physical.
Quoted 114 lines
Remove that phys pointer in
alloc_low_page(), and that will allow us to mergealloc_low_pagebetween 64bit and 32bit.Signed-off-by Yinghai Lu <[email protected]>--- arch/x86/mm/init_64.c | 19 +++++++------------ 1 files changed, 7 insertions(+), 12 deletions(-)arch/x86/mm/init_64.c +7
-12@@ -314,14 +314,13 @@ void __init cleanup_highmap(void) } } -static __ref void *alloc_low_page (unsigned long *phys) +static __ref void *alloc_low_page (void ) {unsigned long pfn;void *adr;if (after_bootmem) { adr = (void *)get_zeroed_page (GFP_ATOMIC | __GFP_NOTRACK); - *phys =__pa (adr);return adr; }@@ -342,7 +341,6 @@ static __ref void *alloc_low_page(unsigned long *phys) adr =__va (pfn *PAGE_SIZE );clear_page (adr); - *phys = pfn *PAGE_SIZE ;return adr; }@@ -400,7 +398,6 @@ phys_pmd_init(pmd_t *pmd_page, unsigned long address, unsigned long end,int i =pmd_index (address);for (; i <PTRS_PER_PMD ; i++, address = next) { -unsigned long pte_phys;pmd_t *pmd = pmd_page +pmd_index (address);pte_t *pte;pgprot_t new_prot = prot;@@ -453,11 +450,11 @@ phys_pmd_init(pmd_t *pmd_page, unsigned long address, unsigned long end,continue ; } - pte =alloc_low_page (&pte_phys); + pte =alloc_low_page (); last_map_addr =phys_pte_init (pte, address, end, new_prot);spin_lock (&init_mm.page_table_lock); -pmd_populate_kernel (&init_mm, pmd,__va (pte_phys)); +pmd_populate_kernel (&init_mm, pmd, pte);spin_unlock (&init_mm.page_table_lock); }update_page_count (PG_LEVEL_2M , pages);@@ -473,7 +470,6 @@ phys_pud_init(pud_t *pud_page, unsigned long addr, unsigned long end,int i =pud_index (addr);for (; i <PTRS_PER_PUD ; i++, addr = next) { -unsigned long pmd_phys;pud_t *pud = pud_page +pud_index (addr);pmd_t *pmd;pgprot_t prot =PAGE_KERNEL ;@@ -525,12 +521,12 @@ phys_pud_init(pud_t *pud_page, unsigned long addr, unsigned long end,continue ; } - pmd =alloc_low_page (&pmd_phys); + pmd =alloc_low_page (); last_map_addr =phys_pmd_init (pmd, addr, end, page_size_mask, prot);spin_lock (&init_mm.page_table_lock); -pud_populate (&init_mm, pud,__va (pmd_phys)); +pud_populate (&init_mm, pud, pmd);spin_unlock (&init_mm.page_table_lock); }__flush_tlb_all ();@@ -555,7 +551,6 @@ kernel_physical_mapping_init(unsigned long start,for (; start < end; start = next) {pgd_t *pgd =pgd_offset_k (start); -unsigned long pud_phys;pud_t *pud; next = (start +PGDIR_SIZE ) &PGDIR_MASK ;@@ -569,12 +564,12 @@ kernel_physical_mapping_init(unsigned long start,continue ; } - pud =alloc_low_page (&pud_phys); + pud =alloc_low_page (); last_map_addr =phys_pud_init (pud,__pa (start),__pa (next), page_size_mask);spin_lock (&init_mm.page_table_lock); -pgd_populate (&init_mm, pgd,__va (pud_phys)); +pgd_populate (&init_mm, pgd, pud);spin_unlock (&init_mm.page_table_lock); pgd_changed = true; }Signature · 7 lines
1.7.7 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 08/19] x86, mm: Remove parameter in alloc_low_page for 64bit
Quoted 8 lines · Konrad Rzeszutek Wilk
Quoted 1 line · Yinghai Lu
Now all page table buf are pre-mapped, and could use virtual address directly.
^^ buffers ^^^^ -> canQuoted 1 line
So don't need to remember physics address anymore.
^^ We
physics? Physical.
ok.
PATCH 9/19 x86, mm: Merge alloc_low_page between 64bit and 32bit
In reply to Yinghai LuThey are almost same except 64 bit need to handle after_bootmem.
Add mm_internal.h to hide that alloc_low_page out of arch/x86/mm/init*.c
--- arch/x86/mm/init.c | 34 ++++++++++++++++++++++++++++++++++ arch/x86/mm/init_32.c | 26 ++------------------------ arch/x86/mm/init_64.c | 32 ++------------------------------ arch/x86/mm/mm_internal.h | 6 ++++++ 4 files changed, 44 insertions(+), 54 deletions(-) create mode 100644 arch/x86/mm/mm_internal.h
arch/x86/mm/init.c +34 -0
@@ -17,10 +17,44 @@#include <asm/proto.h> #include <asm/dma.h> /* for MAX_DMA_PFN */ +#include "mm_internal.h" +unsigned long __initdata pgt_buf_start;unsigned long __meminitdata pgt_buf_end;unsigned long __meminitdata pgt_buf_top; +__ref void *alloc_low_page (void ) +{ +unsigned long pfn; +void *adr; + +#ifdef CONFIG_X86_64 +if (after_bootmem) { + adr = (void *)get_zeroed_page (GFP_ATOMIC | __GFP_NOTRACK); + +return adr; + } +#endif + +if ((pgt_buf_end +1 ) >= pgt_buf_top) { +unsigned long ret; +if (min_pfn_mapped >= max_pfn_mapped) +panic ("alloc_low_page: ran out of memory" ); + ret =memblock_find_in_range (min_pfn_mapped <<PAGE_SHIFT , + max_pfn_mapped <<PAGE_SHIFT , +PAGE_SIZE ,PAGE_SIZE ); +if (!ret) +panic ("alloc_low_page: can not alloc memory" ); +memblock_reserve (ret,PAGE_SIZE ); + pfn = ret >>PAGE_SHIFT ; + }else + pfn = pgt_buf_end++; + + adr =__va (pfn *PAGE_SIZE ); +clear_page (adr); +return adr; +} +/* need 4 4k for initial PMD_SIZE, 4k for 0-ISA_END_ADDRESS */ #define INIT_PGT_BUF_SIZE (5 * PAGE_SIZE)RESERVE_BRK (early_pgt_alloc,INIT_PGT_BUF_SIZE );
arch/x86/mm/init_32.c +2 -24
@@ -53,36 +53,14 @@#include <asm/page_types.h> #include <asm/init.h> +#include "mm_internal.h" +unsigned long highstart_pfn, highend_pfn; static noinline int do_test_wp_bit(void);bool __read_mostly __vmalloc_start_set = false; -static __init void *alloc_low_page (void ) -{ -unsigned long pfn; -void *adr; - -if ((pgt_buf_end +1 ) >= pgt_buf_top) { -unsigned long ret; -if (min_pfn_mapped >= max_pfn_mapped) -panic ("alloc_low_page: ran out of memory" ); - ret =memblock_find_in_range (min_pfn_mapped <<PAGE_SHIFT , - max_pfn_mapped <<PAGE_SHIFT , -PAGE_SIZE ,PAGE_SIZE ); -if (!ret) -panic ("alloc_low_page: can not alloc memory" ); -memblock_reserve (ret,PAGE_SIZE ); - pfn = ret >>PAGE_SHIFT ; - }else - pfn = pgt_buf_end++; - - adr =__va (pfn *PAGE_SIZE ); -clear_page (adr); -return adr; -} -/* * Creates a middle page table and puts a pointer to it in the * given global directory entry. This only returns the gd entry
arch/x86/mm/init_64.c +2 -30
@@ -54,6 +54,8 @@#include <asm/uv/uv.h> #include <asm/setup.h> +#include "mm_internal.h" +static int __init parse_direct_gbpages_off (char *arg) { direct_gbpages =0 ;
@@ -314,36 +316,6 @@ void __init cleanup_highmap(void) } } -static __ref void *alloc_low_page (void ) -{ -unsigned long pfn; -void *adr; - -if (after_bootmem) { - adr = (void *)get_zeroed_page (GFP_ATOMIC | __GFP_NOTRACK); - -return adr; - } - -if ((pgt_buf_end +1 ) >= pgt_buf_top) { -unsigned long ret; -if (min_pfn_mapped >= max_pfn_mapped) -panic ("alloc_low_page: ran out of memory" ); - ret =memblock_find_in_range (min_pfn_mapped <<PAGE_SHIFT , - max_pfn_mapped <<PAGE_SHIFT , -PAGE_SIZE ,PAGE_SIZE ); -if (!ret) -panic ("alloc_low_page: can not alloc memory" ); -memblock_reserve (ret,PAGE_SIZE ); - pfn = ret >>PAGE_SHIFT ; - }else - pfn = pgt_buf_end++; - - adr =__va (pfn *PAGE_SIZE ); -clear_page (adr); -return adr; -} -static unsigned long __meminit phys_pte_init (pte_t *pte_page,unsigned long addr,unsigned long end,pgprot_t prot)
arch/x86/mm/mm_internal.h new file +6 -0
@@ -0,0 +1,6 @@ +#ifndef __X86_MM_INTERNAL_H +#define __X86_MM_INTERNAL_H + +void *alloc_low_page (void ); + +#endif /* __X86_MM_INTERNAL_H */
Signature · 1 line
1.7.7
Re: [PATCH 09/19] x86, mm: Merge alloc_low_page between 64bit and 32bit
Quoted 1 line · Yinghai Lu
They are almost same except 64 bit need to handle
after_bootmem.
^^ -
case.
Quoted 2 lines
Add
mm_internal.hto hide thatalloc_low_pageout ofarch/x86/mm/init*.c
Huh?
I think what you are saying is that you want to expose alloc_low_page decleration in a header since the function resides in mm/init_[32|64].c ?
Quoted 173 lines
Signed-off-by Yinghai Lu <[email protected]>--- arch/x86/mm/init.c | 34 ++++++++++++++++++++++++++++++++++ arch/x86/mm/init_32.c | 26 ++------------------------ arch/x86/mm/init_64.c | 32 ++------------------------------ arch/x86/mm/mm_internal.h | 6 ++++++ 4 files changed, 44 insertions(+), 54 deletions(-) create mode 100644 arch/x86/mm/mm_internal.harch/x86/mm/init.c +34
-0@@ -17,10 +17,44 @@#include <asm/proto.h> #include <asm/dma.h> /* for MAX_DMA_PFN */ +#include "mm_internal.h" +unsigned long __initdata pgt_buf_start;unsigned long __meminitdata pgt_buf_end;unsigned long __meminitdata pgt_buf_top; +__ref void *alloc_low_page (void ) +{ +unsigned long pfn; +void *adr; + +#ifdef CONFIG_X86_64 +if (after_bootmem) { + adr = (void *)get_zeroed_page (GFP_ATOMIC | __GFP_NOTRACK); + +return adr; + } +#endif + +if ((pgt_buf_end +1 ) >= pgt_buf_top) { +unsigned long ret; +if (min_pfn_mapped >= max_pfn_mapped) +panic ("alloc_low_page: ran out of memory" ); + ret =memblock_find_in_range (min_pfn_mapped <<PAGE_SHIFT , + max_pfn_mapped <<PAGE_SHIFT , +PAGE_SIZE ,PAGE_SIZE ); +if (!ret) +panic ("alloc_low_page: can not alloc memory" ); +memblock_reserve (ret,PAGE_SIZE ); + pfn = ret >>PAGE_SHIFT ; + }else + pfn = pgt_buf_end++; + + adr =__va (pfn *PAGE_SIZE ); +clear_page (adr); +return adr; +} +/* need 4 4k for initial PMD_SIZE, 4k for 0-ISA_END_ADDRESS */ #define INIT_PGT_BUF_SIZE (5 * PAGE_SIZE)RESERVE_BRK (early_pgt_alloc,INIT_PGT_BUF_SIZE );arch/x86/mm/init_32.c +2
-24@@ -53,36 +53,14 @@#include <asm/page_types.h> #include <asm/init.h> +#include "mm_internal.h" +unsigned long highstart_pfn, highend_pfn; static noinline int do_test_wp_bit(void);bool __read_mostly __vmalloc_start_set = false; -static __init void *alloc_low_page (void ) -{ -unsigned long pfn; -void *adr; - -if ((pgt_buf_end +1 ) >= pgt_buf_top) { -unsigned long ret; -if (min_pfn_mapped >= max_pfn_mapped) -panic ("alloc_low_page: ran out of memory" ); - ret =memblock_find_in_range (min_pfn_mapped <<PAGE_SHIFT , - max_pfn_mapped <<PAGE_SHIFT , -PAGE_SIZE ,PAGE_SIZE ); -if (!ret) -panic ("alloc_low_page: can not alloc memory" ); -memblock_reserve (ret,PAGE_SIZE ); - pfn = ret >>PAGE_SHIFT ; - }else - pfn = pgt_buf_end++; - - adr =__va (pfn *PAGE_SIZE ); -clear_page (adr); -return adr; -} -/* * Creates a middle page table and puts a pointer to it in the * given global directory entry. This only returns the gd entry arch/x86/mm/init_64.c +2
-30@@ -54,6 +54,8 @@#include <asm/uv/uv.h> #include <asm/setup.h> +#include "mm_internal.h" +static int __init parse_direct_gbpages_off (char *arg) { direct_gbpages =0 ;@@ -314,36 +316,6 @@ void __init cleanup_highmap(void) } } -static __ref void *alloc_low_page (void ) -{ -unsigned long pfn; -void *adr; - -if (after_bootmem) { - adr = (void *)get_zeroed_page (GFP_ATOMIC | __GFP_NOTRACK); - -return adr; - } - -if ((pgt_buf_end +1 ) >= pgt_buf_top) { -unsigned long ret; -if (min_pfn_mapped >= max_pfn_mapped) -panic ("alloc_low_page: ran out of memory" ); - ret =memblock_find_in_range (min_pfn_mapped <<PAGE_SHIFT , - max_pfn_mapped <<PAGE_SHIFT , -PAGE_SIZE ,PAGE_SIZE ); -if (!ret) -panic ("alloc_low_page: can not alloc memory" ); -memblock_reserve (ret,PAGE_SIZE ); - pfn = ret >>PAGE_SHIFT ; - }else - pfn = pgt_buf_end++; - - adr =__va (pfn *PAGE_SIZE ); -clear_page (adr); -return adr; -} -static unsigned long __meminit phys_pte_init (pte_t *pte_page,unsigned long addr,unsigned long end,pgprot_t prot)arch/x86/mm/mm_internal.h new file +6
-0@@ -0,0 +1,6 @@ +#ifndef __X86_MM_INTERNAL_H +#define __X86_MM_INTERNAL_H + +void *alloc_low_page (void ); + +#endif /* __X86_MM_INTERNAL_H */ Signature · 7 lines
1.7.7 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 09/19] x86, mm: Merge alloc_low_page between 64bit and 32bit
Quoted 6 lines · Konrad Rzeszutek Wilk
Quoted 1 line · Yinghai Lu
They are almost same except 64 bit need to handle
after_bootmem.^^ -case.
Quoted 1 line
Quoted 6 lines
Quoted 1 line
Add
mm_internal.hto hide thatalloc_low_pageout ofarch/x86/mm/init*.cHuh?
I think what you are saying is that you want to expose
alloc_low_pagedecleration in a header since the function resides in mm/init_[32|64].c ?
---
They are almost same except 64 bit need to handle after_bootmem case.
Add mm_internal.h to make that alloc_low_page() only to be accessible from arch/x86/mm/init*.c
---
PATCH 10/19 x86, mm: Move min_pfn_mapped back to mm/init.c
In reply to Yinghai LuAlso change it to static.
--- arch/x86/include/asm/page_types.h | 1 - arch/x86/kernel/setup.c | 1 - arch/x86/mm/init.c | 2 ++ 3 files changed, 2 insertions(+), 2 deletions(-)
arch/x86/include/asm/page_types.h +0 -1
@@ -45,7 +45,6 @@ extern int devmem_is_allowed(unsigned long pagenr);extern unsigned long max_low_pfn_mapped;extern unsigned long max_pfn_mapped; -extern unsigned long min_pfn_mapped;static inline phys_addr_t get_max_mapped (void ) {
arch/x86/kernel/setup.c +0 -1
@@ -124,7 +124,6 @@*/ unsigned long max_low_pfn_mapped;unsigned long max_pfn_mapped; -unsigned long min_pfn_mapped;#ifdef CONFIG_DMI RESERVE_BRK (dmi_alloc,65536 );
arch/x86/mm/init.c +2 -0
@@ -23,6 +23,8 @@ unsigned long __initdata pgt_buf_start;unsigned long __meminitdata pgt_buf_end;unsigned long __meminitdata pgt_buf_top; +static unsigned long min_pfn_mapped; +__ref void *alloc_low_page (void ) {unsigned long pfn;
Signature · 1 line
1.7.7
PATCH 11/19 x86, mm, xen: Remove mapping_pagatable_reserve
In reply to Yinghai Lupage table area are pre-mapped now, and mark_page_ro is used to make it RO for xen.
mapping_pagetable_reserve is not used anymore, so remove it.
--- arch/x86/include/asm/pgtable_types.h | 1 - arch/x86/include/asm/x86_init.h | 12 ------------ arch/x86/kernel/x86_init.c | 4 ---- arch/x86/mm/init.c | 4 ---- arch/x86/xen/mmu.c | 28 ---------------------------- 5 files changed, 0 insertions(+), 49 deletions(-)
arch/x86/include/asm/pgtable_types.h +0 -1
@@ -301,7 +301,6 @@ int phys_mem_access_prot_allowed(struct file *file, unsigned long pfn,/* Install a pte for a particular vaddr in kernel space. */ void set_pte_vaddr (unsigned long vaddr,pte_t pte); -extern void native_pagetable_reserve (u64 start,u64 end);#ifdef CONFIG_X86_32 extern void native_pagetable_init (void );#else
arch/x86/include/asm/x86_init.h +0 -12
@@ -69,17 +69,6 @@ struct x86_init_oem { };/** -* struct x86_init_mapping - platform specific initial kernel pagetable setup -* @pagetable_reserve: reserve a range of addresses for kernel pagetable usage -* -* For more details on the purpose of this hook, look in -* init_memory_mapping and the commit that added it. -*/ -struct x86_init_mapping { -void (*pagetable_reserve)(u64 start,u64 end); -}; - -/** * struct x86_init_paging - platform specific paging functions * @pagetable_init: platform specific paging initialization call to setup * the kernel pagetables and prepare accessors functions.
@@ -136,7 +125,6 @@ struct x86_init_ops {struct x86_init_mpparse mpparse;struct x86_init_irqs irqs;struct x86_init_oem oem; -struct x86_init_mapping mapping;struct x86_init_paging paging;struct x86_init_timers timers;struct x86_init_iommu iommu;
arch/x86/kernel/x86_init.c +0 -4
@@ -62,10 +62,6 @@ struct x86_init_ops x86_init __initdata = { .banner = default_banner, }, - .mapping = { - .pagetable_reserve = native_pagetable_reserve, - }, - .paging = { .pagetable_init = native_pagetable_init, },
arch/x86/mm/init.c +0 -4
@@ -112,10 +112,6 @@ static void __init probe_page_size_mask(void) __supported_pte_mask |= _PAGE_GLOBAL; } } -void __init native_pagetable_reserve (u64 start,u64 end) -{ -memblock_reserve (start, end - start); -}#ifdef CONFIG_X86_32 #define NR_RANGE_MR 3
arch/x86/xen/mmu.c +0 -28
@@ -1178,20 +1178,6 @@ static void xen_exit_mmap(struct mm_struct *mm)static void xen_post_allocator_init (void ); -static __init void xen_mapping_pagetable_reserve (u64 start,u64 end) -{ -/* reserve the range used */ -native_pagetable_reserve (start, end); - -/* set as RW the rest */ -printk (KERN_DEBUG "xen: setting RW the range %llx - %llx\n" , end, -PFN_PHYS (pgt_buf_top)); -while (end <PFN_PHYS (pgt_buf_top)) { -make_lowmem_page_readwrite (__va (end)); - end +=PAGE_SIZE ; - } -} -#ifdef CONFIG_X86_64 static void __init xen_cleanhighmap (unsigned long vaddr,unsigned long vaddr_end)
@@ -1484,19 +1470,6 @@ static pte_t __init mask_rw_pte(pte_t *ptep, pte_t pte)#else /* CONFIG_X86_64 */ static pte_t __init mask_rw_pte (pte_t *ptep,pte_t pte) { -unsigned long pfn =pte_pfn (pte); - -/* -* If the new pfn is within the range of the newly allocated -* kernel pagetable, and it isn't being mapped into an -* early_ioremap fixmap slot as a freshly allocated page, make sure -* it is RO. -*/ -if (((!is_early_ioremap_ptep (ptep) && - pfn >= pgt_buf_start && pfn < pgt_buf_top)) || - (is_early_ioremap_ptep (ptep) && pfn != (pgt_buf_end -1 ))) - pte =pte_wrprotect (pte); -return pte; }#endif /* CONFIG_X86_64 */
@@ -2178,7 +2151,6 @@ static const struct pv_mmu_ops xen_mmu_ops __initconst = {void __init xen_init_mmu_ops (void ) { - x86_init.mapping.pagetable_reserve = xen_mapping_pagetable_reserve; x86_init.paging.pagetable_init = xen_pagetable_init; pv_mmu_ops = xen_mmu_ops;
Signature · 1 line
1.7.7
Re: [PATCH 11/19] x86, mm, xen: Remove mapping_pagatable_reserve
Quoted 1 line · Yinghai Lu
page table area are pre-mapped now, and
mark_page_rois used to make it RO
^ Page ^^^^->areas ^^^^^^^^^^^-> ? I must have
missed that patch. Can you include the title of the patch in this git commit so one could take a look.
Quoted 1 line
for xen.
^->Xen
Quoted 146 lines
mapping_pagetable_reserveis not used anymore, so remove it.Signed-off-by Yinghai Lu <[email protected]>--- arch/x86/include/asm/pgtable_types.h | 1 - arch/x86/include/asm/x86_init.h | 12 ------------ arch/x86/kernel/x86_init.c | 4 ---- arch/x86/mm/init.c | 4 ---- arch/x86/xen/mmu.c | 28 ---------------------------- 5 files changed, 0 insertions(+), 49 deletions(-)arch/x86/include/asm/pgtable_types.h +0
-1@@ -301,7 +301,6 @@ int phys_mem_access_prot_allowed(struct file *file, unsigned long pfn,/* Install a pte for a particular vaddr in kernel space. */ void set_pte_vaddr (unsigned long vaddr,pte_t pte); -extern void native_pagetable_reserve (u64 start,u64 end);#ifdef CONFIG_X86_32 extern void native_pagetable_init (void );#else arch/x86/include/asm/x86_init.h +0
-12@@ -69,17 +69,6 @@ struct x86_init_oem { };/** -* struct x86_init_mapping - platform specific initial kernel pagetable setup -* @pagetable_reserve: reserve a range of addresses for kernel pagetable usage -* -* For more details on the purpose of this hook, look in -* init_memory_mapping and the commit that added it. -*/ -struct x86_init_mapping { -void (*pagetable_reserve)(u64 start,u64 end); -}; - -/** * struct x86_init_paging - platform specific paging functions * @pagetable_init: platform specific paging initialization call to setup * the kernel pagetables and prepare accessors functions. @@ -136,7 +125,6 @@ struct x86_init_ops {struct x86_init_mpparse mpparse;struct x86_init_irqs irqs;struct x86_init_oem oem; -struct x86_init_mapping mapping;struct x86_init_paging paging;struct x86_init_timers timers;struct x86_init_iommu iommu;arch/x86/kernel/x86_init.c +0
-4@@ -62,10 +62,6 @@ struct x86_init_ops x86_init __initdata = { .banner = default_banner, }, - .mapping = { - .pagetable_reserve = native_pagetable_reserve, - }, - .paging = { .pagetable_init = native_pagetable_init, },arch/x86/mm/init.c +0
-4@@ -112,10 +112,6 @@ static void __init probe_page_size_mask(void) __supported_pte_mask |= _PAGE_GLOBAL; } } -void __init native_pagetable_reserve (u64 start,u64 end) -{ -memblock_reserve (start, end - start); -}#ifdef CONFIG_X86_32 #define NR_RANGE_MR 3arch/x86/xen/mmu.c +0
-28@@ -1178,20 +1178,6 @@ static void xen_exit_mmap(struct mm_struct *mm)static void xen_post_allocator_init (void ); -static __init void xen_mapping_pagetable_reserve (u64 start,u64 end) -{ -/* reserve the range used */ -native_pagetable_reserve (start, end); - -/* set as RW the rest */ -printk (KERN_DEBUG "xen: setting RW the range %llx - %llx\n" , end, -PFN_PHYS (pgt_buf_top)); -while (end <PFN_PHYS (pgt_buf_top)) { -make_lowmem_page_readwrite (__va (end)); - end +=PAGE_SIZE ; - } -} -#ifdef CONFIG_X86_64 static void __init xen_cleanhighmap (unsigned long vaddr,unsigned long vaddr_end)@@ -1484,19 +1470,6 @@ static pte_t __init mask_rw_pte(pte_t *ptep, pte_t pte)#else /* CONFIG_X86_64 */ static pte_t __init mask_rw_pte (pte_t *ptep,pte_t pte) { -unsigned long pfn =pte_pfn (pte); - -/* -* If the new pfn is within the range of the newly allocated -* kernel pagetable, and it isn't being mapped into an -* early_ioremap fixmap slot as a freshly allocated page, make sure -* it is RO. -*/ -if (((!is_early_ioremap_ptep (ptep) && - pfn >= pgt_buf_start && pfn < pgt_buf_top)) || - (is_early_ioremap_ptep (ptep) && pfn != (pgt_buf_end -1 ))) - pte =pte_wrprotect (pte); -return pte; }#endif /* CONFIG_X86_64 */ @@ -2178,7 +2151,6 @@ static const struct pv_mmu_ops xen_mmu_ops __initconst = {void __init xen_init_mmu_ops (void ) { - x86_init.mapping.pagetable_reserve = xen_mapping_pagetable_reserve; x86_init.paging.pagetable_init = xen_pagetable_init; pv_mmu_ops = xen_mmu_ops;Signature · 7 lines
1.7.7 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 11/19] x86, mm, xen: Remove mapping_pagatable_reserve
Quoted 5 lines · Konrad Rzeszutek Wilk
Quoted 1 line · Yinghai Lu
page table area are pre-mapped now, and
mark_page_rois used to make it RO^ Page ^^^^->areas ^^^^^^^^^^^-> ? I must have
missed that patch. Can you include the title of the patch in this git commit so one could take a look.
sorry, forget to remove those words.
new version:
---
Page table area are pre-mapped now after
x86, mm: setup page table in top-down
x86, mm: Remove early_memremap workaround for page table
accessing on 64bit
mapping_pagetable_reserve is not used anymore, so remove it.
---
PATCH 12/19 x86, mm: Add alloc_low_pages(num)
In reply to Yinghai Lu32bit kmap mapping need page table to be used for low to high.
At this point those page table are still from pgt_buf_* from BRK, So it is ok now.
But we want to move early_ioremap_page_table_range_init() out of init_memory_mapping() and only call it one time later, that will make page_table_range_init/page_table_kmap_check/alloc_low_page to use memblock to get page.
memblock allocation for page table are from high to low.
So will get panic from page_table_kmap_check() that has BUG_ON to do ordering checking.
This patch add alloc_low_pages to make it possible to alloc serveral pages at first, and hand out pages one by one from low to high.
--- arch/x86/mm/init.c | 33 +++++++++++++++++++++------------ arch/x86/mm/mm_internal.h | 6 +++++- 2 files changed, 26 insertions(+), 13 deletions(-)
arch/x86/mm/init.c +21 -12
@@ -25,36 +25,45 @@ unsigned long __meminitdata pgt_buf_top;static unsigned long min_pfn_mapped; -__ref void *alloc_low_page (void ) +__ref void *alloc_low_pages (unsigned int num) {unsigned long pfn; -void *adr; +int i;#ifdef CONFIG_X86_64 if (after_bootmem) { - adr = (void *)get_zeroed_page (GFP_ATOMIC | __GFP_NOTRACK); +unsigned int order; -return adr; + order =get_order ((unsigned long )num <<PAGE_SHIFT ); +return (void *)__get_free_pages (GFP_ATOMIC | __GFP_NOTRACK | + __GFP_ZERO, order); }#endif -if ((pgt_buf_end +1 ) >= pgt_buf_top) { +if ((pgt_buf_end + num) >= pgt_buf_top) {unsigned long ret;if (min_pfn_mapped >= max_pfn_mapped)panic ("alloc_low_page: ran out of memory" ); ret =memblock_find_in_range (min_pfn_mapped <<PAGE_SHIFT , max_pfn_mapped <<PAGE_SHIFT , -PAGE_SIZE ,PAGE_SIZE ); +PAGE_SIZE * num ,PAGE_SIZE );if (!ret)panic ("alloc_low_page: can not alloc memory" ); -memblock_reserve (ret,PAGE_SIZE ); +memblock_reserve (ret,PAGE_SIZE * num); pfn = ret >>PAGE_SHIFT ; - }else - pfn = pgt_buf_end++; + }else { + pfn = pgt_buf_end; + pgt_buf_end += num; + } + +for (i =0 ; i < num; i++) { +void *adr; + + adr =__va ((pfn + i) <<PAGE_SHIFT ); +clear_page (adr); + } - adr =__va (pfn *PAGE_SIZE ); -clear_page (adr); -return adr; +return __va (pfn <<PAGE_SHIFT ); }/* need 4 4k for initial PMD_SIZE, 4k for 0-ISA_END_ADDRESS */
arch/x86/mm/mm_internal.h +5 -1
@@ -1,6 +1,10 @@#ifndef __X86_MM_INTERNAL_H#define __X86_MM_INTERNAL_H -void *alloc_low_page (void ); +void *alloc_low_pages (unsigned int num); +static inline void *alloc_low_page (void ) +{ +return alloc_low_pages (1 ); +}#endif /* __X86_MM_INTERNAL_H */
Signature · 1 line
1.7.7
Re: [PATCH 12/19] x86, mm: Add alloc_low_pages(num)
Quoted 1 line · Yinghai Lu
32bit kmap mapping need page table to be used for low to high.
^-s
Quoted 2 lines
At this point those page table are still from pgt_buf_* from BRK,
^s
Quoted 7 lines
So it is ok now.
But we want to moveearly_ioremap_page_table_range_init()out ofinit_memory_mapping()and only call it one time later, that will make page_table_range_init/page_table_kmap_check/alloc_low_page to use memblock to get page.memblock allocation for page table are from high to low.
^s
Quoted 6 lines
So will get panic from
page_table_kmap_check()that hasBUG_ONto do ordering checking.This patch add
alloc_low_pagesto make it possible to alloc serveral pages at first, and hand out pages one by one from low to high.
.. But for right now this patch just makes it by default one.
Right?
Quoted 94 lines
Signed-off-by Yinghai Lu <[email protected]>--- arch/x86/mm/init.c | 33 +++++++++++++++++++++------------ arch/x86/mm/mm_internal.h | 6 +++++- 2 files changed, 26 insertions(+), 13 deletions(-)arch/x86/mm/init.c +21
-12@@ -25,36 +25,45 @@ unsigned long __meminitdata pgt_buf_top;static unsigned long min_pfn_mapped; -__ref void *alloc_low_page (void ) +__ref void *alloc_low_pages (unsigned int num) {unsigned long pfn; -void *adr; +int i;#ifdef CONFIG_X86_64 if (after_bootmem) { - adr = (void *)get_zeroed_page (GFP_ATOMIC | __GFP_NOTRACK); +unsigned int order; -return adr; + order =get_order ((unsigned long )num <<PAGE_SHIFT ); +return (void *)__get_free_pages (GFP_ATOMIC | __GFP_NOTRACK | + __GFP_ZERO, order); }#endif -if ((pgt_buf_end +1 ) >= pgt_buf_top) { +if ((pgt_buf_end + num) >= pgt_buf_top) {unsigned long ret;if (min_pfn_mapped >= max_pfn_mapped)panic ("alloc_low_page: ran out of memory" ); ret =memblock_find_in_range (min_pfn_mapped <<PAGE_SHIFT , max_pfn_mapped <<PAGE_SHIFT , -PAGE_SIZE ,PAGE_SIZE ); +PAGE_SIZE * num ,PAGE_SIZE );if (!ret)panic ("alloc_low_page: can not alloc memory" ); -memblock_reserve (ret,PAGE_SIZE ); +memblock_reserve (ret,PAGE_SIZE * num); pfn = ret >>PAGE_SHIFT ; - }else - pfn = pgt_buf_end++; + }else { + pfn = pgt_buf_end; + pgt_buf_end += num; + } + +for (i =0 ; i < num; i++) { +void *adr; + + adr =__va ((pfn + i) <<PAGE_SHIFT ); +clear_page (adr); + } - adr =__va (pfn *PAGE_SIZE ); -clear_page (adr); -return adr; +return __va (pfn <<PAGE_SHIFT ); }/* need 4 4k for initial PMD_SIZE, 4k for 0-ISA_END_ADDRESS */ arch/x86/mm/mm_internal.h +5
-1@@ -1,6 +1,10 @@#ifndef __X86_MM_INTERNAL_H#define __X86_MM_INTERNAL_H -void *alloc_low_page (void ); +void *alloc_low_pages (unsigned int num); +static inline void *alloc_low_page (void ) +{ +return alloc_low_pages (1 ); +}#endif /* __X86_MM_INTERNAL_H */ Signature · 7 lines
1.7.7 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 12/19] x86, mm: Add alloc_low_pages(num)
Quoted 17 lines · Konrad Rzeszutek Wilk
Quoted 1 line · Yinghai Lu
32bit kmap mapping need page table to be used for low to high.
^-sQuoted 2 lines
At this point those page table are still from pgt_buf_* from BRK,
^sQuoted 7 lines
So it is ok now.
But we want to moveearly_ioremap_page_table_range_init()out ofinit_memory_mapping()and only call it one time later, that will make page_table_range_init/page_table_kmap_check/alloc_low_page to use memblock to get page.memblock allocation for page table are from high to low.
^sQuoted 1 line
Quoted 7 lines
Quoted 5 lines
So will get panic from
page_table_kmap_check()that hasBUG_ONto do ordering checking.This patch add
alloc_low_pagesto make it possible to alloc serveral pages at first, and hand out pages one by one from low to high... But for right now this patch just makes it by default one.
?
---
32bit kmap mapping needs pages to be used for low to high.
At this point those pages are still from pgt_buf_* from BRK, so it is ok now.
But we want to move early_ioremap_page_table_range_init() out of init_memory_mapping() and only call it one time later, that will make page_table_range_init/page_table_kmap_check/alloc_low_page to use memblock to get page.
memblock allocation for pages are from high to low.
So will get panic from page_table_kmap_check() that has BUG_ON to do ordering checking.
This patch add alloc_low_pages to make it possible to alloc serveral pages at first, and hand out pages one by one from low to high.
-v2: add one line comment about xen requirements.
---
PATCH 13/19 x86, mm: only call early_ioremap_page_table_range_init() once
In reply to Yinghai LuOn 32bit, We should not keep calling that during every init_memory_mapping.
Need to update page_table_range_init() to count the pages for kmap page table at first, and use new added alloc_low_pages() to get pages in sequence. That will conform requirement that page table need to be in low to high order.
--- arch/x86/mm/init.c | 13 +++++-------- arch/x86/mm/init_32.c | 47 +++++++++++++++++++++++++++++++++++++++++------ 2 files changed, 46 insertions(+), 14 deletions(-)
arch/x86/mm/init.c +5 -8
@@ -334,14 +334,6 @@ unsigned long __init_refok init_memory_mapping(unsigned long start, ret =kernel_physical_mapping_init (mr[i].start, mr[i].end, mr[i].page_size_mask); -#ifdef CONFIG_X86_32 -early_ioremap_page_table_range_init (); - -load_cr3 (swapper_pg_dir); -#endif - -__flush_tlb_all (); -add_pfn_range_mapped (start >>PAGE_SHIFT , ret >>PAGE_SHIFT );return ret >>PAGE_SHIFT ;
@@ -435,7 +427,12 @@ void __init init_mem_mapping(void)/* can we preseve max_low_pfn ?*/ max_low_pfn = max_pfn; } +#else +early_ioremap_page_table_range_init (); +load_cr3 (swapper_pg_dir); +__flush_tlb_all ();#endif +early_memtest (0 , max_pfn_mapped <<PAGE_SHIFT ); }
arch/x86/mm/init_32.c +41 -6
78 lines not on this page · raw message
Signature · 1 line
1.7.7
Re: [PATCH 13/19] x86, mm: only call early_ioremap_page_table_range_init() once
Quoted 1 line · Yinghai Lu
On 32bit, We should not keep calling that during every
init_memory_mapping.
Explain pls why.
Quoted 4 lines
Need to update
page_table_range_init()to count the pages for kmap page table at first, and use new addedalloc_low_pages()to get pages in sequence. That will conform requirement that page table need to be in low to high order.
^ to the ^-s
Quoted 49 lines
Signed-off-by Yinghai Lu <[email protected]>--- arch/x86/mm/init.c | 13 +++++-------- arch/x86/mm/init_32.c | 47 +++++++++++++++++++++++++++++++++++++++++------ 2 files changed, 46 insertions(+), 14 deletions(-)arch/x86/mm/init.c +5
-8@@ -334,14 +334,6 @@ unsigned long __init_refok init_memory_mapping(unsigned long start, ret =kernel_physical_mapping_init (mr[i].start, mr[i].end, mr[i].page_size_mask); -#ifdef CONFIG_X86_32 -early_ioremap_page_table_range_init (); - -load_cr3 (swapper_pg_dir); -#endif - -__flush_tlb_all (); -add_pfn_range_mapped (start >>PAGE_SHIFT , ret >>PAGE_SHIFT );return ret >>PAGE_SHIFT ;@@ -435,7 +427,12 @@ void __init init_mem_mapping(void)/* can we preseve max_low_pfn ?*/ max_low_pfn = max_pfn; } +#else +early_ioremap_page_table_range_init (); +load_cr3 (swapper_pg_dir); +__flush_tlb_all ();#endif +early_memtest (0 , max_pfn_mapped <<PAGE_SHIFT ); }arch/x86/mm/init_32.c +2
-0@@ -135,8 +135,39 @@ pte_t * __init populate_extra_pte(unsigned long vaddr)return one_page_table_init (pmd) + pte_idx; } +static unsigned long __init +page_table_range_init_count (unsigned long start,unsigned long end)
arch/x86/mm/init_32.c pte_t * __init populate_extra_pte(unsigned long vaddr) · line 149
Quoted 10 lines
arch/x86/mm/init_32.c +10
-0+{ +unsigned long count =0 ; +#ifdef CONFIG_HIGHMEM +int pmd_idx_kmap_begin =fix_to_virt (FIX_KMAP_END ) >>PMD_SHIFT ; +int pmd_idx_kmap_end =fix_to_virt (FIX_KMAP_BEGIN ) >>PMD_SHIFT ; +int pgd_idx, pmd_idx; +unsigned long vaddr; + +if (pmd_idx_kmap_begin == pmd_idx_kmap_end) +return count;
Or just 'return 0';
Re: [PATCH 13/19] x86, mm: only call early_ioremap_page_table_range_init() once
Quoted 5 lines · Konrad Rzeszutek Wilk
Quoted 1 line · Yinghai Lu
On 32bit, We should not keep calling that during every
init_memory_mapping.Explain pls why.
clear ?
---
On 32bit, before patcheset that only set page table for ram, we only call that one time.
Now, we are calling that during every init_memory_mapping if we have holes under max_low_pfn.
We should only call it one time after all ranges under max_low_page get mapped just like we did before.
Also that could avoid the risk to run out of pgt_buf in BRK.
Need to update page_table_range_init() to count the pages for kmap page table at first, and use new added alloc_low_pages() to get pages in sequence. That will conform to the requirement that pages need to be in low to high order.
---
Re: [PATCH 13/19] x86, mm: only call early_ioremap_page_table_range_init() once
I updated the for-x86-mm branch with updated change log and several split_mem_range clean up.
Please check them.
git://git.kernel.org/pub/scm/linux/kernel/git/yinghai/linux-yinghai.git
for-x86-mm
At the same time, please do check domU 32bit, that looks like only path that is not tested yet.
Thanks
Yinghai
PATCH 14/19 x86, mm: Move back pgt_buf_* to mm/init.c
In reply to Yinghai LuAlso change them to static.
--- arch/x86/include/asm/init.h | 4 ---- arch/x86/mm/init.c | 6 +++--- 2 files changed, 3 insertions(+), 7 deletions(-)
arch/x86/include/asm/init.h +0 -4
@@ -12,8 +12,4 @@ kernel_physical_mapping_init(unsigned long start,unsigned long end, unsigned long page_size_mask); -extern unsigned long __initdata pgt_buf_start; -extern unsigned long __meminitdata pgt_buf_end; -extern unsigned long __meminitdata pgt_buf_top; -#endif /* _ASM_X86_INIT_32_H */
arch/x86/mm/init.c +3 -3
@@ -19,9 +19,9 @@#include "mm_internal.h" -unsigned long __initdata pgt_buf_start; -unsigned long __meminitdata pgt_buf_end; -unsigned long __meminitdata pgt_buf_top; +static unsigned long __initdata pgt_buf_start; +static unsigned long __initdata pgt_buf_end; +static unsigned long __initdata pgt_buf_top;static unsigned long min_pfn_mapped;
Signature · 1 line
1.7.7
PATCH 15/19 x86, mm: Move init_gbpages() out of setup.c
In reply to Yinghai LuPut it in mm/init.c, and call it from probe_page_mask(). init_mem_mapping is calling probe_page_mask at first. So calling sequence is not changed.
--- arch/x86/kernel/setup.c | 15 +-------------- arch/x86/mm/init.c | 12 ++++++++++++ 2 files changed, 13 insertions(+), 14 deletions(-)
arch/x86/kernel/setup.c +1 -14
@@ -282,18 +282,7 @@ void * __init extend_brk(size_t size, size_t align)return ret; } -#ifdef CONFIG_X86_64 -static void __init init_gbpages (void ) -{ -if (direct_gbpages && cpu_has_gbpages) -printk (KERN_INFO "Using GB pages for direct mapping\n" ); -else - direct_gbpages =0 ; -} -#else -static inline void init_gbpages (void ) -{ -} +#ifdef CONFIG_X86_32 static void __init cleanup_highmap (void ) { }
@@ -930,8 +919,6 @@ void __init setup_arch(char **cmdline_p)setup_real_mode (); -init_gbpages (); -init_mem_mapping (); memblock.current_limit =get_max_mapped ();
arch/x86/mm/init.c +12 -0
@@ -89,6 +89,16 @@ int direct_gbpages#endif ; +static void __init init_gbpages (void ) +{ +#ifdef CONFIG_X86_64 +if (direct_gbpages && cpu_has_gbpages) +printk (KERN_INFO "Using GB pages for direct mapping\n" ); +else + direct_gbpages =0 ; +#endif +} +struct map_range {unsigned long start;unsigned long end;
@@ -99,6 +109,8 @@ static int page_size_mask;static void __init probe_page_size_mask (void ) { +init_gbpages (); +#if !defined(CONFIG_DEBUG_PAGEALLOC ) && !defined(CONFIG_KMEMCHECK )/* * For CONFIG_DEBUG_PAGEALLOC, identity mapping will use small pages.
Signature · 1 line
1.7.7
PATCH 16/19 x86, mm: change low/hignmem_pfn_init to static on 32bit
In reply to Yinghai Lu--- arch/x86/mm/init_32.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
arch/x86/mm/init_32.c +2 -2
@@ -575,7 +575,7 @@ early_param("highmem", parse_highmem);* artificially via the highmem=x boot parameter then create * it: */ -void __init lowmem_pfn_init (void ) +static void __init lowmem_pfn_init (void ) {/* max_low_pfn is 0, we already have early_res support */ max_low_pfn = max_pfn;
@@ -611,7 +611,7 @@ void __init lowmem_pfn_init(void)* We have more RAM than fits into lowmem - we try to put it into * highmem, also taking the highmem=x boot parameter into account: */ -void __init highmem_pfn_init (void ) +static void __init highmem_pfn_init (void ) { max_low_pfn =MAXMEM_PFN ;
Signature · 1 line
1.7.7
PATCH 17/19 x86, mm: Move function declaration into mm_internal.h
In reply to Yinghai LuThey are only for mm/init*.c.
--- arch/x86/include/asm/init.h | 16 +++------------- arch/x86/mm/mm_internal.h | 7 +++++++ 2 files changed, 10 insertions(+), 13 deletions(-)
arch/x86/include/asm/init.h +3 -13
@@ -1,15 +1,5 @@ -#ifndef _ASM_X86_INIT_32_H -#define _ASM_X86_INIT_32_H +#ifndef _ASM_X86_INIT_H +#define _ASM_X86_INIT_H -#ifdef CONFIG_X86_32 -extern void __init early_ioremap_page_table_range_init (void ); -#endif -extern void __init zone_sizes_init (void ); - -extern unsigned long __init -kernel_physical_mapping_init (unsigned long start, -unsigned long end, -unsigned long page_size_mask); - -#endif /* _ASM_X86_INIT_32_H */ +#endif /* _ASM_X86_INIT_H */
arch/x86/mm/mm_internal.h +7 -0
@@ -7,4 +7,11 @@ static inline void *alloc_low_page(void) return alloc_low_pages(1); } +void early_ioremap_page_table_range_init (void ); + +unsigned long kernel_physical_mapping_init (unsigned long start, +unsigned long end, +unsigned long page_size_mask); +void zone_sizes_init (void ); +#endif /* __X86_MM_INTERNAL_H */
Signature · 1 line
1.7.7
PATCH 18/19 x86, mm: Let "memmap=" take more entries one time
In reply to Yinghai LuCurrent "memmap=" only can take one entry every time. when we have more entries, we have to use memmap= for each of them.
For pxe booting, we have command line length limitation, those extra "memmap=" would waste too much space.
This patch make memmap= could take several entries one time, and those entries will be split with ','
--- arch/x86/kernel/e820.c | 16 +++++++++++++++- 1 files changed, 15 insertions(+), 1 deletions(-)
arch/x86/kernel/e820.c +15 -1
@@ -835,7 +835,7 @@ static int __init parse_memopt(char *p) }early_param ("mem" , parse_memopt); -static int __init parse_memmap_opt (char *p) +static int __init parse_memmap_one (char *p) {char *oldp;u64 start_at, mem_size;
@@ -877,6 +877,20 @@ static int __init parse_memmap_opt(char *p)return *p =='\0' ?0 : -EINVAL ; } +static int __init parse_memmap_opt (char *str) +{ +while (str) { +char *k =strchr (str,',' ); + +if (k) + *k++ =0 ; + +parse_memmap_one (str); + str = k; + } + +return 0 ; +}early_param ("memmap" , parse_memmap_opt);void __init finish_e820_parsing (void )
Signature · 1 line
1.7.7
Re: [PATCH 18/19] x86, mm: Let "memmap=" take more entries one time
Quoted 8 lines · Yinghai Lu
Current "memmap=" only can take one entry every time. when we have more entries, we have to use memmap= for each of them.
For pxe booting, we have command line length limitation, those extra "memmap=" would waste too much space.
This patch make memmap= could take several entries one time, and those entries will be split with ','
Um, not sure what this patch has to do with this patchset? Should this be sent seperatly?
Quoted 49 lines
Signed-off-by Yinghai Lu <[email protected]>--- arch/x86/kernel/e820.c | 16 +++++++++++++++- 1 files changed, 15 insertions(+), 1 deletions(-)arch/x86/kernel/e820.c +15
-1@@ -835,7 +835,7 @@ static int __init parse_memopt(char *p) }early_param ("mem" , parse_memopt); -static int __init parse_memmap_opt (char *p) +static int __init parse_memmap_one (char *p) {char *oldp;u64 start_at, mem_size;@@ -877,6 +877,20 @@ static int __init parse_memmap_opt(char *p)return *p =='\0' ?0 : -EINVAL ; } +static int __init parse_memmap_opt (char *str) +{ +while (str) { +char *k =strchr (str,',' ); + +if (k) + *k++ =0 ; + +parse_memmap_one (str); + str = k; + } + +return 0 ; +}early_param ("memmap" , parse_memmap_opt);void __init finish_e820_parsing (void )Signature · 7 lines
1.7.7 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 18/19] x86, mm: Let "memmap=" take more entries one time
Quoted 4 lines · Konrad Rzeszutek Wilk
Quoted 3 lines · Yinghai Lu
Current "memmap=" only can take one entry every time. when we have more entries, we have to use memmap= for each of them.
Quoted 8 lines
Quoted 5 lines
For pxe booting, we have command line length limitation, those extra "memmap=" would waste too much space.
This patch make memmap= could take several entries one time, and those entries will be split with ','
Um, not sure what this patch has to do with this patchset? Should this be sent seperatly?
during debug those patches, need to punch hole in memmap find this problem.
thought other guys could have the same problem while test this patch set.
will move it as last one
PATCH 19/19 x86, mm: Add check before clear pte above max_low_pfn on 32bit
In reply to Yinghai LuDuring test patch that adjust page_size_mask to map small range ram with big page size, found page table is setup wrongly for 32bit. And native_pagetable_init wrong clear pte for pmd with large page support.
1. add more comments about why we are expecting pte.
2. Add BUG checking, so next time we could find problem earlier when we mess up page table setup again.
3. max_low_pfn is not included boundary for low memory mapping. We should check from max_low_pfn instead of +1.
4. add print out when some pte really get cleared, or we should use WARN() to find out why above max_low_pfn get mapped? so we could fix it.
--- arch/x86/mm/init_32.c | 18 ++++++++++++++++-- 1 files changed, 16 insertions(+), 2 deletions(-)
arch/x86/mm/init_32.c +16 -2
@@ -480,9 +480,14 @@ void __init native_pagetable_init(void)/* * Remove any mappings which extend past the end of physical -* memory from the boot time page table: +* memory from the boot time page table. +* In virtual address space, we should have at least two pages +* from VMALLOC_END to pkmap or fixmap according to VMALLOC_END +* definition. And max_low_pfn is set to VMALLOC_END physical +* address. If initial memory mapping is doing right job, we +* should have pte used near max_low_pfn or one pmd is not present. */ -for (pfn = max_low_pfn +1 ; pfn <1 <<(32 -PAGE_SHIFT ); pfn++) { +for (pfn = max_low_pfn; pfn <1 <<(32 -PAGE_SHIFT ); pfn++) { va =PAGE_OFFSET + (pfn<<PAGE_SHIFT ); pgd = base +pgd_index (va);if (!pgd_present (*pgd))
@@ -493,10 +498,19 @@ void __init native_pagetable_init(void)if (!pmd_present (*pmd))break ; +/* should not be large page here */ +if (pmd_large (*pmd)) { +pr_warn ("try to clear pte for ram above max_low_pfn: pfn: %lx pmd: %p pmd phys: %lx, but pmd is big page and is not using pte !\n" , + pfn, pmd,__pa (pmd)); +BUG_ON (1 ); + } + pte =pte_offset_kernel (pmd, va);if (!pte_present (*pte))break ; +printk (KERN_DEBUG "clearing pte for ram above max_low_pfn: pfn: %lx pmd: %p pmd phys: %lx pte: %p pte phys: %lx\n" , + pfn, pmd,__pa (pmd), pte,__pa (pte));pte_clear (NULL , va, pte); }paravirt_alloc_pmd (&init_mm,__pa (base) >>PAGE_SHIFT );
Signature · 1 line
1.7.7