Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1532378

Re: [PATCH v3 13/13] clocksource/drivers/rockchip_timer: Prevent ftrace recursion

From Heiko Stübner <heiko@sntech.de>
Newsgroups linux.kernel
Subject Re: [PATCH v3 13/13] clocksource/drivers/rockchip_timer: Prevent ftrace recursion
Date 2016-11-29 16:10 +0100
Message-ID <sIScG-1DN-11@gated-at.bofh.it> (permalink)
References <sIvg5-3iM-5@gated-at.bofh.it> <sIQXf-F4-1@gated-at.bofh.it> <sIQXg-F4-47@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Am Dienstag, 29. November 2016, 16:45:18 schrieb Alexander Kochetkov:
> Currently rockchip_timer can be used as a scheduler clock. We properly
> marked rk_timer_sched_clock_read() as notrace but we then call another
> function rk_timer_counter_read() that _wasn't_ notrace.
> 
> Having a traceable function in the sched_clock() path leads to a recursion
> within ftrace and a kernel crash.
> 
> Fix this by adding an extra notrace function to keep other users of
> rk_timer_counter_read() traceable.
> 
> Signed-off-by: Alexander Kochetkov <al.kochet@gmail.com>

you introduced the issue yourself in patch 11/13. In general any patch should 
never leave the kernel in a worse state than it was before, so no patch should 
ever introduce known issues itself.

In that line of thought, don't patches 10+11 introduce warnings about unused 
functions as well when applied without patch 12?

Maybe merge them?


Heiko

> ---
>  drivers/clocksource/rockchip_timer.c |    9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/clocksource/rockchip_timer.c
> b/drivers/clocksource/rockchip_timer.c index 1af80a0..a127822 100644
> --- a/drivers/clocksource/rockchip_timer.c
> +++ b/drivers/clocksource/rockchip_timer.c
> @@ -87,7 +87,7 @@ static void rk_timer_update_counter(u64 cycles, struct
> rk_timer *timer) writel_relaxed(upper, timer->base + TIMER_LOAD_COUNT1);
>  }
> 
> -static u64 rk_timer_counter_read(struct rk_timer *timer)
> +static u64 notrace _rk_timer_counter_read(struct rk_timer *timer)
>  {
>  	u64 counter;
>  	u32 lower;
> @@ -106,6 +106,11 @@ static u64 rk_timer_counter_read(struct rk_timer
> *timer) return counter;
>  }
> 
> +static u64 rk_timer_counter_read(struct rk_timer *timer)
> +{
> +	return _rk_timer_counter_read(timer);
> +}
> +
>  static void rk_timer_interrupt_clear(struct rk_timer *timer)
>  {
>  	writel_relaxed(1, timer->base + TIMER_INT_STATUS);
> @@ -168,7 +173,7 @@ static u64 notrace rk_timer_sched_clock_read(void)
>  {
>  	struct rk_clocksource *_cs = &cs_timer;
> 
> -	return ~rk_timer_counter_read(&_cs->timer);
> +	return ~_rk_timer_counter_read(&_cs->timer);
>  }
> 
>  static int __init rk_timer_init(struct device_node *np, u32 ctrl_reg)

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCHv2 00/11] Implement clocksource for rockchip SoC using rockchip timer Alexander Kochetkov <al.kochet@gmail.com> - 2016-11-28 15:40 +0100
  [PATCHv2 11/11] clocksource/drivers/rockchip_timer: implement clocksource timer Alexander Kochetkov <al.kochet@gmail.com> - 2016-11-28 15:40 +0100
  [PATCHv2 06/11] clocksource/drivers/rockchip_timer: low level routines take rk_timer as parameter Alexander Kochetkov <al.kochet@gmail.com> - 2016-11-28 15:40 +0100
  [PATCHv2 08/11] clocksource/drivers/rockchip_timer: move TIMER_INT_UNMASK out of rk_timer_enable() Alexander Kochetkov <al.kochet@gmail.com> - 2016-11-28 15:40 +0100
  [PATCHv2 01/11] dt-bindings: clarify compatible property for rockchip timers Alexander Kochetkov <al.kochet@gmail.com> - 2016-11-28 15:40 +0100
  [PATCHv2 10/11] clocksource/drivers/rockchip_timer: implement reading 64bit value from timer Alexander Kochetkov <al.kochet@gmail.com> - 2016-11-28 15:40 +0100
  [PATCH v3 00/13] Implement clocksource for rockchip SoC using rockchip timer Alexander Kochetkov <al.kochet@gmail.com> - 2016-11-29 14:50 +0100
    [PATCH v3 10/13] clocksource/drivers/rockchip_timer: implement loading 64bit value into timer Alexander Kochetkov <al.kochet@gmail.com> - 2016-11-29 14:50 +0100
    [PATCH v3 11/13] clocksource/drivers/rockchip_timer: implement reading 64bit value from timer Alexander Kochetkov <al.kochet@gmail.com> - 2016-11-29 14:50 +0100
    [PATCH v3 02/13] ARM: dts: rockchip: update compatible property for rk3228 timer Alexander Kochetkov <al.kochet@gmail.com> - 2016-11-29 14:50 +0100
    [PATCH v3 03/13] ARM: dts: rockchip: update compatible property for rk3229 timer Alexander Kochetkov <al.kochet@gmail.com> - 2016-11-29 14:50 +0100
    [PATCH v3 09/13] clocksource/drivers/rockchip_timer: move TIMER_INT_UNMASK out of rk_timer_enable() Alexander Kochetkov <al.kochet@gmail.com> - 2016-11-29 14:50 +0100
    [PATCH v3 04/13] ARM: dts: rockchip: add timer entries to rk3188 dtsi Alexander Kochetkov <al.kochet@gmail.com> - 2016-11-29 14:50 +0100
    [PATCH v3 13/13] clocksource/drivers/rockchip_timer: Prevent ftrace recursion Alexander Kochetkov <al.kochet@gmail.com> - 2016-11-29 14:50 +0100
      Re: [PATCH v3 13/13] clocksource/drivers/rockchip_timer: Prevent ftrace recursion Heiko Stübner <heiko@sntech.de> - 2016-11-29 16:10 +0100
        Re: [PATCH v3 13/13] clocksource/drivers/rockchip_timer: Prevent ftrace recursion Alexander Kochetkov <al.kochet@gmail.com> - 2016-11-29 16:40 +0100
    [PATCH v3 05/13] ARM: dts: rockchip: disable arm-global-timer for rk3188 Alexander Kochetkov <al.kochet@gmail.com> - 2016-11-29 14:50 +0100
    [PATCH v3 07/13] clocksource/drivers/rockchip_timer: low level routines take rk_timer as parameter Alexander Kochetkov <al.kochet@gmail.com> - 2016-11-29 14:50 +0100
    [PATCH v3 12/13] clocksource/drivers/rockchip_timer: implement clocksource timer Alexander Kochetkov <al.kochet@gmail.com> - 2016-11-29 14:50 +0100
    [PATCH v3 01/13] dt-bindings: clarify compatible property for rockchip timers Alexander Kochetkov <al.kochet@gmail.com> - 2016-11-29 14:50 +0100
    [PATCH v3 06/13] clocksource/drivers/rockchip_timer: split bc_timer into rk_timer and rk_clock_event_device Alexander Kochetkov <al.kochet@gmail.com> - 2016-11-29 14:50 +0100
    [PATCH v3 08/13] clocksource/drivers/rockchip_timer: drop unused rk_base() and rk_ctrl() Alexander Kochetkov <al.kochet@gmail.com> - 2016-11-29 14:50 +0100
      Re: [PATCH v3 08/13] clocksource/drivers/rockchip_timer: drop unused rk_base() and rk_ctrl() Heiko Stübner <heiko@sntech.de> - 2016-11-29 16:10 +0100
  [PATCH v4 5/9] ARM: dts: rockchip: disable arm-global-timer for rk3188 Alexander Kochetkov <al.kochet@gmail.com> - 2016-11-29 17:20 +0100
  [PATCH v4 6/9] clocksource/drivers/rockchip_timer: split bc_timer into rk_timer and rk_clock_event_device Alexander Kochetkov <al.kochet@gmail.com> - 2016-11-29 17:20 +0100
  [PATCH v4 3/9] ARM: dts: rockchip: update compatible property for rk3229 timer Alexander Kochetkov <al.kochet@gmail.com> - 2016-11-29 17:20 +0100
  [PATCH v4 9/9] clocksource/drivers/rockchip_timer: implement clocksource timer Alexander Kochetkov <al.kochet@gmail.com> - 2016-11-29 17:20 +0100
  [PATCH v4 2/9] ARM: dts: rockchip: update compatible property for rk3228 timer Alexander Kochetkov <al.kochet@gmail.com> - 2016-11-29 17:20 +0100
  [PATCH v4 7/9] clocksource/drivers/rockchip_timer: low level routines take rk_timer as parameter Alexander Kochetkov <al.kochet@gmail.com> - 2016-11-29 17:20 +0100
  [PATCH v4 4/9] ARM: dts: rockchip: add timer entries to rk3188 SoC Alexander Kochetkov <al.kochet@gmail.com> - 2016-11-29 17:20 +0100
  [PATCH v4 8/9] clocksource/drivers/rockchip_timer: move TIMER_INT_UNMASK out of rk_timer_enable() Alexander Kochetkov <al.kochet@gmail.com> - 2016-11-29 17:20 +0100
  [PATCH v4 1/9] dt-bindings: clarify compatible property for rockchip timers Alexander Kochetkov <al.kochet@gmail.com> - 2016-11-29 17:20 +0100
    Re: [PATCH v4 1/9] dt-bindings: clarify compatible property for  rockchip timers Rob Herring <robh@kernel.org> - 2016-12-05 23:30 +0100
  [PATCH v4 0/9] Implement clocksource for rockchip SoC using rockchip timer Alexander Kochetkov <al.kochet@gmail.com> - 2016-11-29 17:20 +0100

csiph-web