Re: [PATCH v4 2/2] pid: Remove pidhash

From: Rik van Riel
Date: Wed Oct 11 2017 - 10:15:28 EST


On Wed, 2017-10-11 at 17:47 +0800, kbuild test robot wrote:

> > > '__compiletime_assert_33' declared with attribute error:
> > > BUILD_BUG_ON failed: sizeof(struct upid) != 32
>
> ÂÂÂÂÂ_compiletime_assert(condition, msg, __compiletime_assert_,
> __LINE__)
> ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ^
> ÂÂÂinclude/linux/compiler.h:556:4: note: in definition of macro
> '__compiletime_assert'
> ÂÂÂÂÂÂÂprefix ## suffix();ÂÂÂÂ\
> ÂÂÂÂÂÂÂ^~~~~~
> ÂÂÂinclude/linux/compiler.h:576:2: note: in expansion of macro
> '_compiletime_assert'
> ÂÂÂÂÂ_compiletime_assert(condition, msg, __compiletime_assert_,
> __LINE__)
> ÂÂÂÂÂ^~~~~~~~~~~~~~~~~~~
> ÂÂÂinclude/linux/build_bug.h:46:37: note: in expansion of macro
> 'compiletime_assert'
> ÂÂÂÂ#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond),
> msg)
> ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ^~~~~~~~~~~~~~~~~~
> ÂÂÂinclude/linux/build_bug.h:70:2: note: in expansion of macro
> 'BUILD_BUG_ON_MSG'
> ÂÂÂÂÂBUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
> ÂÂÂÂÂ^~~~~~~~~~~~~~~~
> > > arch/ia64/kernel/asm-offsets.c:33:2: note: in expansion of macro
> > > 'BUILD_BUG_ON'
>
> ÂÂÂÂÂBUILD_BUG_ON(sizeof(struct upid) != 32);
> ÂÂÂÂÂ^~~~~~~~~~~~
>
Looks like arch/ia64/kernel/asm-offsets.c throws a BUILD_BUG
if sizeof(struct upid) != 32.

Your patch reduced the size of struct upid, which is a nice
thing, but now IA64 no longer builds.

Lets see what IA64 was doing with the size of struct upid
in the first place:

in arch/ia64/kernel/asm-offsets.c:

ÂÂÂÂÂÂÂÂBUILD_BUG_ON(sizeof(struct upid) != 32);
ÂÂÂÂÂÂÂÂDEFINE(IA64_UPID_SHIFT, 5);

Grepping for IA64_UPID_SHIFT leads us to some assembly
code implementing fsys_getpid (why is that in assembly?!):

add r8=IA64_PID_LEVEL_OFFSET,r17
;;
ld4 r8=[r8] // r8 = pid->level
add r17=IA64_PID_UPID_OFFSET,r17 // r17 = &pid->numbers[0]
;;
shl r8=r8,IA64_UPID_SHIFT
;;
add r17=r17,r8 // r17 = &pid->numbers[pid->level]
;;
ld4 r8=[r17] // r8 = pid->numbers[pid->level].nr
;;
mov r17=0

Luckily it looks like this is only referencing the first members of struct upid,
and you are removing the last member, so I suspect you will be fine changing the IA64
to this:

ÂÂÂÂÂÂÂÂBUILD_BUG_ON(sizeof(struct upid) != 16);
ÂÂÂÂÂÂÂÂDEFINE(IA64_UPID_SHIFT, 4);

Tony, does that look ok to you?

--
All Rights Reversed.

Attachment: signature.asc
Description: This is a digitally signed message part