Skip to contentSkip to conversation

x86_64: x86_64 version of the smp alternative patch.

PATCH Dave Jones 2 participants 2 messages Jun 27, 2006 – Jun 28, 2006 1 message not in the archive

lore
Share & tools
lore

Dave Jones

author
#1 lore raw
In reply to a message not in the archive
Quoted 18 lines · Linux Kernel

commit d167a51877e94dda73dd656c51f363502309f713
tree eb02c2974b61777f575dfdc07d4c2adf83bde434
parent 240cd6a80642da528bfa382ec2ae4e3cb8991ea7
author Gerd Hoffmann <[email protected]> Mon, 26 Jun 2006 13:56:16 +0200 committer Linus Torvalds <[email protected]> Tue, 27 Jun 2006 00:48:14 -0700

[PATCH] x86_64: x86_64 version of the smp alternative patch.

Changes are largely identical to the i386 version:

* alternative #define are moved to the new alternative.h file.
* one new elf section with pointers to the lock prefixes which can be nop'ed out for non-smp.
* two new elf sections simliar to the "classic" alternatives to replace SMP code with simpler UP code.
* fixup headers to use alternative.h instead of defining their own LOCK / LOCK_PREFIX macros.

Quoted 6 lines

The patch reuses the i386 version of the alternatives code to avoid code duplication. The code in alternatives.c was shuffled around a bit to reduce the number of #ifdefs needed. It also got some tweaks needed for x86_64 (vsyscall page handling) and new features (noreplacement option which was x86_64 only up to now). Debug printk's are changed from compile-time to runtime.

This has one behaviour slightly different to the i386 version however. If you boot an SMP machine it does this..

SMP: Allowing 4 CPUs, 2 hotplug CPUs
Initializing CPU#0
CPU: Physical Processor ID: 0
CPU: Processor Core ID: 0
CPU0: Thermal monitoring enabled (TM1)
SMP alternatives: switching to UP code
..
SMP alternatives: switching to SMP code
Booting processor 1/2 APIC 0x1
Initializing CPU#1

Seems wasteful (and noisy) to be doing this twice during boot.

Dave

Signature · 1 line
http://www.codemonkey.org.uk
#2 lore raw
Quoted 13 lines

This has one behaviour slightly different to the i386 version however. If you boot an SMP machine it does this..

SMP: Allowing 4 CPUs, 2 hotplug CPUs
Initializing CPU#0
CPU: Physical Processor ID: 0
CPU: Processor Core ID: 0
CPU0: Thermal monitoring enabled (TM1)
SMP alternatives: switching to UP code
..
SMP alternatives: switching to SMP code
Booting processor 1/2 APIC 0x1
Initializing CPU#1

i386 shows the same behavior btw, but with CPU_HOTPLUG=y only. "booting the second CPU" is just a special case of "plugging in a CPU" then, that is where the double-switch comes from.

cheers,

Gerd

Signature · 2 lines
Gerd Hoffmann <[email protected]>
http://www.suse.de/~kraxel/julika-dora.jpeg