From: Brian Gerst <brgerst@gmail.com>
To: Jeremy Fitzhardinge <jeremy@goop.org>
Cc: Tejun Heo <htejun@gmail.com>, Ingo Molnar <mingo@elte.hu>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: unified percpu stuff
Date: Tue, 27 Jan 2009 14:07:49 -0500 [thread overview]
Message-ID: <73c1f2160901271107n55509844xd02592bf9ed00038@mail.gmail.com> (raw)
In-Reply-To: <497F4982.8060103@goop.org>
On Tue, Jan 27, 2009 at 12:50 PM, Jeremy Fitzhardinge <jeremy@goop.org> wrote:
> Brian Gerst wrote:
>>>
>>> BTW, does the initial cpu0 percpu area get reallocated and moved during
>>> boot, or does cpu0 keep using the same memory forever?
>>>
>>
>> It is reallocated in setup_per_cpu_areas().
>>
>
> Hm, OK. What's the reason we need to move cpu 0's percpu area? Its always
> seemed a bit awkward.
>
> Once it has been moved, how can I find the address of a variable in the
> original boot-time cpu 0 percpu area? There's a couple of pages which Xen
> will have marked RO which need to be made RW if they're being freed back
> into the kernel pool. Currently I use per_cpu_var(gdt_page), but guess
> that's a small offset rather than a directly usable address.
The fact that the boot cpu area is moved isn't new. It's been that
way for a while. The reason it is moved is so that extra space can be
allocated at the end for dynamic allocations. It looks like Xen just
avoided it by not loading the per-cpu GDT until after the copy. I
guess you could get by without reloading the GDT, but you would still
need to set MSR_GS_BASE for 64-bit. 32-bit happens to work because
%fs is probably initialized to the same segment as %ds. If 32-bit
were ever to switch to zero-based per-cpu like 64-bit, that assumption
would fail.
You need to add __per_cpu_load to the offset to get the address of the
variable in the original boot per-cpu area.
--
Brian Gerst
prev parent reply other threads:[~2009-01-27 19:08 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-27 1:12 Jeremy Fitzhardinge
2009-01-27 4:17 ` Tejun Heo
2009-01-29 10:43 ` Jeremy Fitzhardinge
2009-01-29 11:01 ` Tejun Heo
2009-01-29 13:43 ` [PATCH] x86: pass in cpu number to switch_to_new_gdt() Brian Gerst
2009-01-29 21:36 ` Jeremy Fitzhardinge
2009-01-29 21:36 ` [PATCH 1/2] x86: split loading percpu segments from loading gdt Jeremy Fitzhardinge
2009-01-29 21:36 ` [PATCH 2/2] xen: setup percpu data pointers Jeremy Fitzhardinge
2009-01-30 8:50 ` Tejun Heo
2009-01-30 8:50 ` [PATCH] x86: pass in cpu number to switch_to_new_gdt() Tejun Heo
2009-01-27 5:57 ` unified percpu stuff Brian Gerst
2009-01-27 7:24 ` Jeremy Fitzhardinge
2009-01-27 12:35 ` Brian Gerst
2009-01-27 17:50 ` Jeremy Fitzhardinge
2009-01-27 19:07 ` Brian Gerst [this message]
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=73c1f2160901271107n55509844xd02592bf9ed00038@mail.gmail.com \
--to=brgerst@gmail.com \
--cc=htejun@gmail.com \
--cc=jeremy@goop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
/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®