All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Naveen N. Rao" <naveen.n.rao@linux.ibm.com>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Christophe Leroy <christophe.leroy@c-s.fr>,
	Michael Ellerman <mpe@ellerman.id.au>,
	nathanl@linux.ibm.com, Paul Mackerras <paulus@samba.org>
Cc: arnd@arndb.de, linux-kernel@vger.kernel.org, luto@kernel.org,
	tglx@linutronix.de, vincenzo.frascino@arm.com,
	linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH v6 4/4] powerpc/vdso: Switch VDSO to generic C implementation.
Date: Tue, 07 Apr 2020 20:38:13 +0530	[thread overview]
Message-ID: <1586271940.xja63xxjer.naveen@linux.ibm.com> (raw)
In-Reply-To: <56e0cc4bc8314ee4da87256fcafc03885977f0dd.1586265010.git.christophe.leroy@c-s.fr>

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@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


WARNING: multiple messages have this Message-ID (diff)
From: "Naveen N. Rao" <naveen.n.rao@linux.ibm.com>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Christophe Leroy <christophe.leroy@c-s.fr>,
	Michael Ellerman <mpe@ellerman.id.au>,
	nathanl@linux.ibm.com, Paul Mackerras <paulus@samba.org>
Cc: arnd@arndb.de, linux-kernel@vger.kernel.org,
	linuxppc-dev@lists.ozlabs.org, luto@kernel.org,
	tglx@linutronix.de, vincenzo.frascino@arm.com
Subject: Re: [PATCH v6 4/4] powerpc/vdso: Switch VDSO to generic C implementation.
Date: Tue, 07 Apr 2020 20:38:13 +0530	[thread overview]
Message-ID: <1586271940.xja63xxjer.naveen@linux.ibm.com> (raw)
In-Reply-To: <56e0cc4bc8314ee4da87256fcafc03885977f0dd.1586265010.git.christophe.leroy@c-s.fr>

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@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


  reply	other threads:[~2020-04-07 15:17 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-07 13:13 [PATCH v6 0/4] powerpc: switch VDSO to C implementation Christophe Leroy
2020-04-07 13:13 ` Christophe Leroy
2020-04-07 13:13 ` [PATCH v6 1/4] powerpc/vdso64: Switch from __get_datapage() to get_datapage inline macro Christophe Leroy
2020-04-07 13:13   ` Christophe Leroy
2020-04-07 13:13 ` [PATCH v6 2/4] powerpc/vdso: Remove __kernel_datapage_offset and simplify __get_datapage() Christophe Leroy
2020-04-07 13:13   ` Christophe Leroy
2020-04-07 13:13 ` [PATCH v6 3/4] powerpc/processor: Move cpu_relax() into asm/vdso/processor.h Christophe Leroy
2020-04-07 13:13   ` Christophe Leroy
2020-04-07 13:13 ` [PATCH v6 4/4] powerpc/vdso: Switch VDSO to generic C implementation Christophe Leroy
2020-04-07 13:13   ` Christophe Leroy
2020-04-07 15:08   ` Naveen N. Rao [this message]
2020-04-07 15:08     ` Naveen N. Rao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1586271940.xja63xxjer.naveen@linux.ibm.com \
    --to=naveen.n.rao@linux.ibm.com \
    --cc=arnd@arndb.de \
    --cc=benh@kernel.crashing.org \
    --cc=christophe.leroy@c-s.fr \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=luto@kernel.org \
    --cc=mpe@ellerman.id.au \
    --cc=nathanl@linux.ibm.com \
    --cc=paulus@samba.org \
    --cc=tglx@linutronix.de \
    --cc=vincenzo.frascino@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.