Skip to contentSkip to conversation

Kexec query about what makes sure control pages/page tables are not overwritten

DISCUSSION Vivek Goyal 2 participants 3 messages Nov 11, 2013

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

Hi,

I am staring at control page allocation logic in case of kdump and wondering what makes sure that these pages are not overwritten by next kernel.

I see that for 64bit entry, control pages have the page tables needed for second kernel. In case of crash these pages from from crash kernel reserved region. Page allocator is very simple and that is start from lowest crash reserved range and move higher and allocate first available page which is not allocated to segments. What makes sure that these pages are not overwritten by second kernel.

I guess it becomes a general bootloader question. How do we make sure bootloader prepared page tables/gdt will not be overwritten by kernel (till kernel sets up its own page tables and gdt) and how should we do the allocation and placement.

Thanks
Vivek

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#1 lore raw

It is pretty simple: the kernel exports how much text+data+bss+brk it needs, and the kernel cannot use memory outside that region until it is ready to control the address space itself.

Quoted 23 lines · Vivek Goyal

Hi,

I am staring at control page allocation logic in case of kdump and wondering what makes sure that these pages are not overwritten by next kernel.

I see that for 64bit entry, control pages have the page tables needed for second kernel. In case of crash these pages from from crash kernel reserved region. Page allocator is very simple and that is start from lowest crash reserved range and move higher and allocate first available
page which is not allocated to segments. What makes sure that these pages
are not overwritten by second kernel.

I guess it becomes a general bootloader question. How do we make sure bootloader prepared page tables/gdt will not be overwritten by kernel (till kernel sets up its own page tables and gdt) and how should we do the
allocation and placement.

Thanks
Vivek

Signature · 6 lines
Sent from my mobile phone.  Please pardon brevity and lack of formatting.

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#2 lore raw
Quoted 1 line · H. Peter Anvin

It is pretty simple: the kernel exports how much text+data+bss+brk it needs, and the kernel cannot use memory outside that region until it is ready to control the address space itself.

Ok. So looks like that field is.

0260/4 2.10+ init_size Linear memory required during initialization

This helps. Thanks.

Vivek

Quoted 18 lines
Quoted 15 lines · Vivek Goyal

Hi,

I am staring at control page allocation logic in case of kdump and wondering what makes sure that these pages are not overwritten by next kernel.

I see that for 64bit entry, control pages have the page tables needed for second kernel. In case of crash these pages from from crash kernel reserved region. Page allocator is very simple and that is start from lowest crash reserved range and move higher and allocate first available
page which is not allocated to segments. What makes sure that these pages
are not overwritten by second kernel.

Quoted 11 lines
Quoted 8 lines

I guess it becomes a general bootloader question. How do we make sure bootloader prepared page tables/gdt will not be overwritten by kernel (till kernel sets up its own page tables and gdt) and how should we do the
allocation and placement.

Thanks
Vivek

Signature · 1 line
Sent from my mobile phone.  Please pardon brevity and lack of formatting.

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec