[PATCH v6 4/4] powerpc/vdso: Switch VDSO to generic C implementation.

Naveen N. Rao naveen.n.rao at linux.ibm.com
Wed Apr 8 01:08:13 AEST 2020


Christophe Leroy wrote:
> powerpc is a bit special for VDSO as well as system calls in the
> way that it requires setting CR SO bit which cannot be done in C.
> Therefore, entry/exit needs to be performed in ASM.
> 
> Implementing __arch_get_vdso_data() would clobbers the link register,
> requiring the caller to save it. As the ASM calling function already
> has to set a stack frame and saves the link register before calling
> the C vdso function, retriving the vdso data pointer there is lighter.
> 
> Implement __arch_vdso_capable() and:
> - When the timebase is used, make it always return true.
> - When the RTC clock is used, make it always return false.
> 

<snip>

> 
> Signed-off-by: Christophe Leroy <christophe.leroy at c-s.fr>
> ---
> v6:
> - Added missing prototypes in asm/vdso/gettimeofday.h for __c_kernel_ functions.
> - Using STACK_FRAME_OVERHEAD instead of INT_FRAME_SIZE
> - Rebased on powerpc/merge as of 7 Apr 2020
> - Fixed build failure with gcc 9
> - Added a patch to create asm/vdso/processor.h and more cpu_relax() in it
> ---
>  arch/powerpc/Kconfig                         |   2 +
>  arch/powerpc/include/asm/clocksource.h       |   7 +
>  arch/powerpc/include/asm/vdso/clocksource.h  |   7 +
>  arch/powerpc/include/asm/vdso/gettimeofday.h | 175 +++++++++++
>  arch/powerpc/include/asm/vdso/vsyscall.h     |  25 ++
>  arch/powerpc/include/asm/vdso_datapage.h     |  40 +--
>  arch/powerpc/kernel/asm-offsets.c            |  49 +---
>  arch/powerpc/kernel/time.c                   |  91 +-----
>  arch/powerpc/kernel/vdso.c                   |   5 +-
>  arch/powerpc/kernel/vdso32/Makefile          |  32 +-
>  arch/powerpc/kernel/vdso32/config-fake32.h   |  34 +++
>  arch/powerpc/kernel/vdso32/gettimeofday.S    | 291 +------------------
>  arch/powerpc/kernel/vdso32/vgettimeofday.c   |  29 ++
>  arch/powerpc/kernel/vdso64/Makefile          |  23 +-
>  arch/powerpc/kernel/vdso64/gettimeofday.S    | 243 +---------------
>  arch/powerpc/kernel/vdso64/vgettimeofday.c   |  29 ++
>  16 files changed, 391 insertions(+), 691 deletions(-)
>  create mode 100644 arch/powerpc/include/asm/clocksource.h
>  create mode 100644 arch/powerpc/include/asm/vdso/clocksource.h
>  create mode 100644 arch/powerpc/include/asm/vdso/gettimeofday.h
>  create mode 100644 arch/powerpc/include/asm/vdso/vsyscall.h
>  create mode 100644 arch/powerpc/kernel/vdso32/config-fake32.h
>  create mode 100644 arch/powerpc/kernel/vdso32/vgettimeofday.c
>  create mode 100644 arch/powerpc/kernel/vdso64/vgettimeofday.c

You should also consider adding -fasynchronous-unwind-tables. For 
background, please see:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=ba96301ce9be7925cdaee677b1a2ff8eddba9fd4


- Naveen



More information about the Linuxppc-dev mailing list