[linux-pm] Some thoughts on suspend/resume development

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 2005-03-10 at 09:43 +1100, Nigel Cunningham wrote:
> > > > > <heresy> I wonder if using sysfs is even the best method for doing
> > > > > run-time PM. It will force your imaginary nice userspace interface to
> > > > > include code to scan the whole directory tree looking for files of each
> > > > > kind, perhaps sorting and collating and so on. Maybe a DBus interface
> > > > > would be better? </heresy>
> > > > 
> > > > DBus is too hard to use from shell, and I do not think whole directory
> > > > scan is so hard to do.
> > > 
> > > Perhaps provide both? Of course I don't know what the implications
> > 
> > No...
> > 
> > I do not believe sysfs is ever going to be efficiency problem. If your
> > machine is so big that your /sys is big, then your machine is fast
> > enough to handle it.
> 
> It is possible, I agree. But how slow would it be?
> 
> I guess the real show stopper would be the fact that you'd need to have
> your userspace daemon constantly scanning these sysfs files for events.
> That or you'd need to provide one sysfs entry that simplified things by
> duplicating all events through one file. If we go that far, it's not
> much further to a netlink socket.
> 

Isn't this exactly what the kobject user events are for ? There is one
here

 KOBJ_CHANGE          = (__force kobject_action_t) 0x03, /* a sysfs attribute file has changed */

to be used when a sysfs attribute has changed. Userspace would listen
for this; it's broadcast on the netlink socket and thus pretty easy to
be picked up. Events can be emitted from the kernel using these
functions

        int kobject_uevent(struct kobject *kobj,
                           enum kobject_action action,
                           struct attribute *attr);
        int kobject_uevent_atomic(struct kobject *kobj,
                                  enum kobject_action action,
                                  struct attribute *attr);
        
defined in include/linux/kobject_uevent.h. You may also define your own
signals; see the header file; for instance we now have messages for
mount/umount so userspace don't have to use the dreadful D_NOTIFY on
e.g. /etc/mtab or /proc/mounts.

I also think there is some general confusion about using D-BUS in kernel
space in this thread - the whole reason for doing the uevents stuff,
IIRC, was that they are easy to be picked up by the D-BUS system message
bus and pushed out to the rest of user space. IIRC there were never any
talk about having user space using D-BUS to invoke methods in the kernel
- it was strictly one-way.

It seems to me that sysfs + uevents for change notification is the
appropriate interface for user space.

Cheers,
David



[Index of Archives]     [Linux ACPI]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [CPU Freq]     [Kernel Newbies]     [Fedora Kernel]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux