All of lore.kernel.org
 help / color / mirror / Atom feed
* [virtio-comment] [RFC] Define a low power state for devices
@ 2023-04-06  7:30 David Stevens
  2023-04-06 12:35 ` Stefan Hajnoczi
  2023-04-07 11:27 ` Michael S. Tsirkin
  0 siblings, 2 replies; 7+ messages in thread
From: David Stevens @ 2023-04-06  7:30 UTC (permalink / raw)
  To: virtio-comment; +Cc: David Stevens

This RFC defines a low power state for virtio devices, to gives
drivers an option for power management besides simply resetting their
device.

This patch is a draft aimed at starting a discussion, rather than being
a finalized patch.

To provide some context on where this is coming from, I'm working on
reducing the power overhead of ARCVM (virtualized Android running on
ChromeOS). One of the big gaps in ARCVM power management is that it does
not implement Android's partial wake locks - i.e. the (virtualized) CPUs
are always on, even if the (virtualized) screen is off. This means we
can't force apps to stop running when they shouldn't be running, which
can lead to higher power consumption compared to the ChromeOS baseline.

Partial wake locks are built on s2idle, but unfortunately the current
power management of virtio drivers does not let us use s2idle. The fact
that power management is based around resetting the virtio device means
that it doesn't work with stateful devices (e.g. virtio-fs). Even for
stateless devices, re-initializing all of the devices takes longer than
we would like, especially on lower end hardware.

My rough idea for how to address this would be to make the existing
virtio power management targeted at S4 specifically (i.e. the freeze
device callback). For S0/S1/S3 (i.e. the suspend device callback), this
new lighter weight low power state would be used if available -
otherwise it would fall back to the existing S4 power management code.

I have a very rough prototype that seems to work, and I haven't seen
anything that makes me think this approach is fundamentally unworkable.
That said, I would like to get feedback on the approach earlier rather
than later.
---
 content.tex | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/content.tex b/content.tex
index cff548ab9675..01da6f62ef20 100644
--- a/content.tex
+++ b/content.tex
@@ -449,6 +449,28 @@ \section{Exporting Objects}\label{sec:Basic Facilities of a Virtio Device / Expo
 types. It is RECOMMENDED that devices generate version 4
 UUIDs as specified by \hyperref[intro:rfc4122]{[RFC4122]}.
 
+\section{Low Power Mode}\label{sec:Basic Facilities of a Virtio Device / Low Power Mode}
+
+A virtio device can be put into a low power state when the
+VIRTIO_F_LOW_POWER bit is negotiated. How a driver puts a
+device into a low power state is transport specific.
+
+In general, a virtio device in a low power state should
+avoid initating any communication with the driver. However,
+certain device-specific functionality is exempt from this
+requirement. Such functionality is detailed in the device
+type specifications.
+
+% One example of such functionality would be allowing
+% the virtio-net device to wake up the guest to deliver
+% incoming network packets.
+
+While a virtio device is in a low power state, it should
+maintain any type specific state in such a way that it is
+able to immediately resume functioning upon leaving the low
+power state, without the need for any additional
+communication with the driver.
+
 \chapter{General Initialization And Device Operation}\label{sec:General Initialization And Device Operation}
 
 We start with an overview of device initialization, then expand on the
@@ -803,6 +825,10 @@ \chapter{Reserved Feature Bits}\label{sec:Reserved Feature Bits}
   that the driver can reset a queue individually.
   See \ref{sec:Basic Facilities of a Virtio Device / Virtqueues / Virtqueue Reset}.
 
+  \item[VIRTIO_F_LOW_POWER(41)] This feature indicates
+  that the driver can put the device into a low power mode.
+  See \ref{sec:Basic Facilities of a Virtio Device / Low Power Mode}.
+
 \end{description}
 
 \drivernormative{\section}{Reserved Feature Bits}{Reserved Feature Bits}
-- 
2.40.0.348.gf938b09366-goog


This publicly archived list offers a means to provide input to the
OASIS Virtual I/O Device (VIRTIO) TC.

In order to verify user consent to the Feedback License terms and
to minimize spam in the list archive, subscription is required
before posting.

Subscribe: virtio-comment-subscribe@lists.oasis-open.org
Unsubscribe: virtio-comment-unsubscribe@lists.oasis-open.org
List help: virtio-comment-help@lists.oasis-open.org
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/


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

end of thread, other threads:[~2023-04-14  8:03 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-06  7:30 [virtio-comment] [RFC] Define a low power state for devices David Stevens
2023-04-06 12:35 ` Stefan Hajnoczi
2023-04-13  5:47   ` David Stevens
2023-04-07 11:27 ` Michael S. Tsirkin
2023-04-13  6:29   ` David Stevens
2023-04-13 15:57     ` Michael S. Tsirkin
2023-04-14  8:03       ` David Stevens

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.