All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@ucw.cz>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: pm list <linux-pm@lists.linux-foundation.org>,
	Stephen Rothwell <sfr@linuxcare.com>
Subject: Re: [PATCH] apm-emulation: notify about all suspend events, not just	apm invoked ones
Date: Fri, 21 Mar 2008 14:29:25 +0100	[thread overview]
Message-ID: <20080321132924.GD5331@ucw.cz> (raw)
In-Reply-To: <1205707065.1614.5.camel@johannes.berg>

Hi!

> This revamps the apm-emulation code to get suspend notifications
> regardless of what way pm_suspend() was invoked, whether via the
> apm ioctl or via /sys/power/state. Also do some code cleanup and
> add comments while at it.

Does this actually change user-kernel ABI?

>  /*
> + * thread states (for threads using a writable /dev/apm_bios fd):
> + *
> + * SUSPEND_NONE:	nothing happening
> + * SUSPEND_PENDING:	suspend event queued for thread and pending to be read
> + * SUSPEND_READ:	suspend event read, pending acknowledgement
> + * SUSPEND_ACKED:	acknowledgement received from thread (via ioctl),
> + *			waiting for resume
> + * SUSPEND_ACKTO:	acknowledgement timeout
> + * SUSPEND_DONE:	thread had acked suspend and is now notified of
> + *			resume
> + *
> + * SUSPEND_WAIT:	this thread invoked suspend and is waiting for resume
> + *
> + * A thread migrates in one of three paths:
> + * 	NONE -1-> PENDING -2-> READ -3-> ACKED -4-> DONE -5-> NONE
> + *	                            -6-> ACKTO -7-> NONE
> + *	NONE -8-> WAIT -9-> NONE
> + *
> + * While in PENDING or READ, the thread is accounted for in the
> + * suspend_acks_pending counter.
> + *
> + * The transitions are invoked as follows:
> + *	1: suspend event is signalled from the core PM code
> + *	2: the suspend event is read from the fd by the userspace thread
> + *	3: userspace thread issues the APM_IOC_SUSPEND ioctl (as ack)
> + *	4: core PM code signals that we have resumed
> + *	5: APM_IOC_SUSPEND ioctl returns
> + *
> + *	6: the notifier invoked from the core PM code timed out waiting
> + *	   for all relevant threds to enter ACKED state and puts those
> + *	   that haven't into ACKTO
> + *	7: those threads issue APM_IOC_SUSPEND ioctl too late,
> + *	   get an error
> + *
> + *	8: userspace thread issues the APM_IOC_SUSPEND ioctl (to suspend),
> + *	   ioctl code invokes pm_suspend()
> + *	9: pm_suspend() returns indicating resume
> + */
> +enum apm_suspend_state {
> +	SUSPEND_NONE,
> +	SUSPEND_PENDING,
> +	SUSPEND_READ,
> +	SUSPEND_ACKED,
> +	SUSPEND_ACKTO,
> +	SUSPEND_WAIT,
> +	SUSPEND_DONE,
> +};
> +
> +/*
>   * The per-file APM data
>   */
>  struct apm_user {

These are not passed to userspace, are they?
						Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

  parent reply	other threads:[~2008-03-21 13:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-16 22:37 [PATCH] apm-emulation: notify about all suspend events, not just apm invoked ones Johannes Berg
2008-03-17 20:39 ` Rafael J. Wysocki
2008-03-17 20:57   ` [PATCH v6] " Johannes Berg
2008-03-21 13:29 ` Pavel Machek [this message]
2008-03-21 14:18   ` [PATCH] " Johannes Berg

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=20080321132924.GD5331@ucw.cz \
    --to=pavel@ucw.cz \
    --cc=johannes@sipsolutions.net \
    --cc=linux-pm@lists.linux-foundation.org \
    --cc=sfr@linuxcare.com \
    /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.