From: Baoquan He <bhe@redhat.com>
To: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Cc: Ingo Molnar <mingo@redhat.com>,
x86@kernel.org, Thomas Gleixner <tglx@linutronix.de>,
"H. Peter Anvin" <hpa@zytor.com>, Borislav Petkov <bp@suse.de>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] x86/kexec: Make kexec work in 5-level paging mode
Date: Mon, 29 Jan 2018 21:00:09 +0800 [thread overview]
Message-ID: <20180129130009.GB7344@localhost.localdomain> (raw)
In-Reply-To: <20180129111901.GA7344@localhost.localdomain>
On 01/29/18 at 07:19pm, Baoquan He wrote:
> On 01/29/18 at 02:08pm, Kirill A. Shutemov wrote:
> > I've missed that we need to change relocate_kernel() to set CR4.LA57
> > flag if the kernel has 5-level paging enabled.
> >
> > I avoided to use ifdef CONFIG_X86_5LEVEL here and inferred if we need to
> > enabled 5-level paging from previous CR4 value. This way the code is
> > ready for boot-time switching between paging modes.
> >
> > Fixes: 77ef56e4f0fb ("x86: Enable 5-level paging support via CONFIG_X86_5LEVEL=y")
> > Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> > Reported-by: Baoquan He <bhe@redhat.com>
>
> Thanks, Kirill.
>
> Tested on qemu with la57 support, kexec works well. Kdump kernel can
> boot into kernel, while there's a memory allocation failure during
> boot which I am trying to fix. The reason is kdump kernel need reserve
> as small memory as possible. Will post soon.
By the way, the kdump failure can be worked around by increasing
crashkernel memory, then kdump kernel can still work well. So this patch
is necessary fix for kexec/kdump.
>
> For this patch, feel free to add my Tested-by.
>
> Tested-by: Baoquan He <bhe@redhat.com>
>
> Thanks
> Baoquan
> > ---
> > arch/x86/kernel/relocate_kernel_64.S | 8 ++++++++
> > 1 file changed, 8 insertions(+)
> >
> > diff --git a/arch/x86/kernel/relocate_kernel_64.S b/arch/x86/kernel/relocate_kernel_64.S
> > index 307d3bac5f04..11eda21eb697 100644
> > --- a/arch/x86/kernel/relocate_kernel_64.S
> > +++ b/arch/x86/kernel/relocate_kernel_64.S
> > @@ -68,6 +68,9 @@ relocate_kernel:
> > movq %cr4, %rax
> > movq %rax, CR4(%r11)
> >
> > + /* Save CR4. Required to enable the right paging mode later. */
> > + movq %rax, %r13
> > +
> > /* zero out flags, and disable interrupts */
> > pushq $0
> > popfq
> > @@ -126,8 +129,13 @@ identity_mapped:
> > /*
> > * Set cr4 to a known state:
> > * - physical address extension enabled
> > + * - 5-level paging, if it was enabled before
> > */
> > movl $X86_CR4_PAE, %eax
> > + testq $X86_CR4_LA57, %r13
> > + jz 1f
> > + orl $X86_CR4_LA57, %eax
> > +1:
> > movq %rax, %cr4
> >
> > jmp 1f
> > --
> > 2.15.1
> >
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2018-01-29 13:01 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-29 11:08 Kirill A. Shutemov
2018-01-29 11:19 ` Baoquan He
2018-01-29 13:00 ` Baoquan He [this message]
2018-01-29 11:59 ` Matthew Wilcox
2018-01-29 13:48 ` Kirill A. Shutemov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180129130009.GB7344@localhost.localdomain \
--to=bhe@redhat.com \
--cc=bp@suse.de \
--cc=hpa@zytor.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox