high-res-timers patches for 2.6.6
Available at http://tree.celinuxforum.org/pubwiki/moin.cgi/CELinux_5fPatchArchive
For those interested, the set of three patches provide POSIX high-res timer support for linux-2.6.6. The core and i386 patches are updates of George Anzinger's hrtimers-2.6.5-1.0.patch available on SourceForge <http://sourceforge.net/projects/high-res-timers/>. The ppc32 port is not available on SourceForge yet.
-Geoff
Quoted 8 lines · Geoff Levand
Available at
http://tree.celinuxforum.org/pubwiki/moin.cgi/CELinux_5fPatchArchive
For those interested, the set of three patches provide POSIX high-res timer support for linux-2.6.6. The core and i386 patches are updates of George Anzinger's hrtimers-2.6.5-1.0.patch available on SourceForge
<http://sourceforge.net/projects/high-res-timers/>. The ppc32 port is not available on SourceForge yet.
-Geoff
I thought George Anzinger's high resolution timer patches had already been merged? At the very least there's already a kernel/posix-timers.c
-- wli
Quoting William Lee Irwin III <[email protected]>:
Quoted 10 lines · Geoff Levand
Quoted 8 lines
Available at
http://tree.celinuxforum.org/pubwiki/moin.cgi/CELinux_5fPatchArchive
For those interested, the set of three patches provide POSIX high-res timer support for linux-2.6.6. The core and i386 patches are updates of George Anzinger's hrtimers-2.6.5-1.0.patch available on SourceForge
<http://sourceforge.net/projects/high-res-timers/>. The ppc32 port is not available on SourceForge yet.
-Geoff
Quoted 2 lines
I thought George Anzinger's high resolution timer patches had already been merged? At the very least there's already a
kernel/posix-timers.c
Not exactly, what has been merged is only the POSIX interface of the timers. The patches to obtain a high resolution (in the order of 10 microseconds instead of 1ms) are still out from the vanilla kernel.
Eric
Quoting William Lee Irwin III <[email protected]>:
Quoted 2 lines
Quoted 2 lines
I thought George Anzinger's high resolution timer patches had already been merged? At the very least there's already a
kernel/posix-timers.c
Quoted 3 lines · On Thu, Jun 10, 2004 at 10:40:55AM +0200, [email protected] wrote:
Not exactly, what has been merged is only the POSIX interface of the time= rs. The patches to obtain a high resolution (in the order of 10 microseconds instead of 1ms) are still out from the vanilla kernel.
That sounds useful. Any chance you could post them to lkml for review? They're significantly less likely to actually be looked at and/or included if ppl have to chase URL's. (That said, I personally don't have much of an interest in all this, maybe others will speak up.)
Thanks.
-- wli
Quoted 8 lines · Geoff Levand
Available at
http://tree.celinuxforum.org/pubwiki/moin.cgi/CELinux_5fPatchArchiveFor those interested, the set of three patches provide POSIX high-res timer support for linux-2.6.6. The core and i386 patches are updates of George Anzinger's hrtimers-2.6.5-1.0.patch available on SourceForge
<http://sourceforge.net/projects/high-res-timers/>. The ppc32 port is not available on SourceForge yet.
My first impression is that it has WAAAAAAAAAAAY too many ifdefs. I would strongly suggest to not make this a config option and just mandatory, it's a core feature that has no point in being optional. If you accept that, the code also becomes a *LOT* cleaner.
Quoted 4 lines · Arjan van de Ven
Quoted 2 lines · Geoff Levand
Available at http://tree.celinuxforum.org/pubwiki/moin.cgi/CELinux_5fPatchArchive
Quoted 8 lines
Quoted 1 line
For those interested, the set of three patches provide POSIX high-res timer support for linux-2.6.6. The core and i386 patches are updates of George Anzinger's hrtimers-2.6.5-1.0.patch available on SourceForge <http://sourceforge.net/projects/high-res-timers/>. The ppc32 port is not available on SourceForge yet.
My first impression is that it has WAAAAAAAAAAAY too many ifdefs. I would strongly suggest to not make this a config option and just mandatory, it's a core feature that has no point in being optional. If you accept that, the code also becomes a *LOT* cleaner.
Yes, but... The main problem is that this would break all the archs that don't have the needed arch dependent code yet. By making the high-res part depend on the arch config turning on a config, we don't break the archs and they can sign up as they get their act together.
Signature · 3 lines
George Anzinger [email protected] High-res-timers: http://sourceforge.net/projects/high-res-timers/ Preemption patch: http://www.kernel.org/pub/linux/kernel/people/rml
Quoted 18 lines · George Anzinger
Quoted 12 lines · Arjan van de Ven
Quoted 8 lines · Geoff Levand
Available at
http://tree.celinuxforum.org/pubwiki/moin.cgi/CELinux_5fPatchArchiveFor those interested, the set of three patches provide POSIX high-res timer support for linux-2.6.6. The core and i386 patches are updates of George Anzinger's hrtimers-2.6.5-1.0.patch available on SourceForge
<http://sourceforge.net/projects/high-res-timers/>. The ppc32 port is not available on SourceForge yet.Quoted 5 lines
My first impression is that it has WAAAAAAAAAAAY too many ifdefs. I would strongly suggest to not make this a config option and just mandatory, it's a core feature that has no point in being optional. If you accept that, the code also becomes a *LOT* cleaner.
Quoted 4 lines
Yes, but... The main problem is that this would break all the archs that don't have the needed arch dependent code yet. By making the high-res part depend on the arch config turning on a config, we don't break the archs and they can sign up as they get their act together.
if the price is this amount of uglyness then that's the wrong approach imo. Would be nicer to make dummy helpers the arch people can just take during the transition instead.
Quoted 18 lines · Arjan van de Ven
Quoted 16 lines · George Anzinger
Quoted 13 lines · Arjan van de Ven
Quoted 3 lines · Geoff Levand
Available at http://tree.celinuxforum.org/pubwiki/moin.cgi/CELinux_5fPatchArchive
For those interested, the set of three patches provide POSIX high-res timer support for linux-2.6.6. The core and i386 patches are updates of George Anzinger's hrtimers-2.6.5-1.0.patch available on SourceForge <http://sourceforge.net/projects/high-res-timers/>. The ppc32 port is not available on SourceForge yet.
My first impression is that it has WAAAAAAAAAAAY too many ifdefs. I would strongly suggest to not make this a config option and just mandatory, it's a core feature that has no point in being optional. If you accept that, the code also becomes a *LOT* cleaner.
Quoted 6 lines
Quoted 1 line
Yes, but... The main problem is that this would break all the archs that don't have the needed arch dependent code yet. By making the high-res part depend on the arch config turning on a config, we don't break the archs and they can sign up as they get their act together.
if the price is this amount of uglyness then that's the wrong approach imo. Would be nicer to make dummy helpers the arch people can just take during the transition instead.
I have another solution, connected with the ability to turn it off at boot time.
Unsupporting archs would just not define a flag.
Signature · 3 lines
George Anzinger [email protected] High-res-timers: http://sourceforge.net/projects/high-res-timers/ Preemption patch: http://www.kernel.org/pub/linux/kernel/people/rml
Quoted 9 lines · Arjan van de Ven
Quoted 7 lines · George Anzinger
Quoted 5 lines · Arjan van de Ven
Quoted 2 lines · Geoff Levand
Available at http://tree.celinuxforum.org/pubwiki/moin.cgi/CELinux_5fPatchArchive
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 1 line
For those interested, the set of three patches provide POSIX high-res timer support for linux-2.6.6. The core and i386 patches are updates of George Anzinger's hrtimers-2.6.5-1.0.patch available on SourceForge <http://sourceforge.net/projects/high-res-timers/>. The ppc32 port is not available on SourceForge yet.
My first impression is that it has WAAAAAAAAAAAY too many ifdefs. I would strongly suggest to not make this a config option and just mandatory, it's a core feature that has no point in being optional. If you accept that, the code also becomes a *LOT* cleaner.
Can I be so bold as to ask about the changed to the timer list code? Assuming we scrapped all the ifdefs, that is.
I have been thinking of a major rewrite which would leave this code alone, but would introduce an additional list and, of course, overhead for high-res timers.
This will take some time and be sub optimal, so I wonder if it is needed.
Signature · 3 lines
George Anzinger [email protected] High-res-timers: http://sourceforge.net/projects/high-res-timers/ Preemption patch: http://www.kernel.org/pub/linux/kernel/people/rml
Quoted 2 lines · George Anzinger
Can I be so bold as to ask about the changed to the timer list code? Assuming we scrapped all the ifdefs, that is.
I wonder what kind of resolution is needed. I'd love for timers to just be in "absolute time" using some fixed point arith, and then when the timer queue gets run you look at the current time and run all the ones that expired so far. That way you can make the HZ timer irq run this list, but if it's cheap enough and you then want higher accuracy, also the RTC clock, and potentially even some oddball thing like the idle loop or network interrupts for network timers, or video vsync irqs or .. or ..
Quoted 4 lines · George Anzinger
I have been thinking of a major rewrite which would leave this code alone, but would introduce an additional list and, of course, overhead for high-res timers. This will take some time and be sub optimal, so I wonder if it is needed.
What would your goal for the major rewrite be?
Redesign the implementation?
Clean up / re-factor the current design?
Add features?
I've been wondering lately if a significant restructuring of the implementation could be done. Something bottom's up that enabled changing / using different time bases without rebooting and coexisted nicely with HPET.
Something along the lines of;
* abstracting the time base's, calibration and computation of the next interrupt time into a polymorphic interface along with the implementation of a few of your time bases (ACPI, TSC) as a stand allown patch.
* implement yet another polymorphic interface for the interrupt source used by the patch, along with a few interrupt sources (PIT, APIC, HPET <-- new )
* Implement a simple RTC-like charactor driver using the above for testing and integration.
* Finally a patch to integrate the first 3 with the POSIX timers code.
What do you think?
--mgross
Quoted 8 lines · Mark Gross
Quoted 4 lines · George Anzinger
I have been thinking of a major rewrite which would leave this code alone, but would introduce an additional list and, of course, overhead for high-res timers. This will take some time and be sub optimal, so I wonder if it is needed.
Quoted 4 lines
What would your goal for the major rewrite be?
Redesign the implementation?
Clean up / re-factor the current design?
Add features?
Mostly I would like to make it "clean" enough to get the community to accept it.
As I look at the current implemtation, the biggest intrusion into the "normal"
kernel is in the timer list area. Thus, my thinking is to introduce a second or slave list which would only be used by HR timers. This list would be "checked" by putting a "normal" i.e. add_timer, timer in place to mark the jiffie that a HR timer was to expire in. The "check" code would then set up the HR interrupt to expire the timer.
I am also considering removing a lot of the ifdefs one way or another. AND, I think I can make the whole thing configureable at boot time just as the pm/TSC/etc. timers are.
Quoted 5 lines
I've been wondering lately if a significant restructuring of the implementation could be done. Something bottom's up that enabled changing / using different time bases without rebooting and coexisted nicely with HPET.
Something along the lines of;
* abstracting the time base's, calibration and computation of the next interrupt time into a polymorphic interface along with the implementation of a few of your time bases (ACPI, TSC) as a stand allown patch.
Uh, is this something like the current TSC/ pmtimer/ HPET/ PIT selection code in the x86? Or do you have something else in mind here. Given the goal of integration with and inclusion in the kernel.org kernel, I don't want to wander too far from what they are doing now.
Quoted 2 lines
* implement yet another polymorphic interface for the interrupt source used by the patch, along with a few interrupt sources (PIT, APIC, HPET <-- new )
* Implement a simple RTC-like charactor driver using the above for testing and integration.
I am not sure what wants to be done here. I have to keep in mind that x86 is only one of many archs. I would like to keep it as simple as possible in this area. See the include/linux/hrtime.h file for the arch interface we are now using.
Quoted 13 lines
* Finally a patch to integrate the first 3 with the POSIX timers code.
What do you think?
--mgross
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Signature · 3 lines
George Anzinger [email protected] High-res-timers: http://sourceforge.net/projects/high-res-timers/ Preemption patch: http://www.kernel.org/pub/linux/kernel/people/rml
Quoted 20 lines · George Anzinger
Quoted 10 lines · Mark Gross
Quoted 4 lines · George Anzinger
I have been thinking of a major rewrite which would leave this code alone, but would introduce an additional list and, of course, overhead for high-res timers. This will take some time and be sub optimal, so I wonder if it is needed.
What would your goal for the major rewrite be?
Redesign the implementation?
Clean up / re-factor the current design?
Add features?Mostly I would like to make it "clean" enough to get the community to accept it. As I look at the current implemtation, the biggest intrusion into the "normal" kernel is in the timer list area. Thus, my thinking is to introduce a second or slave list which would only be used by HR timers. This list would be "checked" by putting a "normal" i.e.
add_timer, timer in place to mark the jiffie that a HR timer was to expire in. The "check" code would then set up the HR interrupt to expire the timer.
Quoted 4 lines
I am also considering removing a lot of the ifdefs one way or another. AND, I think I can make the whole thing configureable at boot time just as the pm/TSC/etc. timers are.
Sounds good to me. The higher level code can use this type of clean up.
Quoted 10 lines
Quoted 9 lines
I've been wondering lately if a significant restructuring of the implementation could be done. Something bottom's up that enabled changing / using different time bases without rebooting and coexisted nicely with HPET.
Something along the lines of;
* abstracting the time base's, calibration and computation of the next interrupt time into a polymorphic interface along with the implementation of a few of your time bases (ACPI, TSC) as a stand allown patch.
Quoted 5 lines
Uh, is this something like the current TSC/ pmtimer/ HPET/ PIT selection code in the x86? Or do you have something else in mind here. Given the goal of integration with and inclusion in the kernel.org kernel, I don't want to wander too far from what they are doing now.
Sort of but implemented with a dynamic binding as opposed to the current compile time binding via ifdefs.
The current HRT code implements a kind of static / compile time polymorphism that is hard for me to read and keep straight. It implements N time bases, with M interrupt sources for K architectures. Implementing the binding logic between all these at compile time leads to a lot of ifdefs and hard to grok code.
Quoted 10 lines
Quoted 4 lines
* implement yet another polymorphic interface for the interrupt source used by the patch, along with a few interrupt sources (PIT, APIC, HPET <-- new ) * Implement a simple RTC-like charactor driver using the above for testing and integration.
I am not sure what wants to be done here. I have to keep in mind that x86 is only one of many archs. I would like to keep it as simple as possible in this area. See the
include/linux/hrtime.hfile for the arch interface we are now using.
yes but the code in the include/linux/hrtime.h file exports zero abstractions to the architecture independent kernel.
Its mostly a documentation header file, that includes the architecture dependent exports, that then need to be used by the architecture independent code. Its all wrapped up in macros and what not to make it work across a handful of architectures but its still a significant CTAGS work out to follow the logic.
I think that re-working the lower level HRT code to be more object based (like pci and net devices for example) with a layered design would significantly simplify the code and improve the extensibility across architectures and platform hardware time based interrupt sources.
The only performance hit would be that some of the in-lined and compile time macro code would no longer be inline-able.
--mgross
Quoted 48 lines · Mark Gross
Quoted 21 lines · George Anzinger
Quoted 11 lines · Mark Gross
Quoted 4 lines · George Anzinger
I have been thinking of a major rewrite which would leave this code alone, but would introduce an additional list and, of course, overhead for high-res timers. This will take some time and be sub optimal, so I wonder if it is needed.
What would your goal for the major rewrite be?
Redesign the implementation?
Clean up / re-factor the current design?
Add features?Mostly I would like to make it "clean" enough to get the community to
accept it. As I look at the current implemtation, the biggest intrusion
into the "normal" kernel is in the timer list area. Thus, my thinking is
to introduce a second or slave list which would only be used by HR timers. This list would be "checked" by putting a "normal" i.e.add_timer, timer in place to mark the jiffie that a HR timer was to expire in. The "check"
code would then set up the HR interrupt to expire the timer.Quoted 3 lines
I am also considering removing a lot of the ifdefs one way or another. AND, I think I can make the whole thing configureable at boot time just as the pm/TSC/etc. timers are.
Sounds good to me. The higher level code can use this type of clean up.
Quoted 10 lines
Quoted 9 lines
I've been wondering lately if a significant restructuring of the implementation could be done. Something bottom's up that enabled changing / using different time bases without rebooting and coexisted nicely with HPET.
Something along the lines of;
* abstracting the time base's, calibration and computation of the next interrupt time into a polymorphic interface along with the implementation of a few of your time bases (ACPI, TSC) as a stand allown patch.Quoted 5 lines
Uh, is this something like the current TSC/ pmtimer/ HPET/ PIT selection code in the x86? Or do you have something else in mind here. Given the goal of integration with and inclusion in the kernel.org kernel, I don't want to wander too far from what they are doing now.
Quoted 4 lines
Sort of but implemented with a dynamic binding as opposed to the current compile time binding via ifdefs.
The current HRT code implements a kind of static / compile time polymorphism that is hard for me to read and keep straight. It implements N time bases, with M interrupt sources for K architectures. Implementing the binding logic between all these at compile time leads to a lot of ifdefs and hard to grok code.
What the 2.6 x86 timer code does is to "try" different clocks until they find one that "accepts" the job. A boot time option can override this to force a given clock, but all are compile in. (By the way, the first machine I wrote code for had a total of 8K bytes, so I really don't like to waste memory :))
I started to do this with the latest patch but stopped when I realized that I would have to redo the conversion code. Still, this isn't too hard and I may finish this conversion. This would eliminate the pm/ TSC configure option AND allow the user to completly eliminate the HR (buy choosing a non-HR option at boot time), which, by the way, he can do now.
Quoted 14 lines
Quoted 7 lines
Quoted 6 lines
* implement yet another polymorphic interface for the interrupt source used by the patch, along with a few interrupt sources (PIT, APIC, HPET <-- new ) * Implement a simple RTC-like charactor driver using the above for testing and integration.
Quoted 5 lines
I am not sure what wants to be done here. I have to keep in mind that x86 is only one of many archs. I would like to keep it as simple as possible in this area. See the
include/linux/hrtime.hfile for the arch interface we are now using.
Quoted 5 lines
yes but the code in the
include/linux/hrtime.hfile exports zero abstractions to the architecture independent kernel.Its mostly a documentation header file, that includes the architecture dependent exports, that then need to be used by the architecture independent code. Its all wrapped up in macros and what not to make it work across a handful of architectures but its still a significant CTAGS work out to follow the logic.
I think that re-working the lower level HRT code to be more object based (like pci and net devices for example) with a layered design would significantly simplify the code and improve the extensibility across architectures and platform hardware time based interrupt sources.
I haven't looked at pci or net stuff lately, but my attmept to export the conversion_bits structure was dissed by the arch folks, so I went for just what was needed. Some of them don't export a conversion to micro seconds conversion, for example. I welcome more details...
George
Quoted 5 lines
The only performance hit would be that some of the in-lined and compile time macro code would no longer be inline-able.
--mgross
Signature · 3 lines
George Anzinger [email protected] High-res-timers: http://sourceforge.net/projects/high-res-timers/ Preemption patch: http://www.kernel.org/pub/linux/kernel/people/rml
Quoted 60 lines · George Anzinger
Quoted 44 lines · Mark Gross
Quoted 21 lines · George Anzinger
Quoted 10 lines · Mark Gross
Quoted 4 lines · George Anzinger
I have been thinking of a major rewrite which would leave this code alone, but would introduce an additional list and, of course, overhead for high-res timers. This will take some time and be sub optimal, so I wonder if it is needed.
What would your goal for the major rewrite be?
Redesign the implementation?
Clean up / re-factor the current design?
Add features?Mostly I would like to make it "clean" enough to get the community to accept it. As I look at the current implemtation, the biggest intrusion into the "normal" kernel is in the timer list area. Thus, my thinking is to introduce a second or slave list which would only be used by HR timers. This list would be "checked" by putting a "normal" i.e.
add_timer, timer in place to mark the jiffie that a HR timer was to expire in. The "check" code would then set up the HR interrupt to expire the timer.Quoted 3 lines
I am also considering removing a lot of the ifdefs one way or another. AND, I think I can make the whole thing configureable at boot time just as the pm/TSC/etc. timers are.
Sounds good to me. The higher level code can use this type of clean up.
Quoted 11 lines
Quoted 10 lines
I've been wondering lately if a significant restructuring of the implementation could be done. Something bottom's up that enabled changing / using different time bases without rebooting and coexisted nicely with HPET.
Something along the lines of;
* abstracting the time base's, calibration and computation of the next interrupt time into a polymorphic interface along with the implementation of a few of your time bases (ACPI, TSC) as a stand allown patch.Quoted 4 lines
Uh, is this something like the current TSC/ pmtimer/ HPET/ PIT selection code in the x86? Or do you have something else in mind here. Given the goal of integration with and inclusion in the kernel.org kernel, I don't want to wander too far from what they are doing now.
Quoted 8 lines
Sort of but implemented with a dynamic binding as opposed to the current compile time binding via ifdefs.
The current HRT code implements a kind of static / compile time polymorphism that is hard for me to read and keep straight. It implements N time bases, with M interrupt sources for K architectures. Implementing the binding logic between all these at compile time leads to a lot of ifdefs and hard to grok code.
What the 2.6 x86 timer code does is to "try" different clocks until they find one that "accepts" the job. A boot time option can override this to force a given clock, but all are compile in. (By the way, the first machine I wrote code for had a total of 8K bytes, so I really don't like to waste memory :))
Quoted 6 lines
I started to do this with the latest patch but stopped when I realized that I would have to redo the conversion code. Still, this isn't too hard and I may finish this conversion. This would eliminate the pm/ TSC configure option AND allow the user to completly eliminate the HR (buy choosing a non-HR option at boot time), which, by the way, he can do now.
Eliminating the PM/TSC configure option idea sounds good to me. Are you talking about the code your private codebase or the patch from SF for 2.6.5?
The code I'm looking at can't really do this, for the various time bases. It chooses between including the conversion code from hrtime-Macpi.h ^htrime-M586.h at compile time. There can be no "try" different clocks with
this linkage to the conversion code.
get_jiffies_time macro, is statically linked to get_arch_cycles who's implementation id dependent on which hrtime-M*.h is included in at build time. Further the interpretation of "sub_left" is a function of the same build time configuration setting.
Grepping on USE_APIC_TIMERS shows more of the compile time ifdef code. It cannot use APIC clocks unless its compiled into the kernel there can be no "try" different timers WRT the APIC timer.
Quoted 24 lines
Quoted 19 lines
Quoted 9 lines
Quoted 4 lines
* implement yet another polymorphic interface for the interrupt source used by the patch, along with a few interrupt sources (PIT, APIC, HPET <-- new ) * Implement a simple RTC-like charactor driver using the above for testing and integration.
I am not sure what wants to be done here. I have to keep in mind that x86 is only one of many archs. I would like to keep it as simple as possible in this area. See the
include/linux/hrtime.hfile for the arch interface we are now using.yes but the code in the
include/linux/hrtime.hfile exports zero abstractions to the architecture independent kernel.Its mostly a documentation header file, that includes the architecture dependent exports, that then need to be used by the architecture independent code. Its all wrapped up in macros and what not to make it work across a handful of architectures but its still a significant CTAGS work out to follow the logic.
Quoted 4 lines
I think that re-working the lower level HRT code to be more object based (like pci and net devices for example) with a layered design would significantly simplify the code and improve the extensibility across architectures and platform hardware time based interrupt sources.
Quoted 5 lines
I haven't looked at pci or net stuff lately, but my attmept to export the
conversion_bitsstructure was dissed by the arch folks, so I went for just what was needed. Some of them don't export a conversion to micro seconds conversion, for example. I welcome more details...
Details... Thats a hard thing to come by when in a high level design discussion.
Its too bad the conversion_bits export got shot down. Perhaps it was because you where exporting a data structure that made implicit assumptions rather than a more object based interface, with function pointers to conversion functions, and private data?
Regardless of doing an object based implementation of your design or not, if we could loose the #ifdefs and implicit ifdefs (i.e. IF_HIGH_RES) from the code (especially posix-timers.c) that would be really a good thing.
I do still like the object based design concept ;)
--mgross
Quoted 74 lines · Mark Gross
Quoted 64 lines · George Anzinger
Quoted 48 lines · Mark Gross
Quoted 23 lines · George Anzinger
Quoted 11 lines · Mark Gross
Quoted 4 lines · George Anzinger
I have been thinking of a major rewrite which would leave this code alone, but would introduce an additional list and, of course, overhead for high-res timers. This will take some time and be sub optimal, so I wonder if it is needed.
What would your goal for the major rewrite be?
Redesign the implementation?
Clean up / re-factor the current design?
Add features?Mostly I would like to make it "clean" enough to get the community to accept it. As I look at the current implemtation, the biggest intrusion into the "normal" kernel is in the timer list area. Thus, my thinking is to introduce a second or slave list which would only be used by HR timers. This list would be "checked" by putting a "normal" i.e.
add_timer, timer in place to mark the jiffie that a HR timer was to expire in. The "check" code would then set up the HR interrupt to expire the timer.Quoted 3 lines
I am also considering removing a lot of the ifdefs one way or another. AND, I think I can make the whole thing configureable at boot time just as the pm/TSC/etc. timers are.
Sounds good to me. The higher level code can use this type of clean up.
Quoted 11 lines
Quoted 10 lines
I've been wondering lately if a significant restructuring of the implementation could be done. Something bottom's up that enabled changing / using different time bases without rebooting and coexisted nicely with HPET.
Something along the lines of;
* abstracting the time base's, calibration and computation of the next interrupt time into a polymorphic interface along with the implementation of a few of your time bases (ACPI, TSC) as a stand allown patch.Quoted 4 lines
Uh, is this something like the current TSC/ pmtimer/ HPET/ PIT selection code in the x86? Or do you have something else in mind here. Given the goal of integration with and inclusion in the kernel.org kernel, I don't want to wander too far from what they are doing now.
Quoted 7 lines
Sort of but implemented with a dynamic binding as opposed to the current compile time binding via ifdefs.
The current HRT code implements a kind of static / compile time
polymorphism that is hard for me to read and keep straight. It
implements N time bases, with M interrupt sources for K architectures. Implementing the binding logic between all these at compile time leads to a lot of ifdefs and hard to grok code.What the 2.6 x86 timer code does is to "try" different clocks until they find one that "accepts" the job. A boot time option can override this to force a given clock, but all are compile in. (By the way, the first machine I wrote code for had a total of 8K bytes, so I really don't like to waste memory :))
Quoted 6 lines
I started to do this with the latest patch but stopped when I realized that I would have to redo the conversion code. Still, this isn't too hard and I may finish this conversion. This would eliminate the pm/ TSC configure option AND allow the user to completly eliminate the HR (buy choosing a non-HR option at boot time), which, by the way, he can do now.
Quoted 1 line
Eliminating the PM/TSC configure option idea sounds good to me. Are you talking about the code your private codebase or the patch from SF for 2.6.5?
I started to to this in the 2.6.5 patch. Some of it is still there, in that you can, at boot time, switch to one of the standard clocks and thus disable HRT (or I think you can as I have not tested this).
Quoted 2 lines
The code I'm looking at can't really do this, for the various time bases. It chooses between including the conversion code from
hrtime-Macpi.h^htrime-M586.hat compile time. There can be no "try" different clocks with this linkage to the conversion code.
Yes, I was looking at merging these two when I realized that the big thing they provide is different conversion routines. Lately, however, I have been thinking that we can use the same routines and just changed the conversion_bits.
Quoted 2 lines
get_jiffies_timemacro, is statically linked toget_arch_cycleswho's implementation id dependent on which hrtime-M*.h is included in at build time. Further the interpretation of "sub_left" is a function of the same build time configuration setting.
I would like to handle this by using something like the timer get nanosecond stuff in the standard timers.
By the way, I have been talking to John Stultz about changing the code for gettimeofday to get nanoseconds and add that to xtime and THEN do the truncate to microseconds. This would change the timers call interface as well.
Quoted 2 lines
Grepping on
USE_APIC_TIMERSshows more of the compile time ifdef code. It cannot use APIC clocks unless its compiled into the kernel there can be no "try" different timers WRT the APIC timer.
I had not considered not using the APIC timer if it was available. Its availablity is a compile time thing. It is used for both PM and TSC clocks and, I would assume, HPET when ever I get such a machine.
Quoted 33 lines
Quoted 26 lines
Quoted 21 lines
Quoted 11 lines
Quoted 6 lines
* implement yet another polymorphic interface for the interrupt source used by the patch, along with a few interrupt sources (PIT, APIC, HPET <-- new ) * Implement a simple RTC-like charactor driver using the above for testing and integration.
I am not sure what wants to be done here. I have to keep in mind that x86 is only one of many archs. I would like to keep it as simple as possible in this area. See the
include/linux/hrtime.hfile for the arch interface we are now using.yes but the code in the
include/linux/hrtime.hfile exports zero abstractions to the architecture independent kernel.Its mostly a documentation header file, that includes the architecture dependent exports, that then need to be used by the architecture independent code. Its all wrapped up in macros and what not to make it work across a handful of architectures but its still a significant CTAGS work out to follow the logic.
Quoted 4 lines
I think that re-working the lower level HRT code to be more object based (like pci and net devices for example) with a layered design would significantly simplify the code and improve the extensibility across architectures and platform hardware time based interrupt sources.
Quoted 5 lines
I haven't looked at pci or net stuff lately, but my attmept to export the
conversion_bitsstructure was dissed by the arch folks, so I went for just what was needed. Some of them don't export a conversion to micro seconds conversion, for example. I welcome more details...
Quoted 3 lines
Details... Thats a hard thing to come by when in a high level design discussion.
Its too bad the
conversion_bitsexport got shot down. Perhaps it was because you where exporting a data structure that made implicit assumptions rather than a more object based interface, with function pointers to conversion functions, and private data?
The functions, of course, were also exported. But this is exported from the arch side of things and not the base. They need to provide the conversion functions, the bits just being somthing that is needed if they export inline code, where as, if they export the functions, they don't need the bits (i.e. they are private). I rather like to export inline code as it is about twice as fast (I would guess).
Quoted 4 lines
Regardless of doing an object based implementation of your design or not, if we could loose the #ifdefs and implicit ifdefs (i.e.
IF_HIGH_RES) from the code (especiallyposix-timers.c) that would be really a good thing.I do still like the object based design concept ;)
I am afraid I am too old :( I rather think I understand object based code while not finding it very "warm". I have never written anything large that way and find myself objecting in the name of performance, but then, as I said, I may be too old.
George Anzinger [email protected]
High-res-timers: http://sourceforge.net/projects/high-res-timers/ Preemption patch: http://www.kernel.org/pub/linux/kernel/people/rml
Quoted 8 lines · George Anzinger
Quoted 7 lines
Details... Thats a hard thing to come by when in a high level design discussion.
Its too bad the
conversion_bitsexport got shot down. Perhaps it was because you where exporting a data structure that made implicit assumptions rather than a more object based interface, with function pointers to conversion functions, and private data?
Quoted 6 lines
The functions, of course, were also exported. But this is exported from the arch side of things and not the base. They need to provide the conversion functions, the bits just being somthing that is needed if they export inline code, where as, if they export the functions, they don't need the bits (i.e. they are private). I rather like to export inline code as it is about twice as fast (I would guess).
I think if in-lines are exported through more than one level of indirection through include files then the code is hard to grok.
Quoted 11 lines
Quoted 6 lines
Regardless of doing an object based implementation of your design or not, if we could loose the #ifdefs and implicit ifdefs (i.e.
IF_HIGH_RES) from the code (especiallyposix-timers.c) that would be really a good thing.I do still like the object based design concept ;)
I am afraid I am too old :( I rather think I understand object based code
while not finding it very "warm". I have never written anything large
that way and find myself objecting in the name of performance, but then, as I said, I may be too old.
Object based code good for some things, and not for others. I think it could be a good match this code, but I bet it can be done well other ways as too.
I think without exporting abstractions (even just prototypes) that are common across architectures, timebases and interrupt source you will get into #ifdef hell with this code.
--mgross
Quoted 20 lines · Mark Gross
Quoted 4 lines · George Anzinger
I have been thinking of a major rewrite which would leave this code alone, but would introduce an additional list and, of course, overhead for high-res timers. This will take some time and be sub optimal, so I wonder if it is needed.
What would your goal for the major rewrite be?
Redesign the implementation?
Clean up / re-factor the current design?
Add features?I've been wondering lately if a significant restructuring of the implementation could be done. Something bottom's up that enabled changing / using different time bases without rebooting and coexisted nicely with HPET.
Something along the lines of;
* abstracting the time base's, calibration and computation of the next interrupt time into a polymorphic interface along with the implementation of a few of your time bases (ACPI, TSC) as a stand allown patch.
* implement yet another polymorphic interface for the interrupt source used by the patch, along with a few interrupt sources (PIT, APIC, HPET <-- new )
* Implement a simple RTC-like charactor driver using the above for testing and integration. * Finally a patch to integrate the first 3 with the POSIX timers code.
Quoted 5 lines
What do you think?
--mgross
Mark,
Generally I agree with your ideas on what needs fixing up, but I'm concerned that the run-time binding of this kind of design would have too much overhead for time-critical code paths. Do you think it is useful to have run-time selection of the time base and interrupt source?
In my work we have a known fixed hardware configuration that has
limited timers, so I don't really see a need for runtime configuration there.
-Geoff
Quoted 26 lines · Geoff Levand
Quoted 24 lines · Mark Gross
Quoted 4 lines · George Anzinger
I have been thinking of a major rewrite which would leave this code alone, but would introduce an additional list and, of course, overhead for high-res timers. This will take some time and be sub optimal, so I wonder if it is needed.
What would your goal for the major rewrite be?
Redesign the implementation?
Clean up / re-factor the current design?
Add features?I've been wondering lately if a significant restructuring of the implementation could be done. Something bottom's up that enabled changing / using different time bases without rebooting and coexisted nicely with HPET.
Something along the lines of;
* abstracting the time base's, calibration and computation of the next interrupt time into a polymorphic interface along with the implementation of a few of your time bases (ACPI, TSC) as a stand allown patch.
* implement yet another polymorphic interface for the interrupt source used by the patch, along with a few interrupt sources (PIT, APIC, HPET <-- new )
* Implement a simple RTC-like charactor driver using the above for testing and integration. * Finally a patch to integrate the first 3 with the POSIX timers code.What do you think?
Quoted 8 lines
Quoted 2 lines
--mgross
Mark,
Generally I agree with your ideas on what needs fixing up, but I'm concerned that the run-time binding of this kind of design would have too much overhead for time-critical code paths. Do you think it is useful to have run-time selection of the time base and interrupt source?
In my work we have a known fixed hardware configuration that has
limited timers, so I don't really see a need for runtime configuration there.
Well, I don't see much added overhead, (save memory). We already dispatch interrupts via indirect function calls in irq.c. And the core clock functions (used by gettimeofday, for example) are also indirected today (this to allow pm-timer, TSC, or PIT at boot time). All we would do is put both of our possibilities in the list. The only place we add overhead is in an indirect to the "proper" hardware timer for the sub-jiffie interrupt.
Signature · 3 lines
George Anzinger [email protected] High-res-timers: http://sourceforge.net/projects/high-res-timers/ Preemption patch: http://www.kernel.org/pub/linux/kernel/people/rml
Quoted 32 lines · George Anzinger
Quoted 30 lines · Geoff Levand
Quoted 27 lines · Mark Gross
Quoted 4 lines · George Anzinger
I have been thinking of a major rewrite which would leave this code alone, but would introduce an additional list and, of course, overhead for high-res timers. This will take some time and be sub optimal, so I wonder if it is needed.
What would your goal for the major rewrite be?
Redesign the implementation?
Clean up / re-factor the current design?
Add features?I've been wondering lately if a significant restructuring of the implementation could be done. Something bottom's up that enabled changing / using different time bases without rebooting and coexisted nicely with HPET.
Something along the lines of;
* abstracting the time base's, calibration and computation of the next interrupt time into a polymorphic interface along with the implementation of a few of your time bases (ACPI, TSC) as a stand allown patch.
* implement yet another polymorphic interface for the interrupt source used by the patch, along with a few interrupt sources (PIT, APIC, HPET <-- new )
* Implement a simple RTC-like charactor driver using the above for testing and integration. * Finally a patch to integrate the first 3 with the POSIX timers code.What do you think?
--mgross
Quoted 7 lines
Quoted 3 lines
Mark,
Generally I agree with your ideas on what needs fixing up, but I'm concerned that the run-time binding of this kind of design would have too much overhead for time-critical code paths. Do you think it is useful to have run-time selection of the time base and interrupt source? In my work we have a known fixed hardware configuration that has limited timers, so I don't really see a need for runtime configuration there.
Well, I don't see much added overhead, (save memory). We already dispatch interrupts via indirect function calls in
irq.c. And the core clock functions (used by gettimeofday, for example) are also indirected today (this to allow pm-timer, TSC, or PIT at boot time). All we would do is put both of our possibilities in the list. The only place we add overhead is in an indirect to the "proper" hardware timer for the sub-jiffie interrupt.
If that's the case, then Mark's proposal sounds like a good way to abstract the arch dependent code. Someone mentioned to me that distro vendors would like the idea of runtime configuration because they could use a single kernel binary to support many different hardware configurations. I suppose if needed some optimization can be done later.
Mark, do you have time to do a first cut at the interfaces? It seems you've been thinking about this, and I'd like to see your ideas. It would be great if you could put together a sample hrtime.h. If you are short on time, I could put something together, but I think you are the guy to do this.
From what I've been told, Renesas did an HRT port to the SH arch on a recent kernel. I'm trying to get the code so that there will be three arch's (i386, ppc32 & sh) to work against when doing the arch independent interface.
Another thing that seems to be a sore point is the HRT core. I think there's a good consensus that the current use of preprocessor conditionals makes the code pretty hairy, but what alternatives are there?
If the HRT code is always compiled in, that would simplify things alot, but then there would always be a small performance hit in the compares, and a slightly bigger code size. Is this acceptable? Also, something would need to be arranged to take care of the non-supported arch's. Any ideas here?
Another way would be to pull out the HRT operations into separate functions that could be conditionally included or replaced with no-op versions based on a config option. I don't know if this would be do-able, or if the result would be very clean though...
George also mentioned an idea of a second 'timer slave list'. Any other ideas here?
-Geoff
Quoted 5 lines
Another thing that seems to be a sore point is the HRT core. I think there's a good consensus that the current use of preprocessor conditionals makes the code pretty hairy, but what alternatives are there?
The way to handle this is to abstract the needed interface into a set of inline's in one place (hrtime.h) then something like
#ifdef CONFIG_HIRES_TIMERS
static inline void update_hires(struct foo *foo) {
foo->sub_tick = ...
}#else
static inline void update_hires(struct foo *foo) { }
#endif
Quoted 5 lines
If the HRT code is always compiled in, that would simplify things alot, but then there would always be a small performance hit in the compares, and a slightly bigger code size. Is this acceptable? Also, something would need to be arranged to take care of the non-supported arch's. Any ideas here?
There are two different questions. Should size of structures change based on config options, that is what tends to make binaries break. The other is whether the sub-tick stuff is implemented or not.
Quoted 4 lines
Another way would be to pull out the HRT operations into separate functions that could be conditionally included or replaced with no-op versions based on a config option. I don't know if this would be do-able, or if the result would be very clean though...
It is best if the conditional code is in only a few of places, like the inline's in an one include file; and the main code in timers plus any arch dependant stuff.
Signature · 2 lines
Stephen Hemminger mailto:[email protected] Open Source Development Lab http://developer.osdl.org/shemminger
Quoted 44 lines · Geoff Levand
Quoted 33 lines · George Anzinger
Quoted 31 lines · Geoff Levand
Quoted 28 lines · Mark Gross
Quoted 4 lines · George Anzinger
I have been thinking of a major rewrite which would leave this code alone, but would introduce an additional list and, of course, overhead for high-res timers. This will take some time and be sub optimal, so I wonder if it is needed.
What would your goal for the major rewrite be?
Redesign the implementation?
Clean up / re-factor the current design?
Add features?I've been wondering lately if a significant restructuring of the implementation could be done. Something bottom's up that enabled changing / using different time bases without rebooting and coexisted nicely with HPET.
Something along the lines of;
* abstracting the time base's, calibration and computation of the next interrupt time into a polymorphic interface along with the implementation of a few of your time bases (ACPI, TSC) as a stand allown patch.
* implement yet another polymorphic interface for the interrupt source used by the patch, along with a few interrupt sources (PIT, APIC, HPET <-- new )
* Implement a simple RTC-like charactor driver using the above for testing and integration. * Finally a patch to integrate the first 3 with the POSIX timers code.What do you think?
--mgross
Quoted 8 lines
Quoted 3 lines
Mark,
Generally I agree with your ideas on what needs fixing up, but I'm concerned that the run-time binding of this kind of design would have too much overhead for time-critical code paths. Do you think it is useful to have run-time selection of the time base and interrupt source? In my work we have a known fixed hardware configuration that has limited timers, so I don't really see a need for runtime configuration there.
Well, I don't see much added overhead, (save memory). We already dispatch interrupts via indirect function calls in
irq.c. And the core clock functions (used by gettimeofday, for example) are also indirected today (this to allow pm-timer, TSC, or PIT at boot time). All we would do is put both of our possibilities in the list. The only place we add overhead is in an indirect to the "proper" hardware timer for the sub-jiffie interrupt.
Quoted 6 lines
If that's the case, then Mark's proposal sounds like a good way to abstract the arch dependent code. Someone mentioned to me that distro vendors would like the idea of runtime configuration because they could use a single kernel binary to support many different hardware configurations. I suppose if needed some optimization can be done later.
Mark, do you have time to do a first cut at the interfaces? It seems you've been thinking about this, and I'd like to see your ideas. It would be great if you could put together a sample
hrtime.h. If you are short on time, I could put something together, but I think you are the guy to do this.From what I've been told, Renesas did an HRT port to the SH arch on a
recent kernel. I'm trying to get the code so that there will be three arch's (i386, ppc32 & sh) to work against when doing the arch independent interface.
MV has ported HRT to PPC, MIPS, and, I think, a couple of ARM processors.
Quoted 4 lines
Another thing that seems to be a sore point is the HRT core. I think there's a good consensus that the current use of preprocessor conditionals makes the code pretty hairy, but what alternatives are there?
If the HRT code is always compiled in, that would simplify things alot, but then there would always be a small performance hit in the compares, and a slightly bigger code size. Is this acceptable? Also, something would need to be arranged to take care of the non-supported arch's. Any ideas here?
I think the best thing is to include an include/asm/hrtime.h in each arch. The file could be empty. (I, at one time, suggested a modification of the build environment such that such a file could be put in the asm-generic/ directory and would be found if no such file was found in the archs asm/ directory, but, alas, the powers that be DID NOT LIKE THAT.) In any case, this would allow the including file (include/hrtime.h) to determine that the arch was not supported (i.e. it did not define the required functions) and define dummys that would satisfy the externals and also prevent the registration of the HR clocks.
Quoted 2 lines
Another way would be to pull out the HRT operations into separate functions that could be conditionally included or replaced with no-op versions based on a config option. I don't know if this would be do-able, or if the result would be very clean though...
As it stands "most" timer and clock functions are dispatched through the k_clocks array. We don't use different functions here at this time except for the monotonic clock_settime(), but, if we wanted to duplicate most of the code, this might be a way to go. (Note, that the current code has a test for existence of the function address and uses a default if no such exists. This was to avoid the indirect function call which, I think, is rather expensive.)
Quoted 2 lines
George also mentioned an idea of a second 'timer slave list'. Any other ideas here?
I am tempted to send a message to Linus on this issue. The problem is that separating the two lists adds overhead and is just not the clean way to do it. The up side is that those who don't want HRT will see less impact on the normal timer code.
Oh, and by the way, I welcome all the help you can give on these issues. Thanks.
Signature · 3 lines
George Anzinger [email protected] High-res-timers: http://sourceforge.net/projects/high-res-timers/ Preemption patch: http://www.kernel.org/pub/linux/kernel/people/rml
I'm thinking we should drop this discussion from LKML, and start a new thread on the high-res-timers-discourse list. If anyone has an interest, please join us there:
<https://lists.sourceforge.net/lists/listinfo/high-res-timers-discourse>
-Geoff
Quoted 79 lines · George Anzinger
Quoted 46 lines · Geoff Levand
Quoted 34 lines · George Anzinger
Quoted 32 lines · Geoff Levand
Quoted 29 lines · Mark Gross
Quoted 4 lines · George Anzinger
I have been thinking of a major rewrite which would leave this code alone, but would introduce an additional list and, of course, overhead for high-res timers. This will take some time and be sub optimal, so I wonder if it is needed.
What would your goal for the major rewrite be?
Redesign the implementation?
Clean up / re-factor the current design?
Add features?I've been wondering lately if a significant restructuring of the implementation could be done. Something bottom's up that enabled changing / using different time bases without rebooting and coexisted nicely with HPET.
Something along the lines of;
* abstracting the time base's, calibration and computation of the next interrupt time into a polymorphic interface along with the implementation of a few of your time bases (ACPI, TSC) as a stand allown patch.
* implement yet another polymorphic interface for the interrupt source used by the patch, along with a few interrupt sources (PIT, APIC, HPET <-- new )
* Implement a simple RTC-like charactor driver using the above for testing and integration. * Finally a patch to integrate the first 3 with the POSIX timers code.What do you think?
--mgross
Quoted 9 lines
Quoted 3 lines
Mark,
Generally I agree with your ideas on what needs fixing up, but I'm concerned that the run-time binding of this kind of design would have too much overhead for time-critical code paths. Do you think it is useful to have run-time selection of the time base and interrupt source? In my work we have a known fixed hardware configuration that has limited timers, so I don't really see a need for runtime configuration there.
Well, I don't see much added overhead, (save memory). We already dispatch interrupts via indirect function calls in
irq.c. And the core clock functions (used by gettimeofday, for example) are also indirected today (this to allow pm-timer, TSC, or PIT at boot time). All we would do is put both of our possibilities in the list. The only place we add overhead is in an indirect to the "proper" hardware timer for the sub-jiffie interrupt.Quoted 6 lines
If that's the case, then Mark's proposal sounds like a good way to abstract the arch dependent code. Someone mentioned to me that distro vendors would like the idea of runtime configuration because they could use a single kernel binary to support many different hardware configurations. I suppose if needed some optimization can be done later.
Mark, do you have time to do a first cut at the interfaces? It seems you've been thinking about this, and I'd like to see your ideas. It would be great if you could put together a sample
hrtime.h. If you are short on time, I could put something together, but I think you are the guy to do this.From what I've been told, Renesas did an HRT port to the SH arch on a
recent kernel. I'm trying to get the code so that there will be three arch's (i386, ppc32 & sh) to work against when doing the arch independent interface.MV has ported HRT to PPC, MIPS, and, I think, a couple of ARM processors.
Quoted 4 lines
Another thing that seems to be a sore point is the HRT core. I think there's a good consensus that the current use of preprocessor conditionals makes the code pretty hairy, but what alternatives are there?
If the HRT code is always compiled in, that would simplify things alot, but then there would always be a small performance hit in the compares, and a slightly bigger code size. Is this acceptable? Also, something would need to be arranged to take care of the non-supported arch's. Any ideas here?
I think the best thing is to include an
include/asm/hrtime.hin each arch. The file could be empty. (I, at one time, suggested a modification of the build environment such that such a file could be put in the asm-generic/ directory and would be found if no such file was found in the archs asm/ directory, but, alas, the powers that be DID NOT LIKE THAT.) In any case, this would allow the including file (include/hrtime.h) to determine that the arch was not supported (i.e. it did not define the required functions) and define dummys that would satisfy the externals and also prevent the registration of the HR clocks.Quoted 2 lines
Another way would be to pull out the HRT operations into separate functions that could be conditionally included or replaced with no-op versions based on a config option. I don't know if this would be do-able, or if the result would be very clean though...
As it stands "most" timer and clock functions are dispatched through the
k_clocksarray. We don't use different functions here at this time except for the monotonicclock_settime(), but, if we wanted to duplicate most of the code, this might be a way to go. (Note, that the current code has a test for existence of the function address and uses a default if no such exists. This was to avoid the indirect function call which, I think, is rather expensive.)Quoted 2 lines
George also mentioned an idea of a second 'timer slave list'. Any other ideas here?
I am tempted to send a message to Linus on this issue. The problem is that separating the two lists adds overhead and is just not the clean way to do it. The up side is that those who don't want HRT will see less impact on the normal timer code.
Oh, and by the way, I welcome all the help you can give on these issues. Thanks.
A message that is not in the archive (sent off-list or not yet received): [email protected]
[ANNOUNCE] high-res-timers patch
For those interested, I migrated George Anzinger's high-res-timers patch to linux-2.6.8.1.
Available at:
<http://tree.celinuxforum.org/pubwiki/moin.cgi/PatchArchive>
The set of patches provide POSIX high resolution timer support. See the SourceForge project pages for more info: <http://sourceforge.net/projects/high-res-timers/>.
-Geoff
[ANNOUNCE] high-res-timers patch
In reply to a message not in the archiveFor those interested, I prepared a set of high resolution timers patches against linux-2.6.9:
<http://sourceforge.net/project/showfiles.php?group_id=20460&package_id=63076&release_id=280281>
New for this release is support for the SH architecture. This SH support is to be considered experimental though. Please send comments to the project mailing list:
This set of patches provide POSIX high resolution timer support. For more info see the SourceForge project pages:
<http://sourceforge.net/projects/high-res-timers/>.
-Geoff
Quoted 62 lines · Geoff Levand
Quoted 47 lines · George Anzinger
Quoted 38 lines · Geoff Levand
Quoted 30 lines · Mark Gross
Quoted 6 lines · George Anzinger
I have been thinking of a major rewrite which would leave this code alone,
but would introduce an additional list and, of course, overhead for high-res timers. This will take some time and be sub optimal, so I wonder
if it is needed.What would your goal for the major rewrite be?
Redesign the implementation?
Clean up / re-factor the current design?
Add features?I've been wondering lately if a significant restructuring of the implementation could be done. Something bottom's up that enabled changing / using different time bases without rebooting and coexisted nicely with HPET.
Something along the lines of;
* abstracting the time base's, calibration and computation of the next interrupt time into a polymorphic interface along with the implementation of a few of your time bases (ACPI, TSC) as a stand allown patch.
* implement yet another polymorphic interface for the interrupt source used by the patch, along with a few interrupt sources (PIT, APIC, HPET <-- new )
* Implement a simple RTC-like charactor driver using the above for testing and integration. * Finally a patch to integrate the first 3 with the POSIX timers code.Quoted 4 lines
What do you think?
--mgross
Mark,
Quoted 7 lines
Generally I agree with your ideas on what needs fixing up, but I'm concerned that the run-time binding of this kind of design would have too much overhead for time-critical code paths. Do you think it is useful to have run-time selection of the time base and interrupt
source? In my work we have a known fixed hardware configuration that
has limited timers, so I don't really see a need for runtime configuration there.Quoted 7 lines
Well, I don't see much added overhead, (save memory). We already dispatch interrupts via indirect function calls in
irq.c. And the core clock functions (used by gettimeofday, for example) are also indirected today (this to allow pm-timer, TSC, or PIT at boot time). All we would do is put both of our possibilities in the list. The only place we add overhead is in an indirect to the "proper" hardware timer for the sub-jiffie interrupt.If that's the case, then Mark's proposal sounds like a good way to abstract the arch dependent code. Someone mentioned to me that distro vendors would like the idea of runtime configuration because they could use a single kernel binary to support many different hardware configurations. I suppose if needed some optimization can be done later.
Quoted 3 lines
Mark, do you have time to do a first cut at the interfaces? It seems you've been thinking about this, and I'd like to see your ideas. It would be great if you could put together a sample
hrtime.h. If you are
I'm sorry, but I'm very much behind schedule on the ipw2200 driver and shouldn't even be taking the time to read LKML right now. And likely won't for a while.
However; I was thinking of a simple structure with a few function pionters and perhaps some data, a pointer to arch specific private data.
struct {
void *hrt_arch_priv; /* <-- perhaps not useful TBD */
function pointer to time convertion function to sub_jiffies hrt_to_sub_jiffies(...);
function pointer to get number of sub_jiffies since last jiffie hrt_sub_jiffies();
function pointer to setting next initerrupt hrt_program_int( sub_jiffes_from_now);
function pointer to getting current drift between system clock and hrt time base hrt_drift(...);
function pointer to drift correction WRT system clock hrt_sync(...);
};It would be easiest to grock if sub_jiffies units where fixed, say nano or micro seconds.
--mgross
Quoted 37 lines
short on time, I could put something together, but I think you are the guy to do this.
From what I've been told, Renesas did an HRT port to the SH arch on a
recent kernel. I'm trying to get the code so that there will be three arch's (i386, ppc32 & sh) to work against when doing the arch independent interface.Another thing that seems to be a sore point is the HRT core. I think there's a good consensus that the current use of preprocessor conditionals makes the code pretty hairy, but what alternatives are there?
If the HRT code is always compiled in, that would simplify things alot, but then there would always be a small performance hit in the compares, and a slightly bigger code size. Is this acceptable? Also, something would need to be arranged to take care of the non-supported arch's. Any ideas here?
Another way would be to pull out the HRT operations into separate functions that could be conditionally included or replaced with no-op versions based on a config option. I don't know if this would be do-able, or if the result would be very clean though...
George also mentioned an idea of a second 'timer slave list'. Any
other ideas here?(quoted diff) +0
-2-Geoff -To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Quoted 34 lines · Geoff Levand
Quoted 26 lines · Mark Gross
Quoted 4 lines · George Anzinger
I have been thinking of a major rewrite which would leave this code alone, but would introduce an additional list and, of course, overhead for high-res timers. This will take some time and be sub optimal, so I wonder if it is needed.
What would your goal for the major rewrite be?
Redesign the implementation?
Clean up / re-factor the current design?
Add features?I've been wondering lately if a significant restructuring of the implementation could be done. Something bottom's up that enabled changing / using different time bases without rebooting and coexisted nicely with HPET.
Something along the lines of;
* abstracting the time base's, calibration and computation of the next interrupt time into a polymorphic interface along with the implementation of a few of your time bases (ACPI, TSC) as a stand allown patch.
* implement yet another polymorphic interface for the interrupt source used by the patch, along with a few interrupt sources (PIT, APIC, HPET <-- new ) * Implement a simple RTC-like charactor driver using the above for testing and integration.
* Finally a patch to integrate the first 3 with the POSIX timers code.Quoted 4 lines
What do you think?
--mgross
Mark,
Quoted 8 lines
Generally I agree with your ideas on what needs fixing up, but I'm concerned that the run-time binding of this kind of design would have too much overhead for time-critical code paths. Do you think it is useful to have run-time selection of the time base and interrupt source?
In my work we have a known fixed hardware configuration that has
limited timers, so I don't really see a need for runtime configuration there.
Runtime selection of time base's and interrupt sources for an HRT implementation may not be too useful in practice. It sure would make testing and comparing different HRT configuration combonations easier.
I may have function pointers on the brain WRT this patch. But, to get an implementation that exports a common abstraction across architectures, WRT time bases and interrupt sources, I don't see any other way than using the function pointers in a common structure. It shouldn't matter much if it oppens up a feature that no one cares about (runtime selection on time base / interrupt source).
--mgross
Quoted 1 line · Geoff Levand
For those interested, the set of three patches provide POSIX high-res timer support for linux-2.6.6. The core and i386 patches are updates of George Anzinger's hrtimers-2.6.5-1.0.patch available on SourceForge <http://sourceforge.net/projects/high-res-timers/>. The ppc32 port is not available on SourceForge yet.
I've got to ask:
Just reading from the Posix 1003.1b section 14 spec referenced by the HRT main project page, I see the following:
------------------------------------------------------------------------------
Realtime applications must be able to operate on data within strict timing constraints in order to schedule application or system events. Timing requirements can be in response to the need for either high system throughput or fast response time. Applications requiring high throughput may process large amounts of data and use a continuous stream of data points equally spaced in time. For example, electrocardiogram research uses a continuous stream of data for qualitative and quantitative analysis.
------------------------------------------------------------------------------
If this is really the goal here, then why not just integrate Adeos into the kernel and make some form of HRT as a loadable module that uses Adeos to provide its services?
Currently Adeos runs on x86, ARM (MMU-full and MMU-less), PPC, so portability is not an issue. Plus, the interface provided can either be directly used by drivers to get hard-rt interrupts or it can be used by another layer to provide more elaborate services (like RTAI or, potentially, HRT.) Using the virtual interrupts that can be dynamically allocated at runtime, it's rather easy to send signals between domains.
Sure, you may not have the exact Posix 1003.1b API, but I don't remember there being any persistent goal of having the kernel conform to any standard.
Karim
Signature · 3 lines
Author, Speaker, Developer, Consultant Pushing Embedded and Real-Time Linux Systems Beyond the Limits http://www.opersys.com || [email protected] || 1-866-677-4546
Quoted 33 lines · Karim Yaghmour
Quoted 1 line · Geoff Levand
For those interested, the set of three patches provide POSIX high-res timer support for linux-2.6.6. The core and i386 patches are updates of George Anzinger's hrtimers-2.6.5-1.0.patch available on SourceForge <http://sourceforge.net/projects/high-res-timers/>. The ppc32 port is not available on SourceForge yet.
I've got to ask:
Just reading from the Posix 1003.1b section 14 spec referenced by the HRT main project page, I see the following:
------------------------------------------------------------------------------Realtime applications must be able to operate on data within strict timing constraints in order to schedule application or system events. Timing requirements can be in response to the need for either high system throughput or fast response time. Applications requiring high throughput may process large amounts of data and use a continuous stream of data points equally spaced in time. For example, electrocardiogram research uses a continuous stream of data for qualitative and quantitative analysis.
------------------------------------------------------------------------------If this is really the goal here, then why not just integrate Adeos into the kernel and make some form of HRT as a loadable module that uses Adeos to provide its services?
Currently Adeos runs on x86, ARM (MMU-full and MMU-less), PPC, so portability is not an issue. Plus, the interface provided can either be directly used by drivers to get hard-rt interrupts or it can be used by another layer to provide more elaborate services (like RTAI or, potentially, HRT.) Using the virtual interrupts that can be dynamically allocated at runtime, it's rather easy to send signals between domains.
Quoted 2 lines
Sure, you may not have the exact Posix 1003.1b API, but I don't remember there being any persistent goal of having the kernel conform to any standard.
I don't see how this delivers any added value to the user. I suppose code running at the kernel level might gain something, but at the user level we still have to deal with preemption latencies, which are the biggest problem (and, aside from messing up the accuracy of the timers, are NOT timer issues at all).
Signature · 3 lines
George Anzinger [email protected] High-res-timers: http://sourceforge.net/projects/high-res-timers/ Preemption patch: http://www.kernel.org/pub/linux/kernel/people/rml
Quoted 1 line · George Anzinger
I don't see how this delivers any added value to the user. I suppose code running at the kernel level might gain something, but at the user level we still have to deal with preemption latencies, which are the biggest problem (and, aside from messing up the accuracy of the timers, are NOT timer issues at all).
Actually I think the point I'm trying to make can't be fairly conveyed without providing a lot of background of what can be done with Adeos. I would suggest that those interested do some digging. Among other things, you may want to read about RTAI/fusion:
http://www.fdn.fr/~brouchou/rtai/rtai-doc-prj/rtai-fusion.html
http://www.fdn.fr/~brouchou/rtai/modules.php?name=Content&pa=showpage&pid=1
Here's a quote from Philippe on how this compares to HRT:
Quoted 25 lines
Last time I checked (i.e. two days ago on a 2.6.6), hi-res timers were not capable of providing 1Khz periodic timings for 10mn with no overrun through
clock_nanosleep(), even with no additional load on the machine. fusion is able to do that directly through a plainnanosleep(); in fact it is able to sustain 10Khz periodic timings with a compilation, disk I/O and interrupt flooding in the background. Frankly, IMHO, determinism with really hi-res timing in user-space is a territory which will remain ruled by RTAI for quite a long time; vanilla Linux will always look miserable at some point in this respect unless, e.g. stuff like that (which is otherwise perfectly sound for a GPOS) disappears from its code base:
kernel/softirq.c:/*
* We restart softirq processingMAX_SOFTIRQ_RESTARTtimes,
* and we fall back to softirqd after that.
*
* This number has been established via experimentation.
* The two things to balance is latency against fairness -
* we want to handle softirqs as soon as possible, but they
* should not be able to lock up the box.
*/
#defineMAX_SOFTIRQ_RESTART10
Quoted 5 lines
asmlinkage void
__do_softirq(void)--
But, hey! I WANT to be able to lock up this box! :o)
Unfortunately, there's no sustained vendor push behind this kind of stuff as their is for HRT, but my experience has been that this is for lack of understanding of what Linux can/should be able to provide as a GPOS then anything else (i.e. a lot of "embedded"/"carrier-grade" vendors seem to somehow believe that eventually plain vanilla Linux could become hard-rt simply by virtue of adding more and more features on top of it ... preemption, HRT, interrupt threading, etc.etc.etc. While the fact of the matter is that Linux is a GPOS and that it really should catter for the average case and leave the hard-rt part to something built with that in mind.) For having been involved with the use of Linux in real-time systems for over 5 years now, I firmly believe any potential solution to determinism in Linux goes through something like Adeos. The example of RTAI/fusion is just one out of many of what can be achieved with such an approach while making it simple for application developers to create applications built on "standard" APIs.
Karim
Signature · 3 lines
Author, Speaker, Developer, Consultant Pushing Embedded and Real-Time Linux Systems Beyond the Limits http://www.opersys.com || [email protected] || 1-866-677-4546
Quoted 44 lines · Karim Yaghmour
Quoted 1 line · George Anzinger
I don't see how this delivers any added value to the user. I suppose code running at the kernel level might gain something, but at the user level we still have to deal with preemption latencies, which are the biggest problem (and, aside from messing up the accuracy of the timers, are NOT timer issues at all).
Actually I think the point I'm trying to make can't be fairly conveyed without providing a lot of background of what can be done with Adeos. I would suggest that those interested do some digging. Among other things, you may want to read about RTAI/fusion:
http://www.fdn.fr/~brouchou/rtai/rtai-doc-prj/rtai-fusion.html
http://www.fdn.fr/~brouchou/rtai/modules.php?name=Content&pa=showpage&pid=1Here's a quote from Philippe on how this compares to HRT:
Quoted 29 lines
Last time I checked (i.e. two days ago on a 2.6.6), hi-res timers were not capable of providing 1Khz periodic timings for 10mn with no overrun through
clock_nanosleep(), even with no additional load on the machine. fusion is able to do that directly through a plainnanosleep(); in fact it is able to sustain 10Khz periodic timings with a compilation, disk I/O and interrupt flooding in the background. Frankly, IMHO, determinism with really hi-res timing in user-space is a territory which will remain ruled by RTAI for quite a long time; vanilla Linux will always look miserable at some point in this respect unless, e.g. stuff like that (which is otherwise perfectly sound for a GPOS) disappears from its code base:
kernel/softirq.c:/*
* We restart softirq processingMAX_SOFTIRQ_RESTARTtimes,
* and we fall back to softirqd after that.
*
* This number has been established via experimentation.
* The two things to balance is latency against fairness -
* we want to handle softirqs as soon as possible, but they
* should not be able to lock up the box.
*/
#defineMAX_SOFTIRQ_RESTART10asmlinkage void
__do_softirq(void)
Quoted 7 lines
Quoted 1 line
But, hey! I WANT to be able to lock up this box! :o)
Unfortunately, there's no sustained vendor push behind this kind of stuff as their is for HRT, but my experience has been that this is for lack of understanding of what Linux can/should be able to provide as a GPOS then anything else (i.e. a lot of "embedded"/"carrier-grade" vendors seem to
I think the real problem is an open source question. The RTAI and RTLINUX folks are not exactly in the same camp (either with each other OR with LINUX) in this regard. Should that change and one or more of these become truly open source without others claiming "foul", there are vendors who are ready and willing to work with the code. Vendors of open source (and their customers) don't want to find themselves in law suits...
As such, this is really off topic... as is a discussion of the merits of this sort of solution. On this list we are interested in working in the confines of LINUX as found on linux.org possibly modified by truly open source patches and packages.
Signature · 3 lines
George Anzinger [email protected] High-res-timers: http://sourceforge.net/projects/high-res-timers/ Preemption patch: http://www.kernel.org/pub/linux/kernel/people/rml
Quoted 1 line · George Anzinger
I think the real problem is an open source question. The RTAI and RTLINUX folks are not exactly in the same camp (either with each other OR with LINUX) in this regard. Should that change and one or more of these become truly open source without others claiming "foul", there are vendors who are ready and willing to work with the code. Vendors of open source (and their customers) don't want to find themselves in law suits...
There's no other way to call it: This is just plain ignorance.
If you care to actually look at the record, you will see that RTAI has always been and will always been "open source". I'm not going to qualify other peoples' claims against it, but let me just say that you've succumbed to FUD, ant THAT is totally pathetic.
I personally don't see why Linux's future should be dictated by a bunch of worried PHBs who haven't even cared to research the case. Following you logic, maybe we should just all stop using Linux altogether just in case SCO sues.
Quoted 1 line
As such, this is really off topic... as is a discussion of the merits of this sort of solution. On this list we are interested in working in the confines of LINUX as found on linux.org possibly modified by truly open source patches and packages.
Again, you don't know what you're talking about. If you have any actual, factual and timely claim against RTAI, then please voice it now. Otherwise, this is plain misleading. Not to mention that offloading something so foreign as hard-rt into a module is actually not that unlike Linux as many vendors, including your employer, claim it to be.
Note that my entire point was about how Adeos could be used as an engine for providing much more than HRT could ever provide. Adeos has always been independent from RTAI and is based entirely on scientific publications that predate the patent. As has been proven on this list, any claim that it is somehow covered by the patent is patently absurd. So whether you buy the FUD against RTAI or not is really inconsequential. The real issue is what Adeos can provide that HRT and all the other wannabee solutions just can't provide.
If FUD is what is driving you to get HRT into Linux, it would just go to show that you have a very poor understanding of what Linux is about.
I take it, though, that since you haven't actually countered my argument, you actually agree with me that RTAI/fusion on Adeos is a far superior solution to HRT on technical terms. Given that you've agreed with that, I'd encourage you now to actually read up on the topic of RTAI and open source so that you too can join in working on RTAI/fusion, and stop the time-waste that HRT is.
Karim
Signature · 3 lines
Author, Speaker, Developer, Consultant Pushing Embedded and Real-Time Linux Systems Beyond the Limits http://www.opersys.com || [email protected] || 1-866-677-4546
A couple of comments on posix-hrt-core-04.06.09.patch
1. Comment in hrtime.h is out of date, you are using seq_lock to do the read stuff now, an example is...
+ * Global locking issues:
+ *
+ * Time is locked with the xtime_lock using read/write locks. + * Note: It is assumed that the do_timer() call is protected by + * write_lock(&xtime_lock). + * + * Using code must not change, but only read, the protected + * variables (xtime, jiffies, any temps tha need protection in the + * arch_get_cycles() code). Usage is as follows:
+ *
+ * read_lock_irq(&xtime_lock);
+ * do the reads
+ * read_unlock_irq(&xtime)
2. Don't like new definition of running_timer; use explicit memory barriers not volatile please.
struct tvec_t_base_s {
spinlock_t lock;
unsigned long timer_jiffies;
- struct timer_list *running_timer;
- tvec_root_t tv1;
- tvec_t tv2;
- tvec_t tv3;
- tvec_t tv4;
- tvec_t tv5;
+ volatile struct timer_list * volatile running_timer;
+ struct list_head tv[NEW_TVEC_SIZE]line_aligned_in_smp;
3. The IF_HIGH_RES() macro looks cute, but get confusing, and makes the code less readable.
On Mon, 21 Jun 2004 16:13:06 -0700 Stephen Hemminger wrote:
| A couple of comments on posix-hrt-core-04.06.09.patch
I haven't looked at the full patch lately, but...
| 3. The IF_HIGH_RES() macro looks cute, but get confusing, and makes the code
| less readable.
this macro was always ugly and obfuscating to me.
Definitely need to lose it.
--
~Randy