From: Jean Delvare <khali@linux-fr.org>
To: lm-sensors@vger.kernel.org
Subject: Re: [lm-sensors] sensors-detect: probing i2c sensors racy?
Date: Wed, 09 Dec 2009 16:11:48 +0000 [thread overview]
Message-ID: <20091209171148.5a8ea5a8@hyperion.delvare> (raw)
In-Reply-To: <20091209153225.GA3947@alittletooquiet.net>
[-- Attachment #1: Type: text/plain, Size: 1431 bytes --]
Hi Forest,
On Wed, 9 Dec 2009 10:32:25 -0500, Forest Bond wrote:
> I am seeing a situation where sensors-detect fails to find sensors in a single
> run due to an apparent race condition. It looks like it loads the i2c-* modules
> and then tries to open /dev/i2c-0 for probing, but it fails to open
> successfully. My sense is that the device is not fully initialize and ready for
> opening immediately following the modprobe calls, but sensors-detect does not
> wait for initialization to complete. I'm not sure what should be happening. It
> seems sensible that modprobe would not return until the device is initialized.
>
> Running sensors-detect again correctly probes the hardware because the i2c bus
> is fully initialized at that point.
You must be typing very fast to be able to trigger this ;) Or udev is
very slow populating /dev on your machine.
> I don't know anything about i2c, so I hope the language I'm using to describe
> this situation is reasonable.
It is perfect.
> I've attached the output from sensors-detect for the first (failed) run and the
> second (successful) run.
>
> Thoughts?
The version of the sensors-detect you're using is getting old. Please
give a try to the latest one:
http://dl.lm-sensors.org/lm-sensors/files/sensors-detect
If you can still reproduce the problem, then please give a try to the
attached patch and report.
--
Jean Delvare
http://khali.linux-fr.org/wishlist.html
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: sensors-detect-wait-for-i2c-dev-nodes.patch --]
[-- Type: text/x-patch; name=sensors-detect-wait-for-i2c-dev-nodes.patch, Size: 666 bytes --]
Index: sensors-detect
===================================================================
--- sensors-detect (révision 5808)
+++ sensors-detect (copie de travail)
@@ -5812,6 +5812,12 @@
$by_default = 1 if dmi_match('board_vendor', 'asustek', 'tyan',
'supermicro');
+ # udev may take some time to create the device node
+ if (!(-x "/sbin/udevadm" && system("/sbin/udevadm settle") == 0)
+ && !(-x "/sbin/udevsettle" && system("/sbin/udevsettle") == 0)) {
+ sleep(1);
+ }
+
for (my $dev_nr = 0; $dev_nr < @i2c_adapters; $dev_nr++) {
next unless exists $i2c_adapters[$dev_nr];
scan_i2c_adapter($dev_nr, $by_default);
[-- Attachment #3: Type: text/plain, Size: 153 bytes --]
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
next prev parent reply other threads:[~2009-12-09 16:11 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-09 15:32 [lm-sensors] sensors-detect: probing i2c sensors racy? Forest Bond
2009-12-09 15:56 ` Forest Bond
2009-12-09 16:11 ` Jean Delvare [this message]
2009-12-09 16:23 ` Forest Bond
2009-12-11 3:31 ` Forest Bond
2009-12-11 8:56 ` Jean Delvare
2009-12-11 12:05 ` Forest Bond
2009-12-11 12:56 ` Jean Delvare
2010-02-03 23:47 ` Forest Bond
2010-02-04 8:18 ` Jean Delvare
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20091209171148.5a8ea5a8@hyperion.delvare \
--to=khali@linux-fr.org \
--cc=lm-sensors@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.