2010-11-01 18:07:34

by Alan

[permalink] [raw]
Subject: Re: [RFC PATCH] device-core: sysfs open - close notify

> Your patch may cause many unnecessary memory waste because
> most of drivers does not need attribute file .open/.close notifier.

Firstly there are not that many driver objects in a small system so it
wouldn't take that much to shift the balance the other way. Secondly
its becoming clear that every time a driver goes to runtime pm these
issues come up - even with things like configuration values for drivers
that need to wake the hardware and then silence it.

So the whole sysfs/open thing is going to keep haunting us with runtime
pm, the question is where to put the callbacks so we don't bloat stuff.
Clearly not per attribute or per sysfs node. One possibility would be
with the runtime pm stuff, but that would need a clean reliable way to
go sysfs->device->runtime_pm

There are also obvious hackish ways to handle it like passing a 0
length read to indicate close etc - they save memory but they are
asking for problems in future.


2010-11-02 06:31:08

by Samu Onkalo

[permalink] [raw]
Subject: Re: [RFC PATCH] device-core: sysfs open - close notify

On Mon, 2010-11-01 at 18:11 +0100, ext Alan Cox wrote:
> > Your patch may cause many unnecessary memory waste because
> > most of drivers does not need attribute file .open/.close notifier.
>
> Firstly there are not that many driver objects in a small system so it
> wouldn't take that much to shift the balance the other way. Secondly
> its becoming clear that every time a driver goes to runtime pm these
> issues come up - even with things like configuration values for drivers
> that need to wake the hardware and then silence it.
>
> So the whole sysfs/open thing is going to keep haunting us with runtime
> pm, the question is where to put the callbacks so we don't bloat stuff.
> Clearly not per attribute or per sysfs node. One possibility would be
> with the runtime pm stuff, but that would need a clean reliable way to
> go sysfs->device->runtime_pm
>
> There are also obvious hackish ways to handle it like passing a 0
> length read to indicate close etc - they save memory but they are
> asking for problems in future.
>

Memory footprint could be minimized by combining separate open close
functions to one like sysfs_open_close_notify and the actual operation
would be a call parameter. But is that hackish?

And perhaps some flags could be used to indicate which attributes trigs
the open / close notification.

-Samu



2010-11-16 03:27:58

by Enrico Weigelt

[permalink] [raw]
Subject: Re: [RFC PATCH] device-core: sysfs open - close notify

* Onkalo Samu <[email protected]> wrote:

<snip />

Perhaps it also could be an more generic event notification op,
where some event id or bitmask tells what actually happened ?
Something like:

...
void (*notify)(struct kobject *, struct attribute *, int event, void * param);
...

That would at least save one ptr of space and can be extended for
other stuff later.


cu
--
----------------------------------------------------------------------
Enrico Weigelt, metux IT service -- http://www.metux.de/

phone: +49 36207 519931 email: [email protected]
mobile: +49 151 27565287 icq: 210169427 skype: nekrad666
----------------------------------------------------------------------
Embedded-Linux / Portierung / Opensource-QM / Verteilte Systeme
----------------------------------------------------------------------