# Kconfig STOP_MACHINE goofiness, 2.6.39+

## wcg

I am getting this warning message from "make menuconfig"

(or "make oldconfig") when configuring kernels from 2.6.39

to 3.1.6 (newest one that I have tried):

```

warning: (HAVE_TEXT_POKE_SMP) selects STOP_MACHINE which has

unmet direct dependencies (SMP && MODULE_UNLOAD || HOTPLUG_CPU)

```

Platform: amd athon64 x2

The correct processor family and smp are selected in the kernel .config.

The system board does not support cpu hotplug, so that is not enabled.

I am not using loadable modules, so loadable module support is not enabled.

The only Kconfig file in the kernel source where HAVE_TEXT_POKE_SMP appears

is under CONFIG_X86 in arch/x86/Kconfig. I am guessing that CONFIG_X86_64

selects CONFIG_X86 and whatever Kconfig options it selects that are not excluded

by some other condition not being met.

I have tried disabling a lot of kernel .config options which might be triggering

this warning, but so far only disabling smp has worked. (Not a reasonable

solution to the problem.)

How else can I get rid of this inane dependence of STOP_MACHINE on loadable

module support or cpu hotplug? (It was not there in vanilla-sources-2.6.38.8,

which is the latest kernel that I configured where I did not get the warning.

It is there in gentoo-sources-2.6.39-r4.)

Any ideas?

----------

## Hu

You can enable CPU hotplug in software even if it is not supported by your hardware.  On systems that support suspend-to-disk, CPU hotplug is forcibly enabled, because the hibernation code uses it to disable non-boot CPUs during creation of the hibernation image.

----------

## wcg

Ok, thanks.

It is not so much that it is doing unreasonable things with

text_poke_smp() or stop_machine et al. They are used either

in early boot code or debugging code like kprobes to

patch jump targets, etc, in the running kernel.

(See arch/x86/kernel/alternative.c, arch/x86/include/asm/fixmap.h,

and kernel/stop_machine.c.) The #ifdef CONFIG_HOTPLUG_CPU

sections are just there for necessary locking if cpus can come

and go while these functions run.

It is just that the code seems to mash the _init and module

load/unload cases together so that it won't need separate

functions or a bunch of #ifdef/#endif blocks if loadable modules

are not enabled.

I was hoping it was only a Kconfig silliness, listing a

dependency that it was not really dependent on in the

actual code.

"Everyone using smp uses loadable modules."

Wrong assumption.

----------

## Hu

Indeed.  I have systems that are SMP and yet have MODULES=n.

----------

## wcg

So, setting CONFIG_HOTPLUG_CPU=y in the kernel 3.1.6 .config

worked. I did not need to enable loadable modules as well. I got

no warnings from menuconfig, the kernel compiled ok, and

it is now running. (There is evidence of an ACPI bug in BIOS

related to plug-n-play, but having the kernel probe and then

disable that at boot is only a noisy log entry in dmesg.)

I still find the "loadable modules *or* cpu hotplug" dependency

of STOP_MACHINE in Kconfig suspicious. By what stretch of the

imagination are those two alternative implementations of the

same functionality? Likely they share a side-effect that the functions

enabled by STOP_MACHINE rely on that should be factored out

into a common implementation of something that any subsystem

can use (imho).

----------

## wcg

Kconfig could have an option called CONFIG_STRICT_TXT_LOCK

which is what STOP_MACHINE wants to keep threads running on other

cpus from stepping on its toes when the caller of its functions

needs to change something in the kernel code. SMP and loadable

modules would both automatically select it and depend on it.

Hotplug cpu would depend on it. STOP_MACHINE would depend on it.

Kprobes et al could select it and depend on it. HAVE_TXT_POKE_SMP

would depend on it. The jump labels stuff would depend on it.

Then there is only the one Kconfig dependency there for these

different kernel config options that need that same funtionality.

The only way to find it not selected in contexts where it is

needed is to alter the .config file with a text editor.

(More explicit and less "kernel gestalt voodoo" Kconfig depencies

makes it easier for users configuring kernels to understand the warnings,

Kconfig files, and so on.)

----------

## libertytrek

Hello,

Ok, I just noticed this warning when configuring a new kernel, and am unsure of what I should do - if anything...

My system is just like OPs - dual AMD64, motherboard doesn't have hotplug support, and I have loadable modules disable...

So... what should I do about this warning? Can it be safely ignored? Or should I enable CPU Hotplug?

Thanks

----------

