unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* Guile hangs on /sys file read.
@ 2006-11-24 20:20 Rob Browning
  2006-11-26 13:33 ` Neil Jerram
  0 siblings, 1 reply; 3+ messages in thread
From: Rob Browning @ 2006-11-24 20:20 UTC (permalink / raw)



Given:

  $ ls -l /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
  -r--r--r-- 1 root root 4096 Nov 24 10:07
    /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq

  $ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
  1862000

This hangs:

  $ guile -c '(call-with-input-file "/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq" read)'

Strace shows that the process is hanging in a select.  The same thing
works fine for /proc/loadavg.

I haven't investigated further yet.

-- 
Rob Browning
rlb @defaultvalue.org and @debian.org; previously @cs.utexas.edu
GPG starting 2002-11-03 = 14DD 432F AE39 534D B592  F9A0 25C8 D377 8C7E 73A4


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


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

* Re: Guile hangs on /sys file read.
  2006-11-24 20:20 Guile hangs on /sys file read Rob Browning
@ 2006-11-26 13:33 ` Neil Jerram
  2006-11-26 18:10   ` Rob Browning
  0 siblings, 1 reply; 3+ messages in thread
From: Neil Jerram @ 2006-11-26 13:33 UTC (permalink / raw)
  Cc: guile-devel

Rob Browning <rlb@defaultvalue.org> writes:

> Given:
>
>   $ ls -l /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
>   -r--r--r-- 1 root root 4096 Nov 24 10:07
>     /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
>
>   $ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
>   1862000
>
> This hangs:
>
>   $ guile -c '(call-with-input-file "/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq" read)'
>
> Strace shows that the process is hanging in a select.  The same thing
> works fine for /proc/loadavg.
>
> I haven't investigated further yet.

It looks like this is a characteristic of the sysfs filesystem.  See
from line 355 onwards here:
http://www.gelato.unsw.edu.au/lxr/source/fs/sysfs/file.c.

Perhaps we could optimize Guile to skip the select when we know we're
reading from a file (or more generally, from any fd for which data is
either already there or will never be there)?

Regards,
     Neil



_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


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

* Re: Guile hangs on /sys file read.
  2006-11-26 13:33 ` Neil Jerram
@ 2006-11-26 18:10   ` Rob Browning
  0 siblings, 0 replies; 3+ messages in thread
From: Rob Browning @ 2006-11-26 18:10 UTC (permalink / raw)
  Cc: guile-devel

Neil Jerram <neil@ossau.uklinux.net> writes:

> It looks like this is a characteristic of the sysfs filesystem.  See
> from line 355 onwards here:
> http://www.gelato.unsw.edu.au/lxr/source/fs/sysfs/file.c.

It looks like the kernel version may be relevant.  Presuming I tested
correctly, Guile doesn't block with a 2.6.16.15 kernel, but does with
2.6.18.3.

-- 
Rob Browning
rlb @defaultvalue.org and @debian.org; previously @cs.utexas.edu
GPG starting 2002-11-03 = 14DD 432F AE39 534D B592  F9A0 25C8 D377 8C7E 73A4


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


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

end of thread, other threads:[~2006-11-26 18:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-24 20:20 Guile hangs on /sys file read Rob Browning
2006-11-26 13:33 ` Neil Jerram
2006-11-26 18:10   ` Rob Browning

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).