Skip to contentSkip to conversation

x86: fix comment on super page alignment requirement

PATCH Superseded Wei Liu 2 participants 3 messages Sep 24, 2018

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Wei Liu

author
#0 lore raw

PATCH v2 1/1 x86: fix comment on super page alignment requirement

BOOTSTRAP_DIRECTMAP_END is gone. The comment in question should refer to BOOSTRAP_MAP_BASE and BOOTSTRAP_MAP_LIMIT instead.

Move the entire comment block to where it belongs -- immediately before the loop which does the things said in the comment.

Remove two trailing spaces while at it.

---
 xen/arch/x86/setup.c | 27 ++++++++++++++-------------
 1 file changed, 14 insertions(+), 13 deletions(-)
xen/arch/x86/setup.c +14 -13
index fb2a194119..86792a4068 100644
@@ -942,19 +942,6 @@ void __init noreturn __start_xen(unsigned long mbi_p)
     initial_images = mod;
     nr_initial_images = mbi->mods_count;
 
-    /*
-     * Iterate backwards over all superpage-aligned RAM regions.
-     * 
-     * We require superpage alignment because the boot allocator is not yet
-     * initialised. Hence we can only map superpages in the address range
-     * 0 to BOOTSTRAP_DIRECTMAP_END, as this is guaranteed not to require
-     * dynamic allocation of pagetables.
-     * 
-     * As well as mapping superpages in that range, in preparation for
-     * initialising the boot allocator, we also look for a region to which
-     * we can relocate the dom0 kernel and other multiboot modules. Also, on
-     * x86/64, we relocate Xen to higher memory.
-     */
     for ( i = 0; !efi_enabled(EFI_LOADER) && i < mbi->mods_count; i++ )
     {
         if ( mod[i].mod_start & (PAGE_SIZE - 1) )
@@ -987,6 +974,20 @@ void __init noreturn __start_xen(unsigned long mbi_p)
         highmem_start &= ~((1UL << L3_PAGETABLE_SHIFT) - 1);
 #endif
 
+    /*
+     * Iterate backwards over all superpage-aligned RAM regions.
+     *
+     * We require superpage alignment because the boot allocator is
+     * not yet initialised. Hence we can only map superpages in the
+     * address range BOOTSTRAP_MAP_BASE to BOOTSTRAP_MAP_LIMIT, as
+     * this is guaranteed not to require dynamic allocation of
+     * pagetables.
+     *
+     * As well as mapping superpages in that range, in preparation for
+     * initialising the boot allocator, we also look for a region to which
+     * we can relocate the dom0 kernel and other multiboot modules. Also, on
+     * x86/64, we relocate Xen to higher memory.
+     */
     for ( i = boot_e820.nr_map-1; i >= 0; i-- )
     {
         uint64_t s, e, mask = (1UL << L2_PAGETABLE_SHIFT) - 1;
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#1 lore raw

xen/arch/x86/setup.c void __init noreturn __start_xen(unsigned long mbi_p) · line 982

Quoted 11 lines
Quoted 1 line
Quoted 1 line · On 24.09.18 at 15:46, <[email protected]> wrote:
xen/arch/x86/setup.c +6 -0
@@ -987,6 +974,20 @@ void __init noreturn __start_xen(unsigned long mbi_p)
         highmem_start &= ~((1UL << L3_PAGETABLE_SHIFT) - 1);
 #endif
 
+    /*
+     * Iterate backwards over all superpage-aligned RAM regions.
+     *
+     * We require superpage alignment because the boot allocator is
+     * not yet initialised. Hence we can only map superpages in the
+     * address range BOOTSTRAP_MAP_BASE to BOOTSTRAP_MAP_LIMIT, as

Well, as said, mentioning BOOTSTRAP_MAP_LIMIT here is then not in line with the code. I think BOOTSTRAP_MAP_LIMIT should really be #undef-ed right after the last function using it.

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

author
#2 lore raw
Quoted 11 lines · Jan Beulich

xen/arch/x86/setup.c void __init noreturn __start_xen(unsigned long mbi_p) · line 982

Quoted 11 lines
Quoted 1 line
Quoted 1 line · On 24.09.18 at 15:46, <[email protected]> wrote:
xen/arch/x86/setup.c +6 -0
@@ -987,6 +974,20 @@ void __init noreturn __start_xen(unsigned long mbi_p)
         highmem_start &= ~((1UL << L3_PAGETABLE_SHIFT) - 1);
 #endif
 
+    /*
+     * Iterate backwards over all superpage-aligned RAM regions.
+     *
+     * We require superpage alignment because the boot allocator is
+     * not yet initialised. Hence we can only map superpages in the
+     * address range BOOTSTRAP_MAP_BASE to BOOTSTRAP_MAP_LIMIT, as

Okay. The address range should be changed to "BOOTSTRAP_MAP_BASE to 4GB".

Quoted 4 lines

Well, as said, mentioning BOOTSTRAP_MAP_LIMIT here is then not in line with the code. I think BOOTSTRAP_MAP_LIMIT should really be #undef-ed right after the last function using it.

Okay.

Wei.

Quoted 4 lines

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel