On Fri, 18 Jan 2019 at 11:42, Vincent Guittot <vincent.guittot@xxxxxxxxxx> wrote: > > Hi Guenter, > > Le Thursday 17 Jan 2019 à 14:16:28 (-0800), Guenter Roeck a écrit : > > On Fri, Dec 21, 2018 at 11:33:56AM +0100, Vincent Guittot wrote: > > > From: Thara Gopinath <thara.gopinath@xxxxxxxxxx> > > > > > > This patch replaces jiffies based accounting for runtime_active_time > > > and runtime_suspended_time with ktime base accounting. This makes the > > > runtime debug counters inline with genpd and other pm subsytems which > > > uses ktime based accounting. > > > > > > timekeeping is initialized before pm_runtime_init() so ktime_get() will > > > be ready before first call. In fact, timekeeping_init() is called early > > > in start_kernel() which is way before driver_init() (and that's when > > > devices can start to be initialized) called from rest_init() via > > > kernel_init_freeable() and do_basic_setup(). > > > > > This is not (always) correct. My qemu "collie" boot test fails with this > > patch applied. Reverting the patch fixes the problem. Bisect log attached. > > > > Can you try the patch below ? > ktime_get_mono_fast_ns() has the advantage of being init with dummy clock so > it can be used at early_init. Another possibility would be delay the init of the gpiochip > > --- > drivers/base/power/runtime.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c > index ae1c728..118c7f6 100644 > --- a/drivers/base/power/runtime.c > +++ b/drivers/base/power/runtime.c > @@ -66,7 +66,7 @@ static int rpm_suspend(struct device *dev, int rpmflags); > */ > void update_pm_runtime_accounting(struct device *dev) > { > - u64 now = ktime_to_ns(ktime_get()); > + u64 now = ktime_get_mono_fast_ns(); > u64 delta; > > delta = now - dev->power.accounting_timestamp; > @@ -1507,7 +1507,7 @@ void pm_runtime_init(struct device *dev) > dev->power.request_pending = false; > dev->power.request = RPM_REQ_NONE; > dev->power.deferred_resume = false; > - dev->power.accounting_timestamp = ktime_to_ns(ktime_get()); > + dev->power.accounting_timestamp = ktime_get_mono_fast_ns(); > INIT_WORK(&dev->power.work, pm_runtime_work); > > dev->power.timer_expires = 0; > -- > 2.7.4 > > > > With some added debugging: > > > > ... > > IRQS: 16, nr_irqs: 65, preallocated irqs: 65 > > irq: Cannot allocate irq_descs @ IRQ1, assuming pre-allocated > > gpio gpiochip0: ############### pm_runtime_init() ############ > > irq: Cannot allocate irq_descs @ IRQ33, assuming pre-allocated > > ############## timekeeping_init() #################### > > sched_clock: 32 bits at 3686kHz, resolution 271ns, wraps every 582542222200ns^M > > ... > > > > This is with: > > > > void pm_runtime_init(struct device *dev) > > { > > + dev_info(dev, "############### pm_runtime_init() ############\n"); > > + > > ... > > @@ -1526,6 +1526,8 @@ void __init timekeeping_init(void) > > struct clocksource *clock; > > unsigned long flags; > > > > + pr_info("############## timekeeping_init() ####################\n"); > > + > > > > Guenter > > > > --- > > # bad: [a37d50ca3b837c19a297f349365d11a20c1087d0] Add linux-next specific files for 20190117 > > # good: [1c7fc5cbc33980acd13d668f1c8f0313d6ae9fd8] Linux 5.0-rc2 > > git bisect start 'HEAD' 'v5.0-rc2' > > # bad: [4edb817d29fdf19fb5d52784bb3c29c40e00f586] Merge remote-tracking branch 'pm/linux-next' > > git bisect bad 4edb817d29fdf19fb5d52784bb3c29c40e00f586 > > # good: [6d95886720d306a1914a7c9a8aeb0bcbc7aef018] Merge remote-tracking branch 'omap/for-next' > > git bisect good 6d95886720d306a1914a7c9a8aeb0bcbc7aef018 > > # good: [975b5cdd74430bc8a04f832d65a47cdb95b73fec] Merge remote-tracking branch 'fuse/for-next' > > git bisect good 975b5cdd74430bc8a04f832d65a47cdb95b73fec > > # good: [112386d2189fc54b979c3a8bf64b2908df91e123] Merge remote-tracking branch 'i2c/i2c/for-next' > > git bisect good 112386d2189fc54b979c3a8bf64b2908df91e123 > > # good: [3943f059823b6e15884387f31618b84826e924b3] media: coda: Add control for h.264 chroma qp index offset > > git bisect good 3943f059823b6e15884387f31618b84826e924b3 > > # good: [44970bbbbb5079ee100875b06e45db5d6e91a16e] Merge remote-tracking branch 'v4l-dvb/master' > > git bisect good 44970bbbbb5079ee100875b06e45db5d6e91a16e > > # bad: [599170c2b860aca3364574f833bb9cc801c9668d] Merge branch 'pm-core' into linux-next > > git bisect bad 599170c2b860aca3364574f833bb9cc801c9668d > > # good: [347d570919ca9a3a3653ce9cbb7399c7c0ba8248] Merge branch 'acpi-pci' into linux-next > > git bisect good 347d570919ca9a3a3653ce9cbb7399c7c0ba8248 > > # good: [e0a9fde86ba1bc26dd754c733b32e70cd8f1c187] Merge branches 'acpi-tables' and 'acpi-apei' into linux-next > > git bisect good e0a9fde86ba1bc26dd754c733b32e70cd8f1c187 > > # good: [3b4ed2e2eb5583774a1ed4aa4596a5a3c55f2567] drm/i915: Move on the new pm runtime interface > > git bisect good 3b4ed2e2eb5583774a1ed4aa4596a5a3c55f2567 > > # bad: [c75c303933a68c547f3352d1d708843f9449d3f4] PM: clock_ops: fix missing clk_prepare() return value check > > git bisect bad c75c303933a68c547f3352d1d708843f9449d3f4 > > # bad: [3982ab9ce433efc72ca31eb9ddc85d9355966444] PM-runtime: Replace jiffies based accounting with ktime-based accounting > > git bisect bad 3982ab9ce433efc72ca31eb9ddc85d9355966444 > > # first bad commit: [3982ab9ce433efc72ca31eb9ddc85d9355966444] PM-runtime: Replace jiffies based accounting with ktime-based accounting _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/dri-devel