From: "Huang, Kai" <kai.huang@intel.com>
To: "luto@kernel.org" <luto@kernel.org>,
"rafael@kernel.org" <rafael@kernel.org>,
"dave.hansen@linux.intel.com" <dave.hansen@linux.intel.com>,
"bp@alien8.de" <bp@alien8.de>,
"peterz@infradead.org" <peterz@infradead.org>,
"hpa@zytor.com" <hpa@zytor.com>,
"mingo@redhat.com" <mingo@redhat.com>,
"kirill.shutemov@linux.intel.com"
<kirill.shutemov@linux.intel.com>,
"tglx@linutronix.de" <tglx@linutronix.de>,
"bhe@redhat.com" <bhe@redhat.com>,
"x86@kernel.org" <x86@kernel.org>
Cc: "thomas.lendacky@amd.com" <thomas.lendacky@amd.com>,
"linux-acpi@vger.kernel.org" <linux-acpi@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"ardb@kernel.org" <ardb@kernel.org>,
"seanjc@google.com" <seanjc@google.com>,
"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
"tzimmermann@suse.de" <tzimmermann@suse.de>
Subject: Re: [PATCH 3/3] x86/64/kexec: Rewrite init_transition_pgtable() with kernel_ident_mapping_init()
Date: Wed, 3 Jul 2024 11:06:21 +0000 [thread overview]
Message-ID: <cd655676d5e81ca9b1de0a66f5f5c719ef816c89.camel@intel.com> (raw)
In-Reply-To: <20240701124334.1855981-4-kirill.shutemov@linux.intel.com>
On Mon, 2024-07-01 at 15:43 +0300, Kirill A. Shutemov wrote:
> init_transition_pgtable() setups transitional page tables. Rewrite it
> using kernel_ident_mapping_init() to avoid code duplication.
setups -> sets up
>
> struct kimage_arch changed to track allocated page tables as a list, not
> linking them to specific page table levels.
This doesn't look like imperative mode. Perhaps change to:
Change struct kimage_arch to track ...
[...]
> static int init_transition_pgtable(struct kimage *image, pgd_t *pgd)
> {
> - pgprot_t prot = PAGE_KERNEL_EXEC_NOENC;
> - unsigned long vaddr, paddr;
> - int result = -ENOMEM;
> - p4d_t *p4d;
> - pud_t *pud;
> - pmd_t *pmd;
> - pte_t *pte;
> + struct x86_mapping_info info = {
> + .alloc_pgt_page = alloc_transition_pgt_page,
> + .context = image,
> + .page_flag = __PAGE_KERNEL_LARGE_EXEC,
> + .kernpg_flag = _KERNPG_TABLE_NOENC,
> + .offset = __START_KERNEL_map - phys_base,
> + };
> + unsigned long mstart = PAGE_ALIGN_DOWN(__pa(relocate_kernel));
> + unsigned long mend = mstart + PAGE_SIZE;
>
> - vaddr = (unsigned long)relocate_kernel;
> - paddr = __pa(page_address(image->control_code_page)+PAGE_SIZE);
Perhaps I am missing something, but this seems a functional change to me.
IIUC the page after image->control_code_page is allocated when loading the
kexec kernel image. It is a different page from the page where the
relocate_kernel code resides in.
The old code maps relocate_kernel kernel VA to the page after the
control_code_page. Later in machine_kexec(), the relocate_kernel code is
copied to that page so the mapping can work for that:
control_page = page_address(image->control_code_page) + PAGE_SIZE;
__memcpy(control_page, relocate_kernel,
KEXEC_CONTROL_CODE_MAX_SIZE);
The new code in this patch, however, seems just maps the relocate_kernel VA
to the PA of the relocate_kernel, which should be different from the old
mapping.
next prev parent reply other threads:[~2024-07-03 11:06 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-01 12:43 [PATCH 0/3] x86: Reduce code duplication on page table initialization Kirill A. Shutemov
2024-07-01 12:43 ` [PATCH 1/3] x86/mm/ident_map: Fix virtual address wrap to zero Kirill A. Shutemov
2024-07-03 10:11 ` Huang, Kai
2024-07-01 12:43 ` [PATCH 2/3] x86/acpi: Replace manual page table initialization with kernel_ident_mapping_init() Kirill A. Shutemov
2024-07-03 10:23 ` Huang, Kai
2024-07-01 12:43 ` [PATCH 3/3] x86/64/kexec: Rewrite init_transition_pgtable() " Kirill A. Shutemov
2024-07-03 11:06 ` Huang, Kai [this message]
2024-07-04 13:44 ` kirill.shutemov
2024-07-05 10:35 ` Huang, Kai
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=cd655676d5e81ca9b1de0a66f5f5c719ef816c89.camel@intel.com \
--to=kai.huang@intel.com \
--cc=akpm@linux-foundation.org \
--cc=ardb@kernel.org \
--cc=bhe@redhat.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rafael@kernel.org \
--cc=seanjc@google.com \
--cc=tglx@linutronix.de \
--cc=thomas.lendacky@amd.com \
--cc=tzimmermann@suse.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®