From: Ian Campbell <Ian.Campbell@eu.citrix.com>
To: Borislav Petkov <bp@alien8.de>
Cc: Jeremy Fitzhardinge <jeremy@goop.org>,
"H. Peter Anvin" <hpa@linux.intel.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"x86@kernel.org" <x86@kernel.org>
Subject: Re: [PATCH] x86: use pgd accessors when cloning a pgd range.
Date: Wed, 27 Oct 2010 18:58:41 +0100 [thread overview]
Message-ID: <1288202321.10179.102.camel@localhost.localdomain> (raw)
In-Reply-To: <20101027174417.GA19194@a1.tnic>
On Wed, 2010-10-27 at 18:44 +0100, Borislav Petkov wrote:
> On Wed, Oct 27, 2010 at 10:31:37AM -0700, Jeremy Fitzhardinge wrote:
> > > Xen shouldn't have any users of this, since it's used for low-level
> > > operations like SMP bootstrap, suspend to RAM, reboot and low-level
> > > BIOS functionality.
> > >
> > Right, but it is being called smack in the middle of setup_arch(). It
> > looks like they could be hidden away in
> > native_pagetable_setup_start/done though.
>
> I think I can put the second sync-back clone_pgd_range in
> native_pagetable_setup_done but the first one needs to take place right
> at the beginning of setup_arch() because a lot of code in-between relies
> on swapper_pg_dir containing proper entries.
>
> Just to make sure I understand you correctly: best it would be for xen
> to not have the copy_pgd_range() calls in setup_arch, correct?
Yes, or to ensure that swapper_pg_dir has not yet been marked as a
pagetable at this point. Under Xen we are running on swapper_pg_dir when
setup_arch is called.
I think we could achieve this within the Xen pvops backend but e.g. the
following would likely work also.
(Note, untested. I also omitted the reindent for clarity at this point)
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index 95a3274..2d89d5a 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -705,12 +705,14 @@ void __init setup_arch(char **cmdline_p)
* copy kernel address range established so far and switch
* to the proper swapper page table
*/
+ if (read_cr3() != __pa(swapper_pg_dir)) {
clone_pgd_range(swapper_pg_dir + KERNEL_PGD_BOUNDARY,
initial_page_table + KERNEL_PGD_BOUNDARY,
KERNEL_PGD_PTRS);
load_cr3(swapper_pg_dir);
__flush_tlb_all();
+ }
#else
printk(KERN_INFO "Command line: %s\n", boot_command_line);
#endif
next prev parent reply other threads:[~2010-10-27 17:58 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-27 8:50 Ian Campbell
2010-10-27 10:40 ` Borislav Petkov
2010-10-27 16:50 ` Jeremy Fitzhardinge
2010-10-27 17:18 ` H. Peter Anvin
2010-10-27 17:31 ` Jeremy Fitzhardinge
2010-10-27 17:42 ` H. Peter Anvin
2010-10-27 17:51 ` Ian Campbell
2010-10-27 17:51 ` Jeremy Fitzhardinge
2010-10-27 18:02 ` Ian Campbell
2010-10-27 18:11 ` H. Peter Anvin
2010-10-27 18:51 ` Jeremy Fitzhardinge
2010-10-27 19:00 ` H. Peter Anvin
2010-10-27 19:02 ` H. Peter Anvin
2010-10-27 17:44 ` Borislav Petkov
2010-10-27 17:54 ` Jeremy Fitzhardinge
2010-10-27 17:58 ` Ian Campbell [this message]
2010-10-28 9:23 ` Ian Campbell
2010-10-28 11:20 ` Borislav Petkov
2010-10-28 11:53 ` Ian Campbell
2010-10-28 15:49 ` H. Peter Anvin
2010-10-28 15:48 ` H. Peter Anvin
2010-11-03 15:35 ` Ian Campbell
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=1288202321.10179.102.camel@localhost.localdomain \
--to=ian.campbell@eu.citrix.com \
--cc=bp@alien8.de \
--cc=hpa@linux.intel.com \
--cc=jeremy@goop.org \
--cc=linux-kernel@vger.kernel.org \
--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®