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

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

 



Hi.

On Thu, 2005-03-10 at 10:08, David Zeuthen wrote:
> > > 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.

That sounds good from the kernel->userspace side, but hideous from the
other perspective! But perhaps I'm just being ignorant :> Say a
userspace daemon learns that we've just lost AC and have 3 minutes of
UPS power left. I guess it would notify HAL, but wouldn't we then want
HAL to notify kernel space? Or would you imagine HAL directly saying to
drivers, "Video driver, turn the monitor off if you haven't already."?

Regards,

Nigel

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

-- 
Nigel Cunningham
Software Engineer, Canberra, Australia
http://www.cyclades.com
Bus: +61 (2) 6291 9554; Hme: +61 (2) 6292 8028;  Mob: +61 (417) 100 574

Maintainer of Suspend2 Kernel Patches http://suspend2.net


[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