From: David Woodhouse <dwmw2@infradead.org>
To: "Huang, Kai" <kai.huang@intel.com>,
"kexec@lists.infradead.org" <kexec@lists.infradead.org>
Cc: "x86@kernel.org" <x86@kernel.org>, "bp@alien8.de" <bp@alien8.de>,
"hpa@zytor.com" <hpa@zytor.com>,
"mingo@redhat.com" <mingo@redhat.com>,
"tglx@linutronix.de" <tglx@linutronix.de>,
"kirill.shutemov@linux.intel.com"
<kirill.shutemov@linux.intel.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"horms@kernel.org" <horms@kernel.org>,
"dave.hansen@linux.intel.com" <dave.hansen@linux.intel.com>,
"nik.borisov@suse.com" <nik.borisov@suse.com>
Subject: Re: [RFC PATCH 1/7] x86/kexec: Clean up and document register use in relocate_kernel_64.S
Date: Tue, 05 Nov 2024 12:17:05 -0800 [thread overview]
Message-ID: <d2138bfeff7caf5d65b2cb2417c92ea6eedbcb9a.camel@infradead.org> (raw)
In-Reply-To: <b7282cfd3cf15462cfbc89bab9c09bcb8791b33c.camel@intel.com>
[-- Attachment #1: Type: text/plain, Size: 2466 bytes --]
On Tue, 2024-11-05 at 10:00 +0000, Huang, Kai wrote:
> On Sun, 2024-11-03 at 05:35 +0000, David Woodhouse wrote:
> > From: David Woodhouse <dwmw@amazon.co.uk>
> >
> > Add more comments explaining what each register contains, and save the
> > preserve_context flag to a non-clobbered register sooner, to keep things
> > simpler.
> >
> > Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
> > ---
> > arch/x86/kernel/relocate_kernel_64.S | 17 +++++++++++++----
> > 1 file changed, 13 insertions(+), 4 deletions(-)
> >
> > diff --git a/arch/x86/kernel/relocate_kernel_64.S b/arch/x86/kernel/relocate_kernel_64.S
> > index e9e88c342f75..c065806884f8 100644
> > --- a/arch/x86/kernel/relocate_kernel_64.S
> > +++ b/arch/x86/kernel/relocate_kernel_64.S
> > @@ -100,6 +100,9 @@ SYM_CODE_START_NOALIGN(relocate_kernel)
> > movq %r10, CP_PA_SWAP_PAGE(%r11)
> > movq %rdi, CP_PA_BACKUP_PAGES_MAP(%r11)
> >
> > + /* Save the preserve_context to %r11 as swap_pages clobbers %rcx. */
> > + movq %rcx, %r11
> > +
>
> Seems moving this here won't break anything. From functionality's perspective
> there's no need move this here, but fine to me since the move is needed for the
> sake of adding the comment (below) to identity_mapped.
I believe I did actually use %rcx in the debug code I added later,
didn't I?
> > /* Switch to the identity mapped page tables */
> > movq %r9, %cr3
> >
> > @@ -116,6 +119,13 @@ SYM_CODE_END(relocate_kernel)
> >
> > SYM_CODE_START_LOCAL_NOALIGN(identity_mapped)
> > UNWIND_HINT_END_OF_STACK
> > + /*
> > + * %rdi indirection page
> > + * %rdx start address
> > + * %r11 preserve_context
> > + * %r12 host_mem_enc_active
> > + */
> > +
>
> I think adding this comment is the main purpose of this patch. Since we have
> listed 4 regs in the comment, how about also add an entry for %r13?
>
> Something like:
>
> %r13 original CR4 when relocate_kernel() is invoked
>
> Yeah this is kinda mentioned in later code but it seems it's more complete if we
> also mention %r13 here.
Ack, I'll add that too. Thanks.
> Anyway, I suppose adding this comment is kinda helpful, so:
>
> Acked-by: Kai Huang <kai.huang@intel.com>
>
[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5965 bytes --]
next prev parent reply other threads:[~2024-11-05 20:17 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-03 5:35 [RFC PATCH 0/7] x86/kexec: Add exception handling for relocate_kernel David Woodhouse
2024-11-03 5:35 ` [RFC PATCH 1/7] x86/kexec: Clean up and document register use in relocate_kernel_64.S David Woodhouse
2024-11-05 10:00 ` Huang, Kai
2024-11-05 20:17 ` David Woodhouse [this message]
2024-11-03 5:35 ` [RFC PATCH 2/7] x86/kexec: Use named labels in swap_pages " David Woodhouse
2024-11-05 10:01 ` Huang, Kai
2024-11-03 5:35 ` [RFC PATCH 3/7] x86/kexec: Only swap pages for preserve_context mode David Woodhouse
2024-11-03 5:35 ` [RFC PATCH 4/7] x86/kexec: Debugging support: load a GDT David Woodhouse
2024-11-03 5:35 ` [RFC PATCH 5/7] x86/kexec: Debugging support: Load an IDT and basic exception entry points David Woodhouse
2024-11-03 5:35 ` [RFC PATCH 6/7] x86/kexec: Debugging support: Dump registers on exception David Woodhouse
2024-11-05 20:38 ` Woodhouse, David
2024-11-05 20:50 ` H. Peter Anvin
2024-11-05 21:29 ` David Woodhouse
2024-11-05 22:08 ` H. Peter Anvin
2024-11-05 21:37 ` H. Peter Anvin
2024-11-05 21:58 ` H. Peter Anvin
2024-11-05 22:27 ` H. Peter Anvin
2024-11-05 22:57 ` H. Peter Anvin
2024-11-14 7:40 ` Andy Shevchenko
2024-11-06 2:43 ` David Woodhouse
2024-11-06 2:47 ` H. Peter Anvin
2024-11-06 3:07 ` David Woodhouse
2024-11-08 5:21 ` David Woodhouse
2024-11-08 5:22 ` [RFC PATCH 1/2] x86/kexec: Use linker script for relocate_kernel page layout David Woodhouse
2024-11-08 5:22 ` [RFC PATCH 2/2] x86/kexec: Add data section to relocate_kernel David Woodhouse
2024-11-08 5:35 ` David Woodhouse
2024-11-08 11:26 ` H. Peter Anvin
2024-11-08 12:29 ` David Woodhouse
2024-11-12 8:44 ` David Woodhouse
2024-11-12 10:14 ` Peter Zijlstra
2024-11-12 10:45 ` David Woodhouse
2024-11-14 1:46 ` jpoimboe
2024-11-03 5:35 ` [RFC PATCH 7/7] [DO NOT MERGE] x86/kexec: enable DEBUG David Woodhouse
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=d2138bfeff7caf5d65b2cb2417c92ea6eedbcb9a.camel@infradead.org \
--to=dwmw2@infradead.org \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=horms@kernel.org \
--cc=hpa@zytor.com \
--cc=kai.huang@intel.com \
--cc=kexec@lists.infradead.org \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=nik.borisov@suse.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
all inboxes | Powered by JetHome®