Re: [linux-pm] [PATCH 0/8] Suspend block api (version 8)

From: Alan Stern
Date: Sat May 29 2010 - 20:45:58 EST


On Sat, 29 May 2010, Arve Hjønnevåg wrote:

> > In place of in-kernel suspend blockers, there will be a new type of QoS
> > constraint -- call it QOS_EVENTUALLY.  It's a very weak constraint,
> > compatible with all cpuidle modes in which runnable threads are allowed
> > to run (which is all of them), but not compatible with suspend.
> >
> This sound just like another API rename. It will work, but given that
> suspend blockers was the name least objectionable last time around,
> I'm not sure what this would solve.

It's not just a rename. By changing this into a QoS constraint, we
make it more generally useful. Instead of standing on its own, it
becomes part of the PM-QOS framework.

> > There is no /sys/power/policy file.  In place of opportunistic suspend,
> > we have "QoS-based suspend".  This is initiated by userspace writing
> > "qos" to /sys/power/state, and it is very much like suspend-to-RAM.
>
> Why do you want to tie it to a specific state?

I don't. I suggested making it a veriant of suspend-to-RAM merely
because that's what you were using. But Nigel's suggestion of having
"qos" variants of all the different suspend states makes sense.

> > However a QoS-based suspend fails immediately if there are any active
>
> Fail or block? Your next paragraph said that it blocks for
> QOS_EVENTUALLY, but if normal constraints fail, you are still stuck in
> a retry loop.

Normal (i.e., non QOS_EVENTUALLY) constraints aren't part of the
Android use case, so it wasn't clear how they should be treated. On
further thought, it probably makes more sense to block for them too
instead of failing immediately.

> > normal QoS constraints incompatible with system suspend, in other
> > words, any constraints requiring a throughput > 0 or an interrupt
> > latency shorter than the time required for a suspend-to-RAM/resume
> > cycle.
> >
> > If no such constraints are active, the QoS-based suspend blocks in an
> > interruptible wait until the number of active QOS_EVENTUALLY
>
> How do you implement this?

I'm not sure what you mean. The same way you implement any
interruptible wait.

> >        for (;;) {
> >                while (any IPC requests remain)
> >                        handle them;
> >                if (any processes need to prevent suspend)
> >                        sleep;
> >                else
> >                        write "qos" to /sys/power/state;
> >        }
> >
> > The idea is that receipt of a new IPC request will cause a signal to be
> > sent, interrupting the sleep or the "qos" write.
>
> What happen if the signal is right before (or even right after)
> calling write "qos". How does the signal handler stop the write?

You're right, this is a serious problem. The process would have to
give the kernel a signal mask to be used during the wait, as in ppoll
or pselect. There ought to be a way to do this or something
equivalent.

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/