From: Tom Rini <trini@kernel.crashing.org>
To: Andi Kleen <ak@suse.de>
Cc: akpm@osdl.org, linux-kernel@vger.kernel.org, bob.picco@hp.com
Subject: Re: [patch 2/3] x86_64: Run setup_per_cpu_areas and trap_init sooner
Date: Mon, 29 Aug 2005 13:03:22 -0700 [thread overview]
Message-ID: <20050829200322.GG3827@smtp.west.cox.net> (raw)
In-Reply-To: <200508292155.01252.ak@suse.de>
On Mon, Aug 29, 2005 at 09:55:00PM +0200, Andi Kleen wrote:
>
> > +void __init early_setup_per_cpu_areas(void)
> > +{
> > + static char cpu0[PERCPU_ENOUGH_ROOM]
> > + __attribute__ ((aligned (SMP_CACHE_BYTES)));
>
> This needs a __cacheline_aligned too, otherwise there could be false sharing.
Done, thanks:
CC: Andi Kleen <ak@suse.de>, Bob Picco <bob.picco@hp.com>
It can be handy in some situations to have run trap_init() sooner than the
generic code does. In order to do this on x86_64 we need to add a custom
early_setup_per_cpu_areas() call as well.
---
linux-2.6.13-trini/arch/x86_64/kernel/setup.c | 3 +++
linux-2.6.13-trini/arch/x86_64/kernel/setup64.c | 16 +++++++++++++++-
linux-2.6.13-trini/arch/x86_64/kernel/traps.c | 4 ++++
linux-2.6.13-trini/include/asm-x86_64/proto.h | 2 ++
4 files changed, 24 insertions(+), 1 deletion(-)
diff -puN arch/x86_64/kernel/setup.c~x86_64-early_funcs arch/x86_64/kernel/setup.c
--- linux-2.6.13/arch/x86_64/kernel/setup.c~x86_64-early_funcs 2005-08-29 12:39:49.000000000 -0700
+++ linux-2.6.13-trini/arch/x86_64/kernel/setup.c 2005-08-29 12:39:49.000000000 -0700
@@ -525,6 +525,9 @@ void __init setup_arch(char **cmdline_p)
{
unsigned long kernel_end;
+ early_setup_per_cpu_areas();
+ early_trap_init();
+
ROOT_DEV = old_decode_dev(ORIG_ROOT_DEV);
drive_info = DRIVE_INFO;
screen_info = SCREEN_INFO;
diff -puN arch/x86_64/kernel/setup64.c~x86_64-early_funcs arch/x86_64/kernel/setup64.c
--- linux-2.6.13/arch/x86_64/kernel/setup64.c~x86_64-early_funcs 2005-08-29 12:39:49.000000000 -0700
+++ linux-2.6.13-trini/arch/x86_64/kernel/setup64.c 2005-08-29 13:01:52.000000000 -0700
@@ -77,7 +77,19 @@ static int __init nonx32_setup(char *str
}
__setup("noexec32=", nonx32_setup);
+void __init early_setup_per_cpu_areas(void)
+{
+ static char cpu0[PERCPU_ENOUGH_ROOM] __cacheline_aligned
+ __attribute__ ((aligned (SMP_CACHE_BYTES)));
+ char *ptr = cpu0;
+
+ cpu_pda[0].data_offset = ptr - __per_cpu_start;
+ memcpy(ptr, __per_cpu_start, __per_cpu_end - __per_cpu_start);
+}
+
/*
+ * We run this a bit sooner than the normal code, so provide a dummy
+ * function as well.
* Great future plan:
* Declare PDA itself and support (irqstack,tss,pgd) as per cpu data.
* Always point %gs to its beginning
@@ -97,7 +109,9 @@ void __init setup_per_cpu_areas(void)
for (i = 0; i < NR_CPUS; i++) {
char *ptr;
- if (!NODE_DATA(cpu_to_node(i))) {
+ if (cpu_pda[i].data_offset)
+ continue;
+ else if (!NODE_DATA(cpu_to_node(i))) {
printk("cpu with no node %d, num_online_nodes %d\n",
i, num_online_nodes());
ptr = alloc_bootmem(size);
diff -puN arch/x86_64/kernel/traps.c~x86_64-early_funcs arch/x86_64/kernel/traps.c
--- linux-2.6.13/arch/x86_64/kernel/traps.c~x86_64-early_funcs 2005-08-29 12:39:49.000000000 -0700
+++ linux-2.6.13-trini/arch/x86_64/kernel/traps.c 2005-08-29 12:39:49.000000000 -0700
@@ -904,6 +904,10 @@ void do_call_debug(struct pt_regs *regs)
void __init trap_init(void)
{
+}
+
+void __init early_trap_init(void)
+{
set_intr_gate(0,÷_error);
set_intr_gate_ist(1,&debug,DEBUG_STACK);
set_intr_gate_ist(2,&nmi,NMI_STACK);
diff -puN include/asm-x86_64/proto.h~x86_64-early_funcs include/asm-x86_64/proto.h
--- linux-2.6.13/include/asm-x86_64/proto.h~x86_64-early_funcs 2005-08-29 12:39:49.000000000 -0700
+++ linux-2.6.13-trini/include/asm-x86_64/proto.h 2005-08-29 12:39:49.000000000 -0700
@@ -10,6 +10,8 @@ struct pt_regs;
extern void get_cpu_vendor(struct cpuinfo_x86*);
extern void start_kernel(void);
+extern void early_trap_init(void);
+extern void early_setup_per_cpu_areas(void);
extern void pda_init(int);
extern void early_idt_handler(void);
--
Tom Rini
http://gate.crashing.org/~trini/
next prev parent reply other threads:[~2005-08-29 20:03 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1.2982005.trini@kernel.crashing.org>
2005-08-29 16:08 ` [patch 01/16] Add a KGDB core Tom Rini
2005-08-29 16:09 ` [patch 02/16] Add support for i386 platforms to KGDB Tom Rini
2005-08-29 16:09 ` [patch 03/16] Add support for PowerPC32 " Tom Rini
2005-08-29 16:09 ` [patch 04/16] I/O driver for 8250-compatible UARTs Tom Rini
2005-08-29 16:09 ` [patch 05/16] Add support for MIPS platforms to KGDB Tom Rini
2005-08-29 16:10 ` [patch 06/16] Add support for IA64 " Tom Rini
2005-08-29 16:10 ` [patch 07/16] x86_64: Rename KDB_VECTOR to DEBUGGER_VECTOR Tom Rini
2005-08-29 16:10 ` [patch 08/16] Add support for X86_64 platforms to KGDB Tom Rini
2005-08-29 16:10 ` [patch 09/16] Add support for SuperH " Tom Rini
2005-08-29 16:10 ` [patch 10/16] Add support for ARM " Tom Rini
2005-08-29 16:11 ` [patch 11/16] Add support for PowerPC64 " Tom Rini
2005-08-29 16:11 ` [patch 12/16] KGDBoE I/O driver Tom Rini
2005-08-29 16:11 ` [patch 13/16] Add CFI DWARF2 annotation support Tom Rini
2005-08-29 16:11 ` [patch 14/16] Minor SysRq keyboard bugfix for KGDB Tom Rini
2005-08-29 16:11 ` [patch 15/16] Allow KGDB to work well with loaded modules Tom Rini
2005-08-29 16:12 ` [patch 16/16] Add hardware breakpoint support for i386 Tom Rini
2005-08-29 21:23 ` Andi Kleen
2005-08-31 14:39 ` Tom Rini
2005-08-30 1:06 ` Keith Owens
2005-08-29 17:13 ` [patch 08/16] Add support for X86_64 platforms to KGDB Andi Kleen
2005-08-29 17:45 ` Tom Rini
2005-08-29 18:46 ` Andi Kleen
2005-08-29 18:49 ` Tom Rini
2005-08-29 16:18 ` [patch 04/16] I/O driver for 8250-compatible UARTs Russell King
2005-08-29 16:28 ` Tom Rini
2005-08-31 19:38 ` Bjorn Helgaas
2005-08-31 20:10 ` Tom Rini
2005-08-31 21:03 ` Russell King
2005-08-31 21:23 ` Tom Rini
2005-08-31 21:19 ` Bjorn Helgaas
2005-08-31 22:15 ` Tom Rini
2005-08-29 19:55 ` [patch 2/3] x86_64: Run setup_per_cpu_areas and trap_init sooner Andi Kleen
2005-08-29 20:03 ` Tom Rini [this message]
2005-08-30 7:33 ` [patch 1/3] x86_64: Add a notify_die() call to the "no context" part of do_page_fault() George Anzinger
2005-08-30 14:06 ` Tom Rini
2005-08-30 14:50 ` George Anzinger
2005-08-30 19:53 ` Tom Rini
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=20050829200322.GG3827@smtp.west.cox.net \
--to=trini@kernel.crashing.org \
--cc=ak@suse.de \
--cc=akpm@osdl.org \
--cc=bob.picco@hp.com \
--cc=linux-kernel@vger.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.