virtio-mem: introduce VIRTIO_MEM_F_PERSISTENT_SUSPEND
PATCH 1/1 virtio-mem: introduce VIRTIO_MEM_F_PERSISTENT_SUSPEND
Before, the behavior while suspending to a deep sleep state and waking up was not specified. For example, in x86 QEMU VM all devices receive a reset request during wake-up. This would lead to unplugging of all the plugged memory blocks. Due to this, suspending is disallowed in the Linux Kernel, when plugged memory is present and VIRTIO_MEM_F_PERSISTENT_SUSPEND feature flag is not advertised by the virtio-mem device.
This new flag should signal to the guest driver, that the device can correctly suspend to a deep sleep state and then wake up without disrupting the plugged memory blocks. This feature flag is already supported in the Linux Kernel [1] and should be soon also supported in QEMU [2].
[1]: https://lore.kernel.org/all/[email protected]/
[2]: https://lore.kernel.org/all/[email protected]/
--- device-types/mem/description.tex | 12 ++++++++++++ 1 file changed, 12 insertions(+)
device-types/mem/description.tex +12 -0
@@ -60,6 +60,8 @@ \subsection{Feature bits}\label{sec:Device Types / Memory Device / Feature bits} access unplugged memory. \footnote{On platforms with memory properties that might get modified implicitly on memory access, this feature is expected to be offered by the device.} +\item[VIRTIO_MEM_F_PERSISTENT_SUSPEND (2)] The driver can allow the guest +system to enter suspended state (deep sleep, suspend-to-RAM). \end{description} \subsection{Device configuration layout}\label{sec:Device Types / Memory Device / Device configuration layout}
@@ -174,6 +176,9 @@ \subsection{Device Initialization}\label{Device Types / Memory Device / Device I The device MUST NOT modify memory or memory properties of plugged memory blocks during device reset. +The device SHOULD offer VIRTIO_MEM_F_PERSISTENT_SUSPEND if the platform +supports suspending (deep sleep, suspend-to-RAM) with plugged memory blocks. + \subsection{Device Operation}\label{sec:Device Types / Memory Device / Device Operation} The device notifies the driver about the amount of memory the device wants
@@ -268,6 +273,9 @@ \subsection{Device Operation}\label{sec:Device Types / Memory Device / Device Op memory blocks to unplug them, or it would not be able to make use of unplugged memory blocks after plugging them (e.g., alignment). +If VIRTIO_MEM_F_PERSISTENT_SUSPEND has not been negotiated, the driver MUST NOT +allow the guest system to enter a suspended state (deep sleep, suspend-to-RAM). + \devicenormative{\subsubsection}{Device Operation}{Device Types / Memory Device / Device Operation} The device MUST provide the exact same memory properties with the exact same
@@ -293,6 +301,10 @@ \subsection{Device Operation}\label{sec:Device Types / Memory Device / Device Op The device SHOULD unplug all memory blocks during system resets. +If VIRTIO_MEM_F_PERSISTENT_SUSPEND has been negotiated, the device MUST NOT not +change the state of memory blocks when suspending or when waking up from +suspended state (deep sleep, suspend-to-RAM). + \subsubsection{PLUG request}\label{sec:Device Types / Memory Device / Device Operation / PLUG request} Request to plug consecutive memory blocks that are currently unplugged.
Signature · 1 line
2.45.2
Quoted 56 lines · Juraj Marcin
Before, the behavior while suspending to a deep sleep state and waking up was not specified. For example, in x86 QEMU VM all devices receive a reset request during wake-up. This would lead to unplugging of all the plugged memory blocks. Due to this, suspending is disallowed in the Linux Kernel, when plugged memory is present and
VIRTIO_MEM_F_PERSISTENT_SUSPENDfeature flag is not advertised by the virtio-mem device.This new flag should signal to the guest driver, that the device can correctly suspend to a deep sleep state and then wake up without disrupting the plugged memory blocks. This feature flag is already supported in the Linux Kernel [1] and should be soon also supported in QEMU [2].
[1]: https://lore.kernel.org/all/[email protected]/
[2]: https://lore.kernel.org/all/[email protected]/Signed-off-by Juraj Marcin <[email protected]>--- device-types/mem/description.tex | 12 ++++++++++++ 1 file changed, 12 insertions(+)device-types/mem/description.tex +8
-0@@ -60,6 +60,8 @@ \subsection{Feature bits}\label{sec:Device Types / Memory Device / Feature bits} access unplugged memory. \footnote{On platforms with memory properties that might get modified implicitly on memory access, this feature is expected to be offered by the device.} +\item[VIRTIO_MEM_F_PERSISTENT_SUSPEND (2)] The driver can allow the guest +system to enter suspended state (deep sleep, suspend-to-RAM). \end{description} \subsection{Device configuration layout}\label{sec:Device Types / Memory Device / Device configuration layout}@@ -174,6 +176,9 @@ \subsection{Device Initialization}\label{Device Types / Memory Device / Device I The device MUST NOT modify memory or memory properties of plugged memory blocks during device reset. +The device SHOULD offer VIRTIO_MEM_F_PERSISTENT_SUSPEND if the platform +supports suspending (deep sleep, suspend-to-RAM) with plugged memory blocks. + \subsection{Device Operation}\label{sec:Device Types / Memory Device / Device Operation} The device notifies the driver about the amount of memory the device wants@@ -268,6 +273,9 @@ \subsection{Device Operation}\label{sec:Device Types / Memory Device / Device Op memory blocks to unplug them, or it would not be able to make use of unplugged memory blocks after plugging them (e.g., alignment). +If VIRTIO_MEM_F_PERSISTENT_SUSPEND has not been negotiated, the driver MUST NOT +allow the guest system to enter a suspended state (deep sleep, suspend-to-RAM). + \devicenormative{\subsubsection}{Device Operation}{Device Types / Memory Device / Device Operation} The device MUST provide the exact same memory properties with the exact same
device-types/mem/description.tex \subsection{Device Operation}\label{sec:Device Types / Memory Device / Device Op · line 310
Quoted 10 lines
device-types/mem/description.tex +4
-0@@ -293,6 +301,10 @@ \subsection{Device Operation}\label{sec:Device Types / Memory Device / Device Op The device SHOULD unplug all memory blocks during system resets. +If VIRTIO_MEM_F_PERSISTENT_SUSPEND has been negotiated, the device MUST NOT not +change the state of memory blocks when suspending or when waking up from +suspended state (deep sleep, suspend-to-RAM). + \subsubsection{PLUG request}\label{sec:Device Types / Memory Device / Device Operation / PLUG request} Request to plug consecutive memory blocks that are currently unplugged.
All sounds correct to me, thanks!
Signature · 3 lines
Cheers, David / dhildenb
Quoted 56 lines · Juraj Marcin
Before, the behavior while suspending to a deep sleep state and waking up was not specified. For example, in x86 QEMU VM all devices receive a reset request during wake-up. This would lead to unplugging of all the plugged memory blocks. Due to this, suspending is disallowed in the Linux Kernel, when plugged memory is present and
VIRTIO_MEM_F_PERSISTENT_SUSPENDfeature flag is not advertised by the virtio-mem device.This new flag should signal to the guest driver, that the device can correctly suspend to a deep sleep state and then wake up without disrupting the plugged memory blocks. This feature flag is already supported in the Linux Kernel [1] and should be soon also supported in QEMU [2].
[1]: https://lore.kernel.org/all/[email protected]/
[2]: https://lore.kernel.org/all/[email protected]/Signed-off-by Juraj Marcin <[email protected]>--- device-types/mem/description.tex | 12 ++++++++++++ 1 file changed, 12 insertions(+)device-types/mem/description.tex +8
-0@@ -60,6 +60,8 @@ \subsection{Feature bits}\label{sec:Device Types / Memory Device / Feature bits} access unplugged memory. \footnote{On platforms with memory properties that might get modified implicitly on memory access, this feature is expected to be offered by the device.} +\item[VIRTIO_MEM_F_PERSISTENT_SUSPEND (2)] The driver can allow the guest +system to enter suspended state (deep sleep, suspend-to-RAM). \end{description} \subsection{Device configuration layout}\label{sec:Device Types / Memory Device / Device configuration layout}@@ -174,6 +176,9 @@ \subsection{Device Initialization}\label{Device Types / Memory Device / Device I The device MUST NOT modify memory or memory properties of plugged memory blocks during device reset. +The device SHOULD offer VIRTIO_MEM_F_PERSISTENT_SUSPEND if the platform +supports suspending (deep sleep, suspend-to-RAM) with plugged memory blocks. + \subsection{Device Operation}\label{sec:Device Types / Memory Device / Device Operation} The device notifies the driver about the amount of memory the device wants@@ -268,6 +273,9 @@ \subsection{Device Operation}\label{sec:Device Types / Memory Device / Device Op memory blocks to unplug them, or it would not be able to make use of unplugged memory blocks after plugging them (e.g., alignment). +If VIRTIO_MEM_F_PERSISTENT_SUSPEND has not been negotiated, the driver MUST NOT +allow the guest system to enter a suspended state (deep sleep, suspend-to-RAM). + \devicenormative{\subsubsection}{Device Operation}{Device Types / Memory Device / Device Operation} The device MUST provide the exact same memory properties with the exact same
device-types/mem/description.tex \subsection{Device Operation}\label{sec:Device Types / Memory Device / Device Op · line 310
Quoted 10 lines
device-types/mem/description.tex +4
-0@@ -293,6 +301,10 @@ \subsection{Device Operation}\label{sec:Device Types / Memory Device / Device Op The device SHOULD unplug all memory blocks during system resets. +If VIRTIO_MEM_F_PERSISTENT_SUSPEND has been negotiated, the device MUST NOT not +change the state of memory blocks when suspending or when waking up from +suspended state (deep sleep, suspend-to-RAM). + \subsubsection{PLUG request}\label{sec:Device Types / Memory Device / Device Operation / PLUG request} Request to plug consecutive memory blocks that are currently unplugged.
The kernel and QEMU part is upstream. A second pair of eyes would be great :)
Signature · 3 lines
Cheers, David / dhildenb
Matias Ezequiel Vara Larsen
Reviewed-byQuoted 40 lines · David Hildenbrand
Quoted 39 lines · Juraj Marcin
Before, the behavior while suspending to a deep sleep state and waking up was not specified. For example, in x86 QEMU VM all devices receive a reset request during wake-up. This would lead to unplugging of all the plugged memory blocks. Due to this, suspending is disallowed in the Linux Kernel, when plugged memory is present and
VIRTIO_MEM_F_PERSISTENT_SUSPENDfeature flag is not advertised by the virtio-mem device.This new flag should signal to the guest driver, that the device can correctly suspend to a deep sleep state and then wake up without disrupting the plugged memory blocks. This feature flag is already supported in the Linux Kernel [1] and should be soon also supported in QEMU [2].
[1]: https://lore.kernel.org/all/[email protected]/
[2]: https://lore.kernel.org/all/[email protected]/Signed-off-by Juraj Marcin <[email protected]>--- device-types/mem/description.tex | 12 ++++++++++++ 1 file changed, 12 insertions(+)device-types/mem/description.tex +4
-0@@ -60,6 +60,8 @@ \subsection{Feature bits}\label{sec:Device Types / Memory Device / Feature bits} access unplugged memory. \footnote{On platforms with memory properties that might get modified implicitly on memory access, this feature is expected to be offered by the device.} +\item[VIRTIO_MEM_F_PERSISTENT_SUSPEND (2)] The driver can allow the guest +system to enter suspended state (deep sleep, suspend-to-RAM). \end{description} \subsection{Device configuration layout}\label{sec:Device Types / Memory Device / Device configuration layout}@@ -174,6 +176,9 @@ \subsection{Device Initialization}\label{Device Types / Memory Device / Device I The device MUST NOT modify memory or memory properties of plugged memory blocks during device reset. +The device SHOULD offer VIRTIO_MEM_F_PERSISTENT_SUSPEND if the platform +supports suspending (deep sleep, suspend-to-RAM) with plugged memory blocks.
Quoted 8 lines
device-types/mem/description.tex \subsection{Device Operation}\label{sec:Device Types / Memory Device / Device Op · line 276
Quoted 8 lines
device-types/mem/description.tex +3
-0+ \subsection{Device Operation}\label{sec:Device Types / Memory Device / Device Operation} The device notifies the driver about the amount of memory the device wants@@ -268,6 +273,9 @@ \subsection{Device Operation}\label{sec:Device Types / Memory Device / Device Op memory blocks to unplug them, or it would not be able to make use of unplugged memory blocks after plugging them (e.g., alignment). +If VIRTIO_MEM_F_PERSISTENT_SUSPEND has not been negotiated, the driver MUST NOT +allow the guest system to enter a suspended state (deep sleep, suspend-to-RAM).
I think guest system could be simply guest but I do not have a strong opinion about it.
Quoted 6 lines
Quoted 6 lines
device-types/mem/description.tex +2
-0+ \devicenormative{\subsubsection}{Device Operation}{Device Types / Memory Device / Device Operation} The device MUST provide the exact same memory properties with the exact same@@ -293,6 +301,10 @@ \subsection{Device Operation}\label{sec:Device Types / Memory Device / Device Op The device SHOULD unplug all memory blocks during system resets. +If VIRTIO_MEM_F_PERSISTENT_SUSPEND has been negotiated, the device MUST NOT not
Quoted 9 lines
device-types/mem/description.tex \subsection{Device Operation}\label{sec:Device Types / Memory Device / Device Op · line 310
Quoted 5 lines
device-types/mem/description.tex +3
-0+change the state of memory blocks when suspending or when waking up from +suspended state (deep sleep, suspend-to-RAM). + \subsubsection{PLUG request}\label{sec:Device Types / Memory Device / Device Operation / PLUG request} Request to plug consecutive memory blocks that are currently unplugged.The kernel and QEMU part is upstream. A second pair of eyes would be great :)
Matias
Quoted 44 lines · Matias Ezequiel Vara Larsen
Quoted 43 lines · David Hildenbrand
Quoted 42 lines · Juraj Marcin
Before, the behavior while suspending to a deep sleep state and waking up was not specified. For example, in x86 QEMU VM all devices receive a reset request during wake-up. This would lead to unplugging of all the plugged memory blocks. Due to this, suspending is disallowed in the Linux Kernel, when plugged memory is present and
VIRTIO_MEM_F_PERSISTENT_SUSPENDfeature flag is not advertised by the virtio-mem device.This new flag should signal to the guest driver, that the device can correctly suspend to a deep sleep state and then wake up without disrupting the plugged memory blocks. This feature flag is already supported in the Linux Kernel [1] and should be soon also supported in QEMU [2].
[1]: https://lore.kernel.org/all/[email protected]/
[2]: https://lore.kernel.org/all/[email protected]/Signed-off-by Juraj Marcin <[email protected]>--- device-types/mem/description.tex | 12 ++++++++++++ 1 file changed, 12 insertions(+)device-types/mem/description.tex +5
-0@@ -60,6 +60,8 @@ \subsection{Feature bits}\label{sec:Device Types / Memory Device / Feature bits} access unplugged memory. \footnote{On platforms with memory properties that might get modified implicitly on memory access, this feature is expected to be offered by the device.} +\item[VIRTIO_MEM_F_PERSISTENT_SUSPEND (2)] The driver can allow the guest +system to enter suspended state (deep sleep, suspend-to-RAM). \end{description} \subsection{Device configuration layout}\label{sec:Device Types / Memory Device / Device configuration layout}@@ -174,6 +176,9 @@ \subsection{Device Initialization}\label{Device Types / Memory Device / Device I The device MUST NOT modify memory or memory properties of plugged memory blocks during device reset. +The device SHOULD offer VIRTIO_MEM_F_PERSISTENT_SUSPEND if the platform +supports suspending (deep sleep, suspend-to-RAM) with plugged memory blocks. + \subsection{Device Operation}\label{sec:Device Types / Memory Device / Device Operation} The device notifies the driver about the amount of memory the device wants
Quoted 8 lines
Quoted 5 lines
device-types/mem/description.tex \subsection{Device Operation}\label{sec:Device Types / Memory Device / Device Op · line 276
Quoted 5 lines
device-types/mem/description.tex +2
-0@@ -268,6 +273,9 @@ \subsection{Device Operation}\label{sec:Device Types / Memory Device / Device Op memory blocks to unplug them, or it would not be able to make use of unplugged memory blocks after plugging them (e.g., alignment). +If VIRTIO_MEM_F_PERSISTENT_SUSPEND has not been negotiated, the driver MUST NOT +allow the guest system to enter a suspended state (deep sleep, suspend-to-RAM).I think
guest systemcould be simplyguestbut I do not have a strong opinion about it.
Makes sense. @Juraj, can you respin with that adjusted?
I'll open an issue afterwards and request a vote.
Signature · 3 lines
Cheers, David / dhildenb
Quoted 64 lines · On Tue, Oct 8, 2024, 15:14 David Hildenbrand <[email protected]> wrote:
Quoted 10 lines · Matias Ezequiel Vara Larsen
Quoted 9 lines · David Hildenbrand
Quoted 8 lines · Juraj Marcin
Before, the behavior while suspending to a deep sleep state and waking up was not specified. For example, in x86 QEMU VM all devices receive a reset request during wake-up. This would lead to unplugging of all the plugged memory blocks. Due to this, suspending is disallowed in the Linux Kernel, when plugged memory is present and
VIRTIO_MEM_F_PERSISTENT_SUSPENDfeature flag is not advertised by the virtio-mem device.Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
This new flag should signal to the guest driver, that the device can correctly suspend to a deep sleep state and then wake up without disrupting the plugged memory blocks. This feature flag is already supported in the Linux Kernel [1] and should be soon also supported in QEMU [2].
[1]:
https://lore.kernel.org/all/[email protected]/
Quoted 1 line
Quoted 1 line
Quoted 1 line
[2]:
https://lore.kernel.org/all/[email protected]/
Quoted 7 lines
Quoted 7 lines
Review
Quoted 7 lines
Signed-off-by Juraj Marcin <[email protected]>--- device-types/mem/description.tex | 12 ++++++++++++ 1 file changed, 12 insertions(+)(quoted diff) +0
-0b/device-types/mem/description.tex
Quoted 4 lines
Quoted 4 lines
device-types/mem/description.tex \subsection{Feature bits}\label{sec:Device Types /
Quoted 4 lines
index 0a6d558..5bff24c 100644
device-types/mem/description.tex +0
-0@@ -60,6 +60,8 @@ \subsection{Feature bits}\label{sec:Device Types /Memory Device / Feature bits}
Quoted 1 line
Quoted 1 line
device-types/mem/description.tex \subsection{Feature bits}\label{sec:Device Types / · line 60
Quoted 1 line
device-types/mem/description.tex +0
-0access unplugged memory. \footnote{On platforms with memoryproperties that
Quoted 1 line
Quoted 1 line
device-types/mem/description.tex \subsection{Feature bits}\label{sec:Device Types / · line 61
Quoted 1 line
device-types/mem/description.tex +0
-0might get modified implicitly on memory access, this feature isexpected to
Quoted 2 lines
Quoted 2 lines
device-types/mem/description.tex \subsection{Feature bits}\label{sec:Device Types / · line 63
Quoted 2 lines
device-types/mem/description.tex +1
-0be offered by the device.} +\item[VIRTIO_MEM_F_PERSISTENT_SUSPEND (2)] The driver can allow theguest
Quoted 3 lines
Quoted 3 lines
device-types/mem/description.tex \subsection{Feature bits}\label{sec:Device Types / Memory Device / Feature bits}
Quoted 3 lines
device-types/mem/description.tex +1
-0+system to enter suspended state (deep sleep, suspend-to-RAM). \end{description} \subsection{Device configuration layout}\label{sec:Device Types /Memory Device / Device configuration layout}
Quoted 1 line
Quoted 1 line
device-types/mem/description.tex \subsection{Device Initialization}\label{Device
Quoted 1 line
device-types/mem/description.tex +0
-0@@ -174,6 +176,9 @@ \subsection{Device Initialization}\label{DeviceTypes / Memory Device / Device I
Quoted 1 line
Quoted 1 line
device-types/mem/description.tex \subsection{Device Initialization}\label{Device · line 176
Quoted 1 line
device-types/mem/description.tex +0
-0The device MUST NOT modify memory or memory properties of pluggedmemory
Quoted 2 lines
Quoted 2 lines
device-types/mem/description.tex \subsection{Device Initialization}\label{Device · line 178
Quoted 2 lines
device-types/mem/description.tex +1
-0blocks during device reset. +The device SHOULD offer VIRTIO_MEM_F_PERSISTENT_SUSPEND if theplatform
Quoted 1 line
Quoted 1 line
device-types/mem/description.tex \subsection{Device Initialization}\label{Device · line 179
Quoted 1 line
device-types/mem/description.tex +1
-0+supports suspending (deep sleep, suspend-to-RAM) with plugged memoryblocks.
Quoted 2 lines
Quoted 2 lines
device-types/mem/description.tex \subsection{Device Initialization}\label{Device · line 181
Quoted 2 lines
device-types/mem/description.tex +1
-0+ \subsection{Device Operation}\label{sec:Device Types / MemoryDevice / Device Operation}
Quoted 1 line
Quoted 1 line
device-types/mem/description.tex \subsection{Device Initialization}\label{Device · line 182
Quoted 1 line
device-types/mem/description.tex +0
-0The device notifies the driver about the amount of memory thedevice wants
Quoted 1 line
Quoted 1 line
device-types/mem/description.tex \subsection{Device Operation}\label{sec:Device
Quoted 1 line
device-types/mem/description.tex +0
-0@@ -268,6 +273,9 @@ \subsection{Device Operation}\label{sec:DeviceTypes / Memory Device / Device Op
Quoted 3 lines
Quoted 3 lines
device-types/mem/description.tex \subsection{Device Operation}\label{sec:Device Types / Memory Device / Device Op
Quoted 3 lines
device-types/mem/description.tex +1
-0memory blocks to unplug them, or it would not be able to make use of unplugged memory blocks after plugging them (e.g., alignment). +If VIRTIO_MEM_F_PERSISTENT_SUSPEND has not been negotiated, the
Quoted 9 lines
driver MUST NOT
Quoted 1 line
Quoted 1 line
device-types/mem/description.tex \subsection{Device Operation}\label{sec:Device · line 276
Quoted 1 line
device-types/mem/description.tex +1
-0+allow the guest system to enter a suspended state (deep sleep,suspend-to-RAM).
Quoted 3 lines
I think
guest systemcould be simplyguestbut I do not have a strong opinion about it.Makes sense. @Juraj, can you respin with that adjusted?
Sure thing. I will update it and respin it shortly.
Thanks!
Quoted 9 lines
I'll open an issue afterwards and request a vote.
--
Cheers,David / dhildenb