Discussion:
[MPlayer-users] Linux clock loses time when DVD is playing
Mike Spencer
2016-07-05 17:58:21 UTC
Permalink
Is there a known bug, misconfiguration problem or hardware conflict
that causes the Linux system clock to lose time while MPlayer is
playing a DVD?

Playing a DVD, my clock loses 6 to 8 seconds per minute of elapsed
time while the video is playing. This effect stops when the video is
paused and when it has ended and mplayer has exited.

I've verified this with a script that polls the clock at 1
min. intervals while a DVD is playing and compares the result to the
time on a LAN-connected laptop.

The clock is otherwise stable with no significant drift, whether up or
shut/powered down. There is no problem with the video, audio or
subtitles.

Some system info below.

Any info about eliminating this behavior and/or its cause welcome.


Tnx,
- Mike




--- Begin system setup ---

mplayer: MPlayer 1.1-3.4.6
command: mplayer DVD://17 [NOT using the -rtc switch]

OS Release: Linux 2.4.33.3, Slackware 11

Box: IBM 8193A3U, 32 bits

DVD: Philips, DVD-RAM writer (internal) SPD2413P

CPU: Intel Pentium 4 CPU 2.40GHz

libc: libc-2.3.6.so

video: Intel 82865G Integrated Graphics Controller

X: X Window System Version 6.9.0

--- End system setup ---
--
Michael Spencer Nova Scotia, Canada .~.
/V\
***@tallships.ca /( )\
http://home.tallships.ca/mspencer/ ^^-^^
Scott W. Larson
2016-07-05 18:39:17 UTC
Permalink
Post by Mike Spencer
Is there a known bug, misconfiguration problem or hardware conflict
that causes the Linux system clock to lose time while MPlayer is
playing a DVD?
It's known that if you use a lot of CPU, the Linux kernel will lose
clock interrupts.

The best (maybe the only) solution is to have the ntp clock daemon keep
the system's clock correct.
Mike Spencer
2016-07-06 05:48:42 UTC
Permalink
Post by Scott W. Larson
Post by Mike Spencer
Is there a known bug, misconfiguration problem or hardware conflict
that causes the Linux system clock to lose time while MPlayer is
playing a DVD?
It's known that if you use a lot of CPU, the Linux kernel will lose
clock interrupts.
Didn't know that. Unclear if that's the problem here. See next post.
(reply to Nicolas George)
Post by Scott W. Larson
The best (maybe the only) solution is to have the ntp clock daemon
keep the system's clock correct.
Awkward for me. Dial-up access in rural Nova Scotia. I could go
on-line and start ntpd with -g after watching a movie but that's not a
whole lot better than just resetting the clock with date -s when it's
several minutes behind.

Tnx,
- Mike
--
Michael Spencer
***@tallships.ca
http://home.tallships.ca/mspencer/
Rashkae
2016-07-08 19:42:40 UTC
Permalink
Post by Mike Spencer
Awkward for me. Dial-up access in rural Nova Scotia. I could go
on-line and start ntpd with -g after watching a movie but that's not a
whole lot better than just resetting the clock with date -s when it's
several minutes behind.
Tnx,
- Mike
Have a look at:
cat /sys/devices/system/clocksource/clocksource0/available_clocksource

Most Linux systems I've seen default to tsc. However, tsc clocksource
can skew when cpu changes frequency, and on some systems, (depending on
the cpu and Linux kernel version I suspect, but I really don't
understand the gory details.) this will cause severe clock drift.

Depending on what's available on your system, try adding a
"clocksource=acpi_pm" or "clocksource=hept" to your kernel boot parameters.

You can can read some more details on clocksources here:

https://access.redhat.com/solutions/18627
Stephen Mollett
2016-07-09 13:26:44 UTC
Permalink
Post by Rashkae
Depending on what's available on your system, try adding a
"clocksource=acpi_pm" or "clocksource=hept" to your kernel boot parameters.
Worth pointing out the typo - that should be "hpet", not "hept".

Your system probably doesn't have its HPET enabled by the BIOS (I've yet
to encounter a system of that vintage that does) but the 865G chipset
does have one available. You can add "hpet=force" to your kernel command
line to force-enable it, which will then allow it to be used as a
clocksource. (I've been doing this on my 855G-based ThinkPad for many
years.)

Also, have you tried running "hdparm -d /dev/hdc"? I think that should
report whether the drive is actually using DMA (I think lshw just shows
whether it can support it). If it's not, try "hdparm -d1 /dev/hdc" to
turn DMA on. (The fact that it plays fine from hard disk or USB makes me
suspicious that it may not be using DMA for the DVD drive.)

If you were running a more recent kernel (yours is from 2006) you could
also try dumping the old IDE subsystem altogether and using the new
libata drivers for IDE devices. That might also have better performance
and may not cause clock interrupts to be dropped. You wouldn't need to
use ide-scsi for the DVD writer. (All drives show up as SCSI devices and
use the SCSI subsystem, so your optical drives will be /dev/sr0 and
/dev/sr1 while the hard drive(s) will be /dev/sda etc.)

I believe there is a 2.6 kernel available in Slackware 11.

Just a few suggestions...

Stephen
Mike Spencer
2016-07-16 06:16:54 UTC
Permalink
On Sat, 9 Jul 2016 14:26:44 +0100,
Post by Stephen Mollett
Post by Rashkae
Depending on what's available on your system, try adding a
"clocksource=acpi_pm" or "clocksource=hept" to your kernel boot parameters.
Worth pointing out the typo - that should be "hpet", not "hept".
Your system probably doesn't have its HPET enabled by the BIOS (I've yet
to encounter a system of that vintage that does) but the 865G chipset
does have one available. You can add "hpet=force" to your kernel command
line to force-enable it, which will then allow it to be used as a
clocksource. (I've been doing this on my 855G-based ThinkPad for many
years.)
Also, have you tried running "hdparm -d /dev/hdc"? I think that should
report whether the drive is actually using DMA (I think lshw just shows
whether it can support it). If it's not, try "hdparm -d1 /dev/hdc" to
turn DMA on. (The fact that it plays fine from hard disk or USB makes me
suspicious that it may not be using DMA for the DVD drive.)
If you were running a more recent kernel (yours is from 2006) you could
also try dumping the old IDE subsystem altogether and using the new
libata drivers for IDE devices. That might also have better performance
and may not cause clock interrupts to be dropped. You wouldn't need to
use ide-scsi for the DVD writer. (All drives show up as SCSI devices and
use the SCSI subsystem, so your optical drives will be /dev/sr0 and
/dev/sr1 while the hard drive(s) will be /dev/sda etc.)
I believe there is a 2.6 kernel available in Slackware 11.
Noted. Thanks, Stephen and Rashkae for pointers. I'm working on it.
This is not the time of year to spend my time hunched over the
keyboard, though. Flower and vegetable gardens are going full bore,
blueberries are just ripening, raspberries will come along in a week
or so.


I'll report back when I have an answer. I still suspect that
weirdness in the IBM mobo IDE emulation for the SATA HD is the source
but, if so, it will take a while to verify that. Y'all have been very
helpful with a problem that turns out to be OT.


Tnx,
- Mike
--
Michael Spencer Nova Scotia, Canada
***@tallships.ca
http://home.tallships.ca/mspencer/
Nicolas George
2016-07-05 19:39:31 UTC
Permalink
Post by Mike Spencer
Is there a known bug, misconfiguration problem or hardware conflict
that causes the Linux system clock to lose time while MPlayer is
playing a DVD?
I had this problem 15 years ago with an IDE DVD drive that did not support
DMA. Did you check it was specific to MPlayer? For example by copying a big
file from a DVD without playing it.
Mike Spencer
2016-07-06 06:35:27 UTC
Permalink
Post by Nicolas George
Post by Mike Spencer
Is there a known bug, misconfiguration problem or hardware conflict
that causes the Linux system clock to lose time while MPlayer is
playing a DVD?
I had this problem 15 years ago with an IDE DVD drive that did not
support DMA.
Hmmm. Mine's an IDE drive. lshw says (in part, more details below):

*-cdrom:0
description: IDE CD-ROM
product: PHILIPS SPD2413P
capabilities: packet atapi cdrom removable nonmagnetic dma lba iordy

So DMA should be supported. (CONFIG_BLK_DEV_IDEDMA=y is in
[kernel-src]/.config, too.)
Post by Nicolas George
Did you check it was specific to MPlayer? For example by copying a
big file from a DVD without playing it.
Not until you suggested it. :-) I had only noticed it when using mplayer.

+ Copy of a ca. 1G file from DVD to HD *does* cause the clock to
lag.

+ Similar copy from USB stick to HD does *not* cause the clock to
lag.

+ Playing video from HD does *not* cause the clock to
lag.

So apparently not caused by MPlayer directly. That makes it off-topic
here. Nevertheless, I'd be grateful any suggestions for a fix or
workaround (Dredged up from 15 year old memory? Deduced from info
below? ) here or in private email.


Thanks for the suggestion,
- Mike


--- Begin more details ---

*-scsi:0
description: SCSI storage controller
physical id: 1
logical name: scsi0
capabilities: emulated scsi-host
configuration: driver=ide-scsi
*-cdrom
description: DVD-RAM writer
product: SPD2413P
vendor: PHILIPS
physical id: 0.0.0
bus info: ***@0:0.0.0
logical name: /dev/dvd
logical name: /dev/scd0
logical name: /dev/sr0
version: GP03
capabilities: removable audio cd-r cd-rw dvd dvd-r dvd-ram
configuration: status=open


*-ide:1
description: IDE Channel 0
physical id: 1
bus info: ***@1
logical name: ide1

*-cdrom:0
description: IDE CD-ROM
product: PHILIPS SPD2413P
vendor: Philips
physical id: 0
bus info: ***@1.0
logical name: /dev/hdc
version: GP03
capabilities: packet atapi cdrom removable nonmagnetic dma lba iordy

--- End more details ---
--
Michael Spencer Nova Scotia, Canada

***@tallships.ca
http://home.tallships.ca/mspencer/
Loading...