How do I compile Fedora kernel with preemption? (PREEMPT, not PREEMPT_VOLUNTARY)

I’m trying to compile a kernel with preemption so I can get lower latency in my Windows 10 virtual machine. I suppose the first question is whether it’s even worth it to try to use fedpkg and the fedora kernel, or should I just use mainline?

Now to the problem I’m having with the fedora kernel. I keep getting some variation of “[OPTION]=is not set after generation, had [OPTION]=[VALUE] in Source tree” when trying to actually build the kernel. Below are the steps I’m taking and the errors I’m getting. What’s going on here?

$ fedpkg clone -a kernel
$ cd kernel

Modified kernel.spec to add a patch (acs override) and change the buildid

Added options to kernel-local:

CONFIG_PREEMPT=y
CONFIG_RCU_FAST_NO_HZ=y
CONFIG_RCU_NOCB_CPU=y
CONFIG_HZ=1000
CONFIG_SCHED_AUTOGROUP=y
CONFIG_GENERIC_CPU=y

.

$ fedpkg local
    
Processing /home/joe/git/kernel/kernel-5.1.fc31/linux-5.2.0-0.rc0.git9.1.vfio.fc31.x86_64/configs/kernel-5.2.0-x86_64.config ... /home/joe/git/kernel/kernel-5.1.fc31/linux-5.2.0-0.rc0.git9.1.vfio.fc31.x86_64/configs/kernel-5.2.0-x86_64.config:4340:warning: override: PREEMPT_VOLUNTARY changes choice state
/home/joe/git/kernel/kernel-5.1.fc31/linux-5.2.0-0.rc0.git9.1.vfio.fc31.x86_64/configs/kernel-5.2.0-x86_64.config:4340:warning: override: PREEMPT_VOLUNTARY changes choice state
Error: Mismatches found in configuration files
Found CONFIG_PREEMPT=is not set after generation, had CONFIG_PREEMPT=y in Source tree

This made me think I just need to disable voluntary preemption, so I added the following to kernel-local:

CONFIG_PREEMPT_VOLUNTARY=n

.
$ fedpkg local

Processing /home/joe/git/kernel/kernel-5.1.fc31/linux-5.2.0-0.rc0.git9.1.vfio.fc31.x86_64/configs/kernel-5.2.0-x86_64.config ... Found unset config items, please set them to an appropriate value
CONFIG_CEC_GPIO=n
CONFIG_DEBUG_PREEMPT=y
CONFIG_PREEMPT_TRACER=n

Ok… I added those to kernel-local. So now it looks like this:

CONFIG_PREEMPT=y
CONFIG_RCU_FAST_NO_HZ=y
CONFIG_RCU_NOCB_CPU=y
CONFIG_HZ=1000
CONFIG_SCHED_AUTOGROUP=y
CONFIG_GENERIC_CPU=y
CONFIG_PREEMPT_VOLUNTARY=n
CONFIG_CEC_GPIO=n
CONFIG_DEBUG_PREEMPT=y
CONFIG_PREEMPT_TRACER=n

.

$ fedpkg local

Processing /home/joe/git/kernel/kernel-5.1.fc31/linux-5.2.0-0.rc0.git9.1.vfio.fc31.x86_64/configs/kernel-5.2.0-x86_64.config ... Error: Mismatches found in configuration files
Found CONFIG_PREEMPT_VOLUNTARY=is not set after generation, had CONFIG_PREEMPT_VOLUNTARY=n in Source tree
Found CONFIG_CEC_GPIO=is not set after generation, had CONFIG_CEC_GPIO=n in Source tree
Found CONFIG_PREEMPT_TRACER=is not set after generation, had CONFIG_PREEMPT_TRACER=n in Source tree

Tried to disable DEBUG_PREEMPT because the other two are already disabled (although I was doubtful it would make a difference)

$ fedpkg local

Found CONFIG_PREEMPT_VOLUNTARY=is not set after generation, had CONFIG_PREEMPT_VOLUNTARY=n in Source tree
Found CONFIG_CEC_GPIO=is not set after generation, had CONFIG_CEC_GPIO=n in Source tree
Found CONFIG_DEBUG_PREEMPT=is not set after generation, had CONFIG_DEBUG_PREEMPT=n in Source tree
Found CONFIG_PREEMPT_TRACER=is not set after generation, had CONFIG_PREEMPT_TRACER=n in Source tree
1 Like

Hello @monopolyman720—welcome to the forum. Please do have a look at the posts in #start-here if you haven’t had a chance yet.

I’ve not built a kernel in a long time, and I see you are pretty much following the instructions from here, so it may be a deeper issue. If you’d like, you could just ask the kernel maintainer’s team on their communication channels. Since it’s a very niche question, that’ll probably get you the answer quicker than waiting here.