Re: [PATCHv4 3/4] x86/boot/compressed/64: Introduce place_trampoline()

2017-12-08 Thread Ingo Molnar
* Kirill A. Shutemov wrote: > On Thu, Dec 07, 2017 at 07:30:48AM +0100, Ingo Molnar wrote: > > > We also need a small stack in the trampoline to re-enable long mode via > > > long return. But stack and code can share the page just fine. > > > > BTW., I'm not sure this is

Re: [PATCHv4 3/4] x86/boot/compressed/64: Introduce place_trampoline()

2017-12-08 Thread Ingo Molnar
* Kirill A. Shutemov wrote: > On Thu, Dec 07, 2017 at 07:30:48AM +0100, Ingo Molnar wrote: > > > We also need a small stack in the trampoline to re-enable long mode via > > > long return. But stack and code can share the page just fine. > > > > BTW., I'm not sure this is necessarily a good

Re: [PATCHv4 3/4] x86/boot/compressed/64: Introduce place_trampoline()

2017-12-08 Thread Kirill A. Shutemov
On Thu, Dec 07, 2017 at 07:30:48AM +0100, Ingo Molnar wrote: > > We also need a small stack in the trampoline to re-enable long mode via > > long return. But stack and code can share the page just fine. > > BTW., I'm not sure this is necessarily a good idea: it means > writable+executable >

Re: [PATCHv4 3/4] x86/boot/compressed/64: Introduce place_trampoline()

2017-12-08 Thread Kirill A. Shutemov
On Thu, Dec 07, 2017 at 07:30:48AM +0100, Ingo Molnar wrote: > > We also need a small stack in the trampoline to re-enable long mode via > > long return. But stack and code can share the page just fine. > > BTW., I'm not sure this is necessarily a good idea: it means > writable+executable >

Re: [PATCHv4 3/4] x86/boot/compressed/64: Introduce place_trampoline()

2017-12-07 Thread Ingo Molnar
* Matthew Wilcox wrote: > On Thu, Dec 07, 2017 at 07:30:48AM +0100, Ingo Molnar wrote: > > > But if the bootloader put the kernel above 4G (not sure if anybody does > > > this), we would loose control as soon as paging is disabled as code > > > becomes unreachable. > > > >

Re: [PATCHv4 3/4] x86/boot/compressed/64: Introduce place_trampoline()

2017-12-07 Thread Ingo Molnar
* Matthew Wilcox wrote: > On Thu, Dec 07, 2017 at 07:30:48AM +0100, Ingo Molnar wrote: > > > But if the bootloader put the kernel above 4G (not sure if anybody does > > > this), we would loose control as soon as paging is disabled as code > > > becomes unreachable. > > > > Yeah, so instead of

Re: [PATCHv4 3/4] x86/boot/compressed/64: Introduce place_trampoline()

2017-12-07 Thread Matthew Wilcox
On Thu, Dec 07, 2017 at 07:30:48AM +0100, Ingo Molnar wrote: > > But if the bootloader put the kernel above 4G (not sure if anybody does > > this), we would loose control as soon as paging is disabled as code > > becomes unreachable. > > Yeah, so instead of the double 'as' which is syntactically

Re: [PATCHv4 3/4] x86/boot/compressed/64: Introduce place_trampoline()

2017-12-07 Thread Matthew Wilcox
On Thu, Dec 07, 2017 at 07:30:48AM +0100, Ingo Molnar wrote: > > But if the bootloader put the kernel above 4G (not sure if anybody does > > this), we would loose control as soon as paging is disabled as code > > becomes unreachable. > > Yeah, so instead of the double 'as' which is syntactically

Re: [PATCHv4 3/4] x86/boot/compressed/64: Introduce place_trampoline()

2017-12-06 Thread Ingo Molnar
* Kirill A. Shutemov wrote: > If a bootloader enables 64-bit mode with 4-level paging, we might need to > switch over to 5-level paging. The switching requires disabling paging. > It works fine if kernel itself is loaded below 4G. s/The switching requires

Re: [PATCHv4 3/4] x86/boot/compressed/64: Introduce place_trampoline()

2017-12-06 Thread Ingo Molnar
* Kirill A. Shutemov wrote: > If a bootloader enables 64-bit mode with 4-level paging, we might need to > switch over to 5-level paging. The switching requires disabling paging. > It works fine if kernel itself is loaded below 4G. s/The switching requires disabling paging. /The switching

[PATCHv4 3/4] x86/boot/compressed/64: Introduce place_trampoline()

2017-12-05 Thread Kirill A. Shutemov
If a bootloader enables 64-bit mode with 4-level paging, we might need to switch over to 5-level paging. The switching requires disabling paging. It works fine if kernel itself is loaded below 4G. But if the bootloader put the kernel above 4G (not sure if anybody does this), we would loose

[PATCHv4 3/4] x86/boot/compressed/64: Introduce place_trampoline()

2017-12-05 Thread Kirill A. Shutemov
If a bootloader enables 64-bit mode with 4-level paging, we might need to switch over to 5-level paging. The switching requires disabling paging. It works fine if kernel itself is loaded below 4G. But if the bootloader put the kernel above 4G (not sure if anybody does this), we would loose