Re: Missing include file in include/uapi/linux/errqueue.h?

2016-07-09 Thread Brooks Moses
On Sat, Jul 9, 2016 at 10:36 AM, Brooks Moses  wrote:
> I've been attempting to qualify the Linux 4.5.2 user-space headers for
> a toolchain release, and ran into what looks like a missing include
> file in include/uapi/linux/errqueue.h.  In particular,
> https://github.com/torvalds/linux/commit/f24b9be5957b38bb420b838115040dc2031b7d0c
> adds the following to this file:
>
> +struct scm_timestamping {
> + struct timespec ts[3];
> +};
>
> However, struct timespec is defined in time.h, which isn't included
> either in 4.5.2 or in current head.  Is this simply a missing #include
> line, or am I misunderstanding something?

As a followup: Unfortunately the obvious fix -- adding "#include
" -- causes other problems, since linux/time.h is
incompatible with the glibc time.h such that including both of them
into the same compilation unit causes errors about redefined types.
And we, at least, have some programs that want to include
linux/errqueue.h and (glibc's) time.h.  The fix of adding "#include
" to linux/errqueue.h seems to work for us, but I'm not sure
that won't cause problems in the other direction for other people.

- Brooks


Missing include file in include/uapi/linux/errqueue.h?

2016-07-09 Thread Brooks Moses
Hello!

I've been attempting to qualify the Linux 4.5.2 user-space headers for
a toolchain release, and ran into what looks like a missing include
file in include/uapi/linux/errqueue.h.  In particular,
https://github.com/torvalds/linux/commit/f24b9be5957b38bb420b838115040dc2031b7d0c
adds the following to this file:

+struct scm_timestamping {
+ struct timespec ts[3];
+};

However, struct timespec is defined in time.h, which isn't included
either in 4.5.2 or in current head.  Is this simply a missing #include
line, or am I misunderstanding something?

I also note that this is the second user-space header in the Linux
4.5.2 release we've run into that simply fails to compile when
included by itself.  Is there not a test target that tests for this?
Would it be welcome if I were to work on adding one?

Thanks,
- Brooks


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

2016-05-05 Thread Brooks Moses
On Thu, May 5, 2016 at 1:24 AM, Borislav Petkov  wrote:
> On Wed, May 04, 2016 at 05:49:27PM -0700, Brooks Moses wrote:
>> 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:
>
> The below patch should help...

Thanks for the quick reply!  Yes, this should fix things for us -- and
answers my implicit question of whether it was better to fix this by
avoiding the macro or whether bitops.h was expected to be exported.

> @Paulo: btw, any chance we can fix that "signifcant" typo :-) in
> KVM_CPUID_FLAG_SIGNIFCANT_INDEX or is it user-visible and cast in
> stone?

It's user-visible, but since it's been defined to something that
doesn't work in user-space, it seems unlikely to me that it has any
actual users

- Brooks


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

2016-05-04 Thread Brooks Moses
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