Commit ed5bb129 authored by Andi Kleen's avatar Andi Kleen Committed by Linus Torvalds

[PATCH] x86-64: turn tss into per cpu data

Turn per cpu TSS into per cpu data.
Signed-off-by: default avatarAndi Kleen <ak@muc.de>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 1b7014f6
......@@ -44,8 +44,7 @@ EXPORT_SYMBOL(init_task);
* section. Since TSS's are completely CPU-local, we want them
* on exact cacheline boundaries, to eliminate cacheline ping-pong.
*/
struct tss_struct init_tss[NR_CPUS] __cacheline_aligned;
DEFINE_PER_CPU(struct tss_struct, init_tss) ____cacheline_maxaligned_in_smp;
#define ALIGN_TO_4K __attribute__((section(".data.init_task")))
......
......@@ -61,7 +61,7 @@ asmlinkage long sys_ioperm(unsigned long from, unsigned long num, int turn_on)
* do it in the per-thread copy and in the TSS ...
*/
set_bitmap(t->io_bitmap_ptr, from, num, !turn_on);
tss = init_tss + get_cpu();
tss = &per_cpu(init_tss, get_cpu());
if (tss->io_bitmap_base == IO_BITMAP_OFFSET) { /* already active? */
set_bitmap(tss->io_bitmap, from, num, !turn_on);
} else {
......
......@@ -251,7 +251,7 @@ void exit_thread(void)
{
struct task_struct *me = current;
if (me->thread.io_bitmap_ptr) {
struct tss_struct *tss = init_tss + get_cpu();
struct tss_struct *tss = &per_cpu(init_tss,get_cpu());
kfree(me->thread.io_bitmap_ptr);
me->thread.io_bitmap_ptr = NULL;
tss->io_bitmap_base = INVALID_IO_BITMAP_OFFSET;
......@@ -404,7 +404,7 @@ struct task_struct *__switch_to(struct task_struct *prev_p, struct task_struct *
struct thread_struct *prev = &prev_p->thread,
*next = &next_p->thread;
int cpu = smp_processor_id();
struct tss_struct *tss = init_tss + cpu;
struct tss_struct *tss = &per_cpu(init_tss, cpu);
unlazy_fpu(prev_p);
......
......@@ -237,7 +237,7 @@ void __init cpu_init (void)
#else
int cpu = smp_processor_id();
#endif
struct tss_struct * t = &init_tss[cpu];
struct tss_struct *t = &per_cpu(init_tss, cpu);
unsigned long v;
char *estacks = NULL;
struct task_struct *me;
......
......@@ -575,7 +575,7 @@ static void __init do_boot_cpu (int apicid)
start_rip = setup_trampoline();
init_rsp = idle->thread.rsp;
init_tss[cpu].rsp0 = init_rsp;
per_cpu(init_tss,cpu).rsp0 = init_rsp;
initial_code = start_secondary;
clear_ti_thread_flag(idle->thread_info, TIF_FORK);
......
......@@ -129,7 +129,7 @@ void restore_processor_state(void)
void fix_processor_context(void)
{
int cpu = smp_processor_id();
struct tss_struct * t = init_tss + cpu;
struct tss_struct *t = &per_cpu(init_tss, cpu);
set_tss_desc(cpu,t); /* This just modifies memory; should not be neccessary. But... This is neccessary, because 386 hardware has concept of busy TSS or some similar stupidity. */
......
......@@ -110,9 +110,10 @@ unsigned long *in_exception_stack(int cpu, unsigned long stack)
{
int k;
for (k = 0; k < N_EXCEPTION_STACKS; k++) {
unsigned long end = init_tss[cpu].ist[k] + EXCEPTION_STKSZ;
struct tss_struct *tss = &per_cpu(init_tss, cpu);
unsigned long end = tss->ist[k] + EXCEPTION_STKSZ;
if (stack >= init_tss[cpu].ist[k] && stack <= end)
if (stack >= tss->ist[k] && stack <= end)
return (unsigned long *)end;
}
return NULL;
......
......@@ -18,6 +18,7 @@
#include <asm/current.h>
#include <asm/system.h>
#include <asm/mmsegment.h>
#include <asm/percpu.h>
#include <linux/personality.h>
#define TF_MASK 0x00000100
......@@ -77,9 +78,6 @@ struct cpuinfo_x86 {
#define X86_VENDOR_NUM 8
#define X86_VENDOR_UNKNOWN 0xff
extern struct cpuinfo_x86 boot_cpu_data;
extern struct tss_struct init_tss[NR_CPUS];
#ifdef CONFIG_SMP
extern struct cpuinfo_x86 cpu_data[];
#define current_cpu_data cpu_data[smp_processor_id()]
......@@ -229,6 +227,9 @@ struct tss_struct {
unsigned long io_bitmap[IO_BITMAP_LONGS + 1];
} __attribute__((packed)) ____cacheline_aligned;
extern struct cpuinfo_x86 boot_cpu_data;
DECLARE_PER_CPU(struct tss_struct,init_tss);
#define ARCH_MIN_TASKALIGN 16
struct thread_struct {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment