[asterisk-users] Playback / Background / Read choppy, but musiconhold fine, even with ztdummy

Tony Mountifield tony at softins.clara.co.uk
Fri Apr 25 11:32:31 CDT 2008


In article <20080425153232.GP27523 at xorcom.com>,
Tzafrir Cohen <tzafrir.cohen at xorcom.com> wrote:
> 
> RTC is available (and used) as of kernel 2.6.15 . The thing that has
> changed in 2.6.13 is that the default of HZ became 250 (but still
> tunable). So unless you build your own kernel, without using RTC you
> would not really get a steady rate of 1000 interrupts per second.

Well, I'm not familiar with the later 2.6 kernels (most of my systems
are at 2.6.12 (FC3) or 2.6.9 (RHEL4 clones)).

However, the USE_RTC code was my creation, so I'm very familiar with the
issues as they were at the time.  See http://bugs.digium.com/view.php?id=4301

The issue was that the original 2.6 version of ztdummy ran off the 1000Hz
kernel jiffy counter. This had a tendency to miss ticks. Having successfully
used the zaprtc module in 2.4, I re-implemented it for 2.6 using the rtc
hooks that the 2.6 kernel provided. It sets the 146818 RTC chip to generate
1024Hz interrupts (it can't do 1000Hz), and then skips 3 every 128, evenly
spaced. This was a huge improvement over the jiffy counter.

Unfortunately, when the patch was applied to CVS, someone screwed up and
missed out ztdummy.h, only doing ztdummy.c. This broke compilation and
caused BKW to throw a fit. The knee-jerk reaction was to slap an #if 0
around the #define USE_RTC, rather than understand the cause of the problem.
Once ztdummy.h was patched correctly, the #if 0 should have been removed,
but it never was, so most people continued to build it with the inferior
jiffy clock.

When kernel 2.6.13 came along, the jiffy clock no longer defaulted to 1000Hz,
so USE_RTC was made the default for those versions. I will never understand
why it was never just enabled for *all* 2.6 kernels at that time, like it
should have been in the first place.

The only dependency it has is that the kernel must have been built with
CONFIG_RTC and not CONFIG_GENRTC.

> And then again, on kernels >= 2.6.22 you have hi-resolution timers which
> generally work better.

I have yet to experience these, but it sounds promising.

Cheers
Tony
-- 
Tony Mountifield
Work: tony at softins.co.uk - http://www.softins.co.uk
Play: tony at mountifield.org - http://tony.mountifield.org



More information about the asterisk-users mailing list