All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marc Zyngier <marc.zyngier@arm.com>
To: "Hiremath, Vaibhav" <hvaibhav@ti.com>
Cc: Russell King - ARM Linux <linux@arm.linux.org.uk>,
	"Hilman, Kevin" <khilman@ti.com>,
	"paul@pwsan.com" <paul@pwsan.com>,
	"Cousson, Benoit" <b-cousson@ti.com>,
	"tony@atomide.com" <tony@atomide.com>,
	"johnstul@us.ibm.com" <johnstul@us.ibm.com>,
	"Balbi, Felipe" <balbi@ti.com>,
	"tglx@linutronix.de" <tglx@linutronix.de>,
	"linux-omap@vger.kernel.org" <linux-omap@vger.kernel.org>,
	"DebBarma, Tarun Kanti" <tarun.kanti@ti.com>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: [RFC PATCH 1/5] arm:omap1/2/3/4:Convert 32k-Sync clocksource driver to platform_driver
Date: Wed, 18 Jan 2012 14:45:36 +0000	[thread overview]
Message-ID: <4F16DB10.8060806@arm.com> (raw)
In-Reply-To: <79CD15C6BA57404B839C016229A409A8317A9C39@DBDE01.ent.ti.com>

On 18/01/12 14:38, Hiremath, Vaibhav wrote:
> On Wed, Jan 18, 2012 at 19:55:51, Marc Zyngier wrote:
>> On 18/01/12 14:11, Russell King - ARM Linux wrote:
>>> On Wed, Jan 18, 2012 at 01:34:55PM +0000, Hiremath, Vaibhav wrote:
>>>> On Wed, Jan 18, 2012 at 17:29:52, Russell King - ARM Linux wrote:
>>>>> On Wed, Jan 18, 2012 at 04:58:02PM +0530, Vaibhav Hiremath wrote:
>>>>>> Convert counter_32k clocksource driver to standard platform_driver
>>>>>> and move it drivers/clocksource/ directory.
>>>>>>
>>>>>> Also, rename it to more generic name "omap-32k.c".
>>>>>
>>>>> NAK.  sched_clock is supposed to be available early.  Platform device
>>>>> driver initialization is FAR too late.
>>>>>
>>>> Russell,
>>>>
>>>> Sched_clock is available very early during boot sequence. Initially gp-timer 
>>>> (dmtimer) will get registered as a clocksource. Please refer to the file
>>>> mach-omap2/timer.c
>>>>
>>>> 32k_sync timer (omap-32k.c) will come get registered during arch_init.
>>>>
>>>> Just FYI, the way I tested it is, I used kernel parameter 
>>>> "clocksourse=counter-32k", the switch from gp-timer to 32k timer
>>>> will happen once it gets registered.
>>>
>>> So please delete the sched_clock code from the 32k timer stuff you've
>>> moved to a platform driver.  It will cause sched_clock to reset to zero,
>>> and that's bad news.
>>>
>>> Only one sched_clock() should ever be registered, and that should only be
>>> registered very early at boot time.
>>
>> The kernel will WARN if two sched_clock() are registered. I hope this
>> will be enough for people not to persist with such a thing...
>>
> Marc,
> 
> This code-snippet is not registering multiple sched_clock() functions,
> Here we have 2 timers
>   - gp-timer (available on all devices)
>   - 32k-sync timer (may not available on all devices, like AM33xx)
> 
> So we are registering both the timers as a clocksource and kernel
> Chooses one based on kernel-parameter or rating.
> From sched_clock perspective, we have only one function exported in
> mach-omap2/timer.c, which in-turn calls omap-32k.c timer api.
> 
> Something like this,
> 
> 
> unsigned long long notrace sched_clock(void)
> {
> 	U32 cyc;
> 
> 	/* First call 32k-sync timer sched_clock() */
> 	/* return 0 means, the device doesn't have 32k-sync timer available */
> 	cyc = sched_clock_32k();
> 	if (cyc)
> 		return cyc;
> 
> 	/* Fall back to gp-timer approach */
> }
> 
> So there is and will not be any warning from kernel here.

Can't you instead use the ARM sched_clock framework? Please have a look
at what's currently in mainline (we basically register a read() function
with the sched_clock framework).

A per-platform sched_clock() is a step backward for the single zImage
work, and I really want to avoid this.

Thanks,

	M.
-- 
Jazz is not dead. It just smells funny...


WARNING: multiple messages have this Message-ID (diff)
From: marc.zyngier@arm.com (Marc Zyngier)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC PATCH 1/5] arm:omap1/2/3/4:Convert 32k-Sync clocksource driver to platform_driver
Date: Wed, 18 Jan 2012 14:45:36 +0000	[thread overview]
Message-ID: <4F16DB10.8060806@arm.com> (raw)
In-Reply-To: <79CD15C6BA57404B839C016229A409A8317A9C39@DBDE01.ent.ti.com>

On 18/01/12 14:38, Hiremath, Vaibhav wrote:
> On Wed, Jan 18, 2012 at 19:55:51, Marc Zyngier wrote:
>> On 18/01/12 14:11, Russell King - ARM Linux wrote:
>>> On Wed, Jan 18, 2012 at 01:34:55PM +0000, Hiremath, Vaibhav wrote:
>>>> On Wed, Jan 18, 2012 at 17:29:52, Russell King - ARM Linux wrote:
>>>>> On Wed, Jan 18, 2012 at 04:58:02PM +0530, Vaibhav Hiremath wrote:
>>>>>> Convert counter_32k clocksource driver to standard platform_driver
>>>>>> and move it drivers/clocksource/ directory.
>>>>>>
>>>>>> Also, rename it to more generic name "omap-32k.c".
>>>>>
>>>>> NAK.  sched_clock is supposed to be available early.  Platform device
>>>>> driver initialization is FAR too late.
>>>>>
>>>> Russell,
>>>>
>>>> Sched_clock is available very early during boot sequence. Initially gp-timer 
>>>> (dmtimer) will get registered as a clocksource. Please refer to the file
>>>> mach-omap2/timer.c
>>>>
>>>> 32k_sync timer (omap-32k.c) will come get registered during arch_init.
>>>>
>>>> Just FYI, the way I tested it is, I used kernel parameter 
>>>> "clocksourse=counter-32k", the switch from gp-timer to 32k timer
>>>> will happen once it gets registered.
>>>
>>> So please delete the sched_clock code from the 32k timer stuff you've
>>> moved to a platform driver.  It will cause sched_clock to reset to zero,
>>> and that's bad news.
>>>
>>> Only one sched_clock() should ever be registered, and that should only be
>>> registered very early at boot time.
>>
>> The kernel will WARN if two sched_clock() are registered. I hope this
>> will be enough for people not to persist with such a thing...
>>
> Marc,
> 
> This code-snippet is not registering multiple sched_clock() functions,
> Here we have 2 timers
>   - gp-timer (available on all devices)
>   - 32k-sync timer (may not available on all devices, like AM33xx)
> 
> So we are registering both the timers as a clocksource and kernel
> Chooses one based on kernel-parameter or rating.
> From sched_clock perspective, we have only one function exported in
> mach-omap2/timer.c, which in-turn calls omap-32k.c timer api.
> 
> Something like this,
> 
> 
> unsigned long long notrace sched_clock(void)
> {
> 	U32 cyc;
> 
> 	/* First call 32k-sync timer sched_clock() */
> 	/* return 0 means, the device doesn't have 32k-sync timer available */
> 	cyc = sched_clock_32k();
> 	if (cyc)
> 		return cyc;
> 
> 	/* Fall back to gp-timer approach */
> }
> 
> So there is and will not be any warning from kernel here.

Can't you instead use the ARM sched_clock framework? Please have a look
at what's currently in mainline (we basically register a read() function
with the sched_clock framework).

A per-platform sched_clock() is a step backward for the single zImage
work, and I really want to avoid this.

Thanks,

	M.
-- 
Jazz is not dead. It just smells funny...

  reply	other threads:[~2012-01-18 14:45 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-18 11:28 [RFC PATCH 0/5] arm:omap1/2/3/4: 32k sync timer cleanup Vaibhav Hiremath
2012-01-18 11:28 ` Vaibhav Hiremath
2012-01-18 11:28 ` [RFC PATCH 1/5] arm:omap1/2/3/4:Convert 32k-Sync clocksource driver to platform_driver Vaibhav Hiremath
2012-01-18 11:28   ` Vaibhav Hiremath
2012-01-18 11:59   ` Russell King - ARM Linux
2012-01-18 11:59     ` Russell King - ARM Linux
2012-01-18 13:34     ` Hiremath, Vaibhav
2012-01-18 13:34       ` Hiremath, Vaibhav
2012-01-18 14:11       ` Russell King - ARM Linux
2012-01-18 14:11         ` Russell King - ARM Linux
2012-01-18 14:19         ` Hiremath, Vaibhav
2012-01-18 14:19           ` Hiremath, Vaibhav
2012-01-18 14:25         ` Marc Zyngier
2012-01-18 14:25           ` Marc Zyngier
2012-01-18 14:38           ` Hiremath, Vaibhav
2012-01-18 14:38             ` Hiremath, Vaibhav
2012-01-18 14:45             ` Marc Zyngier [this message]
2012-01-18 14:45               ` Marc Zyngier
2012-01-18 14:50               ` Russell King - ARM Linux
2012-01-18 14:50                 ` Russell King - ARM Linux
2012-01-19 13:09                 ` Tony Lindgren
2012-01-19 13:09                   ` Tony Lindgren
2012-01-19 13:30                   ` Hiremath, Vaibhav
2012-01-19 13:30                     ` Hiremath, Vaibhav
2012-01-25 23:53   ` john stultz
2012-01-25 23:53     ` john stultz
2012-01-30  8:49     ` Hiremath, Vaibhav
2012-01-30  8:49       ` Hiremath, Vaibhav
2012-01-18 11:28 ` [RFC PATCH 2/5] arm:omap2/3: Add idle_st bits for ST_32KSYNC timer Vaibhav Hiremath
2012-01-18 11:28   ` Vaibhav Hiremath
2012-01-18 11:28 ` [RFC PATCH 3/5] arm:omap1/2/3/4: Add 32k counter data to hwmod database Vaibhav Hiremath
2012-01-18 11:28   ` Vaibhav Hiremath
2012-01-18 11:28 ` [RFC PATCH 4/5] arm:omap1/2/3/4: Add platform hookup code for counter-32k driver Vaibhav Hiremath
2012-01-18 11:28   ` Vaibhav Hiremath
2012-01-18 11:28 ` [RFC PATCH 5/5] arm:omap1/2/3: Change dev name for sync_32k_ick clk to omap-counter-32k Vaibhav Hiremath
2012-01-18 11:28   ` Vaibhav Hiremath

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=4F16DB10.8060806@arm.com \
    --to=marc.zyngier@arm.com \
    --cc=b-cousson@ti.com \
    --cc=balbi@ti.com \
    --cc=hvaibhav@ti.com \
    --cc=johnstul@us.ibm.com \
    --cc=khilman@ti.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=paul@pwsan.com \
    --cc=tarun.kanti@ti.com \
    --cc=tglx@linutronix.de \
    --cc=tony@atomide.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.