All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC][PATCH 0/9] Suspend block api (version 3)
@ 2009-05-06  4:18 Arve Hjønnevåg
  2009-05-06  4:18 ` [PATCH 1/9] PM: Add suspend block api Arve Hjønnevåg
  2009-05-06 17:17 ` [RFC][PATCH 0/9] Suspend block api (version 3) Kevin Hilman
  0 siblings, 2 replies; 64+ messages in thread
From: Arve Hjønnevåg @ 2009-05-06  4:18 UTC (permalink / raw)
  To: linux-pm; +Cc: ncunningham, u.luckas, swetland

This patch series adds a suspend-block api that provides the same
functionality as the android wakelock api. This patch series removes
the sysdev that was used to abort suspend and adds a direct check in
suspend_enter instead. It also has some other code style changes.

---
Arve Hjønnevåg

_______________________________________________
linux-pm mailing list
linux-pm@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/linux-pm

^ permalink raw reply	[flat|nested] 64+ messages in thread
* Re: [linux-pm] [PATCH 2/9] PM: suspend_block: Add driver to access suspend blockers from user-space
  2010-04-27  4:04 [linux-pm] " Arve Hjønnevåg
@ 2010-04-27 18:33 Alan Stern
  2010-04-27 22:03 ` Rafael J. Wysocki
  2010-04-27 22:03 ` [linux-pm] " Rafael J. Wysocki
  0 siblings, 2 replies; 64+ messages in thread
From: Alan Stern @ 2010-04-27 18:33 UTC (permalink / raw)
  To: Arve Hjønnevåg
  Cc: Pavel Machek, Len Brown, linux-doc, linux-kernel, Jesse Barnes,
	Magnus Damm, linux-pm

On Mon, 26 Apr 2010, Arve Hjønnevåg wrote:

> > If you insist on using ioctl for init, you should use the standard
> > convention for passing variable-length data.  The userspace program
> > sets up a fixed-size buffer containing a pointer to the name and the
> > name's length, and it passes the buffer's address as the ioctl
> > argument.
> 
> Are you sure that is the standard? I searched for ioctls with NAME in
> their name and only found one that passed the name that way. The rest
> used fixed length string buffers, or passed the buffersize to _IOC
> like I do. For instance, input.h has ioctls to read string and
> bitmasks where user space specify the buffer size as an argument to
> the ioctl macro. These pass data from the kernel to user space, but I
> don't passing a string length is any worse than passing a buffer size.

You're right.  Okay, I withdraw my objection.

Alan Stern


^ permalink raw reply	[flat|nested] 64+ messages in thread
* Re: [linux-pm] [PATCH 2/9] PM: suspend_block: Add driver to access  suspend blockers from user-space
  2010-04-26 19:25 ` Alan Stern
@ 2010-04-27  4:04 Arve Hjønnevåg
  2010-04-27 18:33 ` Alan Stern
  0 siblings, 1 reply; 64+ messages in thread
From: Arve Hjønnevåg @ 2010-04-27  4:04 UTC (permalink / raw)
  To: Alan Stern
  Cc: Pavel Machek, Len Brown, linux-doc, linux-kernel, Jesse Barnes,
	Magnus Damm, linux-pm

2010/4/26 Alan Stern <stern@rowland.harvard.edu>:
> On Sun, 25 Apr 2010, Arve Hjønnevåg wrote:
>
>> >> > >> > +User-space API
>> >> > >> > +==============
>> >> > >> > +
>> >> > >> > +To create a suspend_blocker from user-space, open the suspend_blocker device:
>> >> > >> > +    fd = open("/dev/suspend_blocker", O_RDWR | O_CLOEXEC);
>> >> > >> > +then call:
>> >> > >> > +    ioctl(fd, SUSPEND_BLOCKER_IOCTL_INIT(strlen(name)), name);
>> >> > >>
>> >> > >>
>> >> > >> This seems like very wrong idea -- it uses different ioctl number for
>> >> > >> each length AFAICT.
>> >> > >
>> >> > > How about specifying the name by an ordinary write() call instead of
>> >> > > by an ioctl()?
>> >> > >
>> >> >
>> >> > I prefer using ioctls. We have three operations at the moment. Init,
>> >> > block and unblock. If we do init with write but block and unblock
>> >> > using ioctls, it would be pretty strange. Specifying a command and
>> >>
>> >> Why would it be "strange"?
>> >
>> > Why indeed?  Using write() is the natural way to pass a data buffer
>> > into the kernel, especially a variable-length buffer.
>> >
>> > Mixing ioctl() and write() might seem strange at first, but it has
>> > plenty of precedent.  Consider adjusting the settings for a serial
>> > port, for example.
>> >
>> That sound like to opposite situation to me. It uses ioctls for setup
>> and read/write access the data stream.
>
> Or you could say that it uses ioctls to send commands and read/write to
> pass data.  That's pretty much what you would be doing.
>
> Let's put it another way: You find it excessively strange to do init
> using write and to send commands via ioctl, but you don't find it
> strange to abuse the ioctl number code for passing the string length?
> The old saying about motes and beams applies here...
>
> If you insist on using ioctl for init, you should use the standard
> convention for passing variable-length data.  The userspace program
> sets up a fixed-size buffer containing a pointer to the name and the
> name's length, and it passes the buffer's address as the ioctl
> argument.

Are you sure that is the standard? I searched for ioctls with NAME in
their name and only found one that passed the name that way. The rest
used fixed length string buffers, or passed the buffersize to _IOC
like I do. For instance, input.h has ioctls to read string and
bitmasks where user space specify the buffer size as an argument to
the ioctl macro. These pass data from the kernel to user space, but I
don't passing a string length is any worse than passing a buffer size.

-- 
Arve Hjønnevåg

^ permalink raw reply	[flat|nested] 64+ messages in thread
* Re: [linux-pm] [PATCH 2/9] PM: suspend_block: Add driver to access  suspend blockers from user-space
  2010-04-24 14:44 ` Alan Stern
@ 2010-04-25 22:34 Arve Hjønnevåg
  2010-04-26 19:25 ` Alan Stern
  2010-04-26 19:25 ` Alan Stern
  0 siblings, 2 replies; 64+ messages in thread
From: Arve Hjønnevåg @ 2010-04-25 22:34 UTC (permalink / raw)
  To: Alan Stern
  Cc: Pavel Machek, Len Brown, linux-doc, linux-kernel, Jesse Barnes,
	Magnus Damm, linux-pm

On Sat, Apr 24, 2010 at 7:44 AM, Alan Stern <stern@rowland.harvard.edu> wrote:
> On Sat, 24 Apr 2010, Pavel Machek wrote:
>
>> On Fri 2010-04-23 20:20:47, Arve Hj?nnev?g wrote:
>> > On Fri, Apr 23, 2010 at 9:43 AM, Alan Stern <stern@rowland.harvard.edu> wrote:
>> > > On Fri, 23 Apr 2010, Pavel Machek wrote:
>> > >
>> > >> Hi!
>> > >>
>> > >> > Add a misc device, "suspend_blocker", that allows user-space processes
>> > >> > to block auto suspend. The device has ioctls to create a suspend_blocker,
>> > >> > and to block and unblock suspend. To delete the suspend_blocker, close
>> > >> > the device.
>> > >> >
>> > >> > Signed-off-by: Arve Hj??nnev??g <arve@android.com>
>> > >>
>> > >> > --- a/Documentation/power/suspend-blockers.txt
>> > >> > +++ b/Documentation/power/suspend-blockers.txt
>> > >> > @@ -95,3 +95,20 @@ if (list_empty(&state->pending_work))
>> > >> >  else
>> > >> >     suspend_block(&state->suspend_blocker);
>> > >> >
>> > >> > +User-space API
>> > >> > +==============
>> > >> > +
>> > >> > +To create a suspend_blocker from user-space, open the suspend_blocker device:
>> > >> > +    fd = open("/dev/suspend_blocker", O_RDWR | O_CLOEXEC);
>> > >> > +then call:
>> > >> > +    ioctl(fd, SUSPEND_BLOCKER_IOCTL_INIT(strlen(name)), name);
>> > >>
>> > >>
>> > >> This seems like very wrong idea -- it uses different ioctl number for
>> > >> each length AFAICT.
>> > >
>> > > How about specifying the name by an ordinary write() call instead of
>> > > by an ioctl()?
>> > >
>> >
>> > I prefer using ioctls. We have three operations at the moment. Init,
>> > block and unblock. If we do init with write but block and unblock
>> > using ioctls, it would be pretty strange. Specifying a command and
>>
>> Why would it be "strange"?
>
> Why indeed?  Using write() is the natural way to pass a data buffer
> into the kernel, especially a variable-length buffer.
>
> Mixing ioctl() and write() might seem strange at first, but it has
> plenty of precedent.  Consider adjusting the settings for a serial
> port, for example.
>
That sound like to opposite situation to me. It uses ioctls for setup
and read/write access the data stream.

>> > argument in a string to write is more complicated to parse than using
>> > ioctls.
>>
>> More complicated to parse?
>
> It shouldn't be -- especially if you assume that the init action must
> always come first.  The first write would contain the suspend blocker's
> name; all following writes would have to be either "on" or "off".
> That's not hard to parse.
>

Why should I have to parse a string at all? We already have a control
interface, ioctl, where user space can pass a command with data. If we
later want to add other commands we can easily add them without
breaking existing command. With your interface, where the first write
is a name, adding more initialization data later becomes harder. I
also don't like that wring the same string twice has a different
meaning the second time. With the ioctl interface, you forget to
initialize the suspend blocker, it block and unblock operations will
fail. With your interface you create a suspend blocker call "on" or
"off".

-- 
Arve Hjønnevåg

^ permalink raw reply	[flat|nested] 64+ messages in thread
* Re: [linux-pm] [PATCH 2/9] PM: suspend_block: Add driver to access suspend blockers from user-space
  2010-04-24  3:20         ` Arve Hjønnevåg
@ 2010-04-24  5:55 Pavel Machek
  2010-04-24 14:44 ` Alan Stern
  2010-04-24 14:44 ` Alan Stern
  0 siblings, 2 replies; 64+ messages in thread
From: Pavel Machek @ 2010-04-24  5:55 UTC (permalink / raw)
  To: Arve Hj?nnev?g
  Cc: Alan Stern, Len Brown, linux-doc, linux-kernel, Jesse Barnes,
	Magnus Damm, linux-pm

On Fri 2010-04-23 20:20:47, Arve Hj?nnev?g wrote:
> On Fri, Apr 23, 2010 at 9:43 AM, Alan Stern <stern@rowland.harvard.edu> wrote:
> > On Fri, 23 Apr 2010, Pavel Machek wrote:
> >
> >> Hi!
> >>
> >> > Add a misc device, "suspend_blocker", that allows user-space processes
> >> > to block auto suspend. The device has ioctls to create a suspend_blocker,
> >> > and to block and unblock suspend. To delete the suspend_blocker, close
> >> > the device.
> >> >
> >> > Signed-off-by: Arve Hj??nnev??g <arve@android.com>
> >>
> >> > --- a/Documentation/power/suspend-blockers.txt
> >> > +++ b/Documentation/power/suspend-blockers.txt
> >> > @@ -95,3 +95,20 @@ if (list_empty(&state->pending_work))
> >> >  else
> >> >     suspend_block(&state->suspend_blocker);
> >> >
> >> > +User-space API
> >> > +==============
> >> > +
> >> > +To create a suspend_blocker from user-space, open the suspend_blocker device:
> >> > +    fd = open("/dev/suspend_blocker", O_RDWR | O_CLOEXEC);
> >> > +then call:
> >> > +    ioctl(fd, SUSPEND_BLOCKER_IOCTL_INIT(strlen(name)), name);
> >>
> >>
> >> This seems like very wrong idea -- it uses different ioctl number for
> >> each length AFAICT.
> >
> > How about specifying the name by an ordinary write() call instead of
> > by an ioctl()?
> >
> 
> I prefer using ioctls. We have three operations at the moment. Init,
> block and unblock. If we do init with write but block and unblock
> using ioctls, it would be pretty strange. Specifying a command and

Why would it be "strange"?

> argument in a string to write is more complicated to parse than using
> ioctls.

More complicated to parse?

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 64+ messages in thread
* [PATCH 0/9] Suspend block api (version 4)
@ 2010-04-23  1:08 Arve Hjønnevåg
  2010-04-23  1:08 ` [PATCH 1/9] PM: Add suspend block api Arve Hjønnevåg
  0 siblings, 1 reply; 64+ messages in thread
From: Arve Hjønnevåg @ 2010-04-23  1:08 UTC (permalink / raw)
  To: linux-pm, linux-kernel

This patch series adds a suspend-block api that provides the same
functionality as the android wakelock api. The code is mostly the
same as version 3 posted last year, but the main entry point has
changed back to /sys/power/state with a new /sys/power/policy to
alter its behavior. Timeout support is not included in this initial
patchset.

--
Arve Hjønnevåg <arve@android.com>



^ permalink raw reply	[flat|nested] 64+ messages in thread
* [RFC][PATCH 0/9] Suspend block api (version 2)
@ 2009-04-30  3:09 Arve Hjønnevåg
  2009-04-30  3:10 ` [PATCH 1/9] PM: Add suspend block api Arve Hjønnevåg
  0 siblings, 1 reply; 64+ messages in thread
From: Arve Hjønnevåg @ 2009-04-30  3:09 UTC (permalink / raw)
  To: linux-pm; +Cc: ncunningham, u.luckas, swetland

This patch series adds a suspend-block api that provides the same
functionality as the android wakelock api. This patch series has
some documentation and code style fixes and it now uses debugfs
for stats. It also fixes some bugs in the user-space interface.

--
Arve Hjønnevåg 

_______________________________________________
linux-pm mailing list
linux-pm@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/linux-pm

^ permalink raw reply	[flat|nested] 64+ messages in thread

end of thread, other threads:[~2010-04-27 23:22 UTC | newest]

Thread overview: 64+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-05-06  4:18 [RFC][PATCH 0/9] Suspend block api (version 3) Arve Hjønnevåg
2009-05-06  4:18 ` [PATCH 1/9] PM: Add suspend block api Arve Hjønnevåg
2009-05-06  4:18   ` [PATCH 2/9] PM: suspend_block: Add driver to access suspend blockers from user-space Arve Hjønnevåg
2009-05-05 20:12     ` Pavel Machek
2009-05-07  1:42       ` Arve Hjønnevåg
2009-05-07 10:32         ` Pavel Machek
2009-05-08  0:43           ` Arve Hjønnevåg
2009-05-08 14:22             ` Rafael J. Wysocki
2009-05-09  0:38               ` Arve Hjønnevåg
2009-05-05 20:16     ` Pavel Machek
2009-05-07  1:31       ` Arve Hjønnevåg
2009-05-07 10:43         ` Pavel Machek
2009-05-06  4:18     ` [PATCH 3/9] PM: suspend_block: Abort task freezing if a suspend_blocker is active Arve Hjønnevåg
2009-05-05 19:57       ` Pavel Machek
2009-05-07  1:51         ` Arve Hjønnevåg
2009-05-07 10:41           ` Pavel Machek
2009-05-07 23:49             ` Arve Hjønnevåg
2009-05-08  1:06               ` Nigel Cunningham
2009-05-08  1:22                 ` Arve Hjønnevåg
2009-05-08  1:35                   ` Nigel Cunningham
2009-05-08 14:40                     ` Rafael J. Wysocki
2009-05-08 22:27                       ` Nigel Cunningham
2009-05-08 23:01                         ` Rafael J. Wysocki
2009-05-09  0:12                           ` Nigel Cunningham
2009-05-12 10:05                           ` Pavel Machek
2009-05-12 16:55                             ` Rafael J. Wysocki
2009-05-12 19:33                               ` Pavel Machek
2009-05-12 10:04               ` Pavel Machek
2009-05-08  0:22         ` Rafael J. Wysocki
2009-05-06  4:18       ` [PATCH 4/9] Input: Block suspend while event queue is not empty Arve Hjønnevåg
2009-05-05 20:02         ` Pavel Machek
2009-05-07  1:57           ` Arve Hjønnevåg
2009-05-06  4:18         ` [PATCH 5/9] PM: suspend_block: Switch to list of active and inactive suspend blockers Arve Hjønnevåg
2009-05-06  4:18           ` [PATCH 6/9] PM: suspend_block: Add debugfs file Arve Hjønnevåg
2009-05-06  4:18             ` [PATCH 7/9] PM: suspend_block: Add suspend_blocker stats Arve Hjønnevåg
2009-05-06  4:18               ` [PATCH 8/9] PM: suspend_block: Add timeout support Arve Hjønnevåg
2009-05-06  4:18                 ` [PATCH 9/9] PM: suspend_block: Add timeout support to user-space suspend_blockers Arve Hjønnevåg
2009-05-06 17:17 ` [RFC][PATCH 0/9] Suspend block api (version 3) Kevin Hilman
2009-05-07 22:42   ` Arve Hjønnevåg
2009-05-08 16:01     ` mark gross
2009-05-08 23:36     ` Kevin Hilman
2009-05-15 19:58     ` Pavel Machek
  -- strict thread matches above, loose matches on Subject: below --
2010-04-27 18:33 [linux-pm] [PATCH 2/9] PM: suspend_block: Add driver to access suspend blockers from user-space Alan Stern
2010-04-27 22:03 ` Rafael J. Wysocki
2010-04-27 22:03 ` [linux-pm] " Rafael J. Wysocki
2010-04-27 23:22   ` Arve Hjønnevåg
2010-04-27  4:04 [linux-pm] " Arve Hjønnevåg
2010-04-27 18:33 ` Alan Stern
2010-04-25 22:34 [linux-pm] " Arve Hjønnevåg
2010-04-26 19:25 ` Alan Stern
2010-04-27  4:04   ` Arve Hjønnevåg
2010-04-26 19:25 ` Alan Stern
2010-04-24  5:55 [linux-pm] " Pavel Machek
2010-04-24 14:44 ` Alan Stern
2010-04-25 22:34   ` Arve Hjønnevåg
2010-04-24 14:44 ` Alan Stern
2010-04-23  1:08 [PATCH 0/9] Suspend block api (version 4) Arve Hjønnevåg
2010-04-23  1:08 ` [PATCH 1/9] PM: Add suspend block api Arve Hjønnevåg
2010-04-23  1:08   ` [PATCH 2/9] PM: suspend_block: Add driver to access suspend blockers from user-space Arve Hjønnevåg
2010-04-23  1:08     ` Arve Hjønnevåg
2010-04-23  2:25     ` Matt Helsley
2010-04-23  2:25     ` [linux-pm] " Matt Helsley
2010-04-23  3:54       ` Arve Hjønnevåg
2010-04-23  4:38       ` Greg KH
2010-04-23  8:43     ` Pavel Machek
2010-04-23 16:43       ` [linux-pm] " Alan Stern
2010-04-24  3:20         ` Arve Hjønnevåg
2010-04-24  5:55           ` Pavel Machek
2010-04-24  3:20         ` Arve Hjønnevåg
2010-04-23 16:43       ` Alan Stern
2010-04-24  1:53       ` tytso
2010-04-24  5:39         ` Pavel Machek
2010-04-24  5:39         ` Pavel Machek
2010-04-24  1:53       ` tytso
2010-04-23  8:43     ` Pavel Machek
2009-04-30  3:09 [RFC][PATCH 0/9] Suspend block api (version 2) Arve Hjønnevåg
2009-04-30  3:10 ` [PATCH 1/9] PM: Add suspend block api Arve Hjønnevåg
2009-04-30  3:10   ` [PATCH 2/9] PM: suspend_block: Add driver to access suspend blockers from user-space Arve Hjønnevåg

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.