All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jean Delvare <khali@linux-fr.org>
To: lm-sensors@vger.kernel.org
Subject: Re: [lm-sensors] lm-sensors 3.0.0-rc1 has been released!
Date: Wed, 03 Oct 2007 10:36:42 +0000	[thread overview]
Message-ID: <20071003123642.765ab999@hyperion.delvare> (raw)
In-Reply-To: <20070925233316.7afaa297@hyperion.delvare>

Hi Henrique,

On Sun, 30 Sep 2007 11:54:29 -0300, Henrique de Moraes Holschuh wrote:
> On Sun, 30 Sep 2007, Jean Delvare wrote:
> > libsensors wouldn't cope with that anyway, so I'm glad you're not doing
> > it. libsensors probes for available features at initialization time.
> 
> We better document that in the kernel docs, then.

Send a patch?

>                                                    Because AFAIK sysfs
> interfaces are actually supposed to make those attributes come and go when
> possible.

According to what standard?

> > After that, the feature list doesn't change and applications can count
> > on it not changing. Of course, applications can run sensors_init()
> > again to get a fresher view of the hardware state, but this is pretty
> > expensive and not something that we want applications to do every other
> > second.
> 
> I've seen that cause endless problems in ACPI drivers (thinkpad-acpi has
> this issue on some deprecated codepaths).  It is really something to avoid
> if at all possible.

I don't understand you. What should be avoided exactly?

> > > (...)
> > > Drivers *do* often retry, if the hardware is busy.  But if they get a
> > > signal, what should they do, then?  AFAIK at least for stuff like sysfs, one
> > > is to return to userspace with EINTR to let userspace handle its signals,
> > > and resubmit the request if it wants to.
> > > 
> > > My sources of EINTR in thinkpad-acpi are from mutex_lock_interruptible.
> > 
> > I really need you to explain in details how and why EINTR is generated
> > and what we are supposed to do with it. I can't implement anything in
> > libsensors as long as I don't understand what we are dealing with.
> > Ideally, you would even be writing the libsensors patch, as you seem to
> > understand the needs much better than I do.
> 
> I am not completely sure I do understand EINTR, mind you.  But here's a
> typical path in thinkpad-acpi that can return EINTR as per the
> mutex_lock_interruptible documentation:
> 
> static ssize_t hotkey_mask_show(struct device *dev,
>                            struct device_attribute *attr,
>                            char *buf)
> {
>         int res;
> 
>         res = mutex_lock_interruptible(&hotkey_mutex);
>         if (res < 0)
>                 return res;
>         res = hotkey_mask_get();
>         mutex_unlock(&hotkey_mutex);
> 
>         return (res)?
>                 res : snprintf(buf, PAGE_SIZE, "0x%08x\n", hotkey_mask);
> }
> 
> It may return -EINTR from mutex_lock_interruptible, or -EIO from
> hotkey_mask_get (a function internal to thinkpad-acpi).
> 
> AFAIK, all cases I have seen for EINTR on the kernel allow one to do
> something like this in userspace:
> 
> rc = -EINTR;
> while (rc = -EINTR) {
> 	(check if any of our signal handlers have signalled that a signal
>          was receivied, e.g. sigterm)
> 	(kernel operation that can return EINTR);
> }
> 
> Because EINTR is something that is one-shot.  You get it when a signal is
> delivered, and that's it.  Many syscalls can even be told to restart
> themselves in case of an EINTR (but I don't know much about that, sorry).
> 
> Thinking a bit more about it, it looks to me like libsensors4 needs to be
> able to pass EINTR down the chain, and must let its user (the application)
> do the retries.  So, as you said, no retries within libsensors4... but we
> need an extra status code for EINTR.

Why are you using mutex_lock_interruptible() rather than just
mutex_lock() as all the other hwmon drivers do?

-- 
Jean Delvare

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

  parent reply	other threads:[~2007-10-03 10:36 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-25 21:33 [lm-sensors] lm-sensors 3.0.0-rc1 has been released! Jean Delvare
2007-09-25 21:45 ` Philip Edelbrock
2007-09-26 21:02 ` Hans de Goede
2007-09-27 14:35 ` Jean Delvare
2007-09-27 14:42 ` Jean Delvare
2007-09-27 17:53 ` Henrique de Moraes Holschuh
2007-09-28 17:07 ` Jean Delvare
2007-09-28 20:13 ` Henrique de Moraes Holschuh
2007-09-29 13:39 ` Jean Delvare
2007-09-30  0:56 ` Henrique de Moraes Holschuh
2007-09-30 11:54 ` Jean Delvare
2007-09-30 12:10 ` Jean Delvare
2007-09-30 14:54 ` Henrique de Moraes Holschuh
2007-10-03 10:36 ` Jean Delvare [this message]
2007-10-03 11:38 ` Henrique de Moraes Holschuh
2007-10-04  9:45 ` Jean Delvare
2007-10-04 12:49 ` Henrique de Moraes Holschuh
2007-10-04 13:42 ` Jean Delvare
2007-10-07 11:21 ` Axel Thimm
2007-10-17 21:44 ` Jean Delvare
2007-10-18  7:17 ` Hans de Goede
2007-10-18  8:18 ` Aurelien Jarno
2007-10-19 14:46 ` Jean Delvare
2007-10-19 20:18 ` Hans de Goede
2007-10-20 18:13 ` Jean Delvare
2007-10-20 22:41 ` Hans de Goede
2007-10-21 19:08 ` Jean Delvare
2007-10-21 19:13 ` Hans de Goede
2007-10-21 21:12 ` Jean Delvare
2007-10-22  7:06 ` Hans de Goede
2007-10-22  7:48 ` Jean Delvare
2007-10-22  8:13 ` Hans de Goede
2007-10-22  8:23 ` Jean Delvare
2007-10-22  9:40 ` Hans de Goede
2007-10-22 11:55 ` Jean Delvare
2007-10-22 13:15 ` Hans de Goede
2007-10-22 13:55 ` Jean Delvare
2007-10-22 19:27 ` Hans de Goede
2007-10-22 22:25 ` Aurelien Jarno
2007-10-24 15:30 ` Jean Delvare
2007-10-24 17:09 ` Hans de Goede

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=20071003123642.765ab999@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.