Is BIT() in arch/x86/include/uapi/asm/kvm.h defined? Where?

From: Brooks Moses
Date: Wed May 04 2016 - 20:49:51 EST


Hello!

Ian and I have run into what looks like a bug in
arch/x86/include/uapi/asm/kvm.h, but it also looks so obvious that we
surely must be doing something wrong. So I request enlightenment.

We discovered this problem on the 4.5.2 release, but the relevant code
appears unchanged from 2013 until current trunk.

When I run "make ARCH=x86 headers_install", and then write a simple C
file that #includes "asm/kvm.h" from the resulting tree, I get a
compiler error: the BIT() macro used on line 219 of that file is
undefined:
https://github.com/torvalds/linux/blob/master/arch/x86/include/uapi/asm/kvm.h#L219

I attempted to find where it was supposed to be defined, and the only
match for "define BIT(" in the whole tree is in
include/linux/bitops.h:
https://github.com/torvalds/linux/blob/master/include/linux/bitops.h#L6

However, that's not in a "uapi" directory, and it's not listed in
include/uapi/linux/Kbuild, so "make headers_install" doesn't install
it. Further, kvm.h doesn't reference it with a #include, so even if
it were installed, it wouldn't be included.

It seems that we must be missing something obvious. But what?

Thanks,
- Brooks


P.S. The change that appears to have added this reference is this
one, signed-off-on by Borislav and Paolo, which is why I've added you
to the cc line.
https://github.com/torvalds/linux/commit/9c15bb1d0a8411f9bb3395d21d5309bde7da0c1c