1. 03 9月, 2015 4 次提交
  2. 20 8月, 2015 1 次提交
  3. 08 8月, 2015 1 次提交
    • G
      clockevents/drivers/sh_cmt: Only perform clocksource suspend/resume if enabled · 54d46b7f
      Geert Uytterhoeven 提交于
      Currently the sh_cmt clocksource timer is disabled or enabled
      unconditionally on clocksource suspend resp. resume, even if a
      better clocksource is present (e.g. arch_sys_counter) and the
      sh_cmt clocksource is not enabled.
      
      As sh_cmt is a syscore device when its timer is enabled, this
      may lead to a genpd.prepared_count imbalance in the presence of
      PM Domains, which may cause a lock-up during reboot after s2ram.
      
      During suspend:
        - pm_genpd_prepare() is called for all non-syscore devices (incl.
          sh_cmt), increasing genpd.prepared_count for each device,
        - clocksource.suspend() is called for all clocksource devices,
        - sh_cmt_clocksource_suspend() calls sh_cmt_stop(), which is a no-op
          as the clocksource was not enabled.
      
      During resume:
        - clocksource.resume() is called for all clocksource devices,
        - sh_cmt_clocksource_resume() calls sh_cmt_start(), which enables the
          clocksource timer, and turns sh_cmt into a syscore device,
        - pm_genpd_complete() is called for all non-syscore devices (excl.
          sh_cmt now!), decreasing genpd.prepared_count for each device but
          sh_cmt.
      
      Now genpd.prepared_count of the PM Domain containing sh_cmt is
      still 1 instead of zero.  On subsequent suspend/resume cycles,
      sh_cmt is still a syscore device, hence it's skipped for
      pm_genpd_{prepare,complete}(), keeping the imbalance of
      genpd.prepared_count at 1.
      
      During reboot:
      
        - platform_drv_shutdown() is called for any platform device that has
          a driver with a .shutdown() method (only rcar-dmac on R-Car Gen2),
      
        - platform_drv_shutdown() calls dev_pm_domain_detach(), which
          calls genpd_dev_pm_detach(),
      
        - genpd_dev_pm_detach() keeps calling pm_genpd_remove_device() until
          it doesn't return -EAGAIN[*],
      
        - If the device is part of the same PM Domain as sh_cmt,
          pm_genpd_remove_device() always fails with -EAGAIN due to
          genpd.prepared_count > 0.
      
        - Infinite loop in genpd_dev_pm_detach()[*].
      
      [*] Commit 93af5e93 ("PM / Domains: Avoid infinite loops in
          attach/detach code") already limited the number of loop iterations,
          avoiding the lock-up.
      
      To fix this, only disable or enable the clocksource timer on
      clocksource suspend resp. resume if the clocksource was enabled.
      
      This was tested on r8a7791/koelsch with the CPG Clock Domain:
      
        - using arch_sys_counter as the clocksource, which is the default, and
          which showed the problem,
      
        - using sh_cmt as a clocksource ("echo ffca0000.timer > \
          /sys/devices/system/clocksource/clocksource0/current_clocksource"),
          which behaves the same as before.
      Signed-off-by: NGeert Uytterhoeven <geert+renesas@glider.be>
      Signed-off-by: NDaniel Lezcano <daniel.lezcano@linaro.org>
      Acked-by: NLaurent Pinchart <laurent.pinchart@ideasonboard.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Link: http://lkml.kernel.org/r/1438875126-12596-2-git-send-email-daniel.lezcano@linaro.orgSigned-off-by: NIngo Molnar <mingo@kernel.org>
      54d46b7f
  4. 07 7月, 2015 1 次提交
  5. 27 6月, 2015 1 次提交
    • D
      clocksource: exynos_mct: Avoid blocking calls in the cpu hotplug notifier · 56a94f13
      Damian Eppel 提交于
      Whilst testing cpu hotplug events on kernel configured with
      DEBUG_PREEMPT and DEBUG_ATOMIC_SLEEP we get following BUG message,
      caused by calling request_irq() and free_irq() in the context of
      hotplug notification (which is in this case atomic context).
      
      [   40.785859] CPU1: Software reset
      [   40.786660] BUG: sleeping function called from invalid context at mm/slub.c:1241
      [   40.786668] in_atomic(): 1, irqs_disabled(): 128, pid: 0, name: swapper/1
      [   40.786678] Preemption disabled at:[<  (null)>]   (null)
      [   40.786681]
      [   40.786692] CPU: 1 PID: 0 Comm: swapper/1 Not tainted 3.19.0-rc4-00024-g7dca860 #36
      [   40.786698] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
      [   40.786728] [<c0014a00>] (unwind_backtrace) from [<c0011980>] (show_stack+0x10/0x14)
      [   40.786747] [<c0011980>] (show_stack) from [<c0449ba0>] (dump_stack+0x70/0xbc)
      [   40.786767] [<c0449ba0>] (dump_stack) from [<c00c6124>] (kmem_cache_alloc+0xd8/0x170)
      [   40.786785] [<c00c6124>] (kmem_cache_alloc) from [<c005d6f8>] (request_threaded_irq+0x64/0x128)
      [   40.786804] [<c005d6f8>] (request_threaded_irq) from [<c0350b8c>] (exynos4_local_timer_setup+0xc0/0x13c)
      [   40.786820] [<c0350b8c>] (exynos4_local_timer_setup) from [<c0350ca8>] (exynos4_mct_cpu_notify+0x30/0xa8)
      [   40.786838] [<c0350ca8>] (exynos4_mct_cpu_notify) from [<c003b330>] (notifier_call_chain+0x44/0x84)
      [   40.786857] [<c003b330>] (notifier_call_chain) from [<c0022fd4>] (__cpu_notify+0x28/0x44)
      [   40.786873] [<c0022fd4>] (__cpu_notify) from [<c0013714>] (secondary_start_kernel+0xec/0x150)
      [   40.786886] [<c0013714>] (secondary_start_kernel) from [<40008764>] (0x40008764)
      
      Interrupts cannot be requested/freed in the CPU_STARTING/CPU_DYING
      notifications which run on the hotplugged cpu with interrupts and
      preemption disabled.
      
      To avoid the issue, request the interrupts for all possible cpus in
      the boot code. The interrupts are marked NO_AUTOENABLE to avoid a racy
      request_irq/disable_irq() sequence. The flag prevents the
      request_irq() code from enabling the interrupt immediately.
      
      The interrupt is then enabled in the CPU_STARTING notifier of the
      hotplugged cpu and again disabled with disable_irq_nosync() in the
      CPU_DYING notifier.
      
      [ tglx: Massaged changelog to match the patch ]
      
      Fixes: 7114cd74 ("clocksource: exynos_mct: use (request/free)_irq calls for local timer registration")
      Reported-by: NKrzysztof Kozlowski <k.kozlowski@samsung.com>
      Reviewed-by: NKrzysztof Kozlowski <k.kozlowski@samsung.com>
      Tested-by: NKrzysztof Kozlowski <k.kozlowski@samsung.com>
      Tested-by: NMarcin Jabrzyk <m.jabrzyk@samsung.com>
      Signed-off-by: NDamian Eppel <d.eppel@samsung.com>
      Cc: m.szyprowski@samsung.com
      Cc: kyungmin.park@samsung.com
      Cc: daniel.lezcano@linaro.org
      Cc: kgene@kernel.org
      Cc: linux-arm-kernel@lists.infradead.org
      Link: http://lkml.kernel.org/r/1435324984-7328-1-git-send-email-d.eppel@samsung.comSigned-off-by: NThomas Gleixner <tglx@linutronix.de>
      Cc: <stable@vger.kernel.org>
      56a94f13
  6. 24 6月, 2015 1 次提交
  7. 23 6月, 2015 2 次提交
  8. 22 6月, 2015 1 次提交
    • P
      clocksource: Increase dependencies of timer-stm32 to limit build wreckage · 1cb6c215
      Paul Gortmaker 提交于
      This driver leaks out into arch/parisc builds that don't have
      CONFIG_GENERIC_CLOCKEVENTS, leading to the following (truncated)
      wreckage:
      
        CC      drivers/clocksource/timer-stm32.o
      drivers/clocksource/timer-stm32.c:38:28: error: field 'evtdev' has incomplete type
      drivers/clocksource/timer-stm32.c:44:19: warning: 'enum clock_event_mode' declared inside parameter list
      drivers/clocksource/timer-stm32.c:44:19: warning: its scope is only this definition or declaration, which is probably not what you want
      drivers/clocksource/timer-stm32.c:43:62: error: parameter 1 ('mode') has incomplete type
      drivers/clocksource/timer-stm32.c:43:13: error: function declaration isn't a prototype
      drivers/clocksource/timer-stm32.c: In function 'stm32_clock_event_set_mode':
      drivers/clocksource/timer-stm32.c:47:3: error: type defaults to 'int' in declaration of '__mptr'
      drivers/clocksource/timer-stm32.c:47:3: warning: initialization from incompatible pointer type
      drivers/clocksource/timer-stm32.c:51:7: error: 'CLOCK_EVT_MODE_PERIODIC' undeclared (first use in this function)
      drivers/clocksource/timer-stm32.c:51:7: note: each undeclared identifier is reported only once for each function it appears in
      drivers/clocksource/timer-stm32.c:56:7: error: 'CLOCK_EVT_MODE_ONESHOT' undeclared (first use in this function)
      
      Tighten up the dependencies to limit where it gets built by copying
      the style of the Kconfig line for CLKSRC_EFM32 a few lines above.
      Signed-off-by: NPaul Gortmaker <paul.gortmaker@windriver.com>
      Cc: Linus Walleij <linus.walleij@linaro.org>
      Cc: Chanwoo Choi <cw00.choi@samsung.com>
      Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>
      Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
      Link: http://lkml.kernel.org/r/1434841352-24300-1-git-send-email-paul.gortmaker@windriver.comSigned-off-by: NThomas Gleixner <tglx@linutronix.de>
      1cb6c215
  9. 03 6月, 2015 2 次提交
  10. 02 6月, 2015 10 次提交
  11. 05 5月, 2015 3 次提交
  12. 06 4月, 2015 1 次提交
  13. 03 4月, 2015 2 次提交
  14. 01 4月, 2015 2 次提交
  15. 31 3月, 2015 8 次提交