linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Kernel without RTC
@ 2017-03-06 19:18 Shah, Nehal-bakulchandra
  2017-03-08 13:17 ` Alexandre Belloni
  0 siblings, 1 reply; 5+ messages in thread
From: Shah, Nehal-bakulchandra @ 2017-03-06 19:18 UTC (permalink / raw)
  To: a.zummo, alexandre.belloni; +Cc: rtc-linux, Jagadish.Hadimani, linux-kernel

Hi,

Currently we are having hardware which does not have RTC. It is single processor system. However it does have TSC timer.

Now, how to use scheduler with only TSC as current kernel scheduler leverage the RTC for scheduling? I had seen one old patch

http://marc.info/?l=linux-kernel&m=112013203625990&w=2 

But i guess this patch was later on not taken, It will be great if you can some pointers to move forward?


Thanks 
Nehal

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Kernel without RTC
  2017-03-06 19:18 Kernel without RTC Shah, Nehal-bakulchandra
@ 2017-03-08 13:17 ` Alexandre Belloni
  2017-03-08 13:33   ` Hadimani, Jagadish
  0 siblings, 1 reply; 5+ messages in thread
From: Alexandre Belloni @ 2017-03-08 13:17 UTC (permalink / raw)
  To: Shah, Nehal-bakulchandra
  Cc: a.zummo, rtc-linux, Jagadish.Hadimani, linux-kernel

Hi,

On 07/03/2017 at 00:48:18 +0530, Shah, Nehal-bakulchandra wrote:
> Hi,
> 
> Currently we are having hardware which does not have RTC. It is single processor system. However it does have TSC timer.
> 
> Now, how to use scheduler with only TSC as current kernel scheduler leverage the RTC for scheduling? I had seen one old patch
> 
> http://marc.info/?l=linux-kernel&m=112013203625990&w=2 
> 
> But i guess this patch was later on not taken, It will be great if you can some pointers to move forward?
> 

The kernel doesn't use the RTC for its time source so it can
already work without an RTC.


-- 
Alexandre Belloni, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Kernel without RTC
  2017-03-08 13:17 ` Alexandre Belloni
@ 2017-03-08 13:33   ` Hadimani, Jagadish
  2017-03-08 13:47     ` Alexandre Belloni
  0 siblings, 1 reply; 5+ messages in thread
From: Hadimani, Jagadish @ 2017-03-08 13:33 UTC (permalink / raw)
  To: Alexandre Belloni
  Cc: Shah, Nehal-bakulchandra, a.zummo, rtc-linux, linux-kernel

Hello Alexandre,

I guess the Linux kernel uses HPET timer...
But can we can force Linux kernel to use Tsc or per core timer...

Sent from my iPhone

> On 8 Mar 2017, at 6:47 PM, Alexandre Belloni <alexandre.belloni@free-electrons.com> wrote:
> 
> Hi,
> 
>> On 07/03/2017 at 00:48:18 +0530, Shah, Nehal-bakulchandra wrote:
>> Hi,
>> 
>> Currently we are having hardware which does not have RTC. It is single processor system. However it does have TSC timer.
>> 
>> Now, how to use scheduler with only TSC as current kernel scheduler leverage the RTC for scheduling? I had seen one old patch
>> 
>> http://marc.info/?l=linux-kernel&m=112013203625990&w=2 
>> 
>> But i guess this patch was later on not taken, It will be great if you can some pointers to move forward?
>> 
> 
> The kernel doesn't use the RTC for its time source so it can
> already work without an RTC.
> 
> 
> -- 
> Alexandre Belloni, Free Electrons
> Embedded Linux and Kernel engineering
> http://free-electrons.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Kernel without RTC
  2017-03-08 13:33   ` Hadimani, Jagadish
@ 2017-03-08 13:47     ` Alexandre Belloni
  2017-03-08 15:06       ` Thomas Gleixner
  0 siblings, 1 reply; 5+ messages in thread
From: Alexandre Belloni @ 2017-03-08 13:47 UTC (permalink / raw)
  To: Hadimani, Jagadish
  Cc: Shah, Nehal-bakulchandra, a.zummo, rtc-linux, linux-kernel,
	Thomas Gleixner, Ingo Molnar

On 08/03/2017 at 13:33:33 +0000, Hadimani, Jagadish wrote:
> Hello Alexandre,
> 
> I guess the Linux kernel uses HPET timer...
> But can we can force Linux kernel to use Tsc or per core timer...
> 

That is probably the case but your are targeting the wrong subsystem.
The timekeeping is done using two different devices: clocksource and
clockevent. Usually, the drivers are in drivers/clocksource. I'm
definitively not an expert in x86 but the clockevent seems to be
registered from arch/x86/kernel/hpet.c and the clocksource from
arch/x86/kernel/tsc.c

IIRC the clocksource is optional but the clockevent is mandatory so if
you don't have an HPET, you will need to register a clockevent device
from somewhere else.

Maybe the simplest thing to do is to ask the x86 maintainers and the
time maintainers. Luckily for you, they are the same people (Thomas and
Ingo, added in cc).


> Sent from my iPhone
> 
> > On 8 Mar 2017, at 6:47 PM, Alexandre Belloni <alexandre.belloni@free-electrons.com> wrote:
> > 
> > Hi,
> > 
> >> On 07/03/2017 at 00:48:18 +0530, Shah, Nehal-bakulchandra wrote:
> >> Hi,
> >> 
> >> Currently we are having hardware which does not have RTC. It is single processor system. However it does have TSC timer.
> >> 
> >> Now, how to use scheduler with only TSC as current kernel scheduler leverage the RTC for scheduling? I had seen one old patch
> >> 
> >> http://marc.info/?l=linux-kernel&m=112013203625990&w=2 
> >> 
> >> But i guess this patch was later on not taken, It will be great if you can some pointers to move forward?
> >> 
> > 
> > The kernel doesn't use the RTC for its time source so it can
> > already work without an RTC.
> > 
> > 
> > -- 
> > Alexandre Belloni, Free Electrons
> > Embedded Linux and Kernel engineering
> > http://free-electrons.com

-- 
Alexandre Belloni, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Kernel without RTC
  2017-03-08 13:47     ` Alexandre Belloni
@ 2017-03-08 15:06       ` Thomas Gleixner
  0 siblings, 0 replies; 5+ messages in thread
From: Thomas Gleixner @ 2017-03-08 15:06 UTC (permalink / raw)
  To: Alexandre Belloni
  Cc: Hadimani, Jagadish, Shah, Nehal-bakulchandra, a.zummo, rtc-linux,
	linux-kernel, Ingo Molnar

On Wed, 8 Mar 2017, Alexandre Belloni wrote:
> On 08/03/2017 at 13:33:33 +0000, Hadimani, Jagadish wrote:
> > Hello Alexandre,
> > 
> > I guess the Linux kernel uses HPET timer...
> > But can we can force Linux kernel to use Tsc or per core timer...
> > 
> 
> That is probably the case but your are targeting the wrong subsystem.
> The timekeeping is done using two different devices: clocksource and
> clockevent. Usually, the drivers are in drivers/clocksource. I'm
> definitively not an expert in x86 but the clockevent seems to be
> registered from arch/x86/kernel/hpet.c and the clocksource from
> arch/x86/kernel/tsc.c
> 
> IIRC the clocksource is optional but the clockevent is mandatory so if
> you don't have an HPET, you will need to register a clockevent device
> from somewhere else.
> 
> Maybe the simplest thing to do is to ask the x86 maintainers and the
> time maintainers. Luckily for you, they are the same people (Thomas and
> Ingo, added in cc).

The scheduler uses TSC anyway.

The RTC is only used for setting the wall clock time at boot and for
figuring out the time a system spent in suspend. If you don't have an RTC
then the boot wall clock time will be simply 1/1/1970 00:00:00.

Jagadish, can you please explain what your problem is. Does the system fail
to boot or does it behave strange or what?

Thanks,

	tglx

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-03-08 15:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-06 19:18 Kernel without RTC Shah, Nehal-bakulchandra
2017-03-08 13:17 ` Alexandre Belloni
2017-03-08 13:33   ` Hadimani, Jagadish
2017-03-08 13:47     ` Alexandre Belloni
2017-03-08 15:06       ` Thomas Gleixner

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).