]> err.no Git - linux-2.6/log
linux-2.6
16 years agox86: unify prefetch operations
Glauber de Oliveira Costa [Wed, 30 Jan 2008 12:31:40 +0000 (13:31 +0100)]
x86: unify prefetch operations

This patch moves the prefetch[w]? functions to processor.h

Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86: move definitions to processor.h
Glauber de Oliveira Costa [Wed, 30 Jan 2008 12:31:39 +0000 (13:31 +0100)]
x86: move definitions to processor.h

This patch moves definitions that are present in only one of the files
(between processor_32.h and processor_64.h), to processor.h. They're mostly
structures and function definitions.

Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86: unify mm_segment_t definition
Glauber de Oliveira Costa [Wed, 30 Jan 2008 12:31:38 +0000 (13:31 +0100)]
x86: unify mm_segment_t definition

This patch moves the mm_segment_t structure definition to processor.h
This makes mmsegment.h file useless, and it is deleted.

Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86: remove legacy stuff from processor_64.h
Glauber de Oliveira Costa [Wed, 30 Jan 2008 12:31:37 +0000 (13:31 +0100)]
x86: remove legacy stuff from processor_64.h

This patch removes definitions and macros that are not used anymore
from processor_64.h

Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86: unify x86_cpuinfo struct.
Glauber de Oliveira Costa [Wed, 30 Jan 2008 12:31:33 +0000 (13:31 +0100)]
x86: unify x86_cpuinfo struct.

x86_cpuinfo is one more to the family of "not fundamentally different"
structs. It's unified in processor.h, with very specific fields enclosed
around ifdefs.

Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86: change bitwise operations to get a void parameter.
Glauber de Oliveira Costa [Wed, 30 Jan 2008 12:31:31 +0000 (13:31 +0100)]
x86: change bitwise operations to get a void parameter.

This patch changes the bitwise operations in bitops.h to get
a void pointers as a parameter. Before this patch, a lot of warnings
can be seen. They're gone after it.

Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86: unify TASK_ALIGN definitions
Glauber de Oliveira Costa [Wed, 30 Jan 2008 12:31:31 +0000 (13:31 +0100)]
x86: unify TASK_ALIGN definitions

This patch moves the TASK_ALIGN constraints to common header.
The base of it is the same for x86_64 and i386. The only difference
is the presence of vSMP in x86_64. As it's not a worry in i386, we can
safely use the same code for both.

Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86: unify thread struct.
Glauber de Oliveira Costa [Wed, 30 Jan 2008 12:31:31 +0000 (13:31 +0100)]
x86: unify thread struct.

The thread_struct is not fundamentally different between architectures, and
this patch puts it in the common header. What's really unique for each of
them is enclosed in ifdefs.

Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86: provide 64-bit with a load_sp0 function.
Glauber de Oliveira Costa [Wed, 30 Jan 2008 12:31:31 +0000 (13:31 +0100)]
x86: provide 64-bit with a load_sp0 function.

Paravirt guests need to inform the underlying hypervisor whenever the sp0
tss field changes. i386 already has such a function, and we use it for
x86_64 too. There's an unnecessary (for 64-bit) msr handling part in the original
version, and it is placed around an ifdef. Making no more sense in
processor_32.h, it is moved to the common header

Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86: unify tss_struct
Glauber de Oliveira Costa [Wed, 30 Jan 2008 12:31:31 +0000 (13:31 +0100)]
x86: unify tss_struct

Although slighly different, the tss_struct is very similar in x86_64 and
i386. The really different part, which matchs the hardware vision of it, is
now called x86_hw_tss, and each of the architectures provides yours.
It's then used as a field in the outter tss_struct.

Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86: unify current_text_addr
Glauber de Oliveira Costa [Wed, 30 Jan 2008 12:31:27 +0000 (13:31 +0100)]
x86: unify current_text_addr

current_text_addr() has a different implementation in x86_64 and
i386, but it is not fundamentally different. I stick to the i386
implementation, that seem to be a common base, and move it to processor.h

Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86: unify common parts of processor.h
Glauber de Oliveira Costa [Wed, 30 Jan 2008 12:31:27 +0000 (13:31 +0100)]
x86: unify common parts of processor.h

This patch moves the pieces of processor_32.h and processor_64 that are
equal to processor.h. Only what's exactly the same is moved around, the rest
not being touched.

Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86: move the definition of set_iopl_mask to common header
Glauber de Oliveira Costa [Wed, 30 Jan 2008 12:31:27 +0000 (13:31 +0100)]
x86: move the definition of set_iopl_mask to common header

This patch moves the definition of set_iopl_mask to processor.h,
instead of letting it at processor_32.h.
For x86_64, nothing is done, as we don't really need such a function.
However, having it on both arches saves us from putting an ifdef in the
pv_cpu_ops struct.

Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86: unify paravirt pieces of processor.h
Glauber de Oliveira Costa [Wed, 30 Jan 2008 12:31:27 +0000 (13:31 +0100)]
x86: unify paravirt pieces of processor.h

This patch unifies the paravirt pieces of processor.h
The functionality present in 32 bit, but not (yet) in 64-bit,
like load_sp0 is _not_ done here, and let to a different patch.

With this unification, we get paravirt for free in x86_64 processor.h

Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86: move load_cr3 to a common place.
Glauber de Oliveira Costa [Wed, 30 Jan 2008 12:31:27 +0000 (13:31 +0100)]
x86: move load_cr3 to a common place.

There are currently two definitions of load_cr3, that essentially do the
same thing. This patch moves them all to processor.h.

Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86: move desc_empty to where they belong
Glauber de Oliveira Costa [Wed, 30 Jan 2008 12:31:27 +0000 (13:31 +0100)]
x86: move desc_empty to where they belong

This patch moves the (duplicated) desc_empty implementation to desc.h,
where the descriptor things belong.

Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86: get rid of _MASK flags
Glauber de Oliveira Costa [Wed, 30 Jan 2008 12:31:27 +0000 (13:31 +0100)]
x86: get rid of _MASK flags

There's no need for the *_MASK flags (TF_MASK, IF_MASK, etc), found in
processor.h (both _32 and _64). They have a one-to-one mapping with the
EFLAGS value. This patch removes the definitions, and use the already
existent X86_EFLAGS_ version when applicable.

[ roland@redhat.com: KVM build fixes. ]

Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86: move tsc definitions to were they belong
Glauber de Oliveira Costa [Wed, 30 Jan 2008 12:31:26 +0000 (13:31 +0100)]
x86: move tsc definitions to were they belong

This patch wipes out the definitions of tsc_disable from processor_32.h
and move it to tsc.h, were it belongs

Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86: clean up arch/x86/kernel/early-quirks.c
Neil Horman [Wed, 30 Jan 2008 12:31:26 +0000 (13:31 +0100)]
x86: clean up arch/x86/kernel/early-quirks.c

clean up checkpatch errors. No code changed.

      text    data     bss     dec     hex filename
       705     120       0     825     339 early-quirks.o.before
       705     120       0     825     339 early-quirks.o.after

Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86: cleanup i387_32.c according to checkpatch
Cyrill Gorcunov [Wed, 30 Jan 2008 12:31:26 +0000 (13:31 +0100)]
x86: cleanup i387_32.c according to checkpatch

clean up checkpatch warnings/errors on i387_32.c

The old and new i387_32.s (asm listings) were checked with diff to
be identical so it's safe to apply this patch.

Signed-off-by: Cyrill Gorcunov <gorunov@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86: unify kexec_{32|64}.h
Harvey Harrison [Wed, 30 Jan 2008 12:31:26 +0000 (13:31 +0100)]
x86: unify kexec_{32|64}.h

One section collecting all constant defines.  Ifdef the asm
blocks for X86_32/64.

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Vivek Goyal <vgoyal@redhat.com>
16 years agox86: local.h fix checkpatch warnings
Harvey Harrison [Wed, 30 Jan 2008 12:31:26 +0000 (13:31 +0100)]
x86: local.h fix checkpatch warnings

Mostly space after comma, one space after if.

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86: unify local_{32|64}.h
Harvey Harrison [Wed, 30 Jan 2008 12:31:26 +0000 (13:31 +0100)]
x86: unify local_{32|64}.h

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86: introduce asm helpers in local_{32|64}.h
Harvey Harrison [Wed, 30 Jan 2008 12:31:26 +0000 (13:31 +0100)]
x86: introduce asm helpers in local_{32|64}.h

Handle the use of long on X86_32 and quad on X86_64

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: fix asm memory constraints in local_64.h
Harvey Harrison [Wed, 30 Jan 2008 12:31:26 +0000 (13:31 +0100)]
x86: fix asm memory constraints in local_64.h

Use the shorter +m form rather than =m and m.

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86: clean up local_{32|64}.h
Harvey Harrison [Wed, 30 Jan 2008 12:31:26 +0000 (13:31 +0100)]
x86: clean up local_{32|64}.h

Common prefix from both files moved to local.h

Change __inline__ to inline

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86: clean up include/asm-x86/pda.h
Cyrill Gorcunov [Wed, 30 Jan 2008 12:31:25 +0000 (13:31 +0100)]
x86: clean up include/asm-x86/pda.h

clean up include/asm-x86/pda.h, as suggested by checkpatch.pl.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86, kexec: force x86 arches to boot kdump kernels on boot cpu
Neil Horman [Wed, 30 Jan 2008 12:31:25 +0000 (13:31 +0100)]
x86, kexec: force x86 arches to boot kdump kernels on boot cpu

Recently a kdump bug was discovered in which a system would hang inside
calibrate_delay during the booting of the kdump kernel.  This was caused
by the fact that the jiffies counter was not being incremented during
timer calibration.  The root cause of this problem was found to be a
bios misconfiguration of the hypertransport bus.  On system affected by
this hang, the bios had assigned APIC ids which used extended apic bits
(more than the nominal 4 bit ids's), but failed to configure bit 17 of
the hypertransport transaction config register, which indicated that the
mask for the destination field of interrupt packets accross the ht bus
(see section 3.3.9 of
http://www.amd.com/us-en/assets/content_type/white_papers_and_tech_docs/26094.PDF).
If a crash occurs on a cpu with an APIC id that extends beyond 4 bits,
it will not recieve interrupts during the kdump kernel boot, and this
hang will be the result.  The fix is to add this patch, whcih add an
early pci quirk check, to forcibly enable this bit in the httcfg
register.  This enables all cpus on a system to receive interrupts, and
allows kdump kernel bootup to procede normally.

Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86: replace outb_p() with udelay(2) in drivers/input/mouse/pc110pad.c
Ingo Molnar [Wed, 30 Jan 2008 12:31:24 +0000 (13:31 +0100)]
x86: replace outb_p() with udelay(2) in drivers/input/mouse/pc110pad.c

replace outb_p() with udelay(2). This is a real ISA device so it likely
needs this particular delay.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86: also define AT_VECTOR_SIZE_ARCH
Jan Beulich [Wed, 30 Jan 2008 12:31:24 +0000 (13:31 +0100)]
x86: also define AT_VECTOR_SIZE_ARCH

The patch introducing this left out x86-64, despite it also having
extra entries.

[ mingo@elte.hu: re-merged this to after the unification patches. ]

Signed-off-by: Jan Beulich <jbeulich@novell.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86: adjust enable_NMI_through_LVT0()
Jan Beulich [Wed, 30 Jan 2008 12:31:24 +0000 (13:31 +0100)]
x86: adjust enable_NMI_through_LVT0()

Its previous use in a call to on_each_cpu() was pointless, as at the
time that code gets executed only one CPU is online. Further, the
function can be __cpuinit, and for this to work without
CONFIG_HOTPLUG_CPU setup_nmi() must also get an attribute (this one
can even be __init; on 64-bits check_timer() also was lacking that
attribute).

Signed-off-by: Jan Beulich <jbeulich@novell.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86: make __{save,restore}_processor_state static
Jan Beulich [Wed, 30 Jan 2008 12:31:23 +0000 (13:31 +0100)]
x86: make __{save,restore}_processor_state static

.. allowing to remove their declarations from a global include file
(the symbols don't exist for anything but x86).

Likewise for 64-bits' fix_processor_context(), just that that one was
properly declared in an arch-specific header.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86: move to .rodata/.init.data
Jan Beulich [Wed, 30 Jan 2008 12:31:23 +0000 (13:31 +0100)]
x86: move to .rodata/.init.data

The array is never written, and on 64-bits it's not even being used
past initial boot.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86-64: honor notify_die() returning NOTIFY_STOP
Jan Beulich [Wed, 30 Jan 2008 12:31:23 +0000 (13:31 +0100)]
x86-64: honor notify_die() returning NOTIFY_STOP

This requires making die() return a value, making its callers honor
this (and be prepared that it may return), and making oops_end() have
two additional parameters.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86-64: make pda's cpunumber and nodenumber unsigned
Jan Beulich [Wed, 30 Jan 2008 12:31:21 +0000 (13:31 +0100)]
x86-64: make pda's cpunumber and nodenumber unsigned

This generally allows better code to be generated, since the zero-
extension during 32-bit operations comes for free (needed when the
result is used as array index or similar), whereas sign extension must
be done explicitly and frequently requires a one byte larger
instruction due to the necessary rex64 prefix.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agoi386: hard_{en,dis}able_TSC can be static
Jan Beulich [Wed, 30 Jan 2008 12:31:21 +0000 (13:31 +0100)]
i386: hard_{en,dis}able_TSC can be static

Signed-off-by: Jan Beulich <jbeulich@novell.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86: kprobes code for x86 unification
Masami Hiramatsu [Wed, 30 Jan 2008 12:31:21 +0000 (13:31 +0100)]
x86: kprobes code for x86 unification

This patch unifies kprobes code.

- Unify kprobes_*.h to kprobes.h
- Unify kprobes_*.c to kprobes.c
  (Differences are separated by ifdefs)
 - Most differences are related to REX prefix and rip relatives.
 - Two inline assembly code are different.
 - One difference in kprobe_handlre()
 - One fixup exception code is different, but it will be unified
   if mm/extable_*.c are unified.
- Merge history logs into arch/x86/kernel/kprobes.c.

Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com>
Signed-off-by: Jim Keniston <jkenisto@us.ibm.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86: prepare kprobes code for x86 unification
Masami Hiramatsu [Wed, 30 Jan 2008 12:31:21 +0000 (13:31 +0100)]
x86: prepare kprobes code for x86 unification

This patch cleanup kprobes code on x86 for unification.
This patch is based on Arjan's previous work.

- Remove spurious whitespace changes
- Add harmless includes
- Make the 32/64 files more identical
 - Generalize structure fields' and local variable name.
 - Wrap accessing to stack address by macros.
 - Modify bitmap making macro.
 - Merge fixup code into is_riprel() and change its name to fix_riprel().
 - Set MAX_INSN_SIZE to 16 on both arch.
 - Use u32 for bitmaps on both architectures.
 - Clarify some comments.

Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com>
Signed-off-by: Arjan van de Ven <arjan@infradead.org>
Signed-off-by: Jim Keniston <jkenisto@us.ibm.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86: return probe-booster for x86-64
Masami Hiramatsu [Wed, 30 Jan 2008 12:31:21 +0000 (13:31 +0100)]
x86: return probe-booster for x86-64

This patch adds kretprobe-booster to kprobes_64.c.

- Changes are based on x86-32.
- Rewrite register saving/restoring code

Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86: kprobe-booster for x86-64
Masami Hiramatsu [Wed, 30 Jan 2008 12:31:21 +0000 (13:31 +0100)]
x86: kprobe-booster for x86-64

This patch adds kprobe-booster to kprobes_64.c.

- Changes are based on x86-32.
- Add REX prefix checking code.

Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com>
Signed-off-by: Jim Keniston <jkenisto@us.ibm.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86: FIFO ticket spinlocks
Nick Piggin [Wed, 30 Jan 2008 12:31:21 +0000 (13:31 +0100)]
x86: FIFO ticket spinlocks

Introduce ticket lock spinlocks for x86 which are FIFO. The implementation
is described in the comments. The straight-line lock/unlock instruction
sequence is slightly slower than the dec based locks on modern x86 CPUs,
however the difference is quite small on Core2 and Opteron when working out of
cache, and becomes almost insignificant even on P4 when the lock misses cache.
trylock is more significantly slower, but they are relatively rare.

On an 8 core (2 socket) Opteron, spinlock unfairness is extremely noticable,
with a userspace test having a difference of up to 2x runtime per thread, and
some threads are starved or "unfairly" granted the lock up to 1 000 000 (!)
times. After this patch, all threads appear to finish at exactly the same
time.

The memory ordering of the lock does conform to x86 standards, and the
implementation has been reviewed by Intel and AMD engineers.

The algorithm also tells us how many CPUs are contending the lock, so
lockbreak becomes trivial and we no longer have to waste 4 bytes per
spinlock for it.

After this, we can no longer spin on any locks with preempt enabled
and cannot reenable interrupts when spinning on an irq safe lock, because
at that point we have already taken a ticket and the would deadlock if
the same CPU tries to take the lock again.  These are questionable anyway:
if the lock happens to be called under a preempt or interrupt disabled section,
then it will just have the same latency problems. The real fix is to keep
critical sections short, and ensure locks are reasonably fair (which this
patch does).

Signed-off-by: Nick Piggin <npiggin@suse.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agospinlock: lockbreak cleanup
Nick Piggin [Wed, 30 Jan 2008 12:31:20 +0000 (13:31 +0100)]
spinlock: lockbreak cleanup

The break_lock data structure and code for spinlocks is quite nasty.
Not only does it double the size of a spinlock but it changes locking to
a potentially less optimal trylock.

Put all of that under CONFIG_GENERIC_LOCKBREAK, and introduce a
__raw_spin_is_contended that uses the lock data itself to determine whether
there are waiters on the lock, to be used if CONFIG_GENERIC_LOCKBREAK is
not set.

Rename need_lockbreak to spin_needbreak, make it use spin_is_contended to
decouple it from the spinlock implementation, and make it typesafe (rwlocks
do not have any need_lockbreak sites -- why do they even get bloated up
with that break_lock then?).

Signed-off-by: Nick Piggin <npiggin@suse.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86, ptrace: new ptrace BTS API
Markus Metzger [Wed, 30 Jan 2008 12:31:20 +0000 (13:31 +0100)]
x86, ptrace: new ptrace BTS API

Here's the new ptrace BTS API that supports two different overflow handling mechanisms (wrap-around and buffer-full-signal) to support two different use cases (debugging and profiling).

It further combines buffer allocation and configuration.

Opens:
- memory rlimit
- overflow signal

What would be the right signal to use?

Signed-off-by: Markus Metzger <markus.t.metzger@intel.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86, ptrace: change BTS GET ptrace interface
Markus Metzger [Wed, 30 Jan 2008 12:31:20 +0000 (13:31 +0100)]
x86, ptrace: change BTS GET ptrace interface

Change the ptrace interface to mimick an array from newst to oldest.

Signed-off-by: Markus Metzger <markus.t.metzger@intel.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86, ptrace: use jiffies for BTS timestamps
Markus Metzger [Wed, 30 Jan 2008 12:31:20 +0000 (13:31 +0100)]
x86, ptrace: use jiffies for BTS timestamps

Replace sched_clock() with jiffies for BTS timestamps.

Signed-off-by: Markus Metzger <markus.t.metzger@intel.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86, ptrace: remove bad comment
Markus Metzger [Wed, 30 Jan 2008 12:31:20 +0000 (13:31 +0100)]
x86, ptrace: remove bad comment

Remove no longer correct comment.

Signed-off-by: Markus Metzger <markus.t.metzger@intel.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86: avoid ifdefs in desc.h, getting rid of pack_ldt and pack_tss
Glauber de Oliveira Costa [Wed, 30 Jan 2008 12:31:20 +0000 (13:31 +0100)]
x86: avoid ifdefs in desc.h, getting rid of pack_ldt and pack_tss

By Andi Kleen's suggestion, this patch removes pack_ldt() and pack_tss()
wrappers in favour of a general wrapper. It saves us an ifdef and some lines
of code, but more importantly, it's more elegant.

No functional change is made, although the object code is expected to be
different.

Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86 boot: use E820 memory map on EFI 32 platform
Huang, Ying [Wed, 30 Jan 2008 12:31:19 +0000 (13:31 +0100)]
x86 boot: use E820 memory map on EFI 32 platform

Because the EFI memory map are converted to e820 memory map in bootloader, the
EFI memory map handling code is removed to clean up.

Signed-off-by: Huang Ying <ying.huang@intel.com>
Cc: Andi Kleen <ak@suse.de>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86: EFI runtime service support: remove duplicated code from efi_32.c
Huang, Ying [Wed, 30 Jan 2008 12:31:19 +0000 (13:31 +0100)]
x86: EFI runtime service support: remove duplicated code from efi_32.c

This patch removes the duplicated code between efi_32.c and efi.c.

Signed-off-by: Huang Ying <ying.huang@intel.com>
Cc: Andi Kleen <ak@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86: EFI runtime service support: document for EFI runtime services
Huang, Ying [Wed, 30 Jan 2008 12:31:19 +0000 (13:31 +0100)]
x86: EFI runtime service support: document for EFI runtime services

This patch adds document for EFI x86_64 runtime services support.

Signed-off-by: Chandramouli Narayanan <mouli@linux.intel.com>
Signed-off-by: Huang Ying <ying.huang@intel.com>
Cc: Andi Kleen <ak@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86: EFI runtime service support: EFI runtime services
Huang, Ying [Wed, 30 Jan 2008 12:31:19 +0000 (13:31 +0100)]
x86: EFI runtime service support: EFI runtime services

This patch adds support for several EFI runtime services for EFI x86_64
system.

The EFI support for emergency_restart is added.

Signed-off-by: Chandramouli Narayanan <mouli@linux.intel.com>
Signed-off-by: Huang Ying <ying.huang@intel.com>
Cc: Andi Kleen <ak@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86: EFI runtime service support
Huang, Ying [Wed, 30 Jan 2008 12:31:19 +0000 (13:31 +0100)]
x86: EFI runtime service support

This patch adds basic runtime services support for EFI x86_64 system.  The
main file of the patch is the addition of efi_64.c for x86_64.  This file is
modeled after the EFI IA32 avatar.  EFI runtime services initialization are
implemented in efi_64.c.  Some x86_64 specifics are worth noting here.  On
x86_64, parameters passed to EFI firmware services need to follow the EFI
calling convention.  For this purpose, a set of functions named efi_call<x>
(<x> is the number of parameters) are implemented.  EFI function calls are
wrapped before calling the firmware service.  The duplicated code between
efi_32.c and efi_64.c is placed in efi.c to remove them from efi_32.c.

Signed-off-by: Chandramouli Narayanan <mouli@linux.intel.com>
Signed-off-by: Huang Ying <ying.huang@intel.com>
Cc: Andi Kleen <ak@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agomcheck mce_64: mce_read_sem to mutex
Daniel Walker [Wed, 30 Jan 2008 12:31:17 +0000 (13:31 +0100)]
mcheck mce_64: mce_read_sem to mutex

Converted to a mutex, and changed the name to mce_read_mutex.

Signed-off-by: Daniel Walker <dwalker@mvista.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86: add ACPI reboot option
Aaron Durbin [Wed, 30 Jan 2008 12:31:17 +0000 (13:31 +0100)]
x86: add ACPI reboot option

Add the ability to reboot an x86_64 based machine using the RESET_REG in the
FADT ACPI table.

Signed-off-by: Aaron Durbin <adurbin@google.com>
Cc: Len Brown <lenb@kernel.org>
Cc: Andi Kleen <ak@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86: dummy placeholder for acpi/reboot.h
Ingo Molnar [Wed, 30 Jan 2008 12:31:17 +0000 (13:31 +0100)]
x86: dummy placeholder for acpi/reboot.h

dummy placeholder for acpi/reboot.h

Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agouml: add asm-um/asm.h
Jeff Dike [Wed, 30 Jan 2008 12:31:17 +0000 (13:31 +0100)]
uml: add asm-um/asm.h

git-x86.patch introduces asm-x86/asm.h.  UML needs to follow this with
an asm/asm.h of its own.

Signed-off-by: Jeff Dike <jdike@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86: __vdso_getcpu() warning fix
Andrew Morton [Wed, 30 Jan 2008 12:31:17 +0000 (13:31 +0100)]
x86: __vdso_getcpu() warning fix

arch/x86/vdso/vgetcpu.c: In function '__vdso_getcpu':
arch/x86/vdso/vgetcpu.c:22: warning: pointer targets in passing argument 1 of 'native_read_tscp' differ in signedness

Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86: remove fastcall from include/asm-x86
Harvey Harrison [Wed, 30 Jan 2008 12:31:17 +0000 (13:31 +0100)]
x86: remove fastcall from include/asm-x86

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86: remove all definitions with fastcall
Harvey Harrison [Wed, 30 Jan 2008 12:31:17 +0000 (13:31 +0100)]
x86: remove all definitions with fastcall

fastcall is always defined to be empty, remove it from arch/x86

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agocore: remove last users of empty FASTCALL macro
Harvey Harrison [Wed, 30 Jan 2008 12:31:17 +0000 (13:31 +0100)]
core: remove last users of empty FASTCALL macro

FASTCALL is always empty after the x86 removal.

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86: remove last users of FASTCALL
Harvey Harrison [Wed, 30 Jan 2008 12:31:16 +0000 (13:31 +0100)]
x86: remove last users of FASTCALL

FASTCALL() is always empty.

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agoUML: remove remaining FASTCALL uses
Harvey Harrison [Wed, 30 Jan 2008 12:31:14 +0000 (13:31 +0100)]
UML: remove remaining FASTCALL uses

With the x86 removal, FASTCALL is always empty now.

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86: unify set_tss_desc
Glauber de Oliveira Costa [Wed, 30 Jan 2008 12:31:14 +0000 (13:31 +0100)]
x86: unify set_tss_desc

This patch unifies the set_tss_desc between i386 and x86_64,
which can now have a common implementation. After the old
functions are removed from desc_{32,64}.h, nothing important is
left, and the files can be removed.

Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86: move _set_gate and its users to a common location
Glauber de Oliveira Costa [Wed, 30 Jan 2008 12:31:14 +0000 (13:31 +0100)]
x86: move _set_gate and its users to a common location

This patch moves _set_gate and its users to desc.h. We can now
use common code for x86_64 and i386.

[ mingo@elte.hu: set_system_gate() fixes for nasty crashes. ]

Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86: unify paravirt pieces of descriptor handling
Glauber de Oliveira Costa [Wed, 30 Jan 2008 12:31:14 +0000 (13:31 +0100)]
x86: unify paravirt pieces of descriptor handling

With the types used to access descriptors in x86_64 and i386
now being the same, the code that effectively handles them can
now be easily shared. This patch moves the paravirt part of
desc_32.h into desc.h, and then, we get paravirt support in x86_64
for free.

Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86: modify get_desc_base
Glauber de Oliveira Costa [Wed, 30 Jan 2008 12:31:14 +0000 (13:31 +0100)]
x86: modify get_desc_base

This patch makes get_desc_base() receive a struct desc_struct,
and then uses its internal fields to compute the base address.
This is done at both i386 and x86_64, and then it is moved
to common header

Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86: use the same data type for tls_array.
Glauber de Oliveira Costa [Wed, 30 Jan 2008 12:31:14 +0000 (13:31 +0100)]
x86: use the same data type for tls_array.

This patch changes the type of tls_array in x86_64 to
a desc_struct. Now, both i386 and x86_64 tls_array have
the same type, and code accessing it can be shared.

Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86: unify non-paravirt parts of desc.h
Glauber de Oliveira Costa [Wed, 30 Jan 2008 12:31:14 +0000 (13:31 +0100)]
x86: unify non-paravirt parts of desc.h

This patch unifies the non-paravirt part of desc_{32,64}.h into
desc.h. Most of it, is simply common code, that is moved to
the shared header. The only exception is the set_ldt_desc in desc_64.h,
which is changed - included its name - to accomodate for the way
the ldt is set up in i386.

Also, constant definitions used in desc_32.h are moved to desc_defs.h

Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86: move constants to desc_defs.h
Glauber de Oliveira Costa [Wed, 30 Jan 2008 12:31:14 +0000 (13:31 +0100)]
x86: move constants to desc_defs.h

this patch moves constant definitions regarding descriptor types
from desc_32.h to desc_defs.h. The change from defines to enum
to comply with previous versions in desc_defs.h

Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86: change write_ldt_entry signature
Glauber de Oliveira Costa [Wed, 30 Jan 2008 12:31:13 +0000 (13:31 +0100)]
x86: change write_ldt_entry signature

this patch changes the signature of write_ldt_entry.

Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com>
CC: Zachary Amsden <zach@vmware.com>
CC: Jeremy Fitzhardinge <Jeremy.Fitzhardinge.citrix.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86: change write_gdt_entry signature.
Glauber de Oliveira Costa [Wed, 30 Jan 2008 12:31:13 +0000 (13:31 +0100)]
x86: change write_gdt_entry signature.

This patch changes the write_gdt_entry function signature.
Instead of the old "a" and "b" parameters, it now receives
a pointer to a desc_struct, and the size of the entry being
handled. This is because x86_64 can have some 16-byte entries
as well as 8-byte ones.

Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com>
CC: Zachary Amsden <zach@vmware.com>
CC: Jeremy Fitzhardinge <Jeremy.Fitzhardinge.citrix.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86: provide tss_desc
Glauber de Oliveira Costa [Wed, 30 Jan 2008 12:31:13 +0000 (13:31 +0100)]
x86: provide tss_desc

Provide a new type, tss_desc, to represent the tss descriptor
in a unified way accross x86_64 and i386

Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86: introduce fill_ldt
Glauber de Oliveira Costa [Wed, 30 Jan 2008 12:31:13 +0000 (13:31 +0100)]
x86: introduce fill_ldt

This patch introduces fill_ldt(), which populates a ldt descriptor
from a user_desc in once, instead of relying in the LDT_entry_a and
LDT_entry_b macros

Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86: modify write_ldt function
Glauber de Oliveira Costa [Wed, 30 Jan 2008 12:31:13 +0000 (13:31 +0100)]
x86: modify write_ldt function

This patch modifies the write_ldt() function to make use
of the new struct desc_struct instead of entry_1 and entry_2
entries

Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86: introduce ldt_desc type.
Glauber de Oliveira Costa [Wed, 30 Jan 2008 12:31:13 +0000 (13:31 +0100)]
x86: introduce ldt_desc type.

this patch introduces ldt_desc type to account for the differences
in the ldt descriptor in x86_64 and i386

Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86: change write_idt_entry signature
Glauber de Oliveira Costa [Wed, 30 Jan 2008 12:31:12 +0000 (13:31 +0100)]
x86: change write_idt_entry signature

this patch changes write_idt_entry signature. It now takes a gate_desc
instead of the a and b parameters. It will allow it to be later unified
between i386 and x86_64.

Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com>
CC: Zachary Amsden <zach@vmware.com>
CC: Jeremy Fitzhardinge <Jeremy.Fitzhardinge.citrix.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86: introduce gate_desc type.
Glauber de Oliveira Costa [Wed, 30 Jan 2008 12:31:12 +0000 (13:31 +0100)]
x86: introduce gate_desc type.

To account for the differences in gate descriptor in i386 and x86_64
a gate_desc type is introduced.

Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86: removed unused variable
Glauber de Oliveira Costa [Wed, 30 Jan 2008 12:31:12 +0000 (13:31 +0100)]
x86: removed unused variable

This variable is not used anywere, and is then removed

Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86: change gdt acessor macro name
Glauber de Oliveira Costa [Wed, 30 Jan 2008 12:31:12 +0000 (13:31 +0100)]
x86: change gdt acessor macro name

This patch changes the name of x86_64 macro used to access the per-cpu
gdt. It is now equal to the i386 version, which will allow code to be shared.

Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86: unify struct desc_ptr
Glauber de Oliveira Costa [Wed, 30 Jan 2008 12:31:12 +0000 (13:31 +0100)]
x86: unify struct desc_ptr

This patch unifies struct desc_ptr between i386 and x86_64.
They can be expressed in the exact same way in C code, only
having to change the name of one of them. As Xgt_desc_struct
is ugly and big, this is the one that goes away.

There's also a padding field in i386, but it is not really
needed in the C structure definition.

Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86: unify desc_struct
Glauber de Oliveira Costa [Wed, 30 Jan 2008 12:31:11 +0000 (13:31 +0100)]
x86: unify desc_struct

This patch aims to make the access of struct desc_struct variables
equal across architectures. In this patch, I unify the i386 and x86_64
versions under an anonymous union, keeping the way they are accessed
untouched (a and b for 32-bit code, individual bit-fields for 64-bit).

This solution is not beautiful, but will allow us to integrate common
code that differed by the way descriptors were used. This is to be viewed
incrementally. There's simply too much code to be fixed at once.

In the future, goal is to set up in a single way of acessing
the desc_struct fields.

Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86: prepare 64-bit architecture initialization for paravirt
Glauber de Oliveira Costa [Wed, 30 Jan 2008 12:31:11 +0000 (13:31 +0100)]
x86: prepare 64-bit architecture initialization for paravirt

This patch prepares the x86_64 architecture initialization for
paravirt. It requires a memory initialization step, which is done
by implementing 64-bit version for machine_specific_memory_setup,
and putting an ARCH_SETUP hook, for guest-dependent initialization.
This last step is done akin to i386

Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Acked-by: Jeremy Fitzhardinge <jeremy@xensource.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86: tweak io_64.h for paravirt.
Glauber de Oliveira Costa [Wed, 30 Jan 2008 12:31:10 +0000 (13:31 +0100)]
x86: tweak io_64.h for paravirt.

We need something here because we can't call in and out instructions
directly. However, we have to be careful, because no indirections are
allowed in misc_64.c , and paravirt_ops is a kind of one. So just
call it directly there

Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Acked-by: Jeremy Fitzhardinge <jeremy@xensource.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86: prepare time related functions for paravirt
Glauber de Oliveira Costa [Wed, 30 Jan 2008 12:31:10 +0000 (13:31 +0100)]
x86: prepare time related functions for paravirt

This patch add provisions for time related functions so they
can be later replaced by paravirt versions.

it basically encloses {g,s}et_wallclock inside the
already existent functions update_persistent_clock and
read_persistent_clock, and defines {s,g}et_wallclock
to the core of such functions.

it also allow for a later-on-game time initialization, as done
by i386. Paravirt guests can set a function to do their own
initialization this way.

Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Acked-by: Jeremy Fitzhardinge <jeremy@xensource.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86: turn priviled operation into a macro in head_64.S
Glauber de Oliveira Costa [Wed, 30 Jan 2008 12:31:10 +0000 (13:31 +0100)]
x86: turn priviled operation into a macro in head_64.S

under paravirt, read cr2 cannot be issued directly anymore.
So wrap it in a macro, defined to the operation itself in case
paravirt is off, but to something else if we have paravirt
in the game

Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Acked-by: Jeremy Fitzhardinge <jeremy@xensource.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86: export cpu_gdt_descr
Glauber de Oliveira Costa [Wed, 30 Jan 2008 12:31:10 +0000 (13:31 +0100)]
x86: export cpu_gdt_descr

With paravirualization, hypervisors needs to handle the gdt,
that was right to this point only used at very early
inialization code. Hypervisors (lguest being the current case)
are commonly modules, so make it an export

Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Acked-by: Jeremy Fitzhardinge <jeremy@xensource.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86: export math_state_restore
Glauber de Oliveira Costa [Wed, 30 Jan 2008 12:31:10 +0000 (13:31 +0100)]
x86: export math_state_restore

Export math_state_restore symbol, so it can be used for hypervisors.
They are commonly loaded as modules (lguest being an example).

Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Acked-by: Jeremy Fitzhardinge <jeremy@xensource.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86: avoid build warning
Ingo Molnar [Wed, 30 Jan 2008 12:31:10 +0000 (13:31 +0100)]
x86: avoid build warning

fix this build warning:

 include/asm/topology_32.h: In function 'node_to_first_cpu':
 include/asm/topology_32.h:66: warning: unused variable 'mask'

Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86: unify mmap_{32|64}.c
Harvey Harrison [Wed, 30 Jan 2008 12:31:10 +0000 (13:31 +0100)]
x86: unify mmap_{32|64}.c

mmap_is_ia32 always true for X86_32, or while emulating IA32 on X86_64

Randomization not supported on X86_32 in legacy layout.  Both layouts allow
randomization on X86_64.

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86: clean up mm/init_32.c
Jeremy Fitzhardinge [Wed, 30 Jan 2008 12:31:09 +0000 (13:31 +0100)]
x86: clean up mm/init_32.c

Some code reformatting in init_32.c.  No functional change.

Signed-off-by: Jeremy Fitzhardinge <Jeremy.Fitzhardinge@citrix.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86: kill mk_pte_huge
Jeremy Fitzhardinge [Wed, 30 Jan 2008 12:31:09 +0000 (13:31 +0100)]
x86: kill mk_pte_huge

It only has a single use, which can be trivially replaced.

Signed-off-by: Jeremy Fitzhardinge <Jeremy.Fitzhardinge@citrix.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86: clean up drivers/char/rtc.c
Ingo Molnar [Wed, 30 Jan 2008 12:31:09 +0000 (13:31 +0100)]
x86: clean up drivers/char/rtc.c

tons of style cleanup in drivers/char/rtc.c - no code changed:

   text    data     bss     dec     hex filename
   6400     384      32    6816    1aa0 rtc.o.before
   6400     384      32    6816    1aa0 rtc.o.after

since we seem to have a number of open breakages in this code we might
as well start with making the code more readable and maintainable.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox64/page.h: convert some macros to inlines
Randy Dunlap [Wed, 30 Jan 2008 12:31:09 +0000 (13:31 +0100)]
x64/page.h: convert some macros to inlines

Convert clear_page/copy_page macros to inline functions for type-checking.
Andrew wants to extirpate these ugly macros. (Ingo too. Thomas as well.
Please send us more "kill ugly macros" patches! :-)

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86: remove arch specific segment headers
Glauber de Oliveira Costa [Wed, 30 Jan 2008 12:31:09 +0000 (13:31 +0100)]
x86: remove arch specific segment headers

This file puts the remainder of the arch specificic segment
headers in segment.h.

Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86: unify common parts of segment.h
Glauber de Oliveira Costa [Wed, 30 Jan 2008 12:31:09 +0000 (13:31 +0100)]
x86: unify common parts of segment.h

Although segment handling in i386 and x86_64 are very different,
there's a common part. Put them in segment.h instead of arch specific
headers

Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86: put get_kernel_rpl in a common location
Glauber de Oliveira Costa [Wed, 30 Jan 2008 12:31:09 +0000 (13:31 +0100)]
x86: put get_kernel_rpl in a common location

This macro is useful for both i386 and x86_64, so put it in a common
location, where both arches can grab it.

Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86, ptrace: support for branch trace store(BTS)
Markus Metzger [Wed, 30 Jan 2008 12:31:09 +0000 (13:31 +0100)]
x86, ptrace: support for branch trace store(BTS)

Resend using different mail client

Changes to the last version:
- split implementation into two layers: ds/bts and ptrace
- renamed TIF's
- save/restore ds save area msr in __switch_to_xtra()
- make block-stepping only look at BTF bit

Signed-off-by: Markus Metzger <markus.t.metzger@intel.com>
Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agoUML: change sigcontext fields to match x86
Jeff Dike [Wed, 30 Jan 2008 12:31:08 +0000 (13:31 +0100)]
UML: change sigcontext fields to match x86

git-x86, in commit 70aa1bd3839e3ec74ce65316528a82570e8de666, changed
a lot of the sigcontext field names.  This patch changes UML usage to
match.

I also changed includes of generic headers from "" to <>.

Signed-off-by: Jeff Dike <jdike@linux.intel.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86: unify system.h
Glauber de Oliveira Costa [Wed, 30 Jan 2008 12:31:08 +0000 (13:31 +0100)]
x86: unify system.h

This patch finishes the unification of system.h file.
i386 needs a constant to be defined, and it is defined inside an ifdef.

Other than that, pretty much nothing but includes are left in the arch
specific headers, and they are deleted.

[ mingo@elte.hu: 64-bit needs the cr8 access inlines. ]

Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86: move switch_to macro to system.h
Glauber de Oliveira Costa [Wed, 30 Jan 2008 12:31:08 +0000 (13:31 +0100)]
x86: move switch_to macro to system.h

This patch moves the switch_to() macro to system.h

As those macros are fundamentally different between i386 and x86_64,
they are enclosed around an ifdef.

Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>