Debian Bug report logs - #456214
hal: should not poll CD drive so often

version graph

Package: hal; Maintainer for hal is Utopia Maintenance Team <pkg-utopia-maintainers@lists.alioth.debian.org>; Source for hal is src:hal.

Reported by: "brian m. carlson" <sandals@crustytoothpaste.net>

Date: Thu, 13 Dec 2007 18:42:01 UTC

Severity: normal

Tags: patch

Found in version hal/0.5.10-4

Forwarded to hal@lists.freedesktop.org

Reply or subscribe to this bug.

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, Sjoerd Simons <sjoerd@debian.org>:
Bug#456214; Package hal. Full text and rfc822 format available.

Acknowledgement sent to "brian m. carlson" <sandals@crustytoothpaste.ath.cx>:
New Bug report received and forwarded. Copy sent to Sjoerd Simons <sjoerd@debian.org>. Full text and rfc822 format available.

Message #5 received at submit@bugs.debian.org (full text, mbox):

From: "brian m. carlson" <sandals@crustytoothpaste.ath.cx>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Subject: hal: should not poll CD drive so often
Date: Thu, 13 Dec 2007 18:36:20 +0000
[Message part 1 (text/plain, inline)]
Package: hal
Version: 0.5.10-4
Severity: normal

According to powertop, hal polls the CD drive very often[0], which 
causes about 35 wakeups per second.  Polling the drive no more than once 
a second or using an asynchronous notification method (if such a method 
exists) would be much preferable.

Disabling the polling of the CD drive disables these wakeups, but I'd 
prefer not to have to do that.

Note that I am using a PATA cdrom with libata.

[0] I suspect it is 10 times a second, because that's the number of 
libata wakeups I see, but I haven't actually checked.

-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.24-rc5-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) (ignored: LC_ALL set to en_US.UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages hal depends on:
ii  adduser                 3.105            add and remove users and groups
ii  dbus                    1.1.2-1          simple interprocess messaging syst
ii  hal-info                20071030-1       Hardware Abstraction Layer - fdi f
ii  libc6                   2.7-4            GNU C Library: Shared libraries
ii  libdbus-1-3             1.1.2-1          simple interprocess messaging syst
ii  libdbus-glib-1-2        0.74-1           simple interprocess messaging syst
ii  libexpat1               1.95.8-4         XML parsing C library - runtime li
ii  libgcc1                 1:4.3-20071130-1 GCC support library
ii  libglib2.0-0            2.14.4-2         The GLib library of C routines
ii  libhal-storage1         0.5.10-4         Hardware Abstraction Layer - share
ii  libhal1                 0.5.10-4         Hardware Abstraction Layer - share
ii  libsmbios1              0.13.10-1        Provide access to (SM)BIOS informa
ii  libstdc++6              4.3-20071130-1   The GNU Standard C++ Library v3
ii  libusb-0.1-4            2:0.1.12-8       userspace USB programming library
ii  libvolume-id0           0.114-2          libvolume_id shared library
ii  lsb-base                3.1-24           Linux Standard Base 3.1 init scrip
ii  mount                   2.13-13          Tools for mounting and manipulatin
ii  pciutils                1:2.2.4-1.1      Linux PCI Utilities
ii  pm-utils                0.99.2-3         utilities and scripts for power ma
ii  udev                    0.114-2          /dev/ and hotplug management daemo
ii  usbutils                0.73-5           Linux USB utilities

Versions of packages hal recommends:
ii  eject                         2.1.5-6    ejects CDs and operates CD-Changer
ii  libsmbios-bin                 0.13.10-1  Provide access to (SM)BIOS informa

-- no debconf information

-- 
brian m. carlson / brian with sandals: Houston, Texas, US
+1 713 440 7475 | http://crustytoothpaste.ath.cx/~bmc | My opinion only
a typesetting engine: http://crustytoothpaste.ath.cx/~bmc/code/thwack
OpenPGP: RSA v4 4096b 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187
[signature.asc (application/pgp-signature, inline)]

Information forwarded to debian-bugs-dist@lists.debian.org, Sjoerd Simons <sjoerd@debian.org>:
Bug#456214; Package hal. Full text and rfc822 format available.

Acknowledgement sent to Michael Biebl <biebl@debian.org>:
Extra info received and forwarded to list. Copy sent to Sjoerd Simons <sjoerd@debian.org>. Full text and rfc822 format available.

Message #10 received at 456214@bugs.debian.org (full text, mbox):

From: Michael Biebl <biebl@debian.org>
To: "brian m. carlson" <sandals@crustytoothpaste.ath.cx>, 456214@bugs.debian.org
Subject: Re: Bug#456214: hal: should not poll CD drive so often
Date: Thu, 13 Dec 2007 22:21:06 +0100
[Message part 1 (text/plain, inline)]
brian m. carlson schrieb:
> Package: hal
> Version: 0.5.10-4
> Severity: normal
> 
> According to powertop, hal polls the CD drive very often[0], which
> causes about 35 wakeups per second.  Polling the drive no more than once
> a second or using an asynchronous notification method (if such a method
> exists) would be much preferable.
> 
> Disabling the polling of the CD drive disables these wakeups, but I'd
> prefer not to have to do that.
> 
> Note that I am using a PATA cdrom with libata.
> 
> [0] I suspect it is 10 times a second, because that's the number of
> libata wakeups I see, but I haven't actually checked.

Hal polls the CD drive every 2 seconds afaik.

Michael

-- 
Why is it that all of the instruments seeking intelligent life in the
universe are pointed away from Earth?

[signature.asc (application/pgp-signature, attachment)]

Information forwarded to debian-bugs-dist@lists.debian.org, Sjoerd Simons <sjoerd@debian.org>:
Bug#456214; Package hal. Full text and rfc822 format available.

Acknowledgement sent to Sjoerd Simons <sjoerd@luon.net>:
Extra info received and forwarded to list. Copy sent to Sjoerd Simons <sjoerd@debian.org>. Full text and rfc822 format available.

Message #15 received at 456214@bugs.debian.org (full text, mbox):

From: Sjoerd Simons <sjoerd@luon.net>
To: Michael Biebl <biebl@debian.org>, 456214@bugs.debian.org
Cc: "brian m. carlson" <sandals@crustytoothpaste.ath.cx>
Subject: Re: Bug#456214: hal: should not poll CD drive so often
Date: Sat, 15 Dec 2007 20:10:04 +0100
On Thu, Dec 13, 2007 at 10:21:06PM +0100, Michael Biebl wrote:
> > [0] I suspect it is 10 times a second, because that's the number of
> > libata wakeups I see, but I haven't actually checked.
> 
> Hal polls the CD drive every 2 seconds afaik.

Hal indeed polls every 2 seconds at most and even less when something hints hal
that nobody the machine is idle.

Could you strace the running hald-addon-storage to check if indeed it's polling
your drive multiple times a second ?

  Sjoerd
-- 
All hope abandon, ye who enter here!
		-- Dante Alighieri




Information forwarded to debian-bugs-dist@lists.debian.org, Sjoerd Simons <sjoerd@debian.org>:
Bug#456214; Package hal. Full text and rfc822 format available.

Acknowledgement sent to "brian m. carlson" <sandals@crustytoothpaste.ath.cx>:
Extra info received and forwarded to list. Copy sent to Sjoerd Simons <sjoerd@debian.org>. Full text and rfc822 format available.

Message #20 received at 456214@bugs.debian.org (full text, mbox):

From: "brian m. carlson" <sandals@crustytoothpaste.ath.cx>
To: Sjoerd Simons <sjoerd@luon.net>
Cc: Michael Biebl <biebl@debian.org>, 456214@bugs.debian.org
Subject: Re: Bug#456214: hal: should not poll CD drive so often
Date: Sun, 16 Dec 2007 01:31:11 +0000
[Message part 1 (text/plain, inline)]
On Sat, Dec 15, 2007 at 08:10:04PM +0100, Sjoerd Simons wrote:
>On Thu, Dec 13, 2007 at 10:21:06PM +0100, Michael Biebl wrote:
>> > [0] I suspect it is 10 times a second, because that's the number of
>> > libata wakeups I see, but I haven't actually checked.
>> 
>> Hal polls the CD drive every 2 seconds afaik.
>
>Hal indeed polls every 2 seconds at most and even less when something hints hal
>that nobody the machine is idle.

hald-addon-storage claims it is polling every two seconds:

lakeview ok % ps ax | grep hald-addon-storage
 3600 ?        S      0:06 hald-addon-storage: polling /dev/scd0 (every 2 sec)

>Could you strace the running hald-addon-storage to check if indeed it's polling
>your drive multiple times a second ?

Output of strace:

open("/dev/scd0", O_RDONLY|O_EXCL|O_NONBLOCK) = 5
ioctl(5, CDROM_DRIVE_STATUS, 0x7fffffff) = 2
close(5)                                = 0
poll([{fd=3, events=POLLIN}], 1, 1981)  = 0
poll([{fd=3, events=POLLIN}], 1, 0)     = 0
open("/dev/scd0", O_RDONLY|O_EXCL|O_NONBLOCK) = 5
ioctl(5, CDROM_DRIVE_STATUS, 0x7fffffff) = 2
close(5)                                = 0
poll([{fd=3, events=POLLIN}], 1, 1980)  = 0
open("/dev/scd0", O_RDONLY|O_EXCL|O_NONBLOCK) = 5
ioctl(5, CDROM_DRIVE_STATUS, 0x7fffffff) = 2
close(5)                                = 0
poll([{fd=3, events=POLLIN}], 1, 1981)  = 0
poll([{fd=3, events=POLLIN}], 1, 0)     = 0
open("/dev/scd0", O_RDONLY|O_EXCL|O_NONBLOCK) = 5
ioctl(5, CDROM_DRIVE_STATUS, 0x7fffffff) = 2
close(5)                                = 0
poll([{fd=3, events=POLLIN}], 1, 1981)  = 0
poll([{fd=3, events=POLLIN}], 1, 0)     = 0

Is it possible that opening and closing the drive is causing the 
wakeups?  I ask because I'm seeing 10 libata wakeups and about 10
"rescheduling interrupts" wakeups whenever hal is polling:

Top causes for wakeups:
  28.2% ( 54.3)       <interrupt> : uhci_hcd:usb1, yenta, i915@pci:0000:00:02.0
  24.3% ( 46.9)       <interrupt> : uhci_hcd:usb2, HDA Intel, firewire_ohci 
  23.0% ( 44.3)      <kernel IPI> : Rescheduling interrupts 
   6.1% ( 11.7)       <interrupt> : libata 
   4.9% (  9.5)       <interrupt> : extra timer interrupt
   2.1% (  4.0)   <kernel module> : usb_hcd_poll_rh_status (rh_timer_func)

versus when it isn't:

Top causes for wakeups:
  31.6% ( 52.9)       <interrupt> : uhci_hcd:usb1, yenta, i915@pci:0000:00:02.0
  28.0% ( 46.9)       <interrupt> : uhci_hcd:usb2, HDA Intel, firewire_ohci 
  20.3% ( 33.9)      <kernel IPI> : Rescheduling interrupts 
   3.3% (  5.5)       <interrupt> : extra timer interrupt
   2.4% (  4.0)   <kernel module> : usb_hcd_poll_rh_status (rh_timer_func)
   1.9% (  3.2)              Xorg : do_setitimer (it_real_fn)


-- 
brian m. carlson / brian with sandals: Houston, Texas, US
+1 713 440 7475 | http://crustytoothpaste.ath.cx/~bmc | My opinion only
a typesetting engine: http://crustytoothpaste.ath.cx/~bmc/code/thwack
OpenPGP: RSA v4 4096b 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187
[signature.asc (application/pgp-signature, inline)]

Information forwarded to debian-bugs-dist@lists.debian.org, Sjoerd Simons <sjoerd@debian.org>:
Bug#456214; Package hal. Full text and rfc822 format available.

Acknowledgement sent to Michael Biebl <biebl@debian.org>:
Extra info received and forwarded to list. Copy sent to Sjoerd Simons <sjoerd@debian.org>. Full text and rfc822 format available.

Message #25 received at 456214@bugs.debian.org (full text, mbox):

From: Michael Biebl <biebl@debian.org>
To: "brian m. carlson" <sandals@crustytoothpaste.ath.cx>, 456214@bugs.debian.org
Subject: Re: Bug#456214: hal: should not poll CD drive so often
Date: Sun, 16 Dec 2007 02:51:19 +0100
[Message part 1 (text/plain, inline)]
brian m. carlson schrieb:

> 
> Top causes for wakeups:
>   28.2% ( 54.3)       <interrupt> : uhci_hcd:usb1, yenta,
> i915@pci:0000:00:02.0
>   24.3% ( 46.9)       <interrupt> : uhci_hcd:usb2, HDA Intel,
> firewire_ohci   23.0% ( 44.3)      <kernel IPI> : Rescheduling
> interrupts    6.1% ( 11.7)       <interrupt> : libata    4.9% ( 
> 9.5)       <interrupt> : extra timer interrupt
>    2.1% (  4.0)   <kernel module> : usb_hcd_poll_rh_status (rh_timer_func)
> 
> versus when it isn't:
> 
> Top causes for wakeups:
>   31.6% ( 52.9)       <interrupt> : uhci_hcd:usb1, yenta,
> i915@pci:0000:00:02.0
>   28.0% ( 46.9)       <interrupt> : uhci_hcd:usb2, HDA Intel,
> firewire_ohci   20.3% ( 33.9)      <kernel IPI> : Rescheduling
> interrupts    3.3% (  5.5)       <interrupt> : extra timer interrupt
>    2.4% (  4.0)   <kernel module> : usb_hcd_poll_rh_status (rh_timer_func)
>    1.9% (  3.2)              Xorg : do_setitimer (it_real_fn)
> 
> 

Maybe I'm missing something, but the total number of wakeups with or
without hald running seems to be almost identical.

Michael

-- 
Why is it that all of the instruments seeking intelligent life in the
universe are pointed away from Earth?

[signature.asc (application/pgp-signature, attachment)]

Information forwarded to debian-bugs-dist@lists.debian.org, Sjoerd Simons <sjoerd@debian.org>:
Bug#456214; Package hal. Full text and rfc822 format available.

Acknowledgement sent to "brian m. carlson" <sandals@crustytoothpaste.ath.cx>:
Extra info received and forwarded to list. Copy sent to Sjoerd Simons <sjoerd@debian.org>. Full text and rfc822 format available.

Message #30 received at 456214@bugs.debian.org (full text, mbox):

From: "brian m. carlson" <sandals@crustytoothpaste.ath.cx>
To: Michael Biebl <biebl@debian.org>
Cc: 456214@bugs.debian.org
Subject: Re: Bug#456214: hal: should not poll CD drive so often
Date: Sun, 16 Dec 2007 02:29:15 +0000
[Message part 1 (text/plain, inline)]
On Sun, Dec 16, 2007 at 02:51:19AM +0100, Michael Biebl wrote:
>Maybe I'm missing something, but the total number of wakeups with or
>without hald running seems to be almost identical.

When the problems with i915 and snd_hda_intel are fixed, hal will be the 
largest cause of wakeups.  i915 is in the process of being fixed, and 
snd_hda_intel can be worked around (and I will report a bug soon).

Also, hal is running either way; it's just not polling in the latter 
case.

-- 
brian m. carlson / brian with sandals: Houston, Texas, US
+1 713 440 7475 | http://crustytoothpaste.ath.cx/~bmc | My opinion only
a typesetting engine: http://crustytoothpaste.ath.cx/~bmc/code/thwack
OpenPGP: RSA v4 4096b 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187
[signature.asc (application/pgp-signature, inline)]

Information forwarded to debian-bugs-dist@lists.debian.org, Sjoerd Simons <sjoerd@debian.org>:
Bug#456214; Package hal. Full text and rfc822 format available.

Acknowledgement sent to Sjoerd Simons <sjoerd@luon.net>:
Extra info received and forwarded to list. Copy sent to Sjoerd Simons <sjoerd@debian.org>. Full text and rfc822 format available.

Message #35 received at 456214@bugs.debian.org (full text, mbox):

From: Sjoerd Simons <sjoerd@luon.net>
To: "brian m. carlson" <sandals@crustytoothpaste.ath.cx>, 456214@bugs.debian.org
Subject: Re: Bug#456214: hal: should not poll CD drive so often
Date: Sun, 16 Dec 2007 21:38:48 +0100
On Sun, Dec 16, 2007 at 01:31:11AM +0000, brian m. carlson wrote:
> On Sat, Dec 15, 2007 at 08:10:04PM +0100, Sjoerd Simons wrote:
>> On Thu, Dec 13, 2007 at 10:21:06PM +0100, Michael Biebl wrote:
>>> > [0] I suspect it is 10 times a second, because that's the number of
>>> > libata wakeups I see, but I haven't actually checked.
>>>
>>> Hal polls the CD drive every 2 seconds afaik.
>>
>> Hal indeed polls every 2 seconds at most and even less when something hints hal
>> that nobody the machine is idle.
>
> hald-addon-storage claims it is polling every two seconds:
>
> lakeview ok % ps ax | grep hald-addon-storage
>  3600 ?        S      0:06 hald-addon-storage: polling /dev/scd0 (every 2 sec)
>
>> Could you strace the running hald-addon-storage to check if indeed it's polling
>> your drive multiple times a second ?
>
> Output of strace:
>
> open("/dev/scd0", O_RDONLY|O_EXCL|O_NONBLOCK) = 5
> ioctl(5, CDROM_DRIVE_STATUS, 0x7fffffff) = 2
> close(5)                                = 0
> poll([{fd=3, events=POLLIN}], 1, 1981)  = 0
> poll([{fd=3, events=POLLIN}], 1, 0)     = 0
> open("/dev/scd0", O_RDONLY|O_EXCL|O_NONBLOCK) = 5
> ioctl(5, CDROM_DRIVE_STATUS, 0x7fffffff) = 2
> close(5)                                = 0
> poll([{fd=3, events=POLLIN}], 1, 1980)  = 0
> open("/dev/scd0", O_RDONLY|O_EXCL|O_NONBLOCK) = 5
> ioctl(5, CDROM_DRIVE_STATUS, 0x7fffffff) = 2
> close(5)                                = 0
> poll([{fd=3, events=POLLIN}], 1, 1981)  = 0
> poll([{fd=3, events=POLLIN}], 1, 0)     = 0
> open("/dev/scd0", O_RDONLY|O_EXCL|O_NONBLOCK) = 5
> ioctl(5, CDROM_DRIVE_STATUS, 0x7fffffff) = 2
> close(5)                                = 0
> poll([{fd=3, events=POLLIN}], 1, 1981)  = 0
> poll([{fd=3, events=POLLIN}], 1, 0)     = 0
>
> Is it possible that opening and closing the drive is causing the wakeups?  
> I ask because I'm seeing 10 libata wakeups and about 10
> "rescheduling interrupts" wakeups whenever hal is polling:

strace -tt would be more usefull as that outputs timing information.  The
open,ioctl,close triple will cause various wakeups every two seconds.. But only
in a short time, so that shouldn't have a big impact on the time your processor
can actually spent in a lower power state.

Polling is indeed not a great thing to do, but unfortunately cd drivers don't
appear to have a nice way to notify media insertion.

  Sjoerd
-- 
No amount of careful planning will ever replace dumb luck.




Information forwarded to debian-bugs-dist@lists.debian.org, Sjoerd Simons <sjoerd@debian.org>:
Bug#456214; Package hal. Full text and rfc822 format available.

Acknowledgement sent to "brian m. carlson" <sandals@crustytoothpaste.ath.cx>:
Extra info received and forwarded to list. Copy sent to Sjoerd Simons <sjoerd@debian.org>. Full text and rfc822 format available.

Message #40 received at 456214@bugs.debian.org (full text, mbox):

From: "brian m. carlson" <sandals@crustytoothpaste.ath.cx>
To: Sjoerd Simons <sjoerd@luon.net>
Cc: 456214@bugs.debian.org
Subject: Re: Bug#456214: hal: should not poll CD drive so often
Date: Sun, 16 Dec 2007 21:59:47 +0000
[Message part 1 (text/plain, inline)]
On Sun, Dec 16, 2007 at 09:38:48PM +0100, Sjoerd Simons wrote:
>strace -tt would be more usefull as that outputs timing information.  The
>open,ioctl,close triple will cause various wakeups every two seconds.. But only
>in a short time, so that shouldn't have a big impact on the time your processor
>can actually spent in a lower power state.

I'll get that to you as soon as I log out and log in again.  
hal-disable-polling --enable-polling is broken (see the bug report I 
just filed).

I'm not exceptionally pleased by the fact that HAL is polling at all; 
polling is a fundamentally broken way to do things, and despite the fact 
that the hardware is broken (by not supporting the MMC commands), it 
still rubs me the wrong way.  Whatever it's doing, it should not be 
waking up the processor on average 20 times a second.

I will do some tests to see if hal-addon-storage wakes up the processor 
less if it doesn't open and close the drive all the time.

>Polling is indeed not a great thing to do, but unfortunately cd drivers don't
>appear to have a nice way to notify media insertion.

Apparently hal knows that my drive supports CDROM_MEDIA_CHANGED, but 
it's not using it.  Why?  Ah, I see, it's checking if the tray is open 
first.  Shouldn't it be checking only to see if there's a media change, 
since obviously if the tray is open, the media hasn't been changed yet?  
Then you can make the kernel do the hard work of determining how to most 
efficiently check the media change notification, with the asynchronous 
API, or the inefficient (polling) one.

And apparently hal doesn't support using the MMC-2 API, it seems.
Why?  MMC-2 is ancient, and most drives should support it.

-- 
brian m. carlson / brian with sandals: Houston, Texas, US
+1 713 440 7475 | http://crustytoothpaste.ath.cx/~bmc | My opinion only
a typesetting engine: http://crustytoothpaste.ath.cx/~bmc/code/thwack
OpenPGP: RSA v4 4096b 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187
[signature.asc (application/pgp-signature, inline)]

Information forwarded to debian-bugs-dist@lists.debian.org, Sjoerd Simons <sjoerd@debian.org>:
Bug#456214; Package hal. Full text and rfc822 format available.

Acknowledgement sent to Michael Biebl <biebl@debian.org>:
Extra info received and forwarded to list. Copy sent to Sjoerd Simons <sjoerd@debian.org>. Full text and rfc822 format available.

Message #45 received at 456214@bugs.debian.org (full text, mbox):

From: Michael Biebl <biebl@debian.org>
To: "brian m. carlson" <sandals@crustytoothpaste.ath.cx>, 456214@bugs.debian.org
Subject: Re: Bug#456214: hal: should not poll CD drive so often
Date: Sun, 16 Dec 2007 23:19:44 +0100
[Message part 1 (text/plain, inline)]
brian m. carlson schrieb:
> On Sun, Dec 16, 2007 at 09:38:48PM +0100, Sjoerd Simons wrote:
>> strace -tt would be more usefull as that outputs timing information.  The
>> open,ioctl,close triple will cause various wakeups every two seconds..
>> But only
>> in a short time, so that shouldn't have a big impact on the time your
>> processor
>> can actually spent in a lower power state.
> 
> I'll get that to you as soon as I log out and log in again. 
> hal-disable-polling --enable-polling is broken (see the bug report I
> just filed).
> 
> I'm not exceptionally pleased by the fact that HAL is polling at all;
> polling is a fundamentally broken way to do things, and despite the fact
> that the hardware is broken (by not supporting the MMC commands), it
> still rubs me the wrong way.  Whatever it's doing, it should not be
> waking up the processor on average 20 times a second.

Only never SATA drives support hardware notifications (via libata).
For others, the only options is to poll, unfortunately.
Why polling every 2 secs causes 20 wakeups per seconds is unclear to me.
Maybe a driver issue, maybe not.

Michael


-- 
Why is it that all of the instruments seeking intelligent life in the
universe are pointed away from Earth?

[signature.asc (application/pgp-signature, attachment)]

Information forwarded to debian-bugs-dist@lists.debian.org, Sjoerd Simons <sjoerd@debian.org>:
Bug#456214; Package hal. Full text and rfc822 format available.

Acknowledgement sent to "brian m. carlson" <sandals@crustytoothpaste.ath.cx>:
Extra info received and forwarded to list. Copy sent to Sjoerd Simons <sjoerd@debian.org>. Full text and rfc822 format available.

Message #50 received at 456214@bugs.debian.org (full text, mbox):

From: "brian m. carlson" <sandals@crustytoothpaste.ath.cx>
To: Michael Biebl <biebl@debian.org>
Cc: 456214@bugs.debian.org
Subject: Re: Bug#456214: hal: should not poll CD drive so often
Date: Mon, 17 Dec 2007 01:44:54 +0000
[Message part 1 (text/plain, inline)]
On Sun, Dec 16, 2007 at 11:19:44PM +0100, Michael Biebl wrote:
>brian m. carlson schrieb:
>> On Sun, Dec 16, 2007 at 09:38:48PM +0100, Sjoerd Simons wrote:
>>> strace -tt would be more usefull as that outputs timing information.  The
>>> open,ioctl,close triple will cause various wakeups every two seconds..
>>> But only
>>> in a short time, so that shouldn't have a big impact on the time your
>>> processor
>>> can actually spent in a lower power state.

Waking up the CD drive to poll its status isn't particularly good for 
power savings, either, regardless of what the main processor is doing.

>Only never SATA drives support hardware notifications (via libata).
>For others, the only options is to poll, unfortunately.
>Why polling every 2 secs causes 20 wakeups per seconds is unclear to me.
>Maybe a driver issue, maybe not.

You'll pardon me if I don't believe you.  HAL itself has a comment that 
says:

/* Check if a disc is in the drive
  *
  * @todo Use MMC-2 API if applicable
  */

Most CD-ROM drives support MMC-2, because MMC-2 is pretty old.  Run 
"wodim -checkdrive" to see.  My drive implements MMC-2, and because HAL 
doesn't implement the MMC-2 API, I have no clue whether it might use a 
more efficient method.

You also ignored the rest of my comment, where I was pointing out that 
hal is wastefully checking the tray status when that's really rather 
irrelevant to whether the media has changed.  In other words, hal is not 
doing everything it can to be efficient.  Whether that will have an 
effect on the number of wakeups is so far unknown, but it is unlikely to 
hurt.

Finally, even if polling is the only way to do something (which I am not 
conceding), that doesn't mean it's not broken, and it certainly doesn't 
mean I have to like it.

The ultimate problem is that hal is the third-leading cause of wakeups 
on my computer.  For me, this is unacceptable.  I'm pointing out that 
there are alternatives to the current method that are very likely more 
efficient, and hal isn't implementing them.  I think it should be.  If 
you don't, then please tag this bug wontfix, and I'll argue it out with 
the upstream maintainers.  But please don't try to tell me that I don't 
know what I'm talking about when the code contradicts you.

I am now going to hack on the code, and see if I can fix this bug.

-- 
brian m. carlson / brian with sandals: Houston, Texas, US
+1 713 440 7475 | http://crustytoothpaste.ath.cx/~bmc | My opinion only
a typesetting engine: http://crustytoothpaste.ath.cx/~bmc/code/thwack
OpenPGP: RSA v4 4096b 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187
[signature.asc (application/pgp-signature, inline)]

Information forwarded to debian-bugs-dist@lists.debian.org, Sjoerd Simons <sjoerd@debian.org>:
Bug#456214; Package hal. Full text and rfc822 format available.

Acknowledgement sent to Michael Biebl <biebl@debian.org>:
Extra info received and forwarded to list. Copy sent to Sjoerd Simons <sjoerd@debian.org>. Full text and rfc822 format available.

Message #55 received at 456214@bugs.debian.org (full text, mbox):

From: Michael Biebl <biebl@debian.org>
To: "brian m. carlson" <sandals@crustytoothpaste.ath.cx>
Cc: 456214@bugs.debian.org
Subject: Re: Bug#456214: hal: should not poll CD drive so often
Date: Mon, 17 Dec 2007 02:54:32 +0100
brian m. carlson schrieb:
> On Sun, Dec 16, 2007 at 11:19:44PM +0100, Michael Biebl wrote:

>> Only never SATA drives support hardware notifications (via libata).
>> For others, the only options is to poll, unfortunately.
>> Why polling every 2 secs causes 20 wakeups per seconds is unclear to me.
>> Maybe a driver issue, maybe not.
> 
> You'll pardon me if I don't believe you.  HAL itself has a comment that
> says:

Well, I don't really mind if you believe me or not, unfortunately what I
mentioned is true, though:
http://kerneltrap.org/Linux/Asynchronous_Event_Notification_Infrastructure

Cheers,
Michael

-- 
Why is it that all of the instruments seeking intelligent life in the
universe are pointed away from Earth?




Information forwarded to debian-bugs-dist@lists.debian.org, Sjoerd Simons <sjoerd@debian.org>:
Bug#456214; Package hal. Full text and rfc822 format available.

Acknowledgement sent to "brian m. carlson" <sandals@crustytoothpaste.ath.cx>:
Extra info received and forwarded to list. Copy sent to Sjoerd Simons <sjoerd@debian.org>. Full text and rfc822 format available.

Message #60 received at 456214@bugs.debian.org (full text, mbox):

From: "brian m. carlson" <sandals@crustytoothpaste.ath.cx>
To: 456214@bugs.debian.org, control@bugs.debian.org
Subject: Patch to prevent hal from causing wakeups
Date: Mon, 17 Dec 2007 02:38:10 +0000
[Message part 1 (text/plain, inline)]
tags 456214 + patch
kthxbye

Attached is a patch to fix the problem with wakeups.  This patch does 
CDROM_MEDIA_CHANGED first, and if it reports true, then checks to make 
sure the drive is closed and then that the drive is not lying.  This 
causes the number of wakeups from HAL to go to zero.  It also has the 
side effect of issuing an extra ioctl(2) when the drive tray is open, 
which is harmless since the drive tray should be closed most of the 
time.

-- 
brian m. carlson / brian with sandals: Houston, Texas, US
+1 713 440 7475 | http://crustytoothpaste.ath.cx/~bmc | My opinion only
a typesetting engine: http://crustytoothpaste.ath.cx/~bmc/code/thwack
OpenPGP: RSA v4 4096b 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187
[hal.patch (text/x-diff, attachment)]
[signature.asc (application/pgp-signature, inline)]

Tags added: patch Request was from "brian m. carlson" <sandals@crustytoothpaste.ath.cx> to control@bugs.debian.org. (Mon, 17 Dec 2007 02:54:03 GMT) Full text and rfc822 format available.

Information forwarded to debian-bugs-dist@lists.debian.org, Sjoerd Simons <sjoerd@debian.org>:
Bug#456214; Package hal. Full text and rfc822 format available.

Acknowledgement sent to Sjoerd Simons <sjoerd@luon.net>:
Extra info received and forwarded to list. Copy sent to Sjoerd Simons <sjoerd@debian.org>. Full text and rfc822 format available.

Message #67 received at 456214@bugs.debian.org (full text, mbox):

From: Sjoerd Simons <sjoerd@luon.net>
To: "brian m. carlson" <sandals@crustytoothpaste.ath.cx>, 456214@bugs.debian.org
Subject: Re: Bug#456214: Patch to prevent hal from causing wakeups
Date: Sat, 22 Dec 2007 17:58:24 +0100
On Mon, Dec 17, 2007 at 02:38:10AM +0000, brian m. carlson wrote:
> tags 456214 + patch
> kthxbye
>
> Attached is a patch to fix the problem with wakeups.  This patch does 
> CDROM_MEDIA_CHANGED first, and if it reports true, then checks to make sure 
> the drive is closed and then that the drive is not lying.  This causes the 
> number of wakeups from HAL to go to zero.  It also has the side effect of 
> issuing an extra ioctl(2) when the drive tray is open, which is harmless 
> since the drive tray should be closed most of the time.

Unfortunately with this patch, iff some other program called
CDROM_MEDIA_CHANGED then hal won't detect the change...

  Sjoerd
-- 
"I don't think so," said Ren'e Descartes.  Just then, he vanished.




Information forwarded to debian-bugs-dist@lists.debian.org, Utopia Maintenance Team <pkg-utopia-maintainers@lists.alioth.debian.org>:
Bug#456214; Package hal. Full text and rfc822 format available.

Acknowledgement sent to "brian m. carlson" <sandals@crustytoothpaste.ath.cx>:
Extra info received and forwarded to list. Copy sent to Utopia Maintenance Team <pkg-utopia-maintainers@lists.alioth.debian.org>. Full text and rfc822 format available.

Message #72 received at 456214@bugs.debian.org (full text, mbox):

From: "brian m. carlson" <sandals@crustytoothpaste.ath.cx>
To: Sjoerd Simons <sjoerd@luon.net>
Cc: 456214@bugs.debian.org
Subject: Re: Bug#456214: Patch to prevent hal from causing wakeups
Date: Sun, 23 Dec 2007 14:43:00 +0000
[Message part 1 (text/plain, inline)]
On Sat, Dec 22, 2007 at 05:58:24PM +0100, Sjoerd Simons wrote:
>Unfortunately with this patch, iff some other program called
>CDROM_MEDIA_CHANGED then hal won't detect the change...

Well, the current method is equally broken.  If the tray is closed and 
the drive doesn't support CDROM_MEDIA_CHANGED, it assumes that there is 
media.  In fact, as long as the tray is actually closed, it assumes 
there is media.  My version at least works some of the time, and it 
has the pleasant side effect of reducing the number of wakeups.

The way I see it, there are only two other solutions: implement the 
MMC-2 API, as the comment in the source code (which may or may not solve 
the bug), or use the patch and make the kernel report 
CDROM_MEDIA_CHANGED per-process.  I think simply using the patch is an 
improvement.

-- 
brian m. carlson / brian with sandals: Houston, Texas, US
+1 713 440 7475 | http://crustytoothpaste.ath.cx/~bmc | My opinion only
a typesetting engine: http://crustytoothpaste.ath.cx/~bmc/code/thwack
OpenPGP: RSA v4 4096b 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187
[signature.asc (application/pgp-signature, inline)]

Information forwarded to debian-bugs-dist@lists.debian.org, Utopia Maintenance Team <pkg-utopia-maintainers@lists.alioth.debian.org>:
Bug#456214; Package hal. Full text and rfc822 format available.

Acknowledgement sent to Sam Morris <sam@robots.org.uk>:
Extra info received and forwarded to list. Copy sent to Utopia Maintenance Team <pkg-utopia-maintainers@lists.alioth.debian.org>. Full text and rfc822 format available.

Message #77 received at 456214@bugs.debian.org (full text, mbox):

From: Sam Morris <sam@robots.org.uk>
To: hal@lists.freedesktop.org
Cc: "brian m. carlson" <sandals@crustytoothpaste.ath.cx>, 456214@bugs.debian.org, 456214-forwarded@bugs.debian.org
Subject: [PATCH] HAL polling, cd drives and wakeups
Date: Wed, 02 Apr 2008 10:52:19 +0100
[Message part 1 (text/plain, inline)]
Brian Carlson noticed that HAL's polling of CD drives was causing his
system to wake up ~20 times a second, and filed a bug about it at
<http://bugs.debian.org/456214>.

He commented,

> Apparently hal knows that my drive supports CDROM_MEDIA_CHANGED, but 
> it's not using it.  Why?  Ah, I see, it's checking if the tray is open 
> first.  Shouldn't it be checking only to see if there's a media change, 
> since obviously if the tray is open, the media hasn't been changed yet?  
> Then you can make the kernel do the hard work of determining how to most 
> efficiently check the media change notification, with the asynchronous 
> API, or the inefficient (polling) one.

He also posted a patch, which I'd like to get reviewed upstream:

> Attached is a patch to fix the problem with wakeups.  This patch does 
> CDROM_MEDIA_CHANGED first, and if it reports true, then checks to make 
> sure the drive is closed and then that the drive is not lying.  This 
> causes the number of wakeups from HAL to go to zero.  It also has the 
> side effect of issuing an extra ioctl(2) when the drive tray is open, 
> which is harmless since the drive tray should be closed most of the 
> time.

The patch can be retrieved from
<http://bugs.debian.org/cgi-bin/bugreport.cgi?msg=60;filename=hal.patch;att=1;bug=456214>.

Please keep Brian and 456214@bugs.debian.org CC'd in replies.

-- 
Sam Morris
http://robots.org.uk/

PGP key id 1024D/5EA01078
3412 EA18 1277 354B 991B  C869 B219 7FDB 5EA0 1078
[signature.asc (application/pgp-signature, inline)]

Reply sent to Sam Morris <sam@robots.org.uk>:
You have marked Bug as forwarded. Full text and rfc822 format available.

Information forwarded to debian-bugs-dist@lists.debian.org, Utopia Maintenance Team <pkg-utopia-maintainers@lists.alioth.debian.org>:
Bug#456214; Package hal. Full text and rfc822 format available.

Acknowledgement sent to David Zeuthen <david@fubar.dk>:
Extra info received and forwarded to list. Copy sent to Utopia Maintenance Team <pkg-utopia-maintainers@lists.alioth.debian.org>. Full text and rfc822 format available.

Message #85 received at 456214@bugs.debian.org (full text, mbox):

From: David Zeuthen <david@fubar.dk>
To: Sam Morris <sam@robots.org.uk>
Cc: hal@lists.freedesktop.org, "brian m. carlson" <sandals@crustytoothpaste.ath.cx>, 456214-forwarded@bugs.debian.org, 456214@bugs.debian.org
Subject: Re: [PATCH] HAL polling, cd drives and wakeups
Date: Wed, 02 Apr 2008 12:34:07 -0400
On Wed, 2008-04-02 at 10:52 +0100, Sam Morris wrote:
> > Attached is a patch to fix the problem with wakeups.  This patch does 
> > CDROM_MEDIA_CHANGED first, and if it reports true, then checks to make 
> > sure the drive is closed and then that the drive is not lying.  This 
> > causes the number of wakeups from HAL to go to zero.  It also has the 
> > side effect of issuing an extra ioctl(2) when the drive tray is open, 
> > which is harmless since the drive tray should be closed most of the 
> > time.

So if I understand this correctly, what this patch does is to reduce the
number of wakeups only when the drive door is open?

     David






Information forwarded to debian-bugs-dist@lists.debian.org, Utopia Maintenance Team <pkg-utopia-maintainers@lists.alioth.debian.org>:
Bug#456214; Package hal. Full text and rfc822 format available.

Acknowledgement sent to Doug Goldstein <cardoe@gentoo.org>:
Extra info received and forwarded to list. Copy sent to Utopia Maintenance Team <pkg-utopia-maintainers@lists.alioth.debian.org>. Full text and rfc822 format available.

Message #91 received at 456214@bugs.debian.org (full text, mbox):

From: Doug Goldstein <cardoe@gentoo.org>
To: David Zeuthen <david@fubar.dk>
Cc: Sam Morris <sam@robots.org.uk>, 456214@bugs.debian.org, "brian m. carlson" <sandals@crustytoothpaste.ath.cx>, 456214-forwarded@bugs.debian.org, hal@lists.freedesktop.org
Subject: Re: [PATCH] HAL polling, cd drives and wakeups
Date: Wed, 02 Apr 2008 12:57:44 -0400
David Zeuthen wrote:
> On Wed, 2008-04-02 at 10:52 +0100, Sam Morris wrote:
>   
>>> Attached is a patch to fix the problem with wakeups.  This patch does 
>>> CDROM_MEDIA_CHANGED first, and if it reports true, then checks to make 
>>> sure the drive is closed and then that the drive is not lying.  This 
>>> causes the number of wakeups from HAL to go to zero.  It also has the 
>>> side effect of issuing an extra ioctl(2) when the drive tray is open, 
>>> which is harmless since the drive tray should be closed most of the 
>>> time.
>>>       
>
> So if I understand this correctly, what this patch does is to reduce the
> number of wakeups only when the drive door is open?
>
>      David
>
>   
No. Other way around. It'll increase the number of wakeups when the 
drive door is opened and decrease them when it's closed. However it's 
problematic in the fact that Linux does not do per-process 
CDROM_MEDIA_CHANGED. If another app reads that, then HAL will never know 
that the media changed.

Right now HAL always checks to see if the drive door and then assumes 
there is media in the drive.

The downside to the patch is that it relies on CDROM_MEDIA_CHANGED not 
being touched by another app. So with the patch HAL, will cause less 
interrupts but will miss media changes in some situations..




Information forwarded to debian-bugs-dist@lists.debian.org, Utopia Maintenance Team <pkg-utopia-maintainers@lists.alioth.debian.org>:
Bug#456214; Package hal. Full text and rfc822 format available.

Acknowledgement sent to David Zeuthen <david@fubar.dk>:
Extra info received and forwarded to list. Copy sent to Utopia Maintenance Team <pkg-utopia-maintainers@lists.alioth.debian.org>. Full text and rfc822 format available.

Message #97 received at 456214@bugs.debian.org (full text, mbox):

From: David Zeuthen <david@fubar.dk>
To: Doug Goldstein <cardoe@gentoo.org>
Cc: Sam Morris <sam@robots.org.uk>, 456214@bugs.debian.org, "brian m. carlson" <sandals@crustytoothpaste.ath.cx>, 456214-forwarded@bugs.debian.org, hal@lists.freedesktop.org, danny.kukawka@web.de
Subject: Re: [PATCH] HAL polling, cd drives and wakeups
Date: Wed, 02 Apr 2008 13:40:24 -0400
On Wed, 2008-04-02 at 12:57 -0400, Doug Goldstein wrote:
> David Zeuthen wrote:
> > On Wed, 2008-04-02 at 10:52 +0100, Sam Morris wrote:
> >   
> >>> Attached is a patch to fix the problem with wakeups.  This patch does 
> >>> CDROM_MEDIA_CHANGED first, and if it reports true, then checks to make 
> >>> sure the drive is closed and then that the drive is not lying.  This 
> >>> causes the number of wakeups from HAL to go to zero.  It also has the 
> >>> side effect of issuing an extra ioctl(2) when the drive tray is open, 
> >>> which is harmless since the drive tray should be closed most of the 
> >>> time.
> >>>       
> >
> > So if I understand this correctly, what this patch does is to reduce the
> > number of wakeups only when the drive door is open?
> >
> >      David
> >
> >   
> No. Other way around. It'll increase the number of wakeups when the 
> drive door is opened and decrease them when it's closed. 

Hmm. I'm confused how it can bring the wakeups to zero as is claimed
upthread. Surely the kernel won't know if media is changed unless it
asks the drive [1]. And the kernel won't do this by itself since it's a
policy decision to do so. Or to put it in another way: To detect media
changes the drive _will_ need to be polled from user space - SATA AN
wasn't invented for nothing.

[1] : Unless of course it's a SATA optical drive supporting AN - but the
Linux kernel interfaces for detecting this have been in a flux (stable
in 2.6.24 I think) so we don't properly support this right now. It's
easy to add and probably something we should do for 0.5.11; in fact I
volunteer to do this as I have the hardware to do so (thanks to Kristen
from Intel). But that's up to Danny whether it should be in 0.5.11
(would be a small invasive patch). Danny?

> However it's 
> problematic in the fact that Linux does not do per-process 
> CDROM_MEDIA_CHANGED. If another app reads that, then HAL will never know 
> that the media changed.
> 
> Right now HAL always checks to see if the drive door and then assumes 
> there is media in the drive.
> 
> The downside to the patch is that it relies on CDROM_MEDIA_CHANGED not 
> being touched by another app. So with the patch HAL, will cause less 
> interrupts but will miss media changes in some situations..
> 





Information forwarded to debian-bugs-dist@lists.debian.org, Utopia Maintenance Team <pkg-utopia-maintainers@lists.alioth.debian.org>:
Bug#456214; Package hal. Full text and rfc822 format available.

Acknowledgement sent to Doug Goldstein <cardoe@gentoo.org>:
Extra info received and forwarded to list. Copy sent to Utopia Maintenance Team <pkg-utopia-maintainers@lists.alioth.debian.org>. Full text and rfc822 format available.

Message #103 received at 456214@bugs.debian.org (full text, mbox):

From: Doug Goldstein <cardoe@gentoo.org>
To: David Zeuthen <david@fubar.dk>
Cc: Sam Morris <sam@robots.org.uk>, 456214@bugs.debian.org, "brian m. carlson" <sandals@crustytoothpaste.ath.cx>, 456214-forwarded@bugs.debian.org, hal@lists.freedesktop.org, danny.kukawka@web.de
Subject: Re: [PATCH] HAL polling, cd drives and wakeups
Date: Thu, 03 Apr 2008 10:38:42 -0400
David Zeuthen wrote:
> On Wed, 2008-04-02 at 12:57 -0400, Doug Goldstein wrote:
>   
>> David Zeuthen wrote:
>>     
>>> On Wed, 2008-04-02 at 10:52 +0100, Sam Morris wrote:
>>>   
>>>       
>>>>> Attached is a patch to fix the problem with wakeups.  This patch does 
>>>>> CDROM_MEDIA_CHANGED first, and if it reports true, then checks to make 
>>>>> sure the drive is closed and then that the drive is not lying.  This 
>>>>> causes the number of wakeups from HAL to go to zero.  It also has the 
>>>>> side effect of issuing an extra ioctl(2) when the drive tray is open, 
>>>>> which is harmless since the drive tray should be closed most of the 
>>>>> time.
>>>>>       
>>>>>           
>>> So if I understand this correctly, what this patch does is to reduce the
>>> number of wakeups only when the drive door is open?
>>>
>>>      David
>>>
>>>   
>>>       
>> No. Other way around. It'll increase the number of wakeups when the 
>> drive door is opened and decrease them when it's closed. 
>>     
>
> Hmm. I'm confused how it can bring the wakeups to zero as is claimed
> upthread. Surely the kernel won't know if media is changed unless it
> asks the drive [1]. And the kernel won't do this by itself since it's a
> policy decision to do so. Or to put it in another way: To detect media
> changes the drive _will_ need to be polled from user space - SATA AN
> wasn't invented for nothing.
>   
Now I could be wrong (I'm not too well versed in hardware specs and 
driver bits). I was under the impression that MMC-2 ATAPI provides for a 
Media Status Notification. Which is a polled condition. However, the 
device should emit an Unit Attention Condition when a disc *may* have 
been removed. Which basically means, the device should emit a notice 
when the drive door opens and closes to tell you that the media may have 
changed.

As the bug report explains now, HAL is checking for the drive door to be 
closed. Instead of relying on the Unit Attention Condition notice.

His patch would bring hal-addon-storage's wakeups down since it would 
offload more work on the kernel where the wakeups would occur.




Information forwarded to debian-bugs-dist@lists.debian.org, Utopia Maintenance Team <pkg-utopia-maintainers@lists.alioth.debian.org>:
Bug#456214; Package hal. Full text and rfc822 format available.

Acknowledgement sent to David Zeuthen <david@fubar.dk>:
Extra info received and forwarded to list. Copy sent to Utopia Maintenance Team <pkg-utopia-maintainers@lists.alioth.debian.org>. Full text and rfc822 format available.

Message #109 received at 456214@bugs.debian.org (full text, mbox):

From: David Zeuthen <david@fubar.dk>
To: Doug Goldstein <cardoe@gentoo.org>
Cc: "brian m. carlson" <sandals@crustytoothpaste.ath.cx>, 456214-forwarded@bugs.debian.org, 456214@bugs.debian.org, hal@lists.freedesktop.org, danny.kukawka@web.de, Sam Morris <sam@robots.org.uk>
Subject: Re: [PATCH] HAL polling, cd drives and wakeups
Date: Thu, 03 Apr 2008 19:49:09 -0400
On Thu, 2008-04-03 at 10:38 -0400, Doug Goldstein wrote:
> Now I could be wrong (I'm not too well versed in hardware specs and 
> driver bits). I was under the impression that MMC-2 ATAPI provides for a 
> Media Status Notification. Which is a polled condition. However, the 
> device should emit an Unit Attention Condition when a disc *may* have 
> been removed. Which basically means, the device should emit a notice 
> when the drive door opens and closes to tell you that the media may have 
> changed.
> 
> As the bug report explains now, HAL is checking for the drive door to be 
> closed. Instead of relying on the Unit Attention Condition notice.

Except that approximately 0% of the drives out there support that
command properly. See 'man hal-disable-polling' for the longer story.

     David






Information forwarded to debian-bugs-dist@lists.debian.org, Utopia Maintenance Team <pkg-utopia-maintainers@lists.alioth.debian.org>:
Bug#456214; Package hal. Full text and rfc822 format available.

Acknowledgement sent to "brian m. carlson" <sandals@crustytoothpaste.ath.cx>:
Extra info received and forwarded to list. Copy sent to Utopia Maintenance Team <pkg-utopia-maintainers@lists.alioth.debian.org>. Full text and rfc822 format available.

Message #115 received at 456214@bugs.debian.org (full text, mbox):

From: "brian m. carlson" <sandals@crustytoothpaste.ath.cx>
To: David Zeuthen <david@fubar.dk>
Cc: Doug Goldstein <cardoe@gentoo.org>, 456214-forwarded@bugs.debian.org, 456214@bugs.debian.org, hal@lists.freedesktop.org, danny.kukawka@web.de, Sam Morris <sam@robots.org.uk>
Subject: Re: [PATCH] HAL polling, cd drives and wakeups
Date: Fri, 4 Apr 2008 14:57:02 +0000
[Message part 1 (text/plain, inline)]
On Thu, Apr 03, 2008 at 07:49:09PM -0400, David Zeuthen wrote:
>On Thu, 2008-04-03 at 10:38 -0400, Doug Goldstein wrote:
>> Now I could be wrong (I'm not too well versed in hardware specs and 
>> driver bits). I was under the impression that MMC-2 ATAPI provides for a 
>> Media Status Notification. Which is a polled condition. However, the 
>> device should emit an Unit Attention Condition when a disc *may* have 
>> been removed. Which basically means, the device should emit a notice 
>> when the drive door opens and closes to tell you that the media may have 
>> changed.
>> 
>> As the bug report explains now, HAL is checking for the drive door to be 
>> closed. Instead of relying on the Unit Attention Condition notice.
>
>Except that approximately 0% of the drives out there support that
>command properly. See 'man hal-disable-polling' for the longer story.

I don't know why it causes fewer wakeups, but it does.  It may or may 
not have anything to do with MMC-2 ATAPI.  HAL shows ten wakeups per 
second without the patch, and doesn't appear in powertop with the patch.  

It doesn't really matter to me why it happens, but since I'm now 
curious: the cdrom driver talks to the specific driver (in the example 
I'm using, ide-cd) and does a media_changed request, which calls 
ide_cdrom_check_media_change_real.  That does a cdrom_check_status, 
which issues a TEST_UNIT_READY command.

Issuing a drive status command calls ide_cdrom_drive_status, which also 
eventually issues a cdrom_check_status, but it also calls 
cdrom_get_media_event, which does a GET_EVENT_STATUS_NOTIFICATION.  This 
appears to be the expensive part.  ide_cdrom_drive_status also checks 
the MMC-2 ATAPI method with UNIT_ATTENTION, and doesn't bother doing the 
more expensive check if that happens.

-- 
brian m. carlson / brian with sandals: Houston, Texas, US
+1 713 440 7475 | http://crustytoothpaste.ath.cx/~bmc | My opinion only
troff on top of XML: http://crustytoothpaste.ath.cx/~bmc/code/thwack
OpenPGP: RSA v4 4096b 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187
[signature.asc (application/pgp-signature, inline)]

Changed Bug submitter to '"brian m. carlson" <sandals@crustytoothpaste.net>' from '"brian m. carlson" <sandals@crustytoothpaste.ath.cx>' Request was from "brian m. carlson" <sandals@crustytoothpaste.net> to control@bugs.debian.org. (Thu, 03 Feb 2011 20:51:22 GMT) Full text and rfc822 format available.

Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Fri Apr 18 09:11:13 2014; Machine Name: beach.debian.org

Debian Bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.