C vdso

Michael Ellerman mpe at ellerman.id.au
Sat Oct 24 21:07:57 AEDT 2020


Michael Ellerman <mpe at ellerman.id.au> writes:
> Christophe Leroy <christophe.leroy at csgroup.eu> writes:
>> Le 24/09/2020 à 15:17, Christophe Leroy a écrit :
>>> Le 17/09/2020 à 14:33, Michael Ellerman a écrit :
>>>> Christophe Leroy <christophe.leroy at csgroup.eu> writes:
>>>>>
>>>>> What is the status with the generic C vdso merge ?
>>>>> In some mail, you mentionned having difficulties getting it working on
>>>>> ppc64, any progress ? What's the problem ? Can I help ?
>>>>
>>>> Yeah sorry I was hoping to get time to work on it but haven't been able
>>>> to.
>>>>
>>>> It's causing crashes on ppc64 ie. big endian.
> ...
>>> 
>>> Can you tell what defconfig you are using ? I have been able to setup a full glibc PPC64 cross 
>>> compilation chain and been able to test it under QEMU with success, using Nathan's vdsotest tool.
>>
>> What config are you using ?
>
> ppc64_defconfig + guest.config
>
> Or pseries_defconfig.
>
> I'm using Ubuntu GCC 9.3.0 mostly, but it happens with other toolchains too.

I'm also seeing warnings because of the feature fixups:

  ------------[ cut here ]------------
  WARNING: CPU: 0 PID: 1 at arch/powerpc/lib/feature-fixups.c:109 .do_feature_fixups+0x80/0xc0
  Modules linked in:
  CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.9.0-rc2-00261-g107a86292cc4 #11
  NIP:  c0000000000a3660 LR: c0000000000a362c CTR: 0000000000000000
  REGS: c00000007e3a3790 TRAP: 0700   Not tainted  (5.9.0-rc2-00261-g107a86292cc4)
  MSR:  8000000002029032 <SF,VEC,EE,ME,IR,DR,RI>  CR: 48000422  XER: 00000000
  CFAR: c0000000000a3630 IRQMASK: 0
  GPR00: c0000000011e8964 c00000007e3a3a20 c000000001bb2b00 0000000000000001
  GPR04: c000000001bc0bc0 c000000001bc0bf0 0000000066736574 00000000fffffe00
  GPR08: 0000000300000004 0000000000000000 0000000000000000 0000000000000db8
  GPR12: 0000000028000224 c000000001dc0000 c000000000012d40 0000000000000000
  GPR16: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
  GPR20: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
  GPR24: c000000001aae0f0 c000000001063f08 c000000001063f18 c000000001063f28
  GPR28: c00000000106e188 000000eb8f4d91a7 c000000001bc0bf0 c000000001bc0bc0
  NIP [c0000000000a3660] .do_feature_fixups+0x80/0xc0
  LR [c0000000000a362c] .do_feature_fixups+0x4c/0xc0
  Call Trace:
  [c00000007e3a3a20] [c0000000000a362c] .do_feature_fixups+0x4c/0xc0 (unreliable)
  [c00000007e3a3ab0] [c0000000011e8964] .vdso_init+0x498/0x95c
  [c00000007e3a3bd0] [c000000000012780] .do_one_initcall+0x60/0x2b8
  [c00000007e3a3cb0] [c0000000011e4d8c] .kernel_init_freeable+0x2d8/0x370
  [c00000007e3a3da0] [c000000000012d64] .kernel_init+0x24/0x150
  [c00000007e3a3e20] [c00000000000e24c] .ret_from_kernel_thread+0x58/0x6c
  Instruction dump:
  40820030 3bff0030 7c3ef840 4181ffe4 38210090 e8010010 eb81ffe0 eba1ffe8
  ebc1fff0 7c0803a6 ebe1fff8 4e800020 <0fe00000> e8ff0028 e8df0020 7f83e378
  ---[ end trace ece1c957ca5bd6e9 ]---
  Unable to patch feature section at bffffffd01bc0bbc - c000000001bc0bc0 with bffffd9101bc0958 - bfffffe501bc0ba4


That's happening because the 32-bit VDSO is built with CONFIG_PPC32=y,
due to config-fake32.h, and that causes the feature fixup entries to be
the wrong size.

See the logic in feature-fixup.h:

  #if defined(CONFIG_PPC64) && !defined(__powerpc64__)
  /* 64 bits kernel, 32 bits code (ie. vdso32) */
  #define FTR_ENTRY_LONG		.8byte
  #define FTR_ENTRY_OFFSET	.long 0xffffffff; .long
  #elif defined(CONFIG_PPC64)
  #define FTR_ENTRY_LONG		.8byte
  #define FTR_ENTRY_OFFSET	.8byte
  #else
  #define FTR_ENTRY_LONG		.long
  #define FTR_ENTRY_OFFSET	.long
  #endif


We expect the fixup entries to still use 64-bit values, even for the
32-bit VDSO in a 64-bit kernel.

TBH I'm not sure how config-fake32.h can work long term, it's so fragile
to be defining/redefining a handful of CONFIG symbols like that.

The generic VDSO code is fairly careful to only include uapi and vdso
headers, not linux ones. So I think we need to better split our headers
so that we can build the VDSO code with few or no linux headers, and so
avoid the need to define any (or most) CONFIG symbols.

cheers


More information about the Linuxppc-dev mailing list