devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Lezcano <daniel.lezcano@linaro.org>
To: Chris Brandt <Chris.Brandt@renesas.com>,
	Rob Herring <robh+dt@kernel.org>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Mark Rutland <mark.rutland@arm.com>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"open list:MEDIA DRIVERS FOR RENESAS - FCP"
	<linux-renesas-soc@vger.kernel.org>,
	Geert Uytterhoeven <geert+renesas@glider.be>,
	Simon Horman <horms+renesas@verge.net.au>,
	Bartosz Golaszewski <bgolaszewski@baylibre.com>,
	Arnd Bergmann <arnd.bergmann@linaro.org>,
	Mark Brown <broonie@linaro.org>
Subject: Re: [PATCH 1/2] clocksource/drivers/ostm: Delay driver registration
Date: Thu, 13 Sep 2018 15:17:23 +0200	[thread overview]
Message-ID: <e4b750b4-2e99-ac24-d7aa-db05a6872a8b@linaro.org> (raw)
In-Reply-To: <TY1PR01MB15629984AA415D4F876B86038A040@TY1PR01MB1562.jpnprd01.prod.outlook.com>

On 11/09/2018 20:42, Chris Brandt wrote:
> On Tuesday, September 11, 2018 1, Rob Herring wrote:
>> Well before we get to initcalls, the kernel calls the arch specific
>> time_init() which (on ARM) calls of_clk_init (for all the reasons
>> above) and then timer_probe(). When timer_probe returns, it is
>> expected that you have setup a clocksource and clockevent. If you
>> haven't, then at some point before we get to initcalls we should hang
>> because we're not getting any timer interrupts and time is not
>> advancing.
> 
> What I get now is:
> 
> [    0.000000] timer_probe: no matching timers found
> ...
> ...
>  [    0.000000] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
> ...
> ...
> 
> 
> But then later on in boot, I'll get (with my subsys_initcall timer fix)
> 
> ...
> ...
> [    0.000000] SCSI subsystem initialized
> [    0.000000] usbcore: registered new interface driver usbfs
> [    0.000000] usbcore: registered new interface driver hub
> [    0.000000] usbcore: registered new device driver usb
> [    0.000000] clocksource: ostm: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 28958491609 ns
> [    0.000619] sched_clock: 32 bits at 66MHz, resolution 15ns, wraps every 32537631224ns
> [    0.008599] ostm: used for clocksource
> [    0.018926] ostm: used for clock events
> [    0.133339] clocksource: Switched to clocksource ostm
> [    0.821474] NET: Registered protocol family 2
> [    0.840624] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 4096 bytes)
> [    0.850549] TCP established hash table entries: 1024 (order: 0, 4096 bytes)
> ...
> ...
> 
> 
> 
>> Maybe you
>> just get lucky and it works as long as no thread blocks (e.g. on a
>> msleep).
> 
> You're right. If I put in a msleep() before my timer is up and running, it hangs.
> 
> As far as I can tell, nothing before device_initcall seems to call anything like msleep.
> 
>> If things changed and you can setup a timer in an initcall,
>> then why are folks still trying to do things like early platform
>> drivers. Regular drivers would work and we should be able to
>> completely remove CLK_OF_DECLARE and TIMER_OF_DECLARE.
> 
> I wonder if the reason is because you can't assign a priority to your 
> driver when you declare it with xxx_initcall( ). So, your driver ends up 
> in the same table as all the other drivers and you are not guaranteed the
> order in which they probe. So, the answer was to make a NEW table and 
> register it using TIMER_OF_DECLARE and CLOCK_OF_DECLARE.
> 
> I wonder they just didn't make a clock_initcall() and timer_initcall() 
> instead.

What happens if you place the clk_init() before board_time_init() ? in
arch/sh/kernel/time.c

void __init time_init(void)
{
        if (board_time_init)
                board_time_init();

        clk_init();

        late_time_init = sh_late_time_init;
}



-- 
 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

  reply	other threads:[~2018-09-13 13:17 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-29 13:29 [PATCH 0/2] clocksource: ostm: Add support for RZ/A2 Chris Brandt
2018-08-29 13:29 ` [PATCH 1/2] clocksource/drivers/ostm: Delay driver registration Chris Brandt
2018-08-29 15:09   ` Daniel Lezcano
2018-08-29 15:44     ` Chris Brandt
2018-08-29 16:26       ` Daniel Lezcano
2018-08-29 18:17         ` Chris Brandt
2018-08-29 19:57         ` Chris Brandt
2018-08-30  7:54         ` Geert Uytterhoeven
2018-08-30  8:08           ` Daniel Lezcano
2018-08-30  8:27             ` Geert Uytterhoeven
2018-08-30  8:37               ` Daniel Lezcano
2018-08-30  8:48                 ` Geert Uytterhoeven
2018-08-30  9:16                   ` Daniel Lezcano
2018-08-30  9:38                     ` Bartosz Golaszewski
2018-09-07 15:16                     ` Chris Brandt
2018-09-10 13:48                       ` Rob Herring
2018-09-10 17:20                         ` Chris Brandt
2018-09-11 16:01                           ` Rob Herring
2018-09-11 18:42                             ` Chris Brandt
2018-09-13 13:17                               ` Daniel Lezcano [this message]
2018-09-13 13:20                                 ` Geert Uytterhoeven
2018-09-13 14:54                                   ` Chris Brandt
2018-09-14 11:39                                     ` Geert Uytterhoeven
2018-09-17 18:56                                       ` Chris Brandt
2018-09-18  7:24                                         ` Geert Uytterhoeven
2018-09-18 11:55                                           ` Chris Brandt
2018-09-18 12:58                                             ` Geert Uytterhoeven
2018-09-18 15:04                                               ` Chris Brandt
2018-09-18 15:10                                                 ` Geert Uytterhoeven
2018-09-18 15:51                                                   ` Chris Brandt
2018-09-18 16:16                                                     ` Geert Uytterhoeven
2018-09-18 16:31                                                       ` Chris Brandt
2018-08-29 13:29 ` [PATCH 2/2] dt-bindings: timer: ostm: Add R7S9210 support Chris Brandt

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=e4b750b4-2e99-ac24-d7aa-db05a6872a8b@linaro.org \
    --to=daniel.lezcano@linaro.org \
    --cc=Chris.Brandt@renesas.com \
    --cc=arnd.bergmann@linaro.org \
    --cc=bgolaszewski@baylibre.com \
    --cc=broonie@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=geert+renesas@glider.be \
    --cc=geert@linux-m68k.org \
    --cc=horms+renesas@verge.net.au \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=robh+dt@kernel.org \
    --cc=tglx@linutronix.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).