• Felipe Balbi 2's avatar
    ARM: 7565/1: sched: stop sched_clock() during suspend · 6a4dae5e
    Felipe Balbi 2 authored
    The scheduler imposes a requirement to sched_clock()
    which is to stop the clock during suspend, if we don't
    do that any RT thread will be rescheduled in the future
    which might cause any sort of problems.
    
    This became an issue on OMAP when we converted omap-i2c.c
    to use threaded IRQs, it turned out that depending on how
    much time we spent on suspend, the I2C IRQ thread would
    end up being rescheduled so far in the future that I2C
    transfers would timeout and, because omap_hsmmc depends
    on an I2C-connected device to detect if an MMC card is
    inserted in the slot, our rootfs would just vanish.
    
    arch/arm/kernel/sched_clock.c already had an optional
    implementation (sched_clock_needs_suspend()) which would
    handle scheduler's requirement properly, what this patch
    does is simply to make that implementation non-optional.
    
    Note that this has the side-effect that printk timings
    won't reflect the actual time spent on suspend so other
    methods to measure that will have to be used.
    
    This has been tested with beagleboard XM (OMAP3630) and
    pandaboard rev A3 (OMAP4430). Suspend to RAM is now working
    after this patch.
    
    Thanks to Kevin Hilman for helping out with debugging.
    Acked-by: default avatarKevin Hilman <khilman@ti.com>
    Acked-by: default avatarLinus Walleij <linus.walleij@linaro.org>
    Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
    Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
    6a4dae5e
sched_clock.c 4.82 KB