Re: [patch] SMP alternatives

From: Andi Kleen
Date: Wed Nov 23 2005 - 09:50:59 EST


Gerd Knorr <kraxel@xxxxxxx> writes:

> Now, some days hacking & debugging and kernel crashing later I have
> something more than just proof-of-concept ;)
>
> Modules are supported now, fully modularized distro kernel works fine
> with it. If you have a kernel with HOTPLUG_CPU compiled you can
> shutdown the second CPU of your dual-processor system via sysfs (echo
> 0 > /sys/devices/system/cpu/cpu1/online) and watch the kernel switch
> over to UP code without lock-prefixed instructions and simplified
> spinlocks, then power up the second CPU again (echo 1 > /sys/...) and
> watch it patching back in the SMP locking.

This looks like total overkill to me. Who needs to optimize
CPU hotplug this way? If you really need this just do it
at boot time with the existing mechanisms. This would keep
it much simpler and simplicity is very important with
such code because otherwise the testing of all the corner
cases will kill you.

BTW the existing mechanism already works fine for modules too.

> + /* Paranoia */
> + asm volatile ("jmp 1f\n1:");
> + mb();

That would be totally obsolete 386 era paranoia. If anything then use
a CLFLUSH (but not available on all x86s)

-Andi

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/