Skip to contentSkip to conversation

introduce basic facilities for virito live migration

PATCH In review Zhu Lingshan 4 participants 186 messages Nov 3, 2023 – Nov 27, 2023 Page 1 of 2

lore
Share & tools
lore
#0 lore raw

v2 cover introduce basic facilities for virito live migration

This series introduces basic facilities to support virtio live migration, includes:

1)a new SUSPEND bit in the device status
Which is used to suspend the device, so that the device states and virtqueue states are stabilized.

2)virtqueue state and its accessor, to get and set last_avail_idx and last_used_idx of virtqueues.

3)dirty page tracking

Changes from V1:
1)move vq state defination from content.tex to splited/packed.tex(Michael)
2)"the device should ignore resetting vqs when suspended" ==> "the driver should not reset vqs when suspended"(Michael) 3)add dirty page tracking facility

Zhu Lingshan (6):
virtio: introduce virtqueue state
virtio: introduce SUSPEND bit in device status
virtio: dont reset vqs when SUSPEND
virtio-pci: implement VIRTIO_F_QUEUE_STATE
virtio: introduce dirty page tracking facility
virtio-pci: implement dirty page tracking

 content.tex       | 66 ++++++++++++++++++++++++++++++++--
 packed-ring.tex   | 58 ++++++++++++++++++++++++++++++
 split-ring.tex    | 39 ++++++++++++++++++++
 transport-pci.tex | 90 +++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 251 insertions(+), 2 deletions(-)
Signature · 18 lines
2.35.3


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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/
#1 lore raw

PATCH v2 1/6 virtio: introduce virtqueue state

This patch adds new virtqueue facility to save and restore virtqueue state. The virtqueue state is split into two parts:

- The available state: The state that is used for read the next available buffer.
- The used state: The state that is used for make buffer used.

This will simply the transport specific method implementation. E.g two le16 could be used instead of a single le32). For split virtqueue, we only need the available state since the used state is implemented in the virtqueue itself (the used index). For packed virtqueue, we need both the available state and the used state.

The typical use cases are live migration and debugging.

---
 content.tex     |  7 ++++--
 packed-ring.tex | 58 +++++++++++++++++++++++++++++++++++++++++++++++++
 split-ring.tex  | 39 +++++++++++++++++++++++++++++++++
 3 files changed, 102 insertions(+), 2 deletions(-)
content.tex +5 -2
index 0a62dce..76813b5 100644
@@ -99,10 +99,10 @@ \section{Feature Bits}\label{sec:Basic Facilities of a Virtio Device / Feature B
 \begin{description}
 \item[0 to 23, and 50 to 127] Feature bits for the specific device type
 
-\item[24 to 41] Feature bits reserved for extensions to the queue and
+\item[24 to 42] Feature bits reserved for extensions to the queue and
   feature negotiation mechanisms
 
-\item[42 to 49, and 128 and above] Feature bits reserved for future extensions.
+\item[43 to 49, and 128 and above] Feature bits reserved for future extensions.
 \end{description}
 
 \begin{note}
@@ -872,6 +872,9 @@ \chapter{Reserved Feature Bits}\label{sec:Reserved Feature Bits}
 	\ref{devicenormative:Basic Facilities of a Virtio Device / Feature Bits} for
 	handling features reserved for future use.
 
+  \item[VIRTIO_F_QUEUE_STATE(42)] This feature indicates that the device allows the driver
+  to access its internal virtqueue state.
+
 \end{description}
 
 \drivernormative{\section}{Reserved Feature Bits}{Reserved Feature Bits}
packed-ring.tex +58 -0

61 lines not on this page · raw message

split-ring.tex +39 -0
index de94038..a78b44d 100644
@@ -734,3 +734,42 @@ \subsection{Receiving Used Buffers From The Device}\label{sec:Basic Facilities o
 }
 \end{lstlisting}
 \end{note}
+
+\subsection{Virtqueue State}\label{sec:Basic Facilities of a Virtio Device / Splited Virtqueues / Virtqueue State}
+
+When VIRTIO_F_QUEUE_STATE has been negotiated, the driver can set and
+get the device internal virtqueue state through the following
+fields. The implementation of the interfaces is transport specific.
+
+\subsubsection{\field{Available State} Field}
+
+The available state field is two bytes of virtqueue state that is used by
+the device to read the next available buffer. It is presented in the followwing format:
+
+\begin{lstlisting}
+le16 last_avail_idx;
+\end{lstlisting}
+
+The \field{last_avail_idx} field is the free-running available ring
+index where the device will read the next available head of a
+descriptor chain.
+
+See also \ref{sec:Basic Facilities of a Virtio Device / Virtqueues / The Virtqueue Available Ring}.
+
+\drivernormative{\subsubsection}{Virtqueue State}{Basic Facilities of a Virtio Device / Splited Virtqueues/ Virtqueue State}
+
+The driver SHOULD NOT access \field{Used State} of any splited virtqueues, it SHOULD use the
+used index in the used ring.
+
+\devicenormative{\subsubsection}{Virtqueue State}{Basic Facilities of a Virtio Device / Splited Virtqueues/ Virtqueue State}
+
+The device SHOULD only accept setting Virtqueue State of any splited virtqueues
+when DRIVER_OK is not set in \field{device status} or SUSPEND is set in \field{device status}.
+Otherwise the device MUST ignore any writes to Virtqueue State of any splited virtqueues.
+
+When SUSPEND is set, the device MUST record the Available State of every enabled splited virtqueue
+in \field{Available State} field,
+and correspondingly restore the Available State of every enabled splited virtqueue
+from \field{Available State} field when DRIVER_OK is set.
+
+The device SHOULD reset \field{Available State} field upon a device reset.
Signature · 18 lines
2.35.3


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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/
#12 lore raw

PATCH v2 2/6 virtio: introduce SUSPEND bit in device status

In reply to Zhu Lingshan

This patch introduces a new status bit in the device status: SUSPEND.

This SUSPEND bit can be used by the driver to suspend a device, in order to stabilize the device states and virtqueue states.

Its main use case is live migration.

---
 content.tex | 36 ++++++++++++++++++++++++++++++++++--
 1 file changed, 34 insertions(+), 2 deletions(-)
content.tex +34 -2
index 76813b5..bcc9d4b 100644
@@ -49,6 +49,10 @@ \section{\field{Device Status} Field}\label{sec:Basic Facilities of a Virtio Dev
 
 \item[DEVICE_NEEDS_RESET (64)] Indicates that the device has experienced
   an error from which it can't recover.
+
+\item[SUSPEND (16)] When VIRTIO_F_SUSPEND is negotiated, indicates that the
+  device has been suspended by the driver.
+
 \end{description}
 
 The \field{device status} field starts out as 0, and is reinitialized to 0 by
@@ -73,6 +77,10 @@ \section{\field{Device Status} Field}\label{sec:Basic Facilities of a Virtio Dev
 recover by issuing a reset.
 \end{note}
 
+The driver SHOULD NOT set SUSPEND if FEATURES_OK is not set.
+
+When setting SUSPEND, the driver MUST re-read \field{device status} to ensure the SUSPEND bit is set.
+
 \devicenormative{\subsection}{Device Status Field}{Basic Facilities of a Virtio Device / Device Status Field}
 
 The device MUST NOT consume buffers or send any used buffer
@@ -82,6 +90,26 @@ \section{\field{Device Status} Field}\label{sec:Basic Facilities of a Virtio Dev
 that a reset is needed.  If DRIVER_OK is set, after it sets DEVICE_NEEDS_RESET, the device
 MUST send a device configuration change notification to the driver.
 
+The device MUST ignore SUSPEND if FEATURES_OK is not set.
+
+The device MUST ignore SUSPEND if VIRTIO_F_SUSPEND is not negotiated.
+
+The device SHOULD allow settings to \field{device status} even when SUSPEND is set.
+
+If VIRTIO_F_SUSPEND is negotiated and SUSPEND is set, the device SHOULD clear SUSPEND
+and resumes operation upon DRIVER_OK.
+
+If VIRTIO_F_SUSPEND is negotiated, when the driver sets SUSPEND,
+the device SHOULD perform the following actions before presenting SUSPEND bit in the \field{device status}:
+
+\begin{itemize}
+\item Stop consuming buffers of any virtqueues and mark all finished descritors as used.
+\item Wait until all descriptors that being processed to finish and mark them as used.
+\item Flush all used buffer and send used buffer notifications to the driver.
+\item Record Virtqueue State of each enabled virtqueue, see section \ref{sec:Virtqueues / Virtqueue State}
+\item Pause its operation except \field{device status} and preserve configurations in its Device Configuration Space, see \ref{sec:Basic Facilities of a Virtio Device / Device Configuration Space}
+\end{itemize}
+
 \section{Feature Bits}\label{sec:Basic Facilities of a Virtio Device / Feature Bits}
 
 Each virtio device offers all the features it understands.  During
@@ -99,10 +127,10 @@ \section{Feature Bits}\label{sec:Basic Facilities of a Virtio Device / Feature B
 \begin{description}
 \item[0 to 23, and 50 to 127] Feature bits for the specific device type
 
-\item[24 to 42] Feature bits reserved for extensions to the queue and
+\item[24 to 43] Feature bits reserved for extensions to the queue and
   feature negotiation mechanisms
 
-\item[43 to 49, and 128 and above] Feature bits reserved for future extensions.
+\item[44 to 49, and 128 and above] Feature bits reserved for future extensions.
 \end{description}
 
 \begin{note}
@@ -875,6 +903,10 @@ \chapter{Reserved Feature Bits}\label{sec:Reserved Feature Bits}
   \item[VIRTIO_F_QUEUE_STATE(42)] This feature indicates that the device allows the driver
   to access its internal virtqueue state.
 
+  \item[VIRTIO_F_SUSPEND(43)] This feature indicates that the driver can
+   SUSPEND the device.
+   See \ref{sec:Basic Facilities of a Virtio Device / Device Status Field}.
+
 \end{description}
 
 \drivernormative{\section}{Reserved Feature Bits}{Reserved Feature Bits}
Signature · 18 lines
2.35.3


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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/
#79 lore raw

PATCH v2 4/6 virtio-pci: implement VIRTIO_F_QUEUE_STATE

In reply to Zhu Lingshan

This patch adds two new le16 fields to common configuration structure to support VIRTIO_F_QUEUE_STATE in PCI transport layer.

---
 transport-pci.tex | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
transport-pci.tex +18 -0
index a5c6719..3161519 100644
@@ -325,6 +325,10 @@ \subsubsection{Common configuration structure layout}\label{sec:Virtio Transport
         /* About the administration virtqueue. */
         le16 admin_queue_index;         /* read-only for driver */
         le16 admin_queue_num;         /* read-only for driver */
+
+	/* Virtqueue state */
+        le16 queue_avail_state;         /* read-write */
+        le16 queue_used_state;          /* read-write */
 };
 \end{lstlisting}
 
@@ -428,6 +432,17 @@ \subsubsection{Common configuration structure layout}\label{sec:Virtio Transport
 	The value 0 indicates no supported administration virtqueues.
 	This field is valid only if VIRTIO_F_ADMIN_VQ has been
 	negotiated.
+
+\item[\field{queue_avail_state}]
+        This field is valid only if VIRTIO_F_QUEUE_STATE has been
+        negotiated. The driver sets and gets the available state of
+        the virtqueue here (see \ref{sec:Virtqueues / Virtqueue State}).
+
+\item[\field{queue_used_state}]
+        This field is valid only if VIRTIO_F_QUEUE_STATE has been
+        negotiated. The driver sets and gets the used state of the
+        virtqueue here (see \ref{sec:Virtqueues / Virtqueue State}).
+
 \end{description}
 
 \devicenormative{\paragraph}{Common configuration structure layout}{Virtio Transport Options / Virtio Over PCI Bus / PCI Device Layout / Common configuration structure layout}
@@ -488,6 +503,9 @@ \subsubsection{Common configuration structure layout}\label{sec:Virtio Transport
 present either a value of 0 or a power of 2 in
 \field{queue_size}.
 
+If VIRTIO_F_QUEUE_STATE has not been negotiated, the device MUST ignore
+any accesses to \field{queue_avail_state} and \field{queue_used_state}.
+
 If VIRTIO_F_ADMIN_VQ has been negotiated, the value
 \field{admin_queue_index} MUST be equal to, or bigger than
 \field{num_queues}; also, \field{admin_queue_num} MUST be
Signature · 18 lines
2.35.3


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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/
#123 lore raw

PATCH v2 5/6 virtio: introduce dirty page tracking facility

In reply to Zhu Lingshan

This commit introduce a new virtio facility to track device dirty pages, a typical use case is live migration.

The implementation of this facility is transport specific.

---
 content.tex | 28 ++++++++++++++++++++++++++--
 1 file changed, 26 insertions(+), 2 deletions(-)
content.tex +26 -2
index 060b5c2..eb9274f 100644
@@ -127,10 +127,10 @@ \section{Feature Bits}\label{sec:Basic Facilities of a Virtio Device / Feature B
 \begin{description}
 \item[0 to 23, and 50 to 127] Feature bits for the specific device type
 
-\item[24 to 43] Feature bits reserved for extensions to the queue and
+\item[24 to 44] Feature bits reserved for extensions to the queue and
   feature negotiation mechanisms
 
-\item[44 to 49, and 128 and above] Feature bits reserved for future extensions.
+\item[45 to 49, and 128 and above] Feature bits reserved for future extensions.
 \end{description}
 
 \begin{note}
@@ -535,6 +535,27 @@ \section{Exporting Objects}\label{sec:Basic Facilities of a Virtio Device / Expo
 
 \input{admin.tex}
 
+\section{Memory Dirty Pages Tracker}\label{sec:Basic Facilities of a Virtio Device / Memory Dirty Pages Tracker}
+
+A "dirty page" refers to a page in memory that has been modified by the device
+but have not yet been acknowledged or processed by the CPU.
+
+This Memory Dirty Pages Tracker is a device facility that can record and report
+dirty pages caused by the device in device address space.
+
+The device offers a feature bit VIRTIO_F_MEM_TRACK if capable of tracking dirty pages.
+The implementation of this dirty page tracking facility is transport specific.
+
+A typical use case of this facility is to track dirty pages during live migration process.
+
+\drivernormative{\subsection}{Memory Dirty Pages Tracker}{Facilities of a Virtio Device / Memory Dirty Pages Tracker}
+
+The driver MUST fetch and clear dirty page information atomically.
+
+\devicenormative{\subsection}{Memory Dirty Pages Tracker}{Facilities of a Virtio Device / Memory Dirty Pages Tracker}
+
+The device MUST report the dirty page information atomically.
+
 \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
@@ -910,6 +931,9 @@ \chapter{Reserved Feature Bits}\label{sec:Reserved Feature Bits}
    SUSPEND the device.
    See \ref{sec:Basic Facilities of a Virtio Device / Device Status Field}.
 
+  \item[VIRTIO_F_MEM_TRACK(44)] This feature indicates that the device can track
+  memory dirty pages caused by itself.
+
 \end{description}
 
 \drivernormative{\section}{Reserved Feature Bits}{Reserved Feature Bits}
Signature · 18 lines
2.35.3


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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/
#126 lore raw

PATCH v2 6/6 virtio-pci: implement dirty page tracking

In reply to Zhu Lingshan

This commit implements dirty page tracking facility in PCI transport layer.

---
 transport-pci.tex | 72 +++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 72 insertions(+)
transport-pci.tex +72 -0
index 3161519..16209f4 100644
@@ -188,6 +188,8 @@ \subsection{Virtio Structure PCI Capabilities}\label{sec:Virtio Transport Option
 #define VIRTIO_PCI_CAP_SHARED_MEMORY_CFG 8
 /* Vendor-specific data */
 #define VIRTIO_PCI_CAP_VENDOR_CFG        9
+/* Memory Dirty Pages Tracker*/
+#define VIRTIO_PCI_CAP_MEMORY_TRACK_CFG  10
 \end{lstlisting}
 
         Any other value is reserved for future use.
@@ -1230,3 +1232,73 @@ \subsubsection{Driver Handling Interrupts}\label{sec:Virtio Transport Options /
         re-examine the configuration space to see what changed.
     \end{itemize}
 \end{itemize}
+
+\subsection{Memory Dirty Pages Tracker Capability}\label{sec:Virtio
+Transport Options / Virtio Over PCI Bus / PCI Device Layout /
+Memory Dirty Pages Tracker Capability}
+
+The Memory Dirty Pages Tracker facility is found at \field{bar} and \field{offset} in VIRTIO_PCI_CAP_MEMORY_TRACK_CFG capability.
+Its layout is shown below:
+
+\begin{lstlisting}
+struct virtio_pci_dity_page_track {
+        u8 enable;               /* Read-Write */
+        u8 gra_power;            /* Read-Write */
+        u8 reserved[2];
+        le32 {
+            pasid: 20;           /* Read-Write */
+            reserved: 12;
+        };
+        le64 bitmap_addr;        /* Read-Write */
+        le64 bitmap_length;      /* Read-Write */
+};
+\end{lstlisting}
+
+\begin{description}
+\item[\field{enable}]
+	The driver writes 1 to enable dirty pages tracking and sets 0 to disable.
+\item[\field{gra_power}]
+	The driver uses this to set the dirty pages tracking granularity.
+	Each bit in the bitmap covers page_size = 2\^{}(12 + gra_power) bytes,
+	so when gra_power == 0, 4K bytes page is default.
+\item[\field{pasid}]
+	Optionally, the driver uses this to assign a pasid to this capability.
+\item[\field{bitmap_addr}]
+	The driver use this to set the address of the bitmap which records the dirty pages
+	caused by the device.
+	Each bit in the bitmap represents one memory page, bit 0 in the bitmap
+	reprsents page 0 at address 0, bit 1 represents page 1, and so on in a linear manner.
+	When \field{enable} is set to 1 and the device writes to a memory page,
+	the device MUST set the corresponding bit to 1 which indicating the page is dirty.
+\item[\field{bitmap_length}]
+	The driver use this to set the length in bytes of the bitmap.
+\end{description}
+
+\devicenormative{\subsubsection}{Memory Dirty Pages Tracker Capability}{Virtio Transport Options / Virtio Over PCI Bus / Memory Dirty Pages Tracker Capability}
+
+The device MUST NOT set any bits beyond bitmap_length when reporting dirty pages.
+
+To prevent a read-modify-write procedure, if a memory page is dirty,
+optionally the device is permitted to set the entire byte, which encompasses the relevant bit, to 1.
+
+The device MAY increase \field{gra_power} to reduce \field{bitmap_length}.
+
+The device must ignore any writes to \field{pasid} if PASID Extended Capability is absent or
+the PASID functionality is disabled in PASID Extended Capability
+
+The bitmap which starts at \field{bitmap_addr} SHOULD not be considered
+as dirty when the device write to it.
+
+On a reset, the device MUST reset \field{pasid} and \field{enable}, and stop
+tracking dirty pages.
+
+\drivernormative{\subsubsection}{Memory Dirty Pages Tracker Capability}{Virtio Transport Options / Virtio Over PCI Bus / Memory Dirty Pages Tracker Capability}
+
+The driver is responsible to allocate the bitmap for tracking device dirty pages.
+
+Upon retrieving a cluster of bits from the bitmap, the driver MUST clear each of them by setting 0.
+
+The driver MUST configure \field{pasid} if PASID is enabled in PASID Extended Capability.
+
+The driver SHOULD NOT access \field{pasid} if PASID Extended Capability is absent or
+the PASID functionality is disabled in PASID Extended Capability.
Signature · 18 lines
2.35.3


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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/
#28 lore raw

PATCH v2 3/6 virtio: dont reset vqs when SUSPEND

In reply to Zhu Lingshan

When SUSPEND is set, device states and virtqueue states should be stablized, therefore the driver should not reset vqs when SUSPEND is set in device status.

---
 content.tex | 3 +++
 1 file changed, 3 insertions(+)
content.tex +3 -0
index bcc9d4b..060b5c2 100644
@@ -444,6 +444,9 @@ \subsubsection{Virtqueue Reset}\label{sec:Basic Facilities of a Virtio Device /
 The device MUST reset any state of a virtqueue to the default state,
 including the available state and the used state.
 
+If VIRTIO_F_SUSPEND is negotiated and SUSPEND is set in \field{device status},
+the driver SHOULD NOT reset any virtqueues.
+
 \drivernormative{\paragraph}{Virtqueue Reset}{Basic Facilities of a Virtio Device / Virtqueues / Virtqueue Reset / Virtqueue Reset}
 
 After the driver tells the device to reset a queue, the driver MUST verify that
Signature · 18 lines
2.35.3


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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/
#127 lore raw

[virtio-comment] Re: [PATCH V2 6/6] virtio-pci: implement dirty page tracking

In reply to Zhu Lingshan

transport-pci.tex \subsubsection{Driver Handling Interrupts}\label{sec:Virtio Transport Options / · line 1255

Quoted 13 lines · Zhu Lingshan

+\begin{lstlisting}

transport-pci.tex +12 -0
+struct virtio_pci_dity_page_track {
+        u8 enable;               /* Read-Write */
+        u8 gra_power;            /* Read-Write */
+        u8 reserved[2];
+        le32 {
+            pasid: 20;           /* Read-Write */
+            reserved: 12;
+        };
+        le64 bitmap_addr;        /* Read-Write */
+        le64 bitmap_length;      /* Read-Write */
+};
+\end{lstlisting}

Okay, so it's a simple mailbox in config space. Which by itself is probably a very reasonable idea - more or less what I suggested. However, using such a generic facility just for the dirty bitmap seems too limited. Please make it accept arbitrary commands. Reusing admin command structure with a special "device itself" group sounds like one way to do it.

Signature · 18 lines
MST


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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/
#133 lore raw

[virtio-comment] Re: [PATCH V2 6/6] virtio-pci: implement dirty page tracking

In reply to Zhu Lingshan
Quoted 12 lines · Zhu Lingshan

+\item[\field{bitmap_addr}]

transport-pci.tex +11 -0
+	The driver use this to set the address of the bitmap which records the dirty pages
+	caused by the device.
+	Each bit in the bitmap represents one memory page, bit 0 in the bitmap
+	reprsents page 0 at address 0, bit 1 represents page 1, and so on in a linear manner.
+	When \field{enable} is set to 1 and the device writes to a memory page,
+	the device MUST set the corresponding bit to 1 which indicating the page is dirty.
+\item[\field{bitmap_length}]
+	The driver use this to set the length in bytes of the bitmap.
+\end{description}
+
+\devicenormative{\subsubsection}{Memory Dirty Pages Tracker Capability}{Virtio Transport Options / Virtio Over PCI Bus / Memory Dirty Pages Tracker Capability}

transport-pci.tex \subsubsection{Driver Handling Interrupts}\label{sec:Virtio Transport Options / · line 1287

Quoted 10 lines
transport-pci.tex +10 -0
+
+The device MUST NOT set any bits beyond bitmap_length when reporting dirty pages.
+
+To prevent a read-modify-write procedure, if a memory page is dirty,
+optionally the device is permitted to set the entire byte, which encompasses the relevant bit, to 1.
+
+The device MAY increase \field{gra_power} to reduce \field{bitmap_length}.
+
+The device must ignore any writes to \field{pasid} if PASID Extended Capability is absent or
+the PASID functionality is disabled in PASID Extended Capability

I have to say this is going to work very badly when the number of dirty pages is small: you will end up scanning and re-scanning all of bitmap. And the resolution is apparently 8 pages? You have just multiplied the migration bandwidth by a factor of 8.

Signature · 18 lines
MST


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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/
#124 lore raw

[virtio-comment] RE: [PATCH V2 5/6] virtio: introduce dirty page tracking facility

In reply to Zhu Lingshan

Hi Jason,

Quoted 11 lines

From: Zhu Lingshan <[email protected]>
Sent: Friday, November 3, 2023 4:05 PM
This commit introduce a new virtio facility to track device dirty pages, a typical use case is live migration.

The implementation of this facility is transport specific.

In my series of dirty page tracking (aka write recording), you kept insisting until Thu, that it is optional, and platform will do it. Why do you propose this facility now?
Can you please explain as commit log says typical use case is "live migration"? :)

#80 lore raw

[virtio-comment] RE: [PATCH V2 4/6] virtio-pci: implement VIRTIO_F_QUEUE_STATE

In reply to Zhu Lingshan
Quoted 20 lines

From: Zhu Lingshan <[email protected]>
Sent: Friday, November 3, 2023 4:05 PM

This patch adds two new le16 fields to common configuration structure to support VIRTIO_F_QUEUE_STATE in PCI transport layer.

---
 transport-pci.tex | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
transport-pci.tex +0 -0
@@ -325,6 +325,10 @@ \subsubsection{Common configuration structure

layout}\label{sec:Virtio Transport
/* About the administration virtqueue. */
le16 admin_queue_index; /* read-only for driver */
le16 admin_queue_num; /* read-only for driver */

transport-pci.tex \subsubsection{Common configuration structure layout}\label{sec:Virtio Transport · line 331

Quoted 4 lines
transport-pci.tex +4 -0
+
+	/* Virtqueue state */
+        le16 queue_avail_state;         /* read-write */
+        le16 queue_used_state;          /* read-write */

This tiny interface for 128 virtio net queues through register read writes, does not work effectively. There are inflight out of order descriptors for block also.
Hence toy registers like this do not work.

Series [1] is comprehensive that covers it even if you consider non-passtrhough device migration model. Where you can suspend individual queues using new admin command and get them in the device context state.

[1] https://lists.oasis-open.org/archives/virtio-comment/202310/msg00472.html

Quoted 31 lines

};
\end{lstlisting}

transport-pci.tex +0 -0
@@ -428,6 +432,17 @@ \subsubsection{Common configuration structure

layout}\label{sec:Virtio Transport

transport-pci.tex +11 -0
 	The value 0 indicates no supported administration virtqueues.
 	This field is valid only if VIRTIO_F_ADMIN_VQ has been
 	negotiated.
+
+\item[\field{queue_avail_state}]
+        This field is valid only if VIRTIO_F_QUEUE_STATE has been
+        negotiated. The driver sets and gets the available state of
+        the virtqueue here (see \ref{sec:Virtqueues / Virtqueue State}).
+
+\item[\field{queue_used_state}]
+        This field is valid only if VIRTIO_F_QUEUE_STATE has been
+        negotiated. The driver sets and gets the used state of the
+        virtqueue here (see \ref{sec:Virtqueues / Virtqueue State}).
+
 \end{description}
 
 \devicenormative{\paragraph}{Common configuration structure layout}{Virtio

Transport Options / Virtio Over PCI Bus / PCI Device Layout / Common configuration structure layout} @@ -488,6 +503,9 @@ \subsubsection{Common configuration structure layout}\label{sec:Virtio Transport present either a value of 0 or a power of 2 in \field{queue_size}.

transport-pci.tex +3 -0
+If VIRTIO_F_QUEUE_STATE has not been negotiated, the device MUST ignore
+any accesses to \field{queue_avail_state} and \field{queue_used_state}.
+
 If VIRTIO_F_ADMIN_VQ has been negotiated, the value
Quoted 4 lines

\field{admin_queue_index} MUST be equal to, or bigger than \field{num_queues}; also, \field{admin_queue_num} MUST be --
2.35.3

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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/

#2 lore raw

[virtio-comment] RE: [PATCH V2 1/6] virtio: introduce virtqueue state

In reply to Zhu Lingshan
Quoted 6 lines

From: Zhu Lingshan <[email protected]>
Sent: Friday, November 3, 2023 4:05 PM

This patch adds new virtqueue facility to save and restore virtqueue state. The virtqueue state is split into two parts:

Quoted 8 lines

- The available state: The state that is used for read the next available buffer.
- The used state: The state that is used for make buffer used.

This will simply the transport specific method implementation. E.g two le16 could be used instead of a single le32). For split virtqueue, we only need the available state since the used state is implemented in the virtqueue itself (the used index).

Sorry, this does not work.
Refer to my latest series at [2] that covers used ring elements too. Commit change log covered the reasoning.

[2] https://lists.oasis-open.org/archives/virtio-comment/202310/msg00472.html

#13 lore raw

[virtio-comment] RE: [PATCH V2 2/6] virtio: introduce SUSPEND bit in device status

In reply to Zhu Lingshan
Quoted 6 lines

From: Zhu Lingshan <[email protected]>
Sent: Friday, November 3, 2023 4:05 PM

This patch introduces a new status bit in the device status: SUSPEND.

Quoted 7 lines

This SUSPEND bit can be used by the driver to suspend a device, in order to stabilize the device states and virtqueue states.

Its main use case is live migration.

You constantly complained that whatever was proposed using admin commands method in [1] must work for passthrough and non-passthrough.

And halfway in the discussion you propose a method after learning all the limitations of in-band, you propose a solution only works for non-passthrough mode.

You asked someone to have comprehensive proposal and when it comes to you following it, you just don’t. And have most shallow commit message to not even mention it.

Please be consistent in design approach.
And if you don’t want to be, stop asking others.

This is not the way TC collaboration works.
I probably shouldn’t even expect this from you.

[1] https://lists.oasis-open.org/archives/virtio-comment/202310/msg00472.html

Quoted 98 lines
---
 content.tex | 36 ++++++++++++++++++++++++++++++++++--
 1 file changed, 34 insertions(+), 2 deletions(-)
content.tex +0 -0
index 76813b5..bcc9d4b 100644
@@ -49,6 +49,10 @@ \section{\field{Device Status} Field}\label{sec:Basic

Facilities of a Virtio Dev

\item[DEVICE_NEEDS_RESET (64)] Indicates that the device has experienced
an error from which it can't recover.

content.tex +5 -0
+
+\item[SUSPEND (16)] When VIRTIO_F_SUSPEND is negotiated, indicates that
+the
+  device has been suspended by the driver.
+
 \end{description}
 
 The \field{device status} field starts out as 0, and is reinitialized to 0 by @@ -

73,6 +77,10 @@ \section{\field{Device Status} Field}\label{sec:Basic Facilities of a Virtio Dev recover by issuing a reset.
\end{note}

content.tex +3 -0
+The driver SHOULD NOT set SUSPEND if FEATURES_OK is not set.
+
+When setting SUSPEND, the driver MUST re-read \field{device status} to ensure

the SUSPEND bit is set.
+
\devicenormative{\subsection}{Device Status Field}{Basic Facilities of a Virtio
Device / Device Status Field}

The device MUST NOT consume buffers or send any used buffer @@ -82,6
+90,26 @@ \section{\field{Device Status} Field}\label{sec:Basic Facilities of a Virtio Dev that a reset is needed. If DRIVER_OK is set, after it sets DEVICE_NEEDS_RESET, the device MUST send a device configuration change notification to the driver.

content.tex +5 -0
+The device MUST ignore SUSPEND if FEATURES_OK is not set.
+
+The device MUST ignore SUSPEND if VIRTIO_F_SUSPEND is not negotiated.
+
+The device SHOULD allow settings to \field{device status} even when SUSPEND

is set.

content.tex +6 -0
+
+If VIRTIO_F_SUSPEND is negotiated and SUSPEND is set, the device SHOULD
+clear SUSPEND and resumes operation upon DRIVER_OK.
+
+If VIRTIO_F_SUSPEND is negotiated, when the driver sets SUSPEND, the
+device SHOULD perform the following actions before presenting SUSPEND bit

in the \field{device status}:
+
+\begin{itemize}
+\item Stop consuming buffers of any virtqueues and mark all finished descritors as used.
+\item Wait until all descriptors that being processed to finish and mark them as used.
+\item Flush all used buffer and send used buffer notifications to the driver. +\item Record Virtqueue State of each enabled virtqueue, see section +\ref{sec:Virtqueues / Virtqueue State} \item Pause its operation except +\field{device status} and preserve configurations in its Device

content.tex +4 -0
+Configuration Space, see \ref{sec:Basic Facilities of a Virtio Device /
+Device Configuration Space} \end{itemize}
+
 \section{Feature Bits}\label{sec:Basic Facilities of a Virtio Device / Feature Bits}
 
 Each virtio device offers all the features it understands.  During @@ -99,10
+127,10 @@ \section{Feature Bits}\label{sec:Basic Facilities of a Virtio Device /

Feature B \begin{description}
\item[0 to 23, and 50 to 127] Feature bits for the specific device type

-\item[24 to 42] Feature bits reserved for extensions to the queue and +\item[24 to 43] Feature bits reserved for extensions to the queue and
feature negotiation mechanisms

-\item[43 to 49, and 128 and above] Feature bits reserved for future extensions. +\item[44 to 49, and 128 and above] Feature bits reserved for future extensions.
\end{description}

\begin{note}

content.tex +0 -0
@@ -875,6 +903,10 @@ \chapter{Reserved Feature Bits}\label{sec:Reserved
 Feature Bits}
   \item[VIRTIO_F_QUEUE_STATE(42)] This feature indicates that the device

allows the driver
to access its internal virtqueue state.

content.tex +4 -1
+  \item[VIRTIO_F_SUSPEND(43)] This feature indicates that the driver can
+   SUSPEND the device.
+   See \ref{sec:Basic Facilities of a Virtio Device / Device Status Field}.
+
 \end{description}
 
 \drivernormative{\section}{Reserved Feature Bits}{Reserved Feature Bits}
--

2.35.3

#134 lore raw

[virtio-comment] RE: [PATCH V2 6/6] virtio-pci: implement dirty page tracking

In reply to Michael S. Tsirkin
Quoted 25 lines

From: Michael S. Tsirkin <[email protected]>
Sent: Friday, November 3, 2023 4:20 PM

Review

Quoted 2 lines · Zhu Lingshan

+\item[\field{bitmap_addr}]

(quoted diff) +1 -0
+	The driver use this to set the address of the bitmap which records the

dirty pages

transport-pci.tex \subsubsection{Driver Handling Interrupts}\label{sec:Virtio Transport Options /

Quoted 3 lines
transport-pci.tex +3 -0
+	caused by the device.
+	Each bit in the bitmap represents one memory page, bit 0 in the bitmap
+	reprsents page 0 at address 0, bit 1 represents page 1, and so on in a

linear manner.

Review

Quoted 2 lines
(quoted diff) +2 -0
+	When \field{enable} is set to 1 and the device writes to a memory page,
+	the device MUST set the corresponding bit to 1 which indicating the

page is dirty.

transport-pci.tex \subsubsection{Driver Handling Interrupts}\label{sec:Virtio Transport Options /

Quoted 9 lines

+\item[\field{bitmap_length}]

transport-pci.tex +8 -0
+	The driver use this to set the length in bytes of the bitmap.
+\end{description}
+
+\devicenormative{\subsubsection}{Memory Dirty Pages Tracker
+Capability}{Virtio Transport Options / Virtio Over PCI Bus / Memory
+Dirty Pages Tracker Capability}
+
+The device MUST NOT set any bits beyond bitmap_length when reporting

dirty pages.

Quoted 2 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+
+To prevent a read-modify-write procedure, if a memory page is dirty,

It is not to prevent; it is just not possible to do racy RMW. 😊 Hence to work around you propose to mark all pages dirty. Too bad. This just does not work.

Secondly the bitmap array is function is for full guest memory size, while there is lot of sparce region now and also in future. This is the second problem.

This is exactly why I asked you to review the page write recording series of admin commands and comment. And you never commented with sheer ignorance.

So clearly the start stop method for specific range and without bandwidth explosion, admin commands of [1] stands better.

If you do [1] on the member device also using its AQ in future, it will work for non-passthrough case. If you build non-passthrough live migration using [1], also it will work.
So I don’t see any point of this series anymore.

[1] https://lists.oasis-open.org/archives/virtio-comment/202310/msg00475.html

Quoted 14 lines
Quoted 1 line

+optionally the device is permitted to set the entire byte, which encompasses

the relevant bit, to 1.

transport-pci.tex \subsubsection{Driver Handling Interrupts}\label{sec:Virtio Transport Options /

Quoted 6 lines
transport-pci.tex +6 -0
+
+The device MAY increase \field{gra_power} to reduce \field{bitmap_length}.
+
+The device must ignore any writes to \field{pasid} if PASID Extended
+Capability is absent or the PASID functionality is disabled in PASID
+Extended Capability

I have to say this is going to work very badly when the number of dirty pages is
small: you will end up scanning and re-scanning all of bitmap.
And the resolution is apparently 8 pages? You have just multiplied the migration bandwidth by a factor of 8.

Yeah.
And device does not even know previously reported pages are read by driver or not. All guess work game for driver and device.

#4 lore raw

[virtio-comment] Re: [PATCH V2 1/6] virtio: introduce virtqueue state

In reply to Zhu Lingshan
Quoted 99 lines · Zhu Lingshan

This patch adds new virtqueue facility to save and restore virtqueue state. The virtqueue state is split into two parts:

- The available state: The state that is used for read the next available buffer.
- The used state: The state that is used for make buffer used.

This will simply the transport specific method implementation. E.g two le16 could be used instead of a single le32). For split virtqueue, we only need the available state since the used state is implemented in the virtqueue itself (the used index). For packed virtqueue, we need both the available state and the used state.

The typical use cases are live migration and debugging.

---
 content.tex     |  7 ++++--
 packed-ring.tex | 58 +++++++++++++++++++++++++++++++++++++++++++++++++
 split-ring.tex  | 39 +++++++++++++++++++++++++++++++++
 3 files changed, 102 insertions(+), 2 deletions(-)
content.tex +5 -2
index 0a62dce..76813b5 100644
@@ -99,10 +99,10 @@ \section{Feature Bits}\label{sec:Basic Facilities of a Virtio Device / Feature B
 \begin{description}
 \item[0 to 23, and 50 to 127] Feature bits for the specific device type
 
-\item[24 to 41] Feature bits reserved for extensions to the queue and
+\item[24 to 42] Feature bits reserved for extensions to the queue and
   feature negotiation mechanisms
 
-\item[42 to 49, and 128 and above] Feature bits reserved for future extensions.
+\item[43 to 49, and 128 and above] Feature bits reserved for future extensions.
 \end{description}
 
 \begin{note}
@@ -872,6 +872,9 @@ \chapter{Reserved Feature Bits}\label{sec:Reserved Feature Bits}
 	\ref{devicenormative:Basic Facilities of a Virtio Device / Feature Bits} for
 	handling features reserved for future use.
 
+  \item[VIRTIO_F_QUEUE_STATE(42)] This feature indicates that the device allows the driver
+  to access its internal virtqueue state.
+
 \end{description}
 
 \drivernormative{\section}{Reserved Feature Bits}{Reserved Feature Bits}
packed-ring.tex +40 -0
index 9eeb382..ad6aba0 100644
@@ -729,3 +729,61 @@ \subsection{Receiving Used Buffers From The Device}\label{sec:Basic Facilities o
         process_buffer(d);
 }
 \end{lstlisting}
+
+\subsection{Virtqueue State}\label{sec:Basic Facilities of a Virtio Device / Packed Virtqueues / Virtqueue State}
+
+When VIRTIO_F_QUEUE_STATE has been negotiated, the driver can set and
+get the device internal virtqueue state through the following
+fields. The implementation of the interfaces is transport specific.
+
+\subsubsection{\field{Available State} Field}
+
+The available state field is two bytes of virtqueue state that is used by
+the device to read the next available buffer. It is presented in the followwing format:
+
+\begin{lstlisting}
+le16 {
+  last_avail_idx : 15;
+  last_avail_wrap_counter : 1;
+};
+\end{lstlisting}
+
+The \field{last_avail_idx} field is the free-running location
+where the device read the next descriptor from the virtqueue descriptor ring.
+
+The \field{last_avail_wrap_counter} field is the last driver ring wrap
+counter that was observed by the device.
+
+See also \ref{sec:Packed Virtqueues / Driver and Device Ring Wrap Counters}.
+
+\subsubsection{\field{Used State} Field}
+
+The used state field is two bytes of virtqueue state that is used by
+the device when marking a buffer used. It is presented in the followwing format:
+
+\begin{lstlisting}
+le16 {
+  used_idx : 15;
+  used_wrap_counter : 1;
+};
+\end{lstlisting}
+
+The \field{used_idx} field is the free-running location where the device write the next

packed-ring.tex \subsection{Receiving Used Buffers From The Device}\label{sec:Basic Facilities o · line 781

Quoted 10 lines
packed-ring.tex +10 -0
+used descriptor to the descriptor ring.
+
+The \field{used_wrap_counter} field is the wrap counter that is used
+by the device.
+
+See also \ref{sec:Packed Virtqueues / Driver and Device Ring Wrap Counters}.
+
+\devicenormative{\subsubsection}{Virtqueue State}{Basic Facilities of a Virtio Device / Packed Virtqueues/ Virtqueue State}
+
+The device SHOULD only accept setting Virtqueue State of any packed virtqueues when DRIVER_OK is not set in \field{device status}, or SUSPEND is set in \field{device status}.

Except SUSPEND is undefined and is explained in patch 2 :( Please do not split patches like this, you are just splitting them at random boundaries.

Quoted 38 lines
packed-ring.tex +8 -0
+Otherwise the device MUST ignore any writes to Virtqueue State of any packed virtqueues.
+
+When SUSPEND is set, the device MUST record the Virtqueue State of every enabled packed virtqueue
+in \field{Available State} field and \field{Used State} field respectively,
+and correspondingly restore the Virtqueue State of every enabled packed virtqueue
+from \field{Available State} field and \field{Used State} field when DRIVER_OK is set.
+
+The device SHOULD reset \field{Available State} field and \field{Used State} field upon a device reset.
split-ring.tex +22 -0
index de94038..a78b44d 100644
@@ -734,3 +734,42 @@ \subsection{Receiving Used Buffers From The Device}\label{sec:Basic Facilities o
 }
 \end{lstlisting}
 \end{note}
+
+\subsection{Virtqueue State}\label{sec:Basic Facilities of a Virtio Device / Splited Virtqueues / Virtqueue State}
+
+When VIRTIO_F_QUEUE_STATE has been negotiated, the driver can set and
+get the device internal virtqueue state through the following
+fields. The implementation of the interfaces is transport specific.
+
+\subsubsection{\field{Available State} Field}
+
+The available state field is two bytes of virtqueue state that is used by
+the device to read the next available buffer. It is presented in the followwing format:
+
+\begin{lstlisting}
+le16 last_avail_idx;
+\end{lstlisting}
+
+The \field{last_avail_idx} field is the free-running available ring
+index where the device will read the next available head of a
+descriptor chain.
+
+See also \ref{sec:Basic Facilities of a Virtio Device / Virtqueues / The Virtqueue Available Ring}.
+

split-ring.tex \subsection{Receiving Used Buffers From The Device}\label{sec:Basic Facilities o · line 768

Quoted 10 lines
split-ring.tex +10 -0
+\drivernormative{\subsubsection}{Virtqueue State}{Basic Facilities of a Virtio Device / Splited Virtqueues/ Virtqueue State}
+
+The driver SHOULD NOT access \field{Used State} of any splited virtqueues, it SHOULD use the
+used index in the used ring.
+
+\devicenormative{\subsubsection}{Virtqueue State}{Basic Facilities of a Virtio Device / Splited Virtqueues/ Virtqueue State}
+
+The device SHOULD only accept setting Virtqueue State of any splited virtqueues
+when DRIVER_OK is not set in \field{device status} or SUSPEND is set in \field{device status}.
+Otherwise the device MUST ignore any writes to Virtqueue State of any splited virtqueues.

all these requests to ignore writes are to what end? just prohibit driver from doing this.

split-ring.tex \subsection{Receiving Used Buffers From The Device}\label{sec:Basic Facilities o · line 775

Quoted 7 lines
split-ring.tex +7 -0
+
+When SUSPEND is set, the device MUST record the Available State of every enabled splited virtqueue
+in \field{Available State} field,
+and correspondingly restore the Available State of every enabled splited virtqueue
+from \field{Available State} field when DRIVER_OK is set.
+
+The device SHOULD reset \field{Available State} field upon a device reset.

At this point I have no idea
- how can a state of a virtqueue at a random time be represented by a 16 bit integer
- if it's not at a random time then why do you even need an integer - synchronize queue to memory and then all state is in memory

Quoted 2 lines
Signature · 1 line
2.35.3

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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/

#125 lore raw

[virtio-comment] Re: [PATCH V2 5/6] virtio: introduce dirty page tracking facility

In reply to Parav Pandit
Quoted 7 lines · Parav Pandit

Hi Jason,

Quoted 5 lines

From: Zhu Lingshan <[email protected]>
Sent: Friday, November 3, 2023 4:05 PM
This commit introduce a new virtio facility to track device dirty pages, a typical use case is live migration.

Quoted 8 lines
Quoted 5 lines

The implementation of this facility is transport specific.

In my series of dirty page tracking (aka write recording), you kept insisting until Thu, that it is optional, and platform will do it. Why do you propose this facility now?
Can you please explain as commit log says typical use case is "live migration"? :)

You misunderstood us.

If you remember, it is you challenge our config space proposal (v1) is incomplete without dirty page tracking facility.

This is to answer your challenge, as an optional backup.

We still believe dirty page tracking should be better done by platform facilities, like vt-d.

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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/

#128 lore raw

[virtio-comment] Re: [PATCH V2 6/6] virtio-pci: implement dirty page tracking

In reply to Michael S. Tsirkin
Quoted 12 lines · Michael S. Tsirkin
Quoted 11 lines · Zhu Lingshan

+\begin{lstlisting}

transport-pci.tex +10 -0
+struct virtio_pci_dity_page_track {
+        u8 enable;               /* Read-Write */
+        u8 gra_power;            /* Read-Write */
+        u8 reserved[2];
+        le32 {
+            pasid: 20;           /* Read-Write */
+            reserved: 12;
+        };
+        le64 bitmap_addr;        /* Read-Write */
+        le64 bitmap_length;      /* Read-Write */
Quoted 8 lines
Quoted 2 lines

+};
+\end{lstlisting}

Okay, so it's a simple mailbox in config space. Which by itself is probably a very reasonable idea - more or less what I suggested. However, using such a generic facility just for the dirty bitmap seems too limited. Please make it accept arbitrary commands. Reusing admin command structure with a special "device itself" group sounds like one way to do it.

processing admin cmds in a cap may be too complex and overkill.
we need to handle variable length of cmds, handle async returned results, and so on.

This struct seems easy and simple. And shall we use platform facilities like vt-d to track dirty pages?

Quoted 1 line

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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/

#178 lore raw

[virtio-comment] Re: [PATCH V2 6/6] virtio-pci: implement dirty page tracking

In reply to Michael S. Tsirkin
Quoted 18 lines · Michael S. Tsirkin
Quoted 17 lines · Zhu Lingshan

+\item[\field{bitmap_addr}]

transport-pci.tex +16 -0
+	The driver use this to set the address of the bitmap which records the dirty pages
+	caused by the device.
+	Each bit in the bitmap represents one memory page, bit 0 in the bitmap
+	reprsents page 0 at address 0, bit 1 represents page 1, and so on in a linear manner.
+	When \field{enable} is set to 1 and the device writes to a memory page,
+	the device MUST set the corresponding bit to 1 which indicating the page is dirty.
+\item[\field{bitmap_length}]
+	The driver use this to set the length in bytes of the bitmap.
+\end{description}
+
+\devicenormative{\subsubsection}{Memory Dirty Pages Tracker Capability}{Virtio Transport Options / Virtio Over PCI Bus / Memory Dirty Pages Tracker Capability}
+
+The device MUST NOT set any bits beyond bitmap_length when reporting dirty pages.
+
+To prevent a read-modify-write procedure, if a memory page is dirty,
+optionally the device is permitted to set the entire byte, which encompasses the relevant bit, to 1.
Quoted 8 lines

transport-pci.tex \subsubsection{Driver Handling Interrupts}\label{sec:Virtio Transport Options / · line 1287

Quoted 5 lines
transport-pci.tex +5 -0
+
+The device MAY increase \field{gra_power} to reduce \field{bitmap_length}.
+
+The device must ignore any writes to \field{pasid} if PASID Extended Capability is absent or
+the PASID functionality is disabled in PASID Extended Capability

I have to say this is going to work very badly when the number of dirty pages is small: you will end up scanning and re-scanning all of bitmap.

The driver needs to scan anyway, Intel production work with similar bitmap based dirty page tracking solution for years.

Otherwise the device should report PFN which is not very practical.

Quoted 2 lines

And the resolution is apparently 8 pages? You have just multiplied the migration bandwidth by a factor of 8.

No, as described in the comments, the tacking granularity is controlled by \field{gra_power}, one bit represents a page with page_size = 2^(12 + gra_power). This can also be used to reduce the size of the bitmap.

"To prevent a read-modify-write procedure, if a memory page is dirty,
optionally the device is permitted to set the entire byte, which encompasses the relevant bit, to 1."

This is optional and DMA is very likely to write a neighbor page, and the device transmit a whole byte anyway when a bit is dirty.

How about we use platform dirty page tracking facility then implement this in virtio, as Jason suggested?

Quoted 1 line
#3 lore raw

[virtio-comment] Re: [PATCH V2 1/6] virtio: introduce virtqueue state

In reply to Parav Pandit
Quoted 14 lines · Parav Pandit
Quoted 6 lines

From: Zhu Lingshan<[email protected]>
Sent: Friday, November 3, 2023 4:05 PM

This patch adds new virtqueue facility to save and restore virtqueue state. The virtqueue state is split into two parts:

Quoted 8 lines

- The available state: The state that is used for read the next available buffer.
- The used state: The state that is used for make buffer used.

This will simply the transport specific method implementation. E.g two le16 could be used instead of a single le32). For split virtqueue, we only need the available state since the used state is implemented in the virtqueue itself (the used index).

Quoted 5 lines

Sorry, this does not work.
Refer to my latest series at [2] that covers used ring elements too. Commit change log covered the reasoning.

[2]https://lists.oasis-open.org/archives/virtio-comment/202310/msg00472.html

this patch is to migrate device internal virtqueue state, not in-guest or in descriptor states, right?

Can you name any missing fields?

#5 lore raw

[virtio-comment] Re: [PATCH V2 1/6] virtio: introduce virtqueue state

In reply to Michael S. Tsirkin
Quoted 105 lines · Michael S. Tsirkin
Quoted 104 lines · Zhu Lingshan

This patch adds new virtqueue facility to save and restore virtqueue state. The virtqueue state is split into two parts:

- The available state: The state that is used for read the next available buffer.
- The used state: The state that is used for make buffer used.

This will simply the transport specific method implementation. E.g two le16 could be used instead of a single le32). For split virtqueue, we only need the available state since the used state is implemented in the virtqueue itself (the used index). For packed virtqueue, we need both the available state and the used state.

The typical use cases are live migration and debugging.

---
  content.tex     |  7 ++++--
  packed-ring.tex | 58 +++++++++++++++++++++++++++++++++++++++++++++++++
  split-ring.tex  | 39 +++++++++++++++++++++++++++++++++
  3 files changed, 102 insertions(+), 2 deletions(-)
content.tex +5 -2
index 0a62dce..76813b5 100644
@@ -99,10 +99,10 @@ \section{Feature Bits}\label{sec:Basic Facilities of a Virtio Device / Feature B
  \begin{description}
  \item[0 to 23, and 50 to 127] Feature bits for the specific device type
 
-\item[24 to 41] Feature bits reserved for extensions to the queue and
+\item[24 to 42] Feature bits reserved for extensions to the queue and
    feature negotiation mechanisms
 
-\item[42 to 49, and 128 and above] Feature bits reserved for future extensions.
+\item[43 to 49, and 128 and above] Feature bits reserved for future extensions.
  \end{description}
 
  \begin{note}
@@ -872,6 +872,9 @@ \chapter{Reserved Feature Bits}\label{sec:Reserved Feature Bits}
  	\ref{devicenormative:Basic Facilities of a Virtio Device / Feature Bits} for
  	handling features reserved for future use.
 
+  \item[VIRTIO_F_QUEUE_STATE(42)] This feature indicates that the device allows the driver
+  to access its internal virtqueue state.
+
  \end{description}
 
  \drivernormative{\section}{Reserved Feature Bits}{Reserved Feature Bits}
packed-ring.tex +45 -0
index 9eeb382..ad6aba0 100644
@@ -729,3 +729,61 @@ \subsection{Receiving Used Buffers From The Device}\label{sec:Basic Facilities o
          process_buffer(d);
  }
  \end{lstlisting}
+
+\subsection{Virtqueue State}\label{sec:Basic Facilities of a Virtio Device / Packed Virtqueues / Virtqueue State}
+
+When VIRTIO_F_QUEUE_STATE has been negotiated, the driver can set and
+get the device internal virtqueue state through the following
+fields. The implementation of the interfaces is transport specific.
+
+\subsubsection{\field{Available State} Field}
+
+The available state field is two bytes of virtqueue state that is used by
+the device to read the next available buffer. It is presented in the followwing format:
+
+\begin{lstlisting}
+le16 {
+  last_avail_idx : 15;
+  last_avail_wrap_counter : 1;
+};
+\end{lstlisting}
+
+The \field{last_avail_idx} field is the free-running location
+where the device read the next descriptor from the virtqueue descriptor ring.
+
+The \field{last_avail_wrap_counter} field is the last driver ring wrap
+counter that was observed by the device.
+
+See also \ref{sec:Packed Virtqueues / Driver and Device Ring Wrap Counters}.
+
+\subsubsection{\field{Used State} Field}
+
+The used state field is two bytes of virtqueue state that is used by
+the device when marking a buffer used. It is presented in the followwing format:
+
+\begin{lstlisting}
+le16 {
+  used_idx : 15;
+  used_wrap_counter : 1;
+};
+\end{lstlisting}
+
+The \field{used_idx} field is the free-running location where the device write the next
+used descriptor to the descriptor ring.
+
+The \field{used_wrap_counter} field is the wrap counter that is used
+by the device.
+
Quoted 8 lines

packed-ring.tex \subsection{Receiving Used Buffers From The Device}\label{sec:Basic Facilities o · line 781

Quoted 5 lines
packed-ring.tex +5 -0
+See also \ref{sec:Packed Virtqueues / Driver and Device Ring Wrap Counters}.
+
+\devicenormative{\subsubsection}{Virtqueue State}{Basic Facilities of a Virtio Device / Packed Virtqueues/ Virtqueue State}
+
+The device SHOULD only accept setting Virtqueue State of any packed virtqueues when DRIVER_OK is not set in \field{device status}, or SUSPEND is set in \field{device status}.

Except SUSPEND is undefined and is explained in patch 2 :( Please do not split patches like this, you are just splitting them at random boundaries.

will do.

Quoted 44 lines
Quoted 44 lines
packed-ring.tex +8 -0
+Otherwise the device MUST ignore any writes to Virtqueue State of any packed virtqueues.
+
+When SUSPEND is set, the device MUST record the Virtqueue State of every enabled packed virtqueue
+in \field{Available State} field and \field{Used State} field respectively,
+and correspondingly restore the Virtqueue State of every enabled packed virtqueue
+from \field{Available State} field and \field{Used State} field when DRIVER_OK is set.
+
+The device SHOULD reset \field{Available State} field and \field{Used State} field upon a device reset.
split-ring.tex +26 -0
index de94038..a78b44d 100644
@@ -734,3 +734,42 @@ \subsection{Receiving Used Buffers From The Device}\label{sec:Basic Facilities o
  }
  \end{lstlisting}
  \end{note}
+
+\subsection{Virtqueue State}\label{sec:Basic Facilities of a Virtio Device / Splited Virtqueues / Virtqueue State}
+
+When VIRTIO_F_QUEUE_STATE has been negotiated, the driver can set and
+get the device internal virtqueue state through the following
+fields. The implementation of the interfaces is transport specific.
+
+\subsubsection{\field{Available State} Field}
+
+The available state field is two bytes of virtqueue state that is used by
+the device to read the next available buffer. It is presented in the followwing format:
+
+\begin{lstlisting}
+le16 last_avail_idx;
+\end{lstlisting}
+
+The \field{last_avail_idx} field is the free-running available ring
+index where the device will read the next available head of a
+descriptor chain.
+
+See also \ref{sec:Basic Facilities of a Virtio Device / Virtqueues / The Virtqueue Available Ring}.
+
+\drivernormative{\subsubsection}{Virtqueue State}{Basic Facilities of a Virtio Device / Splited Virtqueues/ Virtqueue State}
+
+The driver SHOULD NOT access \field{Used State} of any splited virtqueues, it SHOULD use the
+used index in the used ring.
Quoted 8 lines

split-ring.tex \subsection{Receiving Used Buffers From The Device}\label{sec:Basic Facilities o · line 768

Quoted 6 lines
split-ring.tex +6 -0
+
+\devicenormative{\subsubsection}{Virtqueue State}{Basic Facilities of a Virtio Device / Splited Virtqueues/ Virtqueue State}
+
+The device SHOULD only accept setting Virtqueue State of any splited virtqueues
+when DRIVER_OK is not set in \field{device status} or SUSPEND is set in \field{device status}.
+Otherwise the device MUST ignore any writes to Virtqueue State of any splited virtqueues.

all these requests to ignore writes are to what end? just prohibit driver from doing this.

OK

Quoted 11 lines

split-ring.tex \subsection{Receiving Used Buffers From The Device}\label{sec:Basic Facilities o · line 775

Quoted 8 lines
split-ring.tex +7 -0
+
+When SUSPEND is set, the device MUST record the Available State of every enabled splited virtqueue
+in \field{Available State} field,
+and correspondingly restore the Available State of every enabled splited virtqueue
+from \field{Available State} field when DRIVER_OK is set.
+
+The device SHOULD reset \field{Available State} field upon a device reset.

At this point I have no idea
- how can a state of a virtqueue at a random time be represented by a 16 bit integer

not sure what is a random time, this is to request the device to reset
its avail state, for example, it is "le16 queue_avail_state" in virtio-pci common cfg. Resetting this so the device will not recover from a wrong value of the last run.

Quoted 2 lines

- if it's not at a random time then why do you even need an integer - synchronize queue to memory and then all state is in memory

Not sure what is a sync queue, but for example, "le16 queue_avail_state" for PCI transport exists in a cap.

Quoted 5 lines
Quoted 5 lines
Signature · 2 lines
-- 
2.35.3
#14 lore raw

[virtio-comment] Re: [PATCH V2 2/6] virtio: introduce SUSPEND bit in device status

In reply to Parav Pandit
Quoted 10 lines · Parav Pandit
Quoted 10 lines

From: Zhu Lingshan <[email protected]>
Sent: Friday, November 3, 2023 4:05 PM

This patch introduces a new status bit in the device status: SUSPEND.

This SUSPEND bit can be used by the driver to suspend a device, in order to stabilize the device states and virtqueue states.

Its main use case is live migration.

Quoted 7 lines
Quoted 2 lines

You constantly complained that whatever was proposed using admin commands method in [1] must work for passthrough and non-passthrough.

And halfway in the discussion you propose a method after learning all the limitations of in-band, you propose a solution only works for non-passthrough mode.

You asked someone to have comprehensive proposal and when it comes to you following it, you just don’t.

not sure what you are talking about.

Quoted 4 lines

And have most shallow commit message to not even mention it.

Please be consistent in design approach.
And if you don’t want to be, stop asking others.

this SUSPEND/RESUME doesn't change since the RFC series, how can it not be inconsistent???

Quoted 5 lines

This is not the way TC collaboration works.
I probably shouldn’t even expect this from you.

[1] https://lists.oasis-open.org/archives/virtio-comment/202310/msg00472.html

Please don't be so emotional and please be professional.

Why this solution can not work for pass-through? Do you know the device ownership will be transferred to the hypervisor when guest suspended in live migration?

Quoted 96 lines
Quoted 96 lines
---
  content.tex | 36 ++++++++++++++++++++++++++++++++++--
  1 file changed, 34 insertions(+), 2 deletions(-)
content.tex +0 -0
index 76813b5..bcc9d4b 100644
@@ -49,6 +49,10 @@ \section{\field{Device Status} Field}\label{sec:Basic

Facilities of a Virtio Dev

\item[DEVICE_NEEDS_RESET (64)] Indicates that the device has experienced
an error from which it can't recover.

content.tex +5 -0
+
+\item[SUSPEND (16)] When VIRTIO_F_SUSPEND is negotiated, indicates that
+the
+  device has been suspended by the driver.
+
  \end{description}
 
  The \field{device status} field starts out as 0, and is reinitialized to 0 by @@ -

73,6 +77,10 @@ \section{\field{Device Status} Field}\label{sec:Basic Facilities of a Virtio Dev recover by issuing a reset.
\end{note}

content.tex +3 -0
+The driver SHOULD NOT set SUSPEND if FEATURES_OK is not set.
+
+When setting SUSPEND, the driver MUST re-read \field{device status} to ensure

the SUSPEND bit is set.
+
\devicenormative{\subsection}{Device Status Field}{Basic Facilities of a Virtio
Device / Device Status Field}

The device MUST NOT consume buffers or send any used buffer @@ -82,6
+90,26 @@ \section{\field{Device Status} Field}\label{sec:Basic Facilities of a Virtio Dev that a reset is needed. If DRIVER_OK is set, after it sets DEVICE_NEEDS_RESET, the device MUST send a device configuration change notification to the driver.

content.tex +5 -0
+The device MUST ignore SUSPEND if FEATURES_OK is not set.
+
+The device MUST ignore SUSPEND if VIRTIO_F_SUSPEND is not negotiated.
+
+The device SHOULD allow settings to \field{device status} even when SUSPEND

is set.

content.tex +6 -0
+
+If VIRTIO_F_SUSPEND is negotiated and SUSPEND is set, the device SHOULD
+clear SUSPEND and resumes operation upon DRIVER_OK.
+
+If VIRTIO_F_SUSPEND is negotiated, when the driver sets SUSPEND, the
+device SHOULD perform the following actions before presenting SUSPEND bit

in the \field{device status}:
+
+\begin{itemize}
+\item Stop consuming buffers of any virtqueues and mark all finished descritors as used.
+\item Wait until all descriptors that being processed to finish and mark them as used.
+\item Flush all used buffer and send used buffer notifications to the driver. +\item Record Virtqueue State of each enabled virtqueue, see section +\ref{sec:Virtqueues / Virtqueue State} \item Pause its operation except +\field{device status} and preserve configurations in its Device

content.tex +4 -0
+Configuration Space, see \ref{sec:Basic Facilities of a Virtio Device /
+Device Configuration Space} \end{itemize}
+
  \section{Feature Bits}\label{sec:Basic Facilities of a Virtio Device / Feature Bits}
 
  Each virtio device offers all the features it understands.  During @@ -99,10
+127,10 @@ \section{Feature Bits}\label{sec:Basic Facilities of a Virtio Device /

Feature B \begin{description}
\item[0 to 23, and 50 to 127] Feature bits for the specific device type

-\item[24 to 42] Feature bits reserved for extensions to the queue and +\item[24 to 43] Feature bits reserved for extensions to the queue and
feature negotiation mechanisms

-\item[43 to 49, and 128 and above] Feature bits reserved for future extensions. +\item[44 to 49, and 128 and above] Feature bits reserved for future extensions.
\end{description}

\begin{note}

content.tex +0 -0
@@ -875,6 +903,10 @@ \chapter{Reserved Feature Bits}\label{sec:Reserved
 Feature Bits}
    \item[VIRTIO_F_QUEUE_STATE(42)] This feature indicates that the device

allows the driver
to access its internal virtqueue state.

content.tex +4 -0
+  \item[VIRTIO_F_SUSPEND(43)] This feature indicates that the driver can
+   SUSPEND the device.
+   See \ref{sec:Basic Facilities of a Virtio Device / Device Status Field}.
+
  \end{description}
Quoted 3 lines
Quoted 3 lines

\drivernormative{\section}{Reserved Feature Bits}{Reserved Feature Bits}
--
2.35.3

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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/

#81 lore raw

[virtio-comment] Re: [PATCH V2 4/6] virtio-pci: implement VIRTIO_F_QUEUE_STATE

In reply to Parav Pandit
Quoted 11 lines · Parav Pandit
Quoted 11 lines

From: Zhu Lingshan <[email protected]>
Sent: Friday, November 3, 2023 4:05 PM

This patch adds two new le16 fields to common configuration structure to support VIRTIO_F_QUEUE_STATE in PCI transport layer.

---
  transport-pci.tex | 18 ++++++++++++++++++
  1 file changed, 18 insertions(+)
Quoted 15 lines

transport-pci.tex \subsubsection{Common configuration structure layout}\label{sec:Virtio Transport · line 331

Quoted 12 lines
transport-pci.tex +0 -0
@@ -325,6 +325,10 @@ \subsubsection{Common configuration structure

layout}\label{sec:Virtio Transport
/* About the administration virtqueue. */
le16 admin_queue_index; /* read-only for driver */
le16 admin_queue_num; /* read-only for driver */

transport-pci.tex +4 -0
+
+	/* Virtqueue state */
+        le16 queue_avail_state;         /* read-write */
+        le16 queue_used_state;          /* read-write */

This tiny interface for 128 virtio net queues through register read writes, does not work effectively. There are inflight out of order descriptors for block also.
Hence toy registers like this do not work.

Do you know there is a queue_select? Why this does not work? Do you know how other queue related fields work? Like how to set a queue size and enable it?

Quoted 5 lines

Series [1] is comprehensive that covers it even if you consider non-passtrhough device migration model. Where you can suspend individual queues using new admin command and get them in the device context state.

[1] https://lists.oasis-open.org/archives/virtio-comment/202310/msg00472.html

I suggest you read QEMU migration code. If you don't want to, not my fault.

Quoted 28 lines
Quoted 28 lines
  };
  \end{lstlisting}
transport-pci.tex +0 -0
@@ -428,6 +432,17 @@ \subsubsection{Common configuration structure

layout}\label{sec:Virtio Transport
The value 0 indicates no supported administration virtqueues. This field is valid only if VIRTIO_F_ADMIN_VQ has been negotiated.

transport-pci.tex +11 -0
+
+\item[\field{queue_avail_state}]
+        This field is valid only if VIRTIO_F_QUEUE_STATE has been
+        negotiated. The driver sets and gets the available state of
+        the virtqueue here (see \ref{sec:Virtqueues / Virtqueue State}).
+
+\item[\field{queue_used_state}]
+        This field is valid only if VIRTIO_F_QUEUE_STATE has been
+        negotiated. The driver sets and gets the used state of the
+        virtqueue here (see \ref{sec:Virtqueues / Virtqueue State}).
+
  \end{description}
 
  \devicenormative{\paragraph}{Common configuration structure layout}{Virtio

Transport Options / Virtio Over PCI Bus / PCI Device Layout / Common configuration structure layout} @@ -488,6 +503,9 @@ \subsubsection{Common configuration structure layout}\label{sec:Virtio Transport present either a value of 0 or a power of 2 in \field{queue_size}.

Quoted 8 lines
Quoted 8 lines
transport-pci.tex +3 -0
+If VIRTIO_F_QUEUE_STATE has not been negotiated, the device MUST ignore
+any accesses to \field{queue_avail_state} and \field{queue_used_state}.
+
  If VIRTIO_F_ADMIN_VQ has been negotiated, the value

\field{admin_queue_index} MUST be equal to, or bigger than \field{num_queues}; also, \field{admin_queue_num} MUST be --
2.35.3

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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/

#135 lore raw

[virtio-comment] Re: [PATCH V2 6/6] virtio-pci: implement dirty page tracking

In reply to Parav Pandit
Quoted 24 lines · Parav Pandit
Quoted 24 lines

From: Michael S. Tsirkin <[email protected]>
Sent: Friday, November 3, 2023 4:20 PM

Review

Quoted 2 lines · Zhu Lingshan

+\item[\field{bitmap_addr}]

(quoted diff) +1 -0
+	The driver use this to set the address of the bitmap which records the

dirty pages

transport-pci.tex \subsubsection{Driver Handling Interrupts}\label{sec:Virtio Transport Options /

Quoted 3 lines
transport-pci.tex +3 -0
+	caused by the device.
+	Each bit in the bitmap represents one memory page, bit 0 in the bitmap
+	reprsents page 0 at address 0, bit 1 represents page 1, and so on in a

linear manner.

Review

Quoted 2 lines
(quoted diff) +2 -0
+	When \field{enable} is set to 1 and the device writes to a memory page,
+	the device MUST set the corresponding bit to 1 which indicating the

page is dirty.

transport-pci.tex \subsubsection{Driver Handling Interrupts}\label{sec:Virtio Transport Options /

Quoted 9 lines

+\item[\field{bitmap_length}]

transport-pci.tex +8 -0
+	The driver use this to set the length in bytes of the bitmap.
+\end{description}
+
+\devicenormative{\subsubsection}{Memory Dirty Pages Tracker
+Capability}{Virtio Transport Options / Virtio Over PCI Bus / Memory
+Dirty Pages Tracker Capability}
+
+The device MUST NOT set any bits beyond bitmap_length when reporting

dirty pages.

Quoted 3 lines
Quoted 2 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+
+To prevent a read-modify-write procedure, if a memory page is dirty,

It is not to prevent; it is just not possible to do racy RMW. 😊

if you understand what is a atomic routine, you will not call it racy.

Quoted 2 lines

Hence to work around you propose to mark all pages dirty. Too bad. This just does not work.

why? and this is optional.

Quoted 3 lines

Secondly the bitmap array is function is for full guest memory size, while there is lot of sparce region now and also in future. This is the second problem.

did you see gra_power and its comments?

Quoted 9 lines

This is exactly why I asked you to review the page write recording series of admin commands and comment. And you never commented with sheer ignorance.

So clearly the start stop method for specific range and without bandwidth explosion, admin commands of [1] stands better.

If you do [1] on the member device also using its AQ in future, it will work for non-passthrough case. If you build non-passthrough live migration using [1], also it will work.
So I don’t see any point of this series anymore.

As Jason pointed out, there are many problems in your proposal,
you should answer there. I don't need to repeat his words and duplicate the discussions.

Quoted 2 lines

[1] https://lists.oasis-open.org/archives/virtio-comment/202310/msg00475.html

you still need to explain why this does not work for pass-through. And I remember this is a point-less topic as MST ever wants to mute another "pass-through" thread.

Quoted 14 lines
Quoted 14 lines
Quoted 2 lines

+optionally the device is permitted to set the entire byte, which encompasses

the relevant bit, to 1.

transport-pci.tex \subsubsection{Driver Handling Interrupts}\label{sec:Virtio Transport Options /

Quoted 6 lines
transport-pci.tex +6 -0
+
+The device MAY increase \field{gra_power} to reduce \field{bitmap_length}.
+
+The device must ignore any writes to \field{pasid} if PASID Extended
+Capability is absent or the PASID functionality is disabled in PASID
+Extended Capability

I have to say this is going to work very badly when the number of dirty pages is
small: you will end up scanning and re-scanning all of bitmap.
And the resolution is apparently 8 pages? You have just multiplied the migration bandwidth by a factor of 8.

Quoted 2 lines

Yeah.
And device does not even know previously reported pages are read by driver or not. All guess work game for driver and device.

see my reply to him

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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/

#136 lore raw

[virtio-comment] RE: [PATCH V2 6/6] virtio-pci: implement dirty page tracking

Quoted 33 lines

From: Zhu, Lingshan <[email protected]>
Sent: Friday, November 3, 2023 8:33 PM

Quoted 28 lines · Parav Pandit
Quoted 28 lines

From: Michael S. Tsirkin <[email protected]>
Sent: Friday, November 3, 2023 4:20 PM

Review

Quoted 3 lines · Zhu Lingshan

+\item[\field{bitmap_addr}]

(quoted diff) +2 -0
+	The driver use this to set the address of the bitmap which records
+the

dirty pages

transport-pci.tex \subsubsection{Driver Handling Interrupts}\label{sec:Virtio Transport Options /

Quoted 4 lines
transport-pci.tex +4 -0
+	caused by the device.
+	Each bit in the bitmap represents one memory page, bit 0 in the bitmap
+	reprsents page 0 at address 0, bit 1 represents page 1, and so on
+in a

linear manner.

Review

Quoted 3 lines
(quoted diff) +3 -0
+	When \field{enable} is set to 1 and the device writes to a memory page,
+	the device MUST set the corresponding bit to 1 which indicating
+the

page is dirty.

Review

Quoted 10 lines

+\item[\field{bitmap_length}]

(quoted diff) +9 -0
+	The driver use this to set the length in bytes of the bitmap.
+\end{description}
+
+\devicenormative{\subsubsection}{Memory Dirty Pages Tracker
+Capability}{Virtio Transport Options / Virtio Over PCI Bus / Memory
+Dirty Pages Tracker Capability}
+
+The device MUST NOT set any bits beyond bitmap_length when
+reporting

dirty pages.

Quoted 8 lines
Quoted 4 lines
Quoted 3 lines

Review

Quoted 3 lines
(quoted diff) +3 -0
+
+To prevent a read-modify-write procedure, if a memory page is
+dirty,

It is not to prevent; it is just not possible to do racy RMW. 😊

if you understand what is a atomic routine, you will not call it racy.

Quoted 2 lines

Hence to work around you propose to mark all pages dirty. Too bad. This just does not work.

why? and this is optional.

Because device cannot set individual bits in atomic way for same byte read by the cpu.
1. device read the byte that had bit 0 and 4 set.
2. cpu atomically clear these bits.
3. device wrote bits 0, 4, and new bits 2 and 3.
4. cpu now transferred page 0 and 4 again.

Optional thing also needs to work. :)

Quoted 5 lines
Quoted 2 lines

Secondly the bitmap array is function is for full guest memory size, while

there is lot of sparce region now and also in future.

Quoted 1 line

This is the second problem.

did you see gra_power and its comments?

gra_power says the page size.
Not the sparce multiple ranges of the guest memory. Device endup tracking uninterested area as well.

Quoted 6 lines
Quoted 2 lines

This is exactly why I asked you to review the page write recording series of

admin commands and comment.

Quoted 3 lines

And you never commented with sheer ignorance.

So clearly the start stop method for specific range and without bandwidth

Quoted 8 lines

explosion, admin commands of [1] stands better.

Quoted 2 lines

If you do [1] on the member device also using its AQ in future, it will work for

non-passthrough case.

Quoted 2 lines

If you build non-passthrough live migration using [1], also it will work. So I don’t see any point of this series anymore.

As Jason pointed out, there are many problems in your proposal, you should answer there. I don't need to repeat his words and duplicate the discussions.

Many are already addressed in v3.

Quoted 5 lines
Quoted 4 lines

[1]
https://lists.oasis-open.org/archives/virtio-comment/202310/msg00475.h
tml

you still need to explain why this does not work for pass-through.

It does not work for following reasons.
1. Because all the fields that put on the member device are not in direct control of the hypervisor.
The device is directly controlled by the guest including the device status and when it resets the device all the things stored in the device are lost.

2. the PCI FLR is clearing all the registers you exposed here.

3. Endless expansion of config registers of dirty tracking is not scalable, as they are not init time registers not following the Appendix B guidelines.

4. bitmap based dirty tracking is not atomic between cpu and device. Hence, it is racy.

5. All the device context needed for passthrough based hypervisor for a device type specific is missing. All of those can be used for non-passthrough as well.
[1] https://lists.oasis-open.org/archives/virtio-comment/202311/msg00085.html

Quoted 3 lines

And I
remember this is a point-less topic as MST ever wants to mute another "pass- through" thread.

No. he did not say that.
He meant to not endlessly debate which one is better.
He clearly said, try to see if you can make multiple hypervisor model work. And your series shows a clear ignorance of his guidance.

Quoted 17 lines
Quoted 6 lines
Quoted 6 lines

Review

Quoted 3 lines
(quoted diff) +2 -0
+optionally the device is permitted to set the entire byte, which
+encompasses

the relevant bit, to 1.

Review

Quoted 2 lines
(quoted diff) +2 -0
+
+The device MAY increase \field{gra_power} to reduce

\field{bitmap_length}.

Quoted 10 lines
Quoted 10 lines

Review

Quoted 4 lines
(quoted diff) +4 -0
+
+The device must ignore any writes to \field{pasid} if PASID
+Extended Capability is absent or the PASID functionality is
+disabled in PASID Extended Capability

I have to say this is going to work very badly when the number of dirty pages is
small: you will end up scanning and re-scanning all of bitmap. And the resolution is apparently 8 pages? You have just multiplied the migration bandwidth by a factor of 8.

Quoted 4 lines
Quoted 2 lines

Yeah.
And device does not even know previously reported pages are read by driver

or not. All guess work game for driver and device. see my reply to him

Please see above reply.

#82 lore raw

RE: [virtio-comment] Re: [PATCH V2 4/6] virtio-pci: implement VIRTIO_F_QUEUE_STATE

In reply to Zhu, Lingshan
Quoted 31 lines

From: [email protected] <[email protected] open.org> On Behalf Of Zhu, Lingshan
Sent: Friday, November 3, 2023 8:27 PM

Quoted 11 lines · Parav Pandit
Quoted 11 lines

From: Zhu Lingshan <[email protected]>
Sent: Friday, November 3, 2023 4:05 PM

This patch adds two new le16 fields to common configuration structure to support VIRTIO_F_QUEUE_STATE in PCI transport layer.

---
  transport-pci.tex | 18 ++++++++++++++++++
  1 file changed, 18 insertions(+)
Quoted 14 lines

transport-pci.tex \subsubsection{Common configuration structure layout}\label{sec:Virtio Transport · line 331

Quoted 13 lines
transport-pci.tex index renamed from transport-pci.tex +0 -0

a5c6719..3161519 100644

transport-pci.tex +0 -0
@@ -325,6 +325,10 @@ \subsubsection{Common configuration structure

layout}\label{sec:Virtio Transport
/* About the administration virtqueue. */
le16 admin_queue_index; /* read-only for driver */
le16 admin_queue_num; /* read-only for driver */

transport-pci.tex +4 -0
+
+	/* Virtqueue state */
+        le16 queue_avail_state;         /* read-write */
+        le16 queue_used_state;          /* read-write */

This tiny interface for 128 virtio net queues through register read writes, does

Quoted 5 lines

not work effectively.

Quoted 2 lines

There are inflight out of order descriptors for block also. Hence toy registers like this do not work.

Do you know there is a queue_select? Why this does not work? Do you know how other queue related fields work?

:)
Yes. If you notice queue_reset related critical spec bug fix was done when it was introduced so that live migration can _actually_ work.

When queue_select is done for 128 queues serially, it take a lot of time to read those slow register interface for this + inflight descriptors + more.

Quoted 1 line

Like how to set a queue size and enable it?

Those are meant to be used before DRIVER_OK stage as they are init time registers. Not to keep abusing them..

Quoted 64 lines
Quoted 2 lines

Series [1] is comprehensive that covers it even if you consider non-

passtrhough device migration model.

Quoted 1 line

Where you can suspend individual queues using new admin command and get

them in the device context state.

Quoted 4 lines

[1]
https://lists.oasis-open.org/archives/virtio-comment/202310/msg00472.h
tml

I suggest you read QEMU migration code. If you don't want to, not my fault.

Quoted 22 lines
Quoted 22 lines
  };
  \end{lstlisting}
transport-pci.tex +0 -0
@@ -428,6 +432,17 @@ \subsubsection{Common configuration structure

layout}\label{sec:Virtio Transport
The value 0 indicates no supported administration virtqueues. This field is valid only if VIRTIO_F_ADMIN_VQ has been negotiated.

transport-pci.tex +11 -0
+
+\item[\field{queue_avail_state}]
+        This field is valid only if VIRTIO_F_QUEUE_STATE has been
+        negotiated. The driver sets and gets the available state of
+        the virtqueue here (see \ref{sec:Virtqueues / Virtqueue State}).
+
+\item[\field{queue_used_state}]
+        This field is valid only if VIRTIO_F_QUEUE_STATE has been
+        negotiated. The driver sets and gets the used state of the
+        virtqueue here (see \ref{sec:Virtqueues / Virtqueue State}).
+
  \end{description}
Quoted 5 lines
Quoted 5 lines

\devicenormative{\paragraph}{Common configuration structure
layout}{Virtio Transport Options / Virtio Over PCI Bus / PCI Device Layout / Common configuration structure layout} @@ -488,6 +503,9 @@ \subsubsection{Common configuration structure layout}\label{sec:Virtio Transport present either a value of 0 or a power of 2

in \field{queue_size}.

Quoted 3 lines

transport-pci.tex

Quoted 3 lines
transport-pci.tex +2 -0
+If VIRTIO_F_QUEUE_STATE has not been negotiated, the device MUST
+ignore any accesses to \field{queue_avail_state} and

\field{queue_used_state}.

Quoted 6 lines
Quoted 6 lines

+
If VIRTIO_F_ADMIN_VQ has been negotiated, the value
\field{admin_queue_index} MUST be equal to, or bigger than \field{num_queues}; also, \field{admin_queue_num} MUST be --
2.35.3

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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/

#15 lore raw

[virtio-comment] RE: [PATCH V2 2/6] virtio: introduce SUSPEND bit in device status

In reply to Zhu, Lingshan
Quoted 25 lines

From: Zhu, Lingshan <[email protected]>
Sent: Friday, November 3, 2023 8:25 PM

Quoted 5 lines · Parav Pandit
Quoted 5 lines

From: Zhu Lingshan <[email protected]>
Sent: Friday, November 3, 2023 4:05 PM

This patch introduces a new status bit in the device status: SUSPEND.

Quoted 8 lines
Quoted 7 lines

This SUSPEND bit can be used by the driver to suspend a device, in order to stabilize the device states and virtqueue states.

Its main use case is live migration.

You constantly complained that whatever was proposed using admin

commands method in [1] must work for passthrough and non-passthrough.

Quoted 2 lines

And halfway in the discussion you propose a method after learning all the

limitations of in-band, you propose a solution only works for non-passthrough mode.

Quoted 2 lines

You asked someone to have comprehensive proposal and when it comes to

Quoted 11 lines

you following it, you just don’t.
not sure what you are talking about.

Quoted 4 lines

And have most shallow commit message to not even mention it.

Please be consistent in design approach.
And if you don’t want to be, stop asking others.

this SUSPEND/RESUME doesn't change since the RFC series, how can it not be inconsistent???

Quoted 3 lines

This is not the way TC collaboration works.
I probably shouldn’t even expect this from you.

Your proposal does not cover both the use cases of passthrough and non-passthrough. Yet you kept demanding them for others.
This is just wrong.

I am aware that both models as technical pros and cons.

Quoted 9 lines
Quoted 4 lines

[1]
https://lists.oasis-open.org/archives/virtio-comment/202310/msg00472.h
tml

Please don't be so emotional and please be professional.

Why this solution can not work for pass-through? Do you know the device ownership will be transferred to the hypervisor when guest suspended in live migration?

I explained 5 reasons why it does not work in previous reply.

As the word indicates "live migration", the hypervisor needs to access the device when it is "live" (not just after). Hence, passthrough mode must be able to capture the state of the device and dirty pages database when its live. (and after the source is suspended).

Quoted 114 lines
Quoted 6 lines
Quoted 6 lines
---
  content.tex | 36 ++++++++++++++++++++++++++++++++++--
  1 file changed, 34 insertions(+), 2 deletions(-)
Quoted 7 lines
Quoted 7 lines
content.tex +0 -0
@@ -49,6 +49,10 @@ \section{\field{Device Status}

Field}\label{sec:Basic Facilities of a Virtio Dev

\item[DEVICE_NEEDS_RESET (64)] Indicates that the device has

experienced

Quoted 71 lines
Quoted 71 lines

an error from which it can't recover.

content.tex +5 -0
+
+\item[SUSPEND (16)] When VIRTIO_F_SUSPEND is negotiated, indicates
+that the
+  device has been suspended by the driver.
+
  \end{description}
 
  The \field{device status} field starts out as 0, and is

reinitialized to 0 by @@ -
73,6 +77,10 @@ \section{\field{Device Status} Field}\label{sec:Basic Facilities of a Virtio Dev recover by issuing a reset.
\end{note}

content.tex +4 -0
+The driver SHOULD NOT set SUSPEND if FEATURES_OK is not set.
+
+When setting SUSPEND, the driver MUST re-read \field{device status}
+to ensure

the SUSPEND bit is set.
+
\devicenormative{\subsection}{Device Status Field}{Basic Facilities
of a Virtio Device / Device Status Field}

The device MUST NOT consume buffers or send any used buffer @@
-82,6
+90,26 @@ \section{\field{Device Status} Field}\label{sec:Basic +Facilities of a
Virtio Dev that a reset is needed. If DRIVER_OK is set, after it sets DEVICE_NEEDS_RESET, the device MUST send a device configuration change notification to the driver.

content.tex +6 -0
+The device MUST ignore SUSPEND if FEATURES_OK is not set.
+
+The device MUST ignore SUSPEND if VIRTIO_F_SUSPEND is not negotiated.
+
+The device SHOULD allow settings to \field{device status} even when
+SUSPEND

is set.

content.tex +7 -0
+
+If VIRTIO_F_SUSPEND is negotiated and SUSPEND is set, the device
+SHOULD clear SUSPEND and resumes operation upon DRIVER_OK.
+
+If VIRTIO_F_SUSPEND is negotiated, when the driver sets SUSPEND, the
+device SHOULD perform the following actions before presenting
+SUSPEND bit

in the \field{device status}:
+
+\begin{itemize}
+\item Stop consuming buffers of any virtqueues and mark all finished descritors as used.
+\item Wait until all descriptors that being processed to finish and +mark them
as used.
+\item Flush all used buffer and send used buffer notifications to the driver. +\item Record Virtqueue State of each enabled virtqueue, see section +\ref{sec:Virtqueues / Virtqueue State} \item Pause its operation

content.tex +4 -0
+except \field{device status} and preserve configurations in its
+Device Configuration Space, see \ref{sec:Basic Facilities of a
+Virtio Device / Device Configuration Space} \end{itemize}
+
  \section{Feature Bits}\label{sec:Basic Facilities of a Virtio

Device / Feature Bits}

Each virtio device offers all the features it understands. During
@@ -99,10
+127,10 @@ \section{Feature Bits}\label{sec:Basic Facilities of a +Virtio Device /
Feature B \begin{description}
\item[0 to 23, and 50 to 127] Feature bits for the specific device
type

Quoted 7 lines
Quoted 7 lines

-\item[24 to 42] Feature bits reserved for extensions to the queue and
+\item[24 to 43] Feature bits reserved for extensions to the queue +and
feature negotiation mechanisms

-\item[43 to 49, and 128 and above] Feature bits reserved for future

extensions.

Quoted 21 lines
Quoted 21 lines

+\item[44 to 49, and 128 and above] Feature bits reserved for future extensions.
\end{description}

\begin{note}

content.tex +0 -0
@@ -875,6 +903,10 @@ \chapter{Reserved Feature
 Bits}\label{sec:Reserved Feature Bits}
    \item[VIRTIO_F_QUEUE_STATE(42)] This feature indicates that the

device allows the driver
to access its internal virtqueue state.

content.tex +4 -0
+  \item[VIRTIO_F_SUSPEND(43)] This feature indicates that the driver can
+   SUSPEND the device.
+   See \ref{sec:Basic Facilities of a Virtio Device / Device Status Field}.
+
  \end{description}
 
  \drivernormative{\section}{Reserved Feature Bits}{Reserved Feature

Bits}
--
2.35.3

#137 lore raw

[virtio-comment] Re: [PATCH V2 6/6] virtio-pci: implement dirty page tracking

In reply to Parav Pandit
Quoted 7 lines · Parav Pandit
Quoted 4 lines
Quoted 3 lines

[1]
https://lists.oasis-open.org/archives/virtio-comment/202310/msg00475.h
tml

you still need to explain why this does not work for pass-through.

It does not work for following reasons.
1. Because all the fields that put on the member device are not in direct control of the hypervisor.
The device is directly controlled by the guest including the device status and when it resets the device all the things stored in the device are lost.

I think the idea is that when this gateway is in the device then device reset has to trap. At a high level, ok. But then what? Is a full scan of all memory required until device reset is complete? Drivers currently tend to busy poll the reset register,
if this takes very long we might start seeing soft lockup messages. What is the idea then? Maybe for this we need a separate weaker reset that does not touch this capability?

Quoted 2 lines

2. the PCI FLR is clearing all the registers you exposed here.

Same problem, though FLR at least is expected to take a long time.

Quoted 4 lines

3. Endless expansion of config registers of dirty tracking is not scalable, as they are not init time registers not following the Appendix B guidelines.

4. bitmap based dirty tracking is not atomic between cpu and device. Hence, it is racy.

Well pcie atomics exist. Not sure whether it's reasonable to rely on them. Any data on who common implementations are?

Quoted 11 lines

5. All the device context needed for passthrough based hypervisor for a device type specific is missing. All of those can be used for non-passthrough as well.
[1] https://lists.oasis-open.org/archives/virtio-comment/202311/msg00085.html

Quoted 3 lines

And I
remember this is a point-less topic as MST ever wants to mute another "pass- through" thread.

No. he did not say that.
He meant to not endlessly debate which one is better.
He clearly said, try to see if you can make multiple hypervisor model work. And your series shows a clear ignorance of his guidance.

I think you mean "ignoring" :)

Quoted 18 lines
Quoted 18 lines
Quoted 7 lines
Quoted 7 lines

Review

Quoted 4 lines
(quoted diff) +2 -0
+optionally the device is permitted to set the entire byte, which
+encompasses

the relevant bit, to 1.

Review

Quoted 2 lines
(quoted diff) +2 -0
+
+The device MAY increase \field{gra_power} to reduce

\field{bitmap_length}.

Quoted 10 lines
Quoted 10 lines

Review

Quoted 4 lines
(quoted diff) +4 -0
+
+The device must ignore any writes to \field{pasid} if PASID
+Extended Capability is absent or the PASID functionality is
+disabled in PASID Extended Capability

I have to say this is going to work very badly when the number of dirty pages is
small: you will end up scanning and re-scanning all of bitmap. And the resolution is apparently 8 pages? You have just multiplied the migration bandwidth by a factor of 8.

Quoted 5 lines
Quoted 4 lines
Quoted 2 lines

Yeah.
And device does not even know previously reported pages are read by driver

or not. All guess work game for driver and device. see my reply to him

Please see above reply.

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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/

#179 lore raw

[virtio-comment] Re: [PATCH V2 6/6] virtio-pci: implement dirty page tracking

In reply to Zhu, Lingshan
Quoted 30 lines · Lingshan

On 11/3/2023 6:50 PM, Michael S. Tsirkin wrote:

On Fri, Nov 03, 2023 at 06:34:37PM +0800, Zhu Lingshan wrote:

+\item[\field{bitmap_addr}]
+ The driver use this to set the address of the bitmap which records the dirty pages
+ caused by the device.
+ Each bit in the bitmap represents one memory page, bit 0 in the bitmap
+ reprsents page 0 at address 0, bit 1 represents page 1, and so on in a linear manner.
+ When \field{enable} is set to 1 and the device writes to a memory page,
+ the device MUST set the corresponding bit to 1 which indicating the page is dirty.
+\item[\field{bitmap_length}]
+ The driver use this to set the length in bytes of the bitmap.
+\end{description}
+
+\devicenormative{\subsubsection}{Memory Dirty Pages Tracker Capability}{Virtio Transport Options / Virtio Over PCI Bus / Memory Dirty Pages Tracker Capability} +
+The device MUST NOT set any bits beyond bitmap_length when reporting dirty pages.
+
+To prevent a read-modify-write procedure, if a memory page is dirty,
+optionally the device is permitted to set the entire byte, which encompasses the relevant bit, to 1.
+
+The device MAY increase \field{gra_power} to reduce \field{bitmap_length}.
+
+The device must ignore any writes to \field{pasid} if PASID Extended Capability is absent or
+the PASID functionality is disabled in PASID Extended Capability

Quoted 4 lines

I have to say this is going to work very badly when the number of dirty pages is small: you will end up scanning and re-scanning all of bitmap.

The driver needs to scan anyway,

Not with e.g. Parav's proposal - device reports individual pages changed. This is analogous to PML.

Quoted 2 lines

Intel production work with similar bitmap
based dirty page tracking solution for years.

and then VMs became bigger and PML was introduced.

Quoted 1 line

Otherwise the device should report PFN which is not very practical.

Why not?

Quoted 6 lines

And the resolution is apparently 8 pages? You have just multiplied the migration bandwidth by a factor of 8.

No, as described in the comments, the tacking granularity is controlled by \
field{gra_power}, one bit represents a page with page_size = 2^(12 + gra_power). This can also be used to reduce the size of the bitmap.

.. at the cost of increasing migration bandwidth.

Quoted 8 lines

"To prevent a read-modify-write procedure, if a memory page is dirty,
optionally the device is permitted to set the entire byte, which encompasses the relevant bit, to 1."

This is optional and DMA is very likely to write a neighbor page, and the device transmit a whole byte anyway when a bit is dirty.

How about we use platform dirty page tracking facility then implement this in virtio, as Jason suggested?

Without something like PML it likely won't scale either.

Signature · 18 lines
MST


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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/
#176 lore raw

[virtio-comment] Re: [PATCH V2 6/6] virtio-pci: implement dirty page tracking

In reply to Parav Pandit
Quoted 1 line · Parav Pandit

And you never commented with sheer ignorance.

I think you mean ignoring here. ignorance is something else entirely.

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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/

#16 lore raw

[virtio-comment] Re: [PATCH V2 2/6] virtio: introduce SUSPEND bit in device status

In reply to Parav Pandit
Quoted 30 lines · Parav Pandit
Quoted 30 lines

From: Zhu, Lingshan <[email protected]>
Sent: Friday, November 3, 2023 8:25 PM

Quoted 5 lines · Parav Pandit
Quoted 5 lines

From: Zhu Lingshan <[email protected]>
Sent: Friday, November 3, 2023 4:05 PM

This patch introduces a new status bit in the device status: SUSPEND.

Quoted 8 lines
Quoted 7 lines

This SUSPEND bit can be used by the driver to suspend a device, in order to stabilize the device states and virtqueue states.

Its main use case is live migration.

You constantly complained that whatever was proposed using admin

commands method in [1] must work for passthrough and non-passthrough.

Quoted 1 line

And halfway in the discussion you propose a method after learning all the

limitations of in-band, you propose a solution only works for non-passthrough mode.

Quoted 1 line

You asked someone to have comprehensive proposal and when it comes to

you following it, you just don’t.
not sure what you are talking about.

Quoted 4 lines

And have most shallow commit message to not even mention it.

Please be consistent in design approach.
And if you don’t want to be, stop asking others.

this SUSPEND/RESUME doesn't change since the RFC series, how can it not be inconsistent???

Quoted 7 lines
Quoted 2 lines
Quoted 2 lines

This is not the way TC collaboration works.
I probably shouldn’t even expect this from you.

Your proposal does not cover both the use cases of passthrough and non-passthrough. Yet you kept demanding them for others.
This is just wrong.

I am aware that both models as technical pros and cons.

Why this doesn't work? the device status byte has been working for many years, and do you know when guest freeze, the hypervisor owns the device????

Quoted 6 lines
Quoted 6 lines
Quoted 4 lines

[1]
https://lists.oasis-open.org/archives/virtio-comment/202310/msg00472.h
tml

Please don't be so emotional and please be professional.

Quoted 8 lines
Quoted 3 lines

Why this solution can not work for pass-through? Do you know the device ownership will be transferred to the hypervisor when guest suspended in live migration?

I explained 5 reasons why it does not work in previous reply.

As the word indicates "live migration", the hypervisor needs to access the device when it is "live" (not just after). Hence, passthrough mode must be able to capture the state of the device and dirty pages database when its live. (and after the source is suspended).

No, the hypervisor should only collect dirty pages when the device alive. As you can see, the dirty page tracking facility has a PASID for isolation. But still, the question is, we should better use platform dirty page tracking

Then suspend the device after guest freeze, to stabilize the device status, then read the status.

How can you say this does not work???

Quoted 110 lines
Quoted 110 lines
Quoted 6 lines
Quoted 6 lines
---
   content.tex | 36 ++++++++++++++++++++++++++++++++++--
   1 file changed, 34 insertions(+), 2 deletions(-)
Quoted 7 lines
Quoted 7 lines
content.tex +0 -0
@@ -49,6 +49,10 @@ \section{\field{Device Status}

Field}\label{sec:Basic Facilities of a Virtio Dev

\item[DEVICE_NEEDS_RESET (64)] Indicates that the device has

experienced

Quoted 71 lines
Quoted 71 lines

an error from which it can't recover.

content.tex +5 -0
+
+\item[SUSPEND (16)] When VIRTIO_F_SUSPEND is negotiated, indicates
+that the
+  device has been suspended by the driver.
+
   \end{description}
 
   The \field{device status} field starts out as 0, and is

reinitialized to 0 by @@ -
73,6 +77,10 @@ \section{\field{Device Status} Field}\label{sec:Basic Facilities of a Virtio Dev recover by issuing a reset.
\end{note}

content.tex +4 -0
+The driver SHOULD NOT set SUSPEND if FEATURES_OK is not set.
+
+When setting SUSPEND, the driver MUST re-read \field{device status}
+to ensure

the SUSPEND bit is set.
+
\devicenormative{\subsection}{Device Status Field}{Basic Facilities
of a Virtio Device / Device Status Field}

The device MUST NOT consume buffers or send any used buffer @@
-82,6
+90,26 @@ \section{\field{Device Status} Field}\label{sec:Basic +Facilities of a
Virtio Dev that a reset is needed. If DRIVER_OK is set, after it sets DEVICE_NEEDS_RESET, the device MUST send a device configuration change notification to the driver.

content.tex +6 -0
+The device MUST ignore SUSPEND if FEATURES_OK is not set.
+
+The device MUST ignore SUSPEND if VIRTIO_F_SUSPEND is not negotiated.
+
+The device SHOULD allow settings to \field{device status} even when
+SUSPEND

is set.

content.tex +7 -0
+
+If VIRTIO_F_SUSPEND is negotiated and SUSPEND is set, the device
+SHOULD clear SUSPEND and resumes operation upon DRIVER_OK.
+
+If VIRTIO_F_SUSPEND is negotiated, when the driver sets SUSPEND, the
+device SHOULD perform the following actions before presenting
+SUSPEND bit

in the \field{device status}:
+
+\begin{itemize}
+\item Stop consuming buffers of any virtqueues and mark all finished descritors as used.
+\item Wait until all descriptors that being processed to finish and +mark them
as used.
+\item Flush all used buffer and send used buffer notifications to the driver. +\item Record Virtqueue State of each enabled virtqueue, see section +\ref{sec:Virtqueues / Virtqueue State} \item Pause its operation

content.tex +4 -0
+except \field{device status} and preserve configurations in its
+Device Configuration Space, see \ref{sec:Basic Facilities of a
+Virtio Device / Device Configuration Space} \end{itemize}
+
   \section{Feature Bits}\label{sec:Basic Facilities of a Virtio

Device / Feature Bits}

Each virtio device offers all the features it understands. During
@@ -99,10
+127,10 @@ \section{Feature Bits}\label{sec:Basic Facilities of a +Virtio Device /
Feature B \begin{description}
\item[0 to 23, and 50 to 127] Feature bits for the specific device
type

Quoted 7 lines
Quoted 7 lines

-\item[24 to 42] Feature bits reserved for extensions to the queue and
+\item[24 to 43] Feature bits reserved for extensions to the queue +and
feature negotiation mechanisms

-\item[43 to 49, and 128 and above] Feature bits reserved for future

extensions.

Quoted 17 lines
Quoted 17 lines

+\item[44 to 49, and 128 and above] Feature bits reserved for future extensions.
\end{description}

   \begin{note}
content.tex +0 -0
@@ -875,6 +903,10 @@ \chapter{Reserved Feature
 Bits}\label{sec:Reserved Feature Bits}
     \item[VIRTIO_F_QUEUE_STATE(42)] This feature indicates that the

device allows the driver
to access its internal virtqueue state.

content.tex +4 -0
+  \item[VIRTIO_F_SUSPEND(43)] This feature indicates that the driver can
+   SUSPEND the device.
+   See \ref{sec:Basic Facilities of a Virtio Device / Device Status Field}.
+
   \end{description}
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

\drivernormative{\section}{Reserved Feature Bits}{Reserved Feature
Bits}
--
2.35.3

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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/

#83 lore raw

Re: [virtio-comment] Re: [PATCH V2 4/6] virtio-pci: implement VIRTIO_F_QUEUE_STATE

In reply to Parav Pandit
Quoted 31 lines · Parav Pandit
Quoted 31 lines

From: [email protected] <[email protected] open.org> On Behalf Of Zhu, Lingshan
Sent: Friday, November 3, 2023 8:27 PM

Quoted 11 lines · Parav Pandit
Quoted 11 lines

From: Zhu Lingshan <[email protected]>
Sent: Friday, November 3, 2023 4:05 PM

This patch adds two new le16 fields to common configuration structure to support VIRTIO_F_QUEUE_STATE in PCI transport layer.

---
   transport-pci.tex | 18 ++++++++++++++++++
   1 file changed, 18 insertions(+)
Quoted 14 lines

transport-pci.tex \subsubsection{Common configuration structure layout}\label{sec:Virtio Transport · line 331

Quoted 13 lines
transport-pci.tex index renamed from transport-pci.tex +0 -0

a5c6719..3161519 100644

transport-pci.tex +0 -0
@@ -325,6 +325,10 @@ \subsubsection{Common configuration structure

layout}\label{sec:Virtio Transport
/* About the administration virtqueue. */
le16 admin_queue_index; /* read-only for driver */
le16 admin_queue_num; /* read-only for driver */

transport-pci.tex +4 -0
+
+	/* Virtqueue state */
+        le16 queue_avail_state;         /* read-write */
+        le16 queue_used_state;          /* read-write */

This tiny interface for 128 virtio net queues through register read writes, does

not work effectively.

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

There are inflight out of order descriptors for block also. Hence toy registers like this do not work.

Do you know there is a queue_select? Why this does not work? Do you know how other queue related fields work?

:)
Yes. If you notice queue_reset related critical spec bug fix was done when it was introduced so that live migration can _actually_ work.

When queue_select is done for 128 queues serially, it take a lot of time to read those slow register interface for this + inflight descriptors + more.

interesting, virtio work in this pattern for many years, right?

Quoted 4 lines
Quoted 2 lines

Like how to set a queue size and enable it?

Those are meant to be used before DRIVER_OK stage as they are init time registers. Not to keep abusing them..

don't you need to set queue_size at the destination side?

Quoted 52 lines
Quoted 52 lines
Quoted 2 lines

Series [1] is comprehensive that covers it even if you consider non-

passtrhough device migration model.

Quoted 1 line

Where you can suspend individual queues using new admin command and get

them in the device context state.

Quoted 3 lines

[1]
https://lists.oasis-open.org/archives/virtio-comment/202310/msg00472.h
tml

I suggest you read QEMU migration code. If you don't want to, not my fault.

Quoted 21 lines
Quoted 21 lines
   };
   \end{lstlisting}
transport-pci.tex +0 -0
@@ -428,6 +432,17 @@ \subsubsection{Common configuration structure

layout}\label{sec:Virtio Transport
The value 0 indicates no supported administration virtqueues. This field is valid only if VIRTIO_F_ADMIN_VQ has been negotiated.

transport-pci.tex +11 -0
+
+\item[\field{queue_avail_state}]
+        This field is valid only if VIRTIO_F_QUEUE_STATE has been
+        negotiated. The driver sets and gets the available state of
+        the virtqueue here (see \ref{sec:Virtqueues / Virtqueue State}).
+
+\item[\field{queue_used_state}]
+        This field is valid only if VIRTIO_F_QUEUE_STATE has been
+        negotiated. The driver sets and gets the used state of the
+        virtqueue here (see \ref{sec:Virtqueues / Virtqueue State}).
+
   \end{description}
Quoted 5 lines
Quoted 5 lines

\devicenormative{\paragraph}{Common configuration structure
layout}{Virtio Transport Options / Virtio Over PCI Bus / PCI Device Layout / Common configuration structure layout} @@ -488,6 +503,9 @@ \subsubsection{Common configuration structure layout}\label{sec:Virtio Transport present either a value of 0 or a power of 2

in \field{queue_size}.

Quoted 2 lines

transport-pci.tex

Quoted 2 lines
transport-pci.tex +2 -0
+If VIRTIO_F_QUEUE_STATE has not been negotiated, the device MUST
+ignore any accesses to \field{queue_avail_state} and

\field{queue_used_state}.

Quoted 6 lines
Quoted 6 lines

+
If VIRTIO_F_ADMIN_VQ has been negotiated, the value
\field{admin_queue_index} MUST be equal to, or bigger than \field{num_queues}; also, \field{admin_queue_num} MUST be --
2.35.3

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.

Quoted 8 lines
Quoted 8 lines

Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/

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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/

#177 lore raw

[virtio-comment] RE: [PATCH V2 6/6] virtio-pci: implement dirty page tracking

In reply to Michael S. Tsirkin
Quoted 9 lines

From: Michael S. Tsirkin <[email protected]>
Sent: Sunday, November 5, 2023 9:50 PM

Quoted 1 line · Parav Pandit

And you never commented with sheer ignorance.

I think you mean ignoring here. ignorance is something else entirely.

I am sorry. You are right. I meant ignoring.

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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/

#148 lore raw

[virtio-comment] Re: [PATCH V2 6/6] virtio-pci: implement dirty page tracking

In reply to Parav Pandit
Quoted 39 lines · Parav Pandit
Quoted 39 lines

From: Zhu, Lingshan <[email protected]>
Sent: Friday, November 3, 2023 8:33 PM

Quoted 28 lines · Parav Pandit
Quoted 28 lines

From: Michael S. Tsirkin <[email protected]>
Sent: Friday, November 3, 2023 4:20 PM

Review

Quoted 3 lines · Zhu Lingshan

+\item[\field{bitmap_addr}]

(quoted diff) +2 -0
+	The driver use this to set the address of the bitmap which records
+the

dirty pages

transport-pci.tex \subsubsection{Driver Handling Interrupts}\label{sec:Virtio Transport Options /

Quoted 4 lines
transport-pci.tex +4 -0
+	caused by the device.
+	Each bit in the bitmap represents one memory page, bit 0 in the bitmap
+	reprsents page 0 at address 0, bit 1 represents page 1, and so on
+in a

linear manner.

Review

Quoted 3 lines
(quoted diff) +3 -0
+	When \field{enable} is set to 1 and the device writes to a memory page,
+	the device MUST set the corresponding bit to 1 which indicating
+the

page is dirty.

Review

Quoted 10 lines

+\item[\field{bitmap_length}]

(quoted diff) +9 -0
+	The driver use this to set the length in bytes of the bitmap.
+\end{description}
+
+\devicenormative{\subsubsection}{Memory Dirty Pages Tracker
+Capability}{Virtio Transport Options / Virtio Over PCI Bus / Memory
+Dirty Pages Tracker Capability}
+
+The device MUST NOT set any bits beyond bitmap_length when
+reporting

dirty pages.

Quoted 4 lines
Quoted 3 lines

Review

Quoted 3 lines
(quoted diff) +3 -0
+
+To prevent a read-modify-write procedure, if a memory page is
+dirty,

It is not to prevent; it is just not possible to do racy RMW. 😊

if you understand what is a atomic routine, you will not call it racy.

Quoted 2 lines

Hence to work around you propose to mark all pages dirty. Too bad. This just does not work.

Quoted 8 lines
Quoted 1 line

why? and this is optional.

Because device cannot set individual bits in atomic way for same byte read by the cpu.
1. device read the byte that had bit 0 and 4 set.
2. cpu atomically clear these bits.
3. device wrote bits 0, 4, and new bits 2 and 3.
4. cpu now transferred page 0 and 4 again.

Optional thing also needs to work. :)

Do you know both CPU and device actually don't read bit, they read bytes???? Do you know RC connected to memory controller????
Do you know there are locked transaction and atomic operations in PCI???
Do you know there are atomic read/write/clear even read and clear and so on in CPU ISA????

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Secondly the bitmap array is function is for full guest memory size, while

there is lot of sparce region now and also in future.

Quoted 1 line

This is the second problem.

did you see gra_power and its comments?

gra_power says the page size.
Not the sparce multiple ranges of the guest memory. Device endup tracking uninterested area as well.

increase gra_power can reduce bitmap size, right?
Totally up to the hypervisor, right?

Quoted 6 lines
Quoted 6 lines
Quoted 2 lines

This is exactly why I asked you to review the page write recording series of

admin commands and comment.

Quoted 3 lines

And you never commented with sheer ignorance.

So clearly the start stop method for specific range and without bandwidth

Quoted 8 lines
Quoted 7 lines

explosion, admin commands of [1] stands better.

Quoted 1 line

If you do [1] on the member device also using its AQ in future, it will work for

non-passthrough case.

Quoted 2 lines

If you build non-passthrough live migration using [1], also it will work. So I don’t see any point of this series anymore.

As Jason pointed out, there are many problems in your proposal, you should answer there. I don't need to repeat his words and duplicate the discussions.

Many are already addressed in v3.

interesting, does your V3 support nested?

Quoted 8 lines
Quoted 5 lines
Quoted 4 lines

[1]
https://lists.oasis-open.org/archives/virtio-comment/202310/msg00475.h
tml

you still need to explain why this does not work for pass-through.

It does not work for following reasons.
1. Because all the fields that put on the member device are not in direct control of the hypervisor.
The device is directly controlled by the guest including the device status and when it resets the device all the things stored in the device are lost.

have you seen PASID? and if the device reset, it has to forget everything as expected, right?

Quoted 2 lines

2. the PCI FLR is clearing all the registers you exposed here.

see above

Quoted 2 lines

3. Endless expansion of config registers of dirty tracking is not scalable, as they are not init time registers not following the Appendix B guidelines.

endless expansion?? It is a complete set of dirty page tracking, right???? have you see this cap only controls? The device DMA writes the bitmap, not by registers.

Again, if you want to fix Appendix B, OK.

Quoted 3 lines

4. bitmap based dirty tracking is not atomic between cpu and device. Hence, it is racy.

see above, the first reply.

Quoted 4 lines

5. All the device context needed for passthrough based hypervisor for a device type specific is missing. All of those can be used for non-passthrough as well.
[1] https://lists.oasis-open.org/archives/virtio-comment/202311/msg00085.html

If you want to discuss this again, I don't want to wast time but only asking you whether you want to define virtio-fs device context

Quoted 8 lines
Quoted 4 lines

And I
remember this is a point-less topic as MST ever wants to mute another "pass- through" thread.

No. he did not say that.
He meant to not endlessly debate which one is better.
He clearly said, try to see if you can make multiple hypervisor model work. And your series shows a clear ignorance of his guidance.

Let me quote MST's reply here:
"I feel this discussion will keep meandering because the terminology is vague. There's no single thing that is called "passthrough" - vendors just build what is expedient with current hardware and software. Nvidia has a bunch of people working on vfio so they call that passthrough, Red Hat has people working on VDPA and they call that passthrough, etc.

Before I mute this discussion for good, does anyone here have any feeling progress is made? What kind of progress? "

So please don't discuss on pass-through anymore.
It seems only you need to develop the knowledge

Quoted 17 lines
Quoted 17 lines
Quoted 7 lines
Quoted 7 lines

Review

Quoted 4 lines
(quoted diff) +2 -0
+optionally the device is permitted to set the entire byte, which
+encompasses

the relevant bit, to 1.

Review

Quoted 2 lines
(quoted diff) +2 -0
+
+The device MAY increase \field{gra_power} to reduce

\field{bitmap_length}.

Quoted 9 lines
Quoted 9 lines

Review

Quoted 4 lines
(quoted diff) +4 -0
+
+The device must ignore any writes to \field{pasid} if PASID
+Extended Capability is absent or the PASID functionality is
+disabled in PASID Extended Capability

I have to say this is going to work very badly when the number of dirty pages is
small: you will end up scanning and re-scanning all of bitmap. And the resolution is apparently 8 pages? You have just multiplied the migration bandwidth by a factor of 8.

Quoted 5 lines
Quoted 4 lines
Quoted 2 lines

Yeah.
And device does not even know previously reported pages are read by driver

or not. All guess work game for driver and device. see my reply to him

Please see above reply.

see above

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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/

#138 lore raw

[virtio-comment] Re: [PATCH V2 6/6] virtio-pci: implement dirty page tracking

In reply to Michael S. Tsirkin
Quoted 10 lines · Michael S. Tsirkin
Quoted 7 lines · Parav Pandit
Quoted 4 lines
Quoted 3 lines

[1]
https://lists.oasis-open.org/archives/virtio-comment/202310/msg00475.h
tml

you still need to explain why this does not work for pass-through.

It does not work for following reasons.
1. Because all the fields that put on the member device are not in direct control of the hypervisor.
The device is directly controlled by the guest including the device status and when it resets the device all the things stored in the device are lost.

I think the idea is that when this gateway is in the device then device reset has to trap. At a high level, ok. But then what?

No, when device reset, the device is expected to forget everything and re-intialize.

Quoted 1 line

Is a full scan of all memory required until device reset is complete?

Who scan the memory? The device tracks its own dirty pages.

Quoted 4 lines

Drivers currently tend to busy poll the reset register, if this takes very long we might start seeing soft lockup messages. What is the idea then? Maybe for this we need a separate weaker reset that does not touch this capability?

When reset, how can we expect the LM progress continue running.

For example, when the device DMA writes something, then reset before sending an interrupt, the DMA-ed pages should be lost as expected, right?

Quoted 3 lines
Quoted 2 lines

2. the PCI FLR is clearing all the registers you exposed here.

Same problem, though FLR at least is expected to take a long time.

If FLR, then whole device reset, and this is PCI, not virtio. As Jason pointed out, do you want to audit every PCI functionality?

Quoted 12 lines
Quoted 5 lines

3. Endless expansion of config registers of dirty tracking is not scalable, as they are not init time registers not following the Appendix B guidelines.
4. bitmap based dirty tracking is not atomic between cpu and device.
Hence, it is racy.

Well pcie atomics exist. Not sure whether it's reasonable to rely on them. Any data on who common implementations are?

Quoted 4 lines

5. All the device context needed for passthrough based hypervisor for a device type specific is missing. All of those can be used for non-passthrough as well.
[1] https://lists.oasis-open.org/archives/virtio-comment/202311/msg00085.html

Quoted 30 lines
Quoted 7 lines
Quoted 3 lines

And I
remember this is a point-less topic as MST ever wants to mute another "pass- through" thread.

No. he did not say that.
He meant to not endlessly debate which one is better.
He clearly said, try to see if you can make multiple hypervisor model work. And your series shows a clear ignorance of his guidance.

I think you mean "ignoring" :)

Quoted 20 lines
Quoted 15 lines
Quoted 5 lines
Quoted 5 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+optionally the device is permitted to set the entire byte, which
+encompasses

the relevant bit, to 1.

Review

Quoted 2 lines
(quoted diff) +2 -0
+
+The device MAY increase \field{gra_power} to reduce

\field{bitmap_length}.

Quoted 9 lines
Quoted 9 lines

Review

Quoted 4 lines
(quoted diff) +4 -0
+
+The device must ignore any writes to \field{pasid} if PASID
+Extended Capability is absent or the PASID functionality is
+disabled in PASID Extended Capability

I have to say this is going to work very badly when the number of dirty pages is
small: you will end up scanning and re-scanning all of bitmap. And the resolution is apparently 8 pages? You have just multiplied the migration bandwidth by a factor of 8.

Quoted 4 lines
Quoted 2 lines

Yeah.
And device does not even know previously reported pages are read by driver

or not. All guess work game for driver and device. see my reply to him

Please see above reply.

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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/

#141 lore raw

[virtio-comment] RE: [PATCH V2 6/6] virtio-pci: implement dirty page tracking

In reply to Michael S. Tsirkin
Quoted 15 lines

From: Michael S. Tsirkin <[email protected]>
Sent: Sunday, November 5, 2023 9:42 PM

Quoted 7 lines · Parav Pandit
Quoted 5 lines
Quoted 4 lines

[1]
https://lists.oasis-open.org/archives/virtio-comment/202310/msg004
75.h
tml

you still need to explain why this does not work for pass-through.

It does not work for following reasons.
1. Because all the fields that put on the member device are not in direct

control of the hypervisor.

Quoted 1 line

The device is directly controlled by the guest including the device status and

Quoted 9 lines

when it resets the device all the things stored in the device are lost.

I think the idea is that when this gateway is in the device then device reset has to trap. At a high level, ok. But then what?
Is a full scan of all memory required until device reset is complete? Drivers currently tend to busy poll the reset register, if this takes very long we might start seeing soft lockup messages. What is the idea then? Maybe for this we need a separate weaker reset that does not touch this capability?

You meant the gateway is not in the device, right?

I likely didn't understand. I don't see a relation to timing.

When the device reset is not trapped by the hypervisor, most things does not work, it requires trapping other things to like cvq, device registers and more. It may be fine for those use case, but it does not fullfill the requirement of passthrough mode of hw.

Quoted 6 lines
Quoted 2 lines

2. the PCI FLR is clearing all the registers you exposed here.

Same problem, though FLR at least is expected to take a long time.

Quoted 9 lines
Quoted 1 line

3. Endless expansion of config registers of dirty tracking is not scalable, as they

are not init time registers not following the Appendix B guidelines.

Quoted 2 lines

4. bitmap based dirty tracking is not atomic between cpu and device. Hence, it is racy.

Well pcie atomics exist. Not sure whether it's reasonable to rely on them. Any data on who common implementations are?

Pci atomics are (a) fetch add, (b) swap, (c) CAS.
Not atomic_OR().

Quoted 10 lines
Quoted 1 line

5. All the device context needed for passthrough based hypervisor for a

device type specific is missing.

Quoted 8 lines

All of those can be used for non-passthrough as well.
[1]
https://lists.oasis-open.org/archives/virtio-comment/202311/msg00085.h
tml

Quoted 3 lines

And I
remember this is a point-less topic as MST ever wants to mute another "pass- through" thread.

Quoted 7 lines
Quoted 4 lines

No. he did not say that.
He meant to not endlessly debate which one is better.
He clearly said, try to see if you can make multiple hypervisor model work. And your series shows a clear ignorance of his guidance.

I think you mean "ignoring" :)

I am sorry, yes, I meant ignoring.

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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/

#180 lore raw

Re: [virtio-comment] Re: [PATCH V2 6/6] virtio-pci: implement dirty page tracking

In reply to Michael S. Tsirkin
Quoted 30 lines · Michael S. Tsirkin
Quoted 29 lines · Lingshan

On 11/3/2023 6:50 PM, Michael S. Tsirkin wrote:

On Fri, Nov 03, 2023 at 06:34:37PM +0800, Zhu Lingshan wrote:

+\item[\field{bitmap_addr}]
+ The driver use this to set the address of the bitmap which records the dirty pages
+ caused by the device.
+ Each bit in the bitmap represents one memory page, bit 0 in the bitmap
+ reprsents page 0 at address 0, bit 1 represents page 1, and so on in a linear manner.
+ When \field{enable} is set to 1 and the device writes to a memory page,
+ the device MUST set the corresponding bit to 1 which indicating the page is dirty.
+\item[\field{bitmap_length}]
+ The driver use this to set the length in bytes of the bitmap.
+\end{description}
+
+\devicenormative{\subsubsection}{Memory Dirty Pages Tracker Capability}{Virtio Transport Options / Virtio Over PCI Bus / Memory Dirty Pages Tracker Capability} +
+The device MUST NOT set any bits beyond bitmap_length when reporting dirty pages.
+
+To prevent a read-modify-write procedure, if a memory page is dirty,
+optionally the device is permitted to set the entire byte, which encompasses the relevant bit, to 1.
+
+The device MAY increase \field{gra_power} to reduce \field{bitmap_length}.
+
+The device must ignore any writes to \field{pasid} if PASID Extended Capability is absent or
+the PASID functionality is disabled in PASID Extended Capability

Quoted 6 lines
Quoted 4 lines

I have to say this is going to work very badly when the number of dirty pages is small: you will end up scanning and re-scanning all of bitmap.

The driver needs to scan anyway,

Not with e.g. Parav's proposal - device reports individual pages changed. This is analogous to PML.

In this proposal, the device DMA writes the bitmap to recording dirty pages, this can easily be merged into QEMU migration flow.

Quoted 4 lines
Quoted 3 lines

Intel production work with similar bitmap
based dirty page tracking solution for years.

and then VMs became bigger and PML was introduced.

So you agree we should track dirty pages through the platform facilities? I am glad to hear that!

Quoted 3 lines
Quoted 2 lines

Otherwise the device should report PFN which is not very practical.

Why not?

Really? the device report PFN?
What can happen if the device keep writing a small piece of memory???

Quoted 8 lines
Quoted 7 lines

And the resolution is apparently 8 pages? You have just multiplied the migration bandwidth by a factor of 8.

No, as described in the comments, the tacking granularity is controlled by \
field{gra_power}, one bit represents a page with page_size = 2^(12 + gra_power). This can also be used to reduce the size of the bitmap.

.. at the cost of increasing migration bandwidth.

The device is very likely to write a neighbor page, and this happens everywhere for example CPU read 64 bytes aligned data.

This is a tradeoff

Quoted 10 lines
Quoted 9 lines

"To prevent a read-modify-write procedure, if a memory page is dirty,
optionally the device is permitted to set the entire byte, which encompasses the relevant bit, to 1."

This is optional and DMA is very likely to write a neighbor page, and the device transmit a whole byte anyway when a bit is dirty.

How about we use platform dirty page tracking facility then implement this in virtio, as Jason suggested?

Without something like PML it likely won't scale either.

So that would be platform issue which we don't need to take care of? Intel VT-d can do this for sure.

Quoted 1 line

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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/

#17 lore raw

[virtio-comment] RE: [PATCH V2 2/6] virtio: introduce SUSPEND bit in device status

In reply to Zhu, Lingshan
Quoted 39 lines

From: Zhu, Lingshan <[email protected]>
Sent: Monday, November 6, 2023 9:00 AM

Quoted 34 lines · Parav Pandit
Quoted 34 lines

From: Zhu, Lingshan <[email protected]>
Sent: Friday, November 3, 2023 8:25 PM

Quoted 5 lines · Parav Pandit
Quoted 5 lines

From: Zhu Lingshan <[email protected]>
Sent: Friday, November 3, 2023 4:05 PM

This patch introduces a new status bit in the device status: SUSPEND.

Quoted 8 lines
Quoted 7 lines

This SUSPEND bit can be used by the driver to suspend a device, in order to stabilize the device states and virtqueue states.

Its main use case is live migration.

You constantly complained that whatever was proposed using admin

commands method in [1] must work for passthrough and non-passthrough.

Quoted 2 lines

And halfway in the discussion you propose a method after learning all the

limitations of in-band, you propose a solution only works for non-passthrough mode.

Quoted 2 lines

You asked someone to have comprehensive proposal and when it comes to

you following it, you just don’t.
not sure what you are talking about.

Quoted 4 lines

And have most shallow commit message to not even mention it.

Please be consistent in design approach.
And if you don’t want to be, stop asking others.

this SUSPEND/RESUME doesn't change since the RFC series, how can it not be inconsistent???

Quoted 2 lines

This is not the way TC collaboration works.
I probably shouldn’t even expect this from you.

Quoted 8 lines
Quoted 1 line

Your proposal does not cover both the use cases of passthrough and non-

passthrough.

Quoted 4 lines

Yet you kept demanding them for others.
This is just wrong.

I am aware that both models as technical pros and cons.

Why this doesn't work? the device status byte has been working for many years, and do you know when guest freeze, the hypervisor owns the device????

When the guest is not frozen and during the pre-copy phase, hypervisor needs to access the device (context, dirty pages). How does it work if the guest owns the device?

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 5 lines

[1]
https://lists.oasis-open.org/archives/virtio-comment/202310/msg00472
.h
tml

Please don't be so emotional and please be professional.

Why this solution can not work for pass-through? Do you know the device ownership will be transferred to the hypervisor when guest suspended in live migration?

Quoted 8 lines
Quoted 3 lines

I explained 5 reasons why it does not work in previous reply.

As the word indicates "live migration", the hypervisor needs to access the

device when it is "live" (not just after).

Quoted 1 line

Hence, passthrough mode must be able to capture the state of the device and

dirty pages database when its live.

Quoted 1 line

(and after the source is suspended).

No, the hypervisor should only collect dirty pages when the device alive.

It is needed during both the times.
When the device and guest is live during pre-copy phase. And after the device is frozen, to get the final round of pages.

Quoted 3 lines

As you can see, the dirty page tracking facility has a PASID for isolation. But still, the question is, we should better use platform dirty page tracking

Nothing to do with PASID, as PASID is owned by the guest.

Quoted 4 lines

Then suspend the device after guest freeze, to stabilize the device status, then read the status.

How can you say this does not work???

I explained above.

#84 lore raw

RE: [virtio-comment] Re: [PATCH V2 4/6] virtio-pci: implement VIRTIO_F_QUEUE_STATE

In reply to Zhu, Lingshan
Quoted 42 lines

From: Zhu, Lingshan <[email protected]>
Sent: Monday, November 6, 2023 9:01 AM

Quoted 16 lines · Parav Pandit
Quoted 16 lines

From: [email protected] <[email protected] open.org> On Behalf Of Zhu, Lingshan
Sent: Friday, November 3, 2023 8:27 PM

Quoted 11 lines · Parav Pandit
Quoted 11 lines

From: Zhu Lingshan <[email protected]>
Sent: Friday, November 3, 2023 4:05 PM

This patch adds two new le16 fields to common configuration structure to support VIRTIO_F_QUEUE_STATE in PCI transport layer.

---
   transport-pci.tex | 18 ++++++++++++++++++
   1 file changed, 18 insertions(+)
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

transport-pci.tex \subsubsection{Common configuration

Quoted 5 lines
transport-pci.tex index renamed from transport-pci.tex +0 -0

a5c6719..3161519 100644

transport-pci.tex +0 -0
@@ -325,6 +325,10 @@ \subsubsection{Common configuration

structure

Quoted 15 lines
Quoted 15 lines
Quoted 10 lines

transport-pci.tex \subsubsection{Common configuration structure layout}\label{sec:Virtio Transport · line 331

Quoted 8 lines

layout}\label{sec:Virtio Transport
/* About the administration virtqueue. */
le16 admin_queue_index; /* read-only for driver */
le16 admin_queue_num; /* read-only for driver */

transport-pci.tex +4 -0
+
+	/* Virtqueue state */
+        le16 queue_avail_state;         /* read-write */
+        le16 queue_used_state;          /* read-write */

This tiny interface for 128 virtio net queues through register read writes, does

not work effectively.

Quoted 2 lines

There are inflight out of order descriptors for block also. Hence toy registers like this do not work.

Do you know there is a queue_select? Why this does not work? Do you know how other queue related fields work?

Quoted 7 lines
Quoted 2 lines

:)
Yes. If you notice queue_reset related critical spec bug fix was done when it

was introduced so that live migration can _actually_ work.

Quoted 2 lines

When queue_select is done for 128 queues serially, it take a lot of time to

read those slow register interface for this + inflight descriptors + more. interesting, virtio work in this pattern for many years, right?

All these years 400Gbps and 800Gbps virtio was not present, number of queues were not in hw. Device didn’t support LM.
Many limitations existed all these years and TC is improving and expanding them. So all these years do not matter.

Quoted 6 lines
Quoted 3 lines
Quoted 2 lines

Like how to set a queue size and enable it?

Those are meant to be used before DRIVER_OK stage as they are init time

registers.

Quoted 1 line

Not to keep abusing them..

don't you need to set queue_size at the destination side?

No.
But the src/dst does not matter.
Queue_size to be set before DRIVER_OK like rest of the registers, as all queues must be created before the driver_ok phase. Queue_reset was last moment exception.

#149 lore raw

[virtio-comment] RE: [PATCH V2 6/6] virtio-pci: implement dirty page tracking

In reply to Zhu, Lingshan
Quoted 48 lines

From: Zhu, Lingshan <[email protected]>
Sent: Monday, November 6, 2023 9:22 AM

Quoted 36 lines · Parav Pandit
Quoted 36 lines

From: Zhu, Lingshan <[email protected]>
Sent: Friday, November 3, 2023 8:33 PM

Quoted 32 lines · Parav Pandit
Quoted 28 lines

From: Michael S. Tsirkin <[email protected]>
Sent: Friday, November 3, 2023 4:20 PM

Review

Quoted 3 lines · Zhu Lingshan

+\item[\field{bitmap_addr}]

(quoted diff) +2 -0
+	The driver use this to set the address of the bitmap which
+records the

dirty pages

transport-pci.tex \subsubsection{Driver Handling Interrupts}\label{sec:Virtio Transport Options /

Quoted 4 lines
transport-pci.tex +4 -0
+	caused by the device.
+	Each bit in the bitmap represents one memory page, bit 0 in the bitmap
+	reprsents page 0 at address 0, bit 1 represents page 1, and so
+on in a

linear manner.

Review

Quoted 3 lines
(quoted diff) +3 -0
+	When \field{enable} is set to 1 and the device writes to a memory page,
+	the device MUST set the corresponding bit to 1 which indicating
+the

page is dirty.

Review

Quoted 10 lines

+\item[\field{bitmap_length}]

(quoted diff) +9 -0
+	The driver use this to set the length in bytes of the bitmap.
+\end{description}
+
+\devicenormative{\subsubsection}{Memory Dirty Pages Tracker
+Capability}{Virtio Transport Options / Virtio Over PCI Bus /
+Memory Dirty Pages Tracker Capability}
+
+The device MUST NOT set any bits beyond bitmap_length when
+reporting

dirty pages.

Quoted 3 lines

Review

Quoted 3 lines
(quoted diff) +3 -0
+
+To prevent a read-modify-write procedure, if a memory page is
+dirty,

It is not to prevent; it is just not possible to do racy RMW. 😊

Quoted 5 lines
Quoted 4 lines

if you understand what is a atomic routine, you will not call it racy.

Quoted 2 lines

Hence to work around you propose to mark all pages dirty. Too bad. This just does not work.

why? and this is optional.

Because device cannot set individual bits in atomic way for same byte read by

Quoted 8 lines

the cpu.

Quoted 6 lines

1. device read the byte that had bit 0 and 4 set.
2. cpu atomically clear these bits.
3. device wrote bits 0, 4, and new bits 2 and 3.
4. cpu now transferred page 0 and 4 again.

Optional thing also needs to work. :)

Do you know both CPU and device actually don't read bit, they read bytes????

Yes. this is why atomic_OR is not possible on pcie.

Quoted 1 line

Do you know RC connected to memory controller????

Yes.

Quoted 1 line

Do you know there are locked transaction and atomic operations in PCI???

Can you explain how PCI does RMW locked transaction? Is it one TLP or multiple?

Quoted 2 lines

Do you know there are atomic read/write/clear even read and clear and so on in CPU ISA????

Read is always atomic from cpu.
I didn’t know about read_and_clear atomic ISA. This combined with pci future support for atomic_or. If you already know a Linux kernel api for atomic_read_and_clear, please share.

Quoted 11 lines
Quoted 9 lines
Quoted 6 lines
Quoted 3 lines

Secondly the bitmap array is function is for full guest memory size, while

there is lot of sparce region now and also in future.

Quoted 1 line

This is the second problem.

did you see gra_power and its comments?

gra_power says the page size.
Not the sparce multiple ranges of the guest memory. Device endup tracking uninterested area as well.

increase gra_power can reduce bitmap size, right?
Totally up to the hypervisor, right?

Yes, and that can increase the amount of memory.
The way I understood is, if gra_power is 2MB, than whole 2MB page to be considered dirty, even if 8KB was dirty. Did I understand it right?

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 3 lines

This is exactly why I asked you to review the page write recording series of

admin commands and comment.

Quoted 4 lines

And you never commented with sheer ignorance.

So clearly the start stop method for specific range and without bandwidth

explosion, admin commands of [1] stands better.

Quoted 2 lines

If you do [1] on the member device also using its AQ in future, it will work for

Quoted 8 lines
Quoted 5 lines
Quoted 5 lines

non-passthrough case.

Quoted 2 lines

If you build non-passthrough live migration using [1], also it will work. So I don’t see any point of this series anymore.

As Jason pointed out, there are many problems in your proposal, you should answer there. I don't need to repeat his words and duplicate the

discussions.

Quoted 1 line

Many are already addressed in v3.

interesting, does your V3 support nested?

Not directly.
Is it similar to cpu PML which does not supported nested.
One can always implement nested using some emulation.
The second option for high performance would be allow SR-IOV cap on the VF and support true nesting using existing proposal of v3.

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

[1]
https://lists.oasis-open.org/archives/virtio-comment/202310/msg00475
.h
tml

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

you still need to explain why this does not work for pass-through.

It does not work for following reasons.
1. Because all the fields that put on the member device are not in direct

control of the hypervisor.

Quoted 1 line

The device is directly controlled by the guest including the device status and

when it resets the device all the things stored in the device are lost. have you seen PASID? and if the device reset, it has to forget everything as expected, right?

PASID does not help with the reset. Because as you told reset, resets everything. PASID does not bifurcate the device common control which is not linked to any PASID.

Quoted 9 lines
Quoted 2 lines

2. the PCI FLR is clearing all the registers you exposed here.

see above

Quoted 2 lines

3. Endless expansion of config registers of dirty tracking is not scalable, as they

are not init time registers not following the Appendix B guidelines. endless expansion?? It is a complete set of dirty page tracking, right???? have you see this cap only controls? The device DMA writes the bitmap, not by registers.

Device dirty page tracking is start/stop command to be done by the hypervisor. So when guest is resetting the device, it stopped the DMA initiated by the hypervisor. This fundamentally breaks things.

Quoted 7 lines

Again, if you want to fix Appendix B, OK.

Quoted 3 lines

4. bitmap based dirty tracking is not atomic between cpu and device. Hence, it is racy.

see above, the first reply.

Quoted 1 line
Quoted 8 lines
Quoted 1 line

5. All the device context needed for passthrough based hypervisor for a

device type specific is missing.

Quoted 4 lines

All of those can be used for non-passthrough as well.
[1]
https://lists.oasis-open.org/archives/virtio-comment/202311/msg00085.h
tml

If you want to discuss this again, I don't want to wast time but only asking you whether you want to define virtio-fs device context

It will be defined in future.
And if virtio-fs was not written with migration in mind, may be one will invent virtio-fs2.

Quoted 17 lines
Quoted 8 lines
Quoted 4 lines

And I
remember this is a point-less topic as MST ever wants to mute another "pass- through" thread.

No. he did not say that.
He meant to not endlessly debate which one is better.
He clearly said, try to see if you can make multiple hypervisor model work. And your series shows a clear ignorance of his guidance.

Let me quote MST's reply here:
"I feel this discussion will keep meandering because the terminology is vague. There's no single thing that is called "passthrough" - vendors just build what is expedient with current hardware and software. Nvidia has a bunch of people working on vfio so they call that passthrough, Red Hat has people working on VDPA and they call that passthrough, etc.

Quoted 4 lines

Before I mute this discussion for good, does anyone here have any feeling progress is made? What kind of progress? "

So please don't discuss on pass-through anymore.

I don’t want to discuss the pros and cons of passthrough vs, vdpa, as usual.
V3 covers broader use case of passthrough, hence once can always implement trap+emulation instead of passthrough. V3 already indicates that other variants of the passthrough can be done as well or can be extended. So please explore if that fits your vdpa need.

Quoted 26 lines

It seems only you need to develop the knowledge

Quoted 17 lines
Quoted 17 lines
Quoted 7 lines
Quoted 7 lines

Review

Quoted 4 lines
(quoted diff) +2 -0
+optionally the device is permitted to set the entire byte, which
+encompasses

the relevant bit, to 1.

Review

Quoted 2 lines
(quoted diff) +2 -0
+
+The device MAY increase \field{gra_power} to reduce

\field{bitmap_length}.

Quoted 9 lines
Quoted 9 lines

Review

Quoted 4 lines
(quoted diff) +4 -0
+
+The device must ignore any writes to \field{pasid} if PASID
+Extended Capability is absent or the PASID functionality is
+disabled in PASID Extended Capability

I have to say this is going to work very badly when the number of dirty pages is
small: you will end up scanning and re-scanning all of bitmap. And the resolution is apparently 8 pages? You have just multiplied the migration bandwidth by a factor of 8.

Quoted 6 lines
Quoted 5 lines
Quoted 3 lines

Yeah.
And device does not even know previously reported pages are read by driver

or not. All guess work game for driver and device. see my reply to him

Please see above reply.

see above

#129 lore raw

[virtio-comment] Re: [PATCH V2 6/6] virtio-pci: implement dirty page tracking

In reply to Zhu, Lingshan
Quoted 23 lines · Lingshan
Quoted 12 lines · Michael S. Tsirkin
Quoted 11 lines · Zhu Lingshan

+\begin{lstlisting}
+struct virtio_pci_dity_page_track {
+        u8 enable;               /* Read-Write */ +        u8 gra_power;            /* Read-Write */ +        u8 reserved[2];
+        le32 {
+            pasid: 20;           /* Read-Write */ +            reserved: 12;
+        };
+        le64 bitmap_addr;        /* Read-Write */ +        le64 bitmap_length;      /* Read-Write */

Quoted 8 lines
Quoted 2 lines

+};
+\end{lstlisting}

Okay, so it's a simple mailbox in config space.  Which by itself is probably a very reasonable idea - more or less what I suggested. However, using such a generic facility just for the dirty bitmap seems too limited.  Please make it accept arbitrary commands. Reusing admin command structure with a special "device itself" group sounds like one way to do it.

Quoted 5 lines

processing admin cmds in a cap may be too complex and overkill.
we need to handle variable length of cmds, handle async returned results, and so on.

This struct seems easy and simple. And shall we use platform facilities like vt-d to track dirty pages?

To demonstrate these issues, suppose we have a struct in a bar to process admin cmds:

struct virtio_admin_cmd {
        u64 in_data_length;
        u8 cmd_in_data[];
        u64 out_data_length;
        u8 cmd_out_data[];
        u8 ret;
};

The problems are:
1) command_in_data and command_out data have variable length, so how many HW resource should be reserved in the bar?
2) To process the cmds in the bar, the device MAY need to read many registers in cmd_in_data[] and write many registers in cmd_out_data[], which can be ineffective, this is not DMA.
3) a bar can only process one cmd at a time, and the driver can only issue another cmd after received an ret.
This process has to be synchronous IO, one cmd blocks another.
4) VF implementing a bar processing admin cmds conflicts with PF's admin vq.

So I think a bar or a cap processing admin cmds is way to complex and overkill.

Thanks

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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/

#18 lore raw

Re: [virtio-comment] RE: [PATCH V2 2/6] virtio: introduce SUSPEND bit in device status

In reply to Parav Pandit
Quoted 40 lines · Parav Pandit
Quoted 40 lines

From: Zhu, Lingshan <[email protected]>
Sent: Monday, November 6, 2023 9:00 AM

Quoted 28 lines · Parav Pandit
Quoted 28 lines

From: Zhu, Lingshan <[email protected]>
Sent: Friday, November 3, 2023 8:25 PM

Quoted 5 lines · Parav Pandit
Quoted 5 lines

From: Zhu Lingshan <[email protected]>
Sent: Friday, November 3, 2023 4:05 PM

This patch introduces a new status bit in the device status: SUSPEND.

Quoted 8 lines
Quoted 7 lines

This SUSPEND bit can be used by the driver to suspend a device, in order to stabilize the device states and virtqueue states.

Its main use case is live migration.

You constantly complained that whatever was proposed using admin

commands method in [1] must work for passthrough and non-passthrough.

Quoted 2 lines

And halfway in the discussion you propose a method after learning all the

limitations of in-band, you propose a solution only works for non-passthrough mode.

Quoted 2 lines

You asked someone to have comprehensive proposal and when it comes to

you following it, you just don’t.
not sure what you are talking about.

Quoted 2 lines

And have most shallow commit message to not even mention it.

Quoted 7 lines
Quoted 6 lines
Quoted 2 lines

Please be consistent in design approach.
And if you don’t want to be, stop asking others.

this SUSPEND/RESUME doesn't change since the RFC series, how can it not be inconsistent???

Quoted 2 lines

This is not the way TC collaboration works.
I probably shouldn’t even expect this from you.

Your proposal does not cover both the use cases of passthrough and non-

passthrough.

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

Yet you kept demanding them for others.
This is just wrong.

I am aware that both models as technical pros and cons.

Why this doesn't work? the device status byte has been working for many years, and do you know when guest freeze, the hypervisor owns the device????

When the guest is not frozen and during the pre-copy phase, hypervisor needs to access the device (context, dirty pages). How does it work if the guest owns the device?

Have you seen PASID there?

Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 10 lines
Quoted 5 lines

[1]
https://lists.oasis-open.org/archives/virtio-comment/202310/msg00472
.h
tml

Please don't be so emotional and please be professional.

Why this solution can not work for pass-through? Do you know the device ownership will be transferred to the hypervisor when guest suspended in live migration?

I explained 5 reasons why it does not work in previous reply.

As the word indicates "live migration", the hypervisor needs to access the

Quoted 8 lines
Quoted 5 lines

device when it is "live" (not just after).

Quoted 1 line

Hence, passthrough mode must be able to capture the state of the device and

dirty pages database when its live.

Quoted 1 line

(and after the source is suspended).

No, the hypervisor should only collect dirty pages when the device alive.

It is needed during both the times.
When the device and guest is live during pre-copy phase. And after the device is frozen, to get the final round of pages.

With PASID, dirty page tracking facility can be isolated from the guest, means the hypervisor owns this facility. So the hypervisor can collect the dirty pages.

When the device suspended, it should report the last round of dirty pages through dirty page tracking facility as expected.

This can work, right?

Quoted 5 lines
Quoted 4 lines

As you can see, the dirty page tracking facility has a PASID for isolation. But still, the question is, we should better use platform dirty page tracking

Nothing to do with PASID, as PASID is owned by the guest.

It looks you don't know how PASID work.

Host can setup PASID to isolate some facilities, right?

Quoted 6 lines
Quoted 5 lines

Then suspend the device after guest freeze, to stabilize the device status, then read the status.

How can you say this does not work???

I explained above.

see above

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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/

#85 lore raw

Re: [virtio-comment] Re: [PATCH V2 4/6] virtio-pci: implement VIRTIO_F_QUEUE_STATE

In reply to Parav Pandit
Quoted 41 lines · Parav Pandit
Quoted 41 lines

From: Zhu, Lingshan <[email protected]>
Sent: Monday, November 6, 2023 9:01 AM

Quoted 16 lines · Parav Pandit
Quoted 16 lines

From: [email protected] <[email protected] open.org> On Behalf Of Zhu, Lingshan
Sent: Friday, November 3, 2023 8:27 PM

Quoted 11 lines · Parav Pandit
Quoted 11 lines

From: Zhu Lingshan <[email protected]>
Sent: Friday, November 3, 2023 4:05 PM

This patch adds two new le16 fields to common configuration structure to support VIRTIO_F_QUEUE_STATE in PCI transport layer.

---
    transport-pci.tex | 18 ++++++++++++++++++
    1 file changed, 18 insertions(+)
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

transport-pci.tex \subsubsection{Common configuration

Quoted 5 lines
transport-pci.tex index renamed from transport-pci.tex +0 -0

a5c6719..3161519 100644

transport-pci.tex +0 -0
@@ -325,6 +325,10 @@ \subsubsection{Common configuration

structure

Quoted 15 lines
Quoted 15 lines
Quoted 10 lines

transport-pci.tex \subsubsection{Common configuration structure layout}\label{sec:Virtio Transport · line 331

Quoted 8 lines

layout}\label{sec:Virtio Transport
/* About the administration virtqueue. */
le16 admin_queue_index; /* read-only for driver */
le16 admin_queue_num; /* read-only for driver */

transport-pci.tex +4 -0
+
+	/* Virtqueue state */
+        le16 queue_avail_state;         /* read-write */
+        le16 queue_used_state;          /* read-write */

This tiny interface for 128 virtio net queues through register read writes, does

not work effectively.

Quoted 2 lines

There are inflight out of order descriptors for block also. Hence toy registers like this do not work.

Do you know there is a queue_select? Why this does not work? Do you know how other queue related fields work?

Quoted 7 lines
Quoted 6 lines
Quoted 2 lines

:)
Yes. If you notice queue_reset related critical spec bug fix was done when it

was introduced so that live migration can _actually_ work.

Quoted 1 line

When queue_select is done for 128 queues serially, it take a lot of time to

read those slow register interface for this + inflight descriptors + more. interesting, virtio work in this pattern for many years, right?

All these years 400Gbps and 800Gbps virtio was not present, number of queues were not in hw.

The registers are control path in config space, how 400G or 800G affect?? See the virtio common cfg, you will find the max number of vqs is there, num_queues.

Quoted 3 lines

Device didn’t support LM.
Many limitations existed all these years and TC is improving and expanding them. So all these years do not matter.

Not sure what are you talking about, haven't we initialize the device and vqs in config space for years?????? What's wrong with this mechanism? Are you questioning virito-pci fundamentals???

Quoted 10 lines
Quoted 6 lines
Quoted 3 lines
Quoted 2 lines

Like how to set a queue size and enable it?

Those are meant to be used before DRIVER_OK stage as they are init time

registers.

Quoted 1 line

Not to keep abusing them..

don't you need to set queue_size at the destination side?

No.
But the src/dst does not matter.
Queue_size to be set before DRIVER_OK like rest of the registers, as all queues must be created before the driver_ok phase. Queue_reset was last moment exception.

create a queue? Nvidia specific?

For standard virtio, you need to read the number of enabled vqs at the source side, then enable them at the dst, so queue_size matters, not to create.

Quoted 1 line

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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/

#150 lore raw

[virtio-comment] Re: [PATCH V2 6/6] virtio-pci: implement dirty page tracking

In reply to Parav Pandit
Quoted 60 lines · Parav Pandit
Quoted 47 lines

From: Zhu, Lingshan <[email protected]>
Sent: Monday, November 6, 2023 9:22 AM

Quoted 36 lines · Parav Pandit
Quoted 36 lines

From: Zhu, Lingshan <[email protected]>
Sent: Friday, November 3, 2023 8:33 PM

Quoted 32 lines · Parav Pandit
Quoted 28 lines

From: Michael S. Tsirkin <[email protected]>
Sent: Friday, November 3, 2023 4:20 PM

Review

Quoted 3 lines · Zhu Lingshan

+\item[\field{bitmap_addr}]

(quoted diff) +2 -0
+	The driver use this to set the address of the bitmap which
+records the

dirty pages

Review

Quoted 4 lines
(quoted diff) +4 -0
+	caused by the device.
+	Each bit in the bitmap represents one memory page, bit 0 in the bitmap
+	reprsents page 0 at address 0, bit 1 represents page 1, and so
+on in a

linear manner.

Review

Quoted 3 lines
(quoted diff) +3 -0
+	When \field{enable} is set to 1 and the device writes to a memory page,
+	the device MUST set the corresponding bit to 1 which indicating
+the

page is dirty.

Review

Quoted 10 lines

+\item[\field{bitmap_length}]

(quoted diff) +9 -0
+	The driver use this to set the length in bytes of the bitmap.
+\end{description}
+
+\devicenormative{\subsubsection}{Memory Dirty Pages Tracker
+Capability}{Virtio Transport Options / Virtio Over PCI Bus /
+Memory Dirty Pages Tracker Capability}
+
+The device MUST NOT set any bits beyond bitmap_length when
+reporting

dirty pages.

Quoted 3 lines

Review

Quoted 3 lines
(quoted diff) +3 -0
+
+To prevent a read-modify-write procedure, if a memory page is
+dirty,

It is not to prevent; it is just not possible to do racy RMW. 😊

Quoted 5 lines
Quoted 4 lines

if you understand what is a atomic routine, you will not call it racy.

Quoted 2 lines

Hence to work around you propose to mark all pages dirty. Too bad. This just does not work.

why? and this is optional.

Because device cannot set individual bits in atomic way for same byte read by

Quoted 8 lines

the cpu.

Quoted 6 lines

1. device read the byte that had bit 0 and 4 set.
2. cpu atomically clear these bits.
3. device wrote bits 0, 4, and new bits 2 and 3.
4. cpu now transferred page 0 and 4 again.

Optional thing also needs to work. :)

Do you know both CPU and device actually don't read bit, they read bytes????

Yes. this is why atomic_OR is not possible on pcie.

Quoted 1 line

Do you know RC connected to memory controller????

Yes.

Quoted 1 line

Do you know there are locked transaction and atomic operations in PCI???

Quoted 8 lines

Can you explain how PCI does RMW locked transaction? Is it one TLP or multiple?

Quoted 2 lines

Do you know there are atomic read/write/clear even read and clear and so on in CPU ISA????

Read is always atomic from cpu.
I didn’t know about read_and_clear atomic ISA. This combined with pci future support for atomic_or. If you already know a Linux kernel api for atomic_read_and_clear, please share.

To answer all questions above, you should read PCI spec and CPU SDM, we don't copy and paste the content here, nobody develop their knowledge this way.

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 3 lines

Secondly the bitmap array is function is for full guest memory size, while

there is lot of sparce region now and also in future.

Quoted 1 line

This is the second problem.

did you see gra_power and its comments?

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

gra_power says the page size.
Not the sparce multiple ranges of the guest memory. Device endup tracking uninterested area as well.

increase gra_power can reduce bitmap size, right?
Totally up to the hypervisor, right?

Yes, and that can increase the amount of memory.
The way I understood is, if gra_power is 2MB, than whole 2MB page to be considered dirty, even if 8KB was dirty. Did I understand it right?

Do you know DMA are very likely to write a neighbor page? Do you know why huge page is introduced?
Hint: not only for reduce TLB miss.

Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Quoted 3 lines

This is exactly why I asked you to review the page write recording series of

admin commands and comment.

Quoted 4 lines

And you never commented with sheer ignorance.

So clearly the start stop method for specific range and without bandwidth

explosion, admin commands of [1] stands better.

Quoted 2 lines

If you do [1] on the member device also using its AQ in future, it will work for

non-passthrough case.

Quoted 2 lines

If you build non-passthrough live migration using [1], also it will work. So I don’t see any point of this series anymore.

As Jason pointed out, there are many problems in your proposal, you should answer there. I don't need to repeat his words and duplicate the

Quoted 7 lines
Quoted 3 lines

discussions.

Quoted 1 line

Many are already addressed in v3.

interesting, does your V3 support nested?

Not directly.
Is it similar to cpu PML which does not supported nested.
One can always implement nested using some emulation.
The second option for high performance would be allow SR-IOV cap on the VF and support true nesting using existing proposal of v3.

If your proposal does not support nested, then it is incomplete.

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 6 lines
Quoted 5 lines

[1]
https://lists.oasis-open.org/archives/virtio-comment/202310/msg00475
.h
tml

you still need to explain why this does not work for pass-through.

It does not work for following reasons.
1. Because all the fields that put on the member device are not in direct

Quoted 7 lines
Quoted 5 lines

control of the hypervisor.

Quoted 1 line

The device is directly controlled by the guest including the device status and

when it resets the device all the things stored in the device are lost. have you seen PASID? and if the device reset, it has to forget everything as expected, right?

PASID does not help with the reset. Because as you told reset, resets everything. PASID does not bifurcate the device common control which is not linked to any PASID.

PASID means some facilities can be isolated. When reset, the device forget everything.

Quoted 11 lines
Quoted 8 lines
Quoted 2 lines

2. the PCI FLR is clearing all the registers you exposed here.

see above

Quoted 1 line

3. Endless expansion of config registers of dirty tracking is not scalable, as they

are not init time registers not following the Appendix B guidelines. endless expansion?? It is a complete set of dirty page tracking, right???? have you see this cap only controls? The device DMA writes the bitmap, not by registers.

Device dirty page tracking is start/stop command to be done by the hypervisor. So when guest is resetting the device, it stopped the DMA initiated by the hypervisor. This fundamentally breaks things.

Why? When device resets, do you want to keep tracking dirty pages????

Quoted 7 lines
Quoted 7 lines

Again, if you want to fix Appendix B, OK.

Quoted 2 lines

4. bitmap based dirty tracking is not atomic between cpu and device. Hence, it is racy.

see above, the first reply.

Quoted 1 line

5. All the device context needed for passthrough based hypervisor for a

device type specific is missing.

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

All of those can be used for non-passthrough as well.
[1]
https://lists.oasis-open.org/archives/virtio-comment/202311/msg00085.h
tml

If you want to discuss this again, I don't want to wast time but only asking you whether you want to define virtio-fs device context

It will be defined in future.
And if virtio-fs was not written with migration in mind, may be one will invent virtio-fs2.

don't say future, talk is cheap, show me the code.

Quoted 16 lines
Quoted 16 lines
Quoted 8 lines
Quoted 4 lines

And I
remember this is a point-less topic as MST ever wants to mute another "pass- through" thread.

No. he did not say that.
He meant to not endlessly debate which one is better.
He clearly said, try to see if you can make multiple hypervisor model work. And your series shows a clear ignorance of his guidance.

Let me quote MST's reply here:
"I feel this discussion will keep meandering because the terminology is vague. There's no single thing that is called "passthrough" - vendors just build what is expedient with current hardware and software. Nvidia has a bunch of people working on vfio so they call that passthrough, Red Hat has people working on VDPA and they call that passthrough, etc.

Quoted 8 lines
Quoted 4 lines

Before I mute this discussion for good, does anyone here have any feeling progress is made? What kind of progress? "

So please don't discuss on pass-through anymore.

I don’t want to discuss the pros and cons of passthrough vs, vdpa, as usual.
V3 covers broader use case of passthrough, hence once can always implement trap+emulation instead of passthrough. V3 already indicates that other variants of the passthrough can be done as well or can be extended. So please explore if that fits your vdpa need.

So, please no pass-through discussion anymore.

Quoted 18 lines
Quoted 18 lines

It seems only you need to develop the knowledge

Quoted 16 lines
Quoted 16 lines
Quoted 6 lines
Quoted 6 lines

Review

Quoted 3 lines
(quoted diff) +2 -0
+optionally the device is permitted to set the entire byte, which
+encompasses

the relevant bit, to 1.

Review

Quoted 2 lines
(quoted diff) +2 -0
+
+The device MAY increase \field{gra_power} to reduce

\field{bitmap_length}.

Quoted 9 lines
Quoted 9 lines

Review

Quoted 4 lines
(quoted diff) +4 -0
+
+The device must ignore any writes to \field{pasid} if PASID
+Extended Capability is absent or the PASID functionality is
+disabled in PASID Extended Capability

I have to say this is going to work very badly when the number of dirty pages is
small: you will end up scanning and re-scanning all of bitmap. And the resolution is apparently 8 pages? You have just multiplied the migration bandwidth by a factor of 8.

Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
Quoted 5 lines
Quoted 3 lines

Yeah.
And device does not even know previously reported pages are read by driver

or not. All guess work game for driver and device. see my reply to him

Please see above reply.

see above

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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/

#6 lore raw

[virtio-comment] Re: [PATCH V2 1/6] virtio: introduce virtqueue state

In reply to Zhu, Lingshan
Quoted 7 lines · Lingshan

+When SUSPEND is set, the device MUST record the Available State of every enabled splited virtqueue +in \field{Available State} field,
+and correspondingly restore the Available State of every enabled splited virtqueue +from \field{Available State} field when DRIVER_OK is set.
+
+The device SHOULD reset \field{Available State} field upon a device reset.

Quoted 8 lines

At this point I have no idea
- how can a state of a virtqueue at a random time be represented by a 16 bit integer

not sure what is a random time, this is to request the device to reset its avail state, for example, it is "le16 queue_avail_state" in virtio-pci common cfg. Resetting this so the device will not recover from a wrong value of the last run.

You simply never bother to say what is "Available State" and what does it mean to restore it. Not to mention words like "splited" which just adds to the confusion.

Quoted 5 lines

- if it's not at a random time then why do you even need an integer - synchronize queue to memory and then all state is in memory

Not sure what is a sync queue, but for example, "le16 queue_avail_state" for PCI transport exists in a cap.

I just point out that normally a lot of ring state is in memory. So you need to be much more specific about how you are augmenting that. For example, if buffers are used exactly in order for a split ring then used index seems to be exactly the same as last available index you describe - it's a free running counter. OTOH if they are not used in order then I don't see how is a single index sufficient to describe which ones have been used and which not.

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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/

#7 lore raw

[virtio-comment] Re: [PATCH V2 1/6] virtio: introduce virtqueue state

Quoted 12 lines · Michael S. Tsirkin
Quoted 11 lines · Lingshan

+When SUSPEND is set, the device MUST record the Available State of every enabled splited virtqueue +in \field{Available State} field,
+and correspondingly restore the Available State of every enabled splited virtqueue +from \field{Available State} field when DRIVER_OK is set.
+
+The device SHOULD reset \field{Available State} field upon a device reset.

At this point I have no idea
- how can a state of a virtqueue at a random time be represented by a 16 bit integer

Quoted 7 lines
Quoted 4 lines

not sure what is a random time, this is to request the device to reset its avail state, for example, it is "le16 queue_avail_state" in virtio-pci common cfg. Resetting this so the device will not recover from a wrong value of the last run.

You simply never bother to say what is "Available State" and what does it mean to restore it. Not to mention words like "splited" which just adds to the confusion.

It says:
+The available state field is two bytes of virtqueue state that is used by +the device to read the next available buffer. It is presented in the following format:

Do you want me to add more descriptions?

Quoted 6 lines
Quoted 6 lines

- if it's not at a random time then why do you even need an integer - synchronize queue to memory and then all state is in memory

Not sure what is a sync queue, but for example, "le16 queue_avail_state" for PCI transport exists in a cap.

Quoted 7 lines

I just point out that normally a lot of ring state is in memory. So you need to be much more specific about how you are augmenting that. For example, if buffers are used exactly in order for a split ring then used index seems to be exactly the same as last available index you describe - it's a free running counter. OTOH if they are not used in order then I don't see how is a single index sufficient to describe which ones have been used and which not.

I am not sure I get it.

Used idx(not like packed vq, no over-writing descriptors) and other states are in guest memory, so migrated with guest migration.

Quoted 1 line

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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/

#24 lore raw

[virtio-comment] Re: [PATCH V2 2/6] virtio: introduce SUSPEND bit in device status

In reply to Zhu Lingshan
Quoted 19 lines · Zhu Lingshan

This patch introduces a new status bit in the device status: SUSPEND.

This SUSPEND bit can be used by the driver to suspend a device, in order to stabilize the device states and virtqueue states.

Its main use case is live migration.

---
 content.tex | 36 ++++++++++++++++++++++++++++++++++--
 1 file changed, 34 insertions(+), 2 deletions(-)
content.tex +0 -0
index 76813b5..bcc9d4b 100644

content.tex \section{\field{Device Status} Field}\label{sec:Basic Facilities of a Virtio Dev · line 55

Quoted 7 lines
content.tex +4 -0
@@ -49,6 +49,10 @@ \section{\field{Device Status} Field}\label{sec:Basic Facilities of a Virtio Dev
 
 \item[DEVICE_NEEDS_RESET (64)] Indicates that the device has experienced
   an error from which it can't recover.
+
+\item[SUSPEND (16)] When VIRTIO_F_SUSPEND is negotiated, indicates that the
+  device has been suspended by the driver.
+

what does this mean?

content.tex \section{\field{Device Status} Field}\label{sec:Basic Facilities of a Virtio Dev · line 83

Quoted 11 lines
content.tex +4 -0
 \end{description}
 
 The \field{device status} field starts out as 0, and is reinitialized to 0 by
@@ -73,6 +77,10 @@ \section{\field{Device Status} Field}\label{sec:Basic Facilities of a Virtio Dev
 recover by issuing a reset.
 \end{note}
 
+The driver SHOULD NOT set SUSPEND if FEATURES_OK is not set.
+
+When setting SUSPEND, the driver MUST re-read \field{device status} to ensure the SUSPEND bit is set.
+

and if it's not?

content.tex \section{\field{Device Status} Field}\label{sec:Basic Facilities of a Virtio Dev · line 97

Quoted 12 lines
content.tex +5 -0
 \devicenormative{\subsection}{Device Status Field}{Basic Facilities of a Virtio Device / Device Status Field}
 
 The device MUST NOT consume buffers or send any used buffer
@@ -82,6 +90,26 @@ \section{\field{Device Status} Field}\label{sec:Basic Facilities of a Virtio Dev
 that a reset is needed.  If DRIVER_OK is set, after it sets DEVICE_NEEDS_RESET, the device
 MUST send a device configuration change notification to the driver.
 
+The device MUST ignore SUSPEND if FEATURES_OK is not set.
+
+The device MUST ignore SUSPEND if VIRTIO_F_SUSPEND is not negotiated.
+
+The device SHOULD allow settings to \field{device status} even when SUSPEND is set.

which settings?

content.tex \section{\field{Device Status} Field}\label{sec:Basic Facilities of a Virtio Dev · line 106

Quoted 9 lines
content.tex +9 -0
+
+If VIRTIO_F_SUSPEND is negotiated and SUSPEND is set, the device SHOULD clear SUSPEND
+and resumes operation upon DRIVER_OK.
+
+If VIRTIO_F_SUSPEND is negotiated, when the driver sets SUSPEND,
+the device SHOULD perform the following actions before presenting SUSPEND bit in the \field{device status}:
+
+\begin{itemize}
+\item Stop consuming buffers of any virtqueues and mark all finished descritors as used.

descritors? and what does finished mean?

content.tex \section{\field{Device Status} Field}\label{sec:Basic Facilities of a Virtio Dev · line 107

Quoted 1 line
content.tex +1 -0
+\item Wait until all descriptors that being processed to finish and mark them as used.

descriptors are not marked used. buffers are.

that being -> that are being maybe?

content.tex \section{\field{Device Status} Field}\label{sec:Basic Facilities of a Virtio Dev · line 108

Quoted 1 line
content.tex +1 -0
+\item Flush all used buffer and send used buffer notifications to the driver.

used buffers?
what does Flush mean?

content.tex \section{\field{Device Status} Field}\label{sec:Basic Facilities of a Virtio Dev · line 109

Quoted 1 line
content.tex +1 -0
+\item Record Virtqueue State of each enabled virtqueue, see section \ref{sec:Virtqueues / Virtqueue State}

execpt that one unfortunately does not bother to say what does this mean :(

content.tex \section{\field{Device Status} Field}\label{sec:Basic Facilities of a Virtio Dev · line 110

Quoted 1 line
content.tex +1 -0
+\item Pause its operation except \field{device status} and preserve configurations in its Device Configuration Space, see \ref{sec:Basic Facilities of a Virtio Device / Device Configuration Space}

How do you Pause? For example, consider a link state register. You set SUSPEND, then link goes down. What is device supposed to do? Record this somewhere internal but do not show it to driver? And how exactly will this hidden internal state be migrated since it is not visible?

Quoted 19 lines
content.tex +4 -2
+\end{itemize}
+
 \section{Feature Bits}\label{sec:Basic Facilities of a Virtio Device / Feature Bits}
 
 Each virtio device offers all the features it understands.  During
@@ -99,10 +127,10 @@ \section{Feature Bits}\label{sec:Basic Facilities of a Virtio Device / Feature B
 \begin{description}
 \item[0 to 23, and 50 to 127] Feature bits for the specific device type
 
-\item[24 to 42] Feature bits reserved for extensions to the queue and
+\item[24 to 43] Feature bits reserved for extensions to the queue and
   feature negotiation mechanisms
 
-\item[43 to 49, and 128 and above] Feature bits reserved for future extensions.
+\item[44 to 49, and 128 and above] Feature bits reserved for future extensions.
 \end{description}
 
 \begin{note}

content.tex \chapter{Reserved Feature Bits}\label{sec:Reserved Feature Bits} · line 907

Quoted 5 lines
content.tex +2 -0
@@ -875,6 +903,10 @@ \chapter{Reserved Feature Bits}\label{sec:Reserved Feature Bits}
   \item[VIRTIO_F_QUEUE_STATE(42)] This feature indicates that the device allows the driver
   to access its internal virtqueue state.
 
+  \item[VIRTIO_F_SUSPEND(43)] This feature indicates that the driver can
+   SUSPEND the device.

why is SUSPEND upper-case here?

Quoted 7 lines
content.tex +2 -0
+   See \ref{sec:Basic Facilities of a Virtio Device / Device Status Field}.
+
 \end{description}
 
 \drivernormative{\section}{Reserved Feature Bits}{Reserved Feature Bits}
Signature · 1 line
2.35.3

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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/

#8 lore raw

[virtio-comment] Re: [PATCH V2 1/6] virtio: introduce virtqueue state

In reply to Zhu, Lingshan
Quoted 27 lines · Lingshan
Quoted 12 lines · Michael S. Tsirkin
Quoted 11 lines · Lingshan

+When SUSPEND is set, the device MUST record the Available State of every enabled splited virtqueue +in \field{Available State} field,
+and correspondingly restore the Available State of every enabled splited virtqueue +from \field{Available State} field when DRIVER_OK is set.
+
+The device SHOULD reset \field{Available State} field upon a device reset.

At this point I have no idea
- how can a state of a virtqueue at a random time be represented by a 16 bit integer

Quoted 7 lines
Quoted 4 lines

not sure what is a random time, this is to request the device to reset its avail state, for example, it is "le16 queue_avail_state" in virtio-pci common cfg. Resetting this so the device will not recover from a wrong value of the last run.

You simply never bother to say what is "Available State" and what does it mean to restore it. Not to mention words like "splited" which just adds to the confusion.

It says:

(quoted diff) +2 -0
+The available state field is two bytes of virtqueue state that is used by
+the device to read the next available buffer. It is presented in the

following format:

Quoted 1 line

Do you want me to add more descriptions?

maybe start with an example

Quoted 13 lines
Quoted 6 lines
Quoted 6 lines

- if it's not at a random time then why do you even need an integer - synchronize queue to memory and then all state is in memory

Not sure what is a sync queue, but for example, "le16 queue_avail_state" for PCI transport exists in a cap.

Quoted 7 lines

I just point out that normally a lot of ring state is in memory. So you need to be much more specific about how you are augmenting that. For example, if buffers are used exactly in order for a split ring then used index seems to be exactly the same as last available index you describe - it's a free running counter. OTOH if they are not used in order then I don't see how is a single index sufficient to describe which ones have been used and which not.

Quoted 4 lines

I am not sure I get it.

Used idx(not like packed vq, no over-writing descriptors) and other states are in guest memory, so migrated with guest migration.

yes and so? why is that not enough and what is this available state then?

Signature · 18 lines
MST


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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/
#29 lore raw

[virtio-comment] Re: [PATCH V2 3/6] virtio: dont reset vqs when SUSPEND

In reply to Zhu Lingshan
Quoted 14 lines · Zhu Lingshan

When SUSPEND is set, device states and virtqueue states should be stablized, therefore the driver should not reset vqs when SUSPEND is set in device status.

---
 content.tex | 3 +++
 1 file changed, 3 insertions(+)
content.tex +0 -0
index bcc9d4b..060b5c2 100644

content.tex \subsubsection{Virtqueue Reset}\label{sec:Basic Facilities of a Virtio Device / · line 452

Quoted 9 lines
content.tex +3 -0
@@ -444,6 +444,9 @@ \subsubsection{Virtqueue Reset}\label{sec:Basic Facilities of a Virtio Device /
 The device MUST reset any state of a virtqueue to the default state,
 including the available state and the used state.
 
+If VIRTIO_F_SUSPEND is negotiated and SUSPEND is set in \field{device status},
+the driver SHOULD NOT reset any virtqueues.
+
 \drivernormative{\paragraph}{Virtqueue Reset}{Basic Facilities of a Virtio Device / Virtqueues / Virtqueue Reset / Virtqueue Reset}
 
 After the driver tells the device to reset a queue, the driver MUST verify that

Seems somewhat arbitrary and breaks the claim that the feature is orthogonal and can have uses besides migration.

Quoted 2 lines
Signature · 1 line
2.35.3

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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/

#130 lore raw

[virtio-comment] Re: [PATCH V2 6/6] virtio-pci: implement dirty page tracking

In reply to Zhu, Lingshan
Quoted 36 lines · Lingshan
Quoted 23 lines · Lingshan
Quoted 12 lines · Michael S. Tsirkin
Quoted 11 lines · Zhu Lingshan

+\begin{lstlisting}
+struct virtio_pci_dity_page_track {
+        u8 enable;               /* Read-Write */ +        u8 gra_power;            /* Read-Write */ +        u8 reserved[2];
+        le32 {
+            pasid: 20;           /* Read-Write */ +            reserved: 12;
+        };
+        le64 bitmap_addr;        /* Read-Write */ +        le64 bitmap_length;      /* Read-Write */

Quoted 8 lines
Quoted 2 lines

+};
+\end{lstlisting}

Okay, so it's a simple mailbox in config space.  Which by itself is probably a very reasonable idea - more or less what I suggested. However, using such a generic facility just for the dirty bitmap seems too limited.  Please make it accept arbitrary commands. Reusing admin command structure with a special "device itself" group sounds like one way to do it.

Quoted 7 lines

processing admin cmds in a cap may be too complex and overkill. we need to handle variable length of cmds, handle async returned results, and so on.

This struct seems easy and simple. And shall we use platform facilities like vt-d
to track dirty pages?

To demonstrate these issues, suppose we have a struct in a bar to process admin cmds:

Quoted 7 lines

struct virtio_admin_cmd {
        u64 in_data_length;
        u8 cmd_in_data[];
        u64 out_data_length;
        u8 cmd_out_data[];
        u8 ret;
};

An alternative is do same as you did here, e.g.:
struct virtio_admin_cmd {
        u64 admin_cmd_pa; /* an out descriptor followed by an in descriptor */

         u32 pasid : 20;
	 u8 reserved : 11;
	 u8 hardware : 1;
};

or we can stick two lengths and addresses straight in the capability.

Quoted 3 lines

The problems are:
1) command_in_data and command_out data have variable length, so how many HW resource should be reserved in the bar?

actually admin commands are truncated by device so just set to length that device understands.

Quoted 3 lines

2) To process the cmds in the bar, the device MAY need to read many registers in cmd_in_data[] and write many registers in cmd_out_data[], which can be ineffective, this is not DMA.

True. Again if you don't want to depend on pasid that's the only option.

Quoted 3 lines

3) a bar can only process one cmd at a time, and the driver can only issue another cmd after received an ret.
This process has to be synchronous IO, one cmd blocks another.

Exactly same as what you did though.

Quoted 1 line

4) VF implementing a bar processing admin cmds conflicts with PF's admin vq.

So just don't create conflicts. It's same as multiple admin vqs really which we already support.

Quoted 5 lines

So I think a bar or a cap processing admin cmds is way to complex and overkill.

Thanks

Sounds like a straw man argument.

Signature · 18 lines
MST


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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/
#181 lore raw

Re: [virtio-comment] Re: [PATCH V2 6/6] virtio-pci: implement dirty page tracking

In reply to Zhu, Lingshan
Quoted 5 lines · Lingshan
Quoted 3 lines
Quoted 2 lines

Intel production work with similar bitmap
based dirty page tracking solution for years.

and then VMs became bigger and PML was introduced.

So you agree we should track dirty pages through the platform facilities? I am glad to hear that!

I just said that I thought there's no PML in platform facilities and that might be a problem. Am I wrong?

Quoted 5 lines
Quoted 3 lines
Quoted 2 lines

Otherwise the device should report PFN which is not very practical.

Why not?

Really? the device report PFN?
What can happen if the device keep writing a small piece of memory???

then you just report the PFN once. Should work like PML really - IOW devices maintains a bit per page internally and reports PFN when bit is set.

Quoted 9 lines
Quoted 8 lines
Quoted 7 lines

And the resolution is apparently 8 pages? You have just multiplied the migration bandwidth by a factor of 8.

No, as described in the comments, the tacking granularity is controlled by \
field{gra_power}, one bit represents a page with page_size = 2^(12 + gra_power). This can also be used to reduce the size of the bitmap.

.. at the cost of increasing migration bandwidth.

The device is very likely to write a neighbor page,

how likely? and e.g. with slab randomization too? please collect some data and show it.

Quoted 2 lines

and this happens
everywhere for example CPU read 64 bytes aligned data.

CPUs don't need to send their cache across a bandwidth constrained shared network.

Quoted 2 lines

This is a tradeoff

tradeoff between which two options?

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

"To prevent a read-modify-write procedure, if a memory page is dirty,
optionally the device is permitted to set the entire byte, which encompasses the relevant bit, to 1."

Quoted 8 lines
Quoted 6 lines
Quoted 5 lines

This is optional and DMA is very likely to write a neighbor page, and the device transmit a whole byte anyway when a bit is dirty.

How about we use platform dirty page tracking facility then implement this in virtio, as Jason suggested?

Without something like PML it likely won't scale either.

So that would be platform issue which we don't need to take care of? Intel VT-d can do this for sure.

Intel VT-d supports PML from the IOMMU? I didn't realize. Could you help me find it in the doc please? Which hardware supports this in the field? What about other vendors?

Signature · 18 lines
MST


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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/
#170 lore raw

[virtio-comment] Re: [PATCH V2 6/6] virtio-pci: implement dirty page tracking

In reply to Parav Pandit
Quoted 3 lines · Parav Pandit
Quoted 1 line

Do you know there are locked transaction and atomic operations in PCI???

Can you explain how PCI does RMW locked transaction? Is it one TLP or multiple?

Parav what are you asking about here? pcie supports CAS and Swap which likely can work for this use-case - these are non posted writes. It's in the pcie spec. Zhu Lingshan if your proposal relies on this then you should include
- explanation on how it's supposed to be implemented using AtomicOp
- some data on how common support is or is likely to be in the field

Signature · 18 lines
MST


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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/
#139 lore raw

[virtio-comment] Re: [PATCH V2 6/6] virtio-pci: implement dirty page tracking

In reply to Zhu, Lingshan
Quoted 7 lines · Lingshan
Quoted 4 lines · Michael S. Tsirkin
Quoted 3 lines · Parav Pandit
Quoted 3 lines
Quoted 3 lines

[1]
https://lists.oasis-open.org/archives/virtio-comment/202310/msg00475.h
tml

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 1 line

you still need to explain why this does not work for pass-through.

It does not work for following reasons.
1. Because all the fields that put on the member device are not in direct control of the hypervisor.
The device is directly controlled by the guest including the device status and when it resets the device all the things stored in the device are lost.

I think the idea is that when this gateway is in the device then device reset has to trap. At a high level, ok. But then what?

No, when device reset, the device is expected to forget everything and re-intialize.

That's a problem then - memory that was already written will not be detected as such.

Quoted 2 lines
Quoted 1 line

Is a full scan of all memory required until device reset is complete?

Who scan the memory? The device tracks its own dirty pages.

yes but reset erases this information.

Quoted 9 lines
Quoted 4 lines

Drivers currently tend to busy poll the reset register, if this takes very long we might start seeing soft lockup messages. What is the idea then? Maybe for this we need a separate weaker reset that does not touch this capability?

When reset, how can we expect the LM progress continue running.

For example, when the device DMA writes something, then reset before sending an interrupt,
the DMA-ed pages should be lost as expected, right?

interrupt is going to guest, has nothing to do with it.

device writes data into memory
device sends interrupt
driver sees data
driver sends reset

meanwhile hypervisor did not see any dirty pages

now what? hypervisor must apparently retrieve all
dirty page data before it can reset the device.

Signature · 18 lines
MST


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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/
#19 lore raw

RE: [virtio-comment] RE: [PATCH V2 2/6] virtio: introduce SUSPEND bit in device status

In reply to Zhu, Lingshan
Quoted 49 lines

From: Zhu, Lingshan <[email protected]>
Sent: Monday, November 6, 2023 2:51 PM

Quoted 44 lines · Parav Pandit
Quoted 44 lines

From: Zhu, Lingshan <[email protected]>
Sent: Monday, November 6, 2023 9:00 AM

Quoted 28 lines · Parav Pandit
Quoted 28 lines

From: Zhu, Lingshan <[email protected]>
Sent: Friday, November 3, 2023 8:25 PM

Quoted 5 lines · Parav Pandit
Quoted 5 lines

From: Zhu Lingshan <[email protected]>
Sent: Friday, November 3, 2023 4:05 PM

This patch introduces a new status bit in the device status: SUSPEND.

Quoted 8 lines
Quoted 7 lines

This SUSPEND bit can be used by the driver to suspend a device, in order to stabilize the device states and virtqueue states.

Its main use case is live migration.

You constantly complained that whatever was proposed using admin

commands method in [1] must work for passthrough and non-passthrough.

Quoted 2 lines

And halfway in the discussion you propose a method after learning all the

limitations of in-band, you propose a solution only works for non-passthrough mode.

Quoted 2 lines

You asked someone to have comprehensive proposal and when it comes to

you following it, you just don’t.
not sure what you are talking about.

Quoted 2 lines

And have most shallow commit message to not even mention it.

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

Please be consistent in design approach.
And if you don’t want to be, stop asking others.

this SUSPEND/RESUME doesn't change since the RFC series, how can it not be inconsistent???

Quoted 2 lines

This is not the way TC collaboration works.
I probably shouldn’t even expect this from you.

Your proposal does not cover both the use cases of passthrough and non-

passthrough.

Quoted 3 lines

Yet you kept demanding them for others.
This is just wrong.

Quoted 8 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line

I am aware that both models as technical pros and cons.

Why this doesn't work? the device status byte has been working for many years, and do you know when guest freeze, the hypervisor owns the

device????

Quoted 1 line

When the guest is not frozen and during the pre-copy phase, hypervisor needs

to access the device (context, dirty pages).

Quoted 1 line

How does it work if the guest owns the device?

Have you seen PASID there?

PASID does not help because as explained virtio common config space and device specific config space is owned by the guest driver.

Secondly PASID space is also owned by the guest driver.

Quoted 24 lines
Quoted 16 lines
Quoted 16 lines
Quoted 8 lines
Quoted 8 lines
Quoted 6 lines

[1]
https://lists.oasis-open.org/archives/virtio-comment/202310/msg004
72
.h
tml

Please don't be so emotional and please be professional.

Quoted 7 lines
Quoted 3 lines

Why this solution can not work for pass-through? Do you know the device ownership will be transferred to the hypervisor when guest suspended in live migration?

I explained 5 reasons why it does not work in previous reply.

As the word indicates "live migration", the hypervisor needs to access the

device when it is "live" (not just after).

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Hence, passthrough mode must be able to capture the state of the device and

dirty pages database when its live.

Quoted 1 line

(and after the source is suspended).

No, the hypervisor should only collect dirty pages when the device alive.

It is needed during both the times.
When the device and guest is live during pre-copy phase. And after the device is frozen, to get the final round of pages.

Quoted 7 lines

With PASID, dirty page tracking facility can be isolated from the guest, means the hypervisor owns this facility. So the hypervisor can collect the dirty pages.

When the device suspended, it should report the last round of dirty pages through dirty page tracking facility as expected.

This can work, right?

Unfortunately no, as non atomic bitmap cannot reside in the host memory,
And whatever is in the device gets reset on device reset and/or FLR. So the dirty map detail is lost. Similarly the device context is also lost on these two events triggered by guest.

Quoted 10 lines
Quoted 6 lines
Quoted 5 lines

As you can see, the dirty page tracking facility has a PASID for isolation. But still, the question is, we should better use platform dirty page tracking

Nothing to do with PASID, as PASID is owned by the guest.

It looks you don't know how PASID work.

Host can setup PASID to isolate some facilities, right?

There are few limitations with PASID.
a. All platforms do not have PASID and
b. I explained above PASID do not work always as PASID only bifurcates DMA not the device _functionality_. c. PASID to be available to guest as_is what is present on the device

Quoted 7 lines
Quoted 6 lines
Quoted 5 lines

Then suspend the device after guest freeze, to stabilize the device status, then read the status.

How can you say this does not work???

I explained above.

see above

#86 lore raw

RE: [virtio-comment] Re: [PATCH V2 4/6] virtio-pci: implement VIRTIO_F_QUEUE_STATE

In reply to Zhu, Lingshan
Quoted 49 lines

From: Zhu, Lingshan <[email protected]>
Sent: Monday, November 6, 2023 2:57 PM

Quoted 44 lines · Parav Pandit
Quoted 44 lines

From: Zhu, Lingshan <[email protected]>
Sent: Monday, November 6, 2023 9:01 AM

Quoted 16 lines · Parav Pandit
Quoted 16 lines

From: [email protected] <[email protected] open.org> On Behalf Of Zhu, Lingshan
Sent: Friday, November 3, 2023 8:27 PM

Quoted 11 lines · Parav Pandit
Quoted 11 lines

From: Zhu Lingshan <[email protected]>
Sent: Friday, November 3, 2023 4:05 PM

This patch adds two new le16 fields to common configuration structure to support VIRTIO_F_QUEUE_STATE in PCI transport layer.

---
    transport-pci.tex | 18 ++++++++++++++++++
    1 file changed, 18 insertions(+)
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

transport-pci.tex \subsubsection{Common configuration

Quoted 5 lines
transport-pci.tex index renamed from transport-pci.tex +0 -0

a5c6719..3161519 100644

transport-pci.tex +0 -0
@@ -325,6 +325,10 @@ \subsubsection{Common configuration

structure

Quoted 18 lines
Quoted 10 lines
Quoted 10 lines

transport-pci.tex

Quoted 8 lines

layout}\label{sec:Virtio Transport
/* About the administration virtqueue. */
le16 admin_queue_index; /* read-only for driver */
le16 admin_queue_num; /* read-only for driver */

transport-pci.tex +4 -0
+
+	/* Virtqueue state */
+        le16 queue_avail_state;         /* read-write */
+        le16 queue_used_state;          /* read-write */

This tiny interface for 128 virtio net queues through register read writes, does

Quoted 5 lines

not work effectively.

Quoted 2 lines

There are inflight out of order descriptors for block also. Hence toy registers like this do not work.

Do you know there is a queue_select? Why this does not work? Do you know how other queue related fields work?

:)
Yes. If you notice queue_reset related critical spec bug fix was done when it

Quoted 8 lines
Quoted 6 lines
Quoted 5 lines

was introduced so that live migration can _actually_ work.

Quoted 2 lines

When queue_select is done for 128 queues serially, it take a lot of time to

read those slow register interface for this + inflight descriptors + more. interesting, virtio work in this pattern for many years, right?

All these years 400Gbps and 800Gbps virtio was not present, number of

queues were not in hw.
The registers are control path in config space, how 400G or 800G affect??

Because those are the one in practice requires large number of VQs.

You are asking per VQ register commands to modify things dynamically via this one vq at a time, serializing all the operations. It does not scale well with high q count.

Quoted 2 lines

See the virtio common cfg, you will find the max number of vqs is there, num_queues.

:)
Sure. those values at high q count affects.

Quoted 7 lines
Quoted 2 lines

Device didn’t support LM.
Many limitations existed all these years and TC is improving and expanding

them.

Quoted 1 line

So all these years do not matter.

Not sure what are you talking about, haven't we initialize the device and vqs in config space for years?????? What's wrong with this mechanism?
Are you questioning virito-pci fundamentals???

Don’t point to in-efficient past to establish similar in-efficient future.

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
Quoted 2 lines

Like how to set a queue size and enable it?

Those are meant to be used before DRIVER_OK stage as they are init time

registers.

Quoted 9 lines
Quoted 5 lines
Quoted 2 lines
Quoted 1 line

Not to keep abusing them..

don't you need to set queue_size at the destination side?

No.
But the src/dst does not matter.
Queue_size to be set before DRIVER_OK like rest of the registers, as all

queues must be created before the driver_ok phase.

Quoted 1 line

Queue_reset was last moment exception.

create a queue? Nvidia specific?

Huh. No.
Do git log and realize what happened with queue_reset.

Quoted 2 lines

For standard virtio, you need to read the number of enabled vqs at the source side, then enable them at the dst, so queue_size matters, not to create.

All that happens in the pre-copy phase.

#151 lore raw

[virtio-comment] RE: [PATCH V2 6/6] virtio-pci: implement dirty page tracking

In reply to Zhu, Lingshan
Quoted 74 lines

From: Zhu, Lingshan <[email protected]>
Sent: Monday, November 6, 2023 3:04 PM

Quoted 13 lines · Parav Pandit
Quoted 13 lines

From: Zhu, Lingshan <[email protected]>
Sent: Monday, November 6, 2023 9:22 AM

Quoted 7 lines · Parav Pandit
Quoted 7 lines

From: Zhu, Lingshan <[email protected]>
Sent: Friday, November 3, 2023 8:33 PM

Quoted 3 lines · Parav Pandit
Quoted 3 lines

From: Michael S. Tsirkin <[email protected]>
Sent: Friday, November 3, 2023 4:20 PM

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines · Zhu Lingshan

Review

Quoted 3 lines

+\item[\field{bitmap_addr}]

(quoted diff) +2 -0
+	The driver use this to set the address of the bitmap which
+records the

dirty pages

Review

Quoted 2 lines
(quoted diff) +2 -0
+	caused by the device.
+	Each bit in the bitmap represents one memory page, bit 0 in

the bitmap

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+	reprsents page 0 at address 0, bit 1 represents page 1, and so
+on in a

linear manner.

Review

Quoted 1 line
(quoted diff) +1 -0
+	When \field{enable} is set to 1 and the device writes to a

memory page,

Quoted 24 lines
Quoted 24 lines
Quoted 24 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+	the device MUST set the corresponding bit to 1 which
+indicating the

page is dirty.

Review

Quoted 10 lines

+\item[\field{bitmap_length}]

(quoted diff) +9 -0
+	The driver use this to set the length in bytes of the bitmap.
+\end{description}
+
+\devicenormative{\subsubsection}{Memory Dirty Pages Tracker
+Capability}{Virtio Transport Options / Virtio Over PCI Bus /
+Memory Dirty Pages Tracker Capability}
+
+The device MUST NOT set any bits beyond bitmap_length when
+reporting

dirty pages.

Quoted 8 lines
Quoted 4 lines
Quoted 3 lines

Review

Quoted 3 lines
(quoted diff) +3 -0
+
+To prevent a read-modify-write procedure, if a memory page is
+dirty,

It is not to prevent; it is just not possible to do racy RMW. 😊

if you understand what is a atomic routine, you will not call it racy.

Quoted 2 lines

Hence to work around you propose to mark all pages dirty. Too bad. This just does not work.

why? and this is optional.

Because device cannot set individual bits in atomic way for same byte read by

Quoted 8 lines
Quoted 8 lines

the cpu.

Quoted 6 lines

1. device read the byte that had bit 0 and 4 set.
2. cpu atomically clear these bits.
3. device wrote bits 0, 4, and new bits 2 and 3.
4. cpu now transferred page 0 and 4 again.

Optional thing also needs to work. :)

Do you know both CPU and device actually don't read bit, they read

bytes????

Quoted 10 lines

Yes. this is why atomic_OR is not possible on pcie.

Quoted 1 line

Do you know RC connected to memory controller????

Yes.

Quoted 1 line

Do you know there are locked transaction and atomic operations in PCI???

Can you explain how PCI does RMW locked transaction? Is it one TLP or multiple?

Quoted 2 lines

Do you know there are atomic read/write/clear even read and clear and so on in CPU ISA????

Quoted 7 lines
Quoted 2 lines

Read is always atomic from cpu.
I didn’t know about read_and_clear atomic ISA. This combined with pci future

support for atomic_or.

Quoted 1 line

If you already know a Linux kernel api for atomic_read_and_clear, please

share.
To answer all questions above, you should read PCI spec and CPU SDM, we don't copy and paste the content here, nobody develop their knowledge this way.

I read the pci spec and I see only 3 operations which does not have atomic or. I will try to find for the CPU instruction on read_and_clear that you suggested. Thanks for the suggestion.

Quoted 75 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines

Secondly the bitmap array is function is for full guest memory size, while

there is lot of sparce region now and also in future.

Quoted 1 line

This is the second problem.

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 1 line

did you see gra_power and its comments?

gra_power says the page size.
Not the sparce multiple ranges of the guest memory. Device endup tracking uninterested area as well.

increase gra_power can reduce bitmap size, right?
Totally up to the hypervisor, right?

Yes, and that can increase the amount of memory.
The way I understood is, if gra_power is 2MB, than whole 2MB page to be

considered dirty, even if 8KB was dirty.

Quoted 1 line

Did I understand it right?

Do you know DMA are very likely to write a neighbor page? Do you know why huge page is introduced?
Hint: not only for reduce TLB miss.

Quoted 17 lines
Quoted 17 lines
Quoted 17 lines
Quoted 17 lines
Quoted 3 lines

This is exactly why I asked you to review the page write recording series of

admin commands and comment.

Quoted 4 lines

And you never commented with sheer ignorance.

So clearly the start stop method for specific range and without bandwidth

explosion, admin commands of [1] stands better.

Quoted 2 lines

If you do [1] on the member device also using its AQ in future, it will work for

non-passthrough case.

Quoted 2 lines

If you build non-passthrough live migration using [1], also it will work. So I don’t see any point of this series anymore.

As Jason pointed out, there are many problems in your proposal, you should answer there. I don't need to repeat his words and duplicate the

Quoted 7 lines
Quoted 3 lines

discussions.

Quoted 1 line

Many are already addressed in v3.

interesting, does your V3 support nested?

Not directly.
Is it similar to cpu PML which does not supported nested.
One can always implement nested using some emulation.
The second option for high performance would be allow SR-IOV cap on the VF

and support true nesting using existing proposal of v3. If your proposal does not support nested, then it is incomplete.

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 7 lines
Quoted 6 lines

[1]
https://lists.oasis-open.org/archives/virtio-comment/202310/msg004
75
.h
tml

you still need to explain why this does not work for pass-through.

It does not work for following reasons.
1. Because all the fields that put on the member device are not in direct

Quoted 7 lines
Quoted 6 lines

control of the hypervisor.

Quoted 2 lines

The device is directly controlled by the guest including the device status and

when it resets the device all the things stored in the device are lost. have you seen PASID? and if the device reset, it has to forget everything as expected, right?

PASID does not help with the reset. Because as you told reset, resets

everything.

Quoted 1 line

PASID does not bifurcate the device common control which is not linked to any

PASID.
PASID means some facilities can be isolated. When reset, the device forget everything.

Quoted 9 lines
Quoted 9 lines
Quoted 2 lines

2. the PCI FLR is clearing all the registers you exposed here.

see above

Quoted 2 lines

3. Endless expansion of config registers of dirty tracking is not scalable, as they

are not init time registers not following the Appendix B guidelines. endless expansion?? It is a complete set of dirty page tracking, right???? have you see this cap only controls? The device DMA writes the bitmap, not by registers.

Quoted 6 lines
Quoted 1 line

Device dirty page tracking is start/stop command to be done by the

hypervisor.

Quoted 1 line

So when guest is resetting the device, it stopped the DMA initiated by the

hypervisor.

Quoted 1 line

This fundamentally breaks things.

Why? When device resets, do you want to keep tracking dirty pages????

Yes, when the device resets, before that event occurred, all the pages which were dirtied, must be migrated. And after reset also new page tracking to continue.

Quoted 74 lines
Quoted 14 lines
Quoted 14 lines

Again, if you want to fix Appendix B, OK.

Quoted 2 lines

4. bitmap based dirty tracking is not atomic between cpu and device. Hence, it is racy.

see above, the first reply.

Quoted 2 lines

5. All the device context needed for passthrough based hypervisor for a

device type specific is missing.

Quoted 5 lines

All of those can be used for non-passthrough as well.
[1]
https://lists.oasis-open.org/archives/virtio-comment/202311/msg00085
.h
tml

Quoted 4 lines
Quoted 2 lines

If you want to discuss this again, I don't want to wast time but only asking you whether you want to define virtio-fs device context

It will be defined in future.
And if virtio-fs was not written with migration in mind, may be one will invent

virtio-fs2.
don't say future, talk is cheap, show me the code.

Quoted 11 lines
Quoted 11 lines
Quoted 9 lines
Quoted 5 lines

And I
remember this is a point-less topic as MST ever wants to mute another
"pass- through" thread.

No. he did not say that.
He meant to not endlessly debate which one is better.
He clearly said, try to see if you can make multiple hypervisor model work. And your series shows a clear ignorance of his guidance.

Let me quote MST's reply here:
"I feel this discussion will keep meandering because the terminology is

vague.

Quoted 6 lines
Quoted 6 lines

There's no single thing that is called "passthrough" - vendors just build what is expedient with current hardware and software. Nvidia has a bunch of people working on vfio so they call that passthrough, Red Hat has people working on VDPA and they call that passthrough, etc.

Quoted 6 lines
Quoted 4 lines

Before I mute this discussion for good, does anyone here have any feeling progress is made? What kind of progress? "

So please don't discuss on pass-through anymore.

I don’t want to discuss the pros and cons of passthrough vs, vdpa, as usual. V3 covers broader use case of passthrough, hence once can always implement

trap+emulation instead of passthrough.

Quoted 1 line

V3 already indicates that other variants of the passthrough can be done as

well or can be extended.

Quoted 1 line

So please explore if that fits your vdpa need.

So, please no pass-through discussion anymore.

Quoted 25 lines
Quoted 25 lines

It seems only you need to develop the knowledge

Quoted 16 lines
Quoted 16 lines
Quoted 6 lines
Quoted 6 lines

Review

Quoted 3 lines
(quoted diff) +2 -0
+optionally the device is permitted to set the entire byte,
+which encompasses

the relevant bit, to 1.

Review

Quoted 2 lines
(quoted diff) +2 -0
+
+The device MAY increase \field{gra_power} to reduce

\field{bitmap_length}.

Quoted 9 lines
Quoted 9 lines

Review

Quoted 4 lines
(quoted diff) +4 -0
+
+The device must ignore any writes to \field{pasid} if PASID
+Extended Capability is absent or the PASID functionality is
+disabled in PASID Extended Capability

I have to say this is going to work very badly when the number of dirty pages is
small: you will end up scanning and re-scanning all of bitmap. And the resolution is apparently 8 pages? You have just multiplied the migration bandwidth by a factor of 8.

Quoted 6 lines
Quoted 5 lines
Quoted 3 lines

Yeah.
And device does not even know previously reported pages are read by driver

or not. All guess work game for driver and device. see my reply to him

Please see above reply.

see above

#152 lore raw

[virtio-comment] Re: [PATCH V2 6/6] virtio-pci: implement dirty page tracking

Quoted 1 line · Parav Pandit

I read the pci spec and I see only 3 operations which does not have atomic or.

CAS+retry can be used to implement any atomics including atomic or.

Signature · 18 lines
MST


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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/
#153 lore raw

[virtio-comment] RE: [PATCH V2 6/6] virtio-pci: implement dirty page tracking

Quoted 7 lines

From: Michael S. Tsirkin <[email protected]>
Sent: Monday, November 6, 2023 4:36 PM

Quoted 1 line · Parav Pandit

I read the pci spec and I see only 3 operations which does not have atomic or.

CAS+retry can be used to implement any atomics including atomic or.

Yes, we considered it. the PCI backpressure is lot that negates the value of such retries for such small transactions.

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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/

#160 lore raw

[virtio-comment] RE: [PATCH V2 6/6] virtio-pci: implement dirty page tracking

In reply to Zhu, Lingshan
Quoted 5 lines

From: Zhu, Lingshan <[email protected]>
Sent: Monday, November 6, 2023 3:04 PM

So, please no pass-through discussion anymore.

If you comment like this, nothing can progress.

What you are implying with above language is:
"hey a virtio can do live migration ONLY by creating vdpa device on top of ALREADY virtio device, and you get another virtio device by running through 3 layers of stack you get virtio device on other side!".

Then for sure, I disagree to it for 100% for such a single-minded design.

At least I am trying to propose if a solution can work for generic passthrough where least amount of hypervisor mediation is done.

And an extension where hypervisor has choice to more medication layers as it finds suitable. And if there are technical issues, may be two different interfaces or more admin commands needed for two modes. The idea is to attempt to converge and discuss those details, not the opposite.

Your above comment shows a clear sign of non-collaboration to make both mode works. At one point I may probably stop responding to your comments that repeatedly says:

"Go read QEMU code, Do you know what is PASID?, Do you know num_queues, Go read PCI spec"...

Taking deep breath now to do some productive work in TC...

#171 lore raw

[virtio-comment] RE: [PATCH V2 6/6] virtio-pci: implement dirty page tracking

In reply to Michael S. Tsirkin
Quoted 5 lines

From: Michael S. Tsirkin <[email protected]>
Sent: Monday, November 6, 2023 4:00 PM

On Mon, Nov 06, 2023 at 04:34:44AM +0000, Parav Pandit wrote:

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

Do you know there are locked transaction and atomic operations in PCI???

Can you explain how PCI does RMW locked transaction? Is it one TLP or multiple?

Parav what are you asking about here?

pcie supports CAS and Swap which likely
can work for this use-case - these are non posted writes. It's in the pcie spec.

PCI spec do not have atomic OR operation.
Lingshan in above comment suggested some unknown locked transaction and atomic operation. So I was asking him which is that atomic operation and how PCI does it?
I don't know if any that can do PCI atomic OR without a workaround.

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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/

#154 lore raw

[virtio-comment] Re: [PATCH V2 6/6] virtio-pci: implement dirty page tracking

In reply to Parav Pandit
Quoted 9 lines · Parav Pandit
Quoted 7 lines

From: Michael S. Tsirkin <[email protected]>
Sent: Monday, November 6, 2023 4:36 PM

Quoted 1 line · Parav Pandit

I read the pci spec and I see only 3 operations which does not have atomic or.

CAS+retry can be used to implement any atomics including atomic or.

Yes, we considered it. the PCI backpressure is lot that negates the value of such retries for such small transactions.

if there's some locality device can buffer these up maybe, though of course the chances of a failure increase then.

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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/

#172 lore raw

[virtio-comment] Re: [PATCH V2 6/6] virtio-pci: implement dirty page tracking

In reply to Parav Pandit
Quoted 9 lines · Parav Pandit
Quoted 9 lines

From: Michael S. Tsirkin <[email protected]>
Sent: Monday, November 6, 2023 4:00 PM

Quoted 3 lines · Parav Pandit
Quoted 1 line

Do you know there are locked transaction and atomic operations in PCI???

Can you explain how PCI does RMW locked transaction? Is it one TLP or multiple?

Quoted 8 lines
Quoted 4 lines

Parav what are you asking about here?

pcie supports CAS and Swap which likely
can work for this use-case - these are non posted writes. It's in the pcie spec.

PCI spec do not have atomic OR operation.
Lingshan in above comment suggested some unknown locked transaction and atomic operation. So I was asking him which is that atomic operation and how PCI does it?
I don't know if any that can do PCI atomic OR without a workaround.

Well this is not what you wrote - you asked about RMW and that's exactly what CAS does. Maybe you should take a bit more care writing then. Generally this discussion would benefit a lot if people stop shooting from the hip.

Signature · 18 lines
MST


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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/
#173 lore raw

[virtio-comment] RE: [PATCH V2 6/6] virtio-pci: implement dirty page tracking

Quoted 21 lines

From: Michael S. Tsirkin <[email protected]>
Sent: Monday, November 6, 2023 4:58 PM

Quoted 6 lines · Parav Pandit
Quoted 6 lines

From: Michael S. Tsirkin <[email protected]>
Sent: Monday, November 6, 2023 4:00 PM

Quoted 1 line · Parav Pandit
Quoted 1 line

Do you know there are locked transaction and atomic operations in

PCI???

Quoted 9 lines
Quoted 7 lines
Quoted 2 lines

Can you explain how PCI does RMW locked transaction? Is it one TLP or multiple?

Parav what are you asking about here?

pcie supports CAS and Swap which likely can work for this use-case - these are non posted writes. It's in the pcie spec.

PCI spec do not have atomic OR operation.
Lingshan in above comment suggested some unknown locked transaction and

Quoted 8 lines

atomic operation.

Quoted 2 lines

So I was asking him which is that atomic operation and how PCI does it? I don't know if any that can do PCI atomic OR without a workaround.

Well this is not what you wrote - you asked about RMW and that's exactly what CAS does.
Maybe you should take a bit more care writing then. Generally this discussion would benefit a lot if people stop shooting from the hip.

Yes. I will take more care. Thanks.

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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/

#184 lore raw
In reply to Zhu Lingshan
Quoted 11 lines · Zhu Lingshan

This series introduces basic facilities to support virtio live migration, includes:

1)a new SUSPEND bit in the device status
Which is used to suspend the device, so that the device states and virtqueue states are stabilized.

2)virtqueue state and its accessor, to get and set last_avail_idx and last_used_idx of virtqueues.

3)dirty page tracking

So looking at this from 100ft:
- SUSPEND bit looks like something that might have value as a generic component. For example, maybe for NUMA balancing we could suspend, quickly copy ring to a different node and resume. However current restrictions make it very limited, e.g. apparently you can't change config space while suspended.
As another example, changing config while suspended might be needed e.g. for net announcements.
Also, do we want to suspend individual
queues then? what exactly happens with config changes while suspended that would happen otherwise is also unclear. Also as is, proposal is very light on detail. Other patches in the series make it look like there are more assumptions made about e.g. how vq enters the suspended state.

- virtqueue state proposal looks very vague. A couple of 16 bit indices are insufficient to fully describe internal vq state at an arbitrary time. Some assumptions seem to be made that make this possible and yes, these would need to be stated and/or lifted. Preferably lifted since another use-case proposed was debugging - you do not, while debugging, want to depend on device following a complex set of assumptions.

- dirty page tracking as described does not seem practical for
many systems. increasing page size x8 is just being nasty
towards other network users. CAS + retry could be a solution,
but this needs to be documented thoroughly then and it appears this is not what author expects to implement anyway - instead, there's an assumption that platform itself
will support dirty tracking. By itself, this is not
an impossible assumption - will possibly result in a cheaper,
slower device. why not have an option like this?
I would probably just drop it from this proposal completely.
Also, tracking memory on the device means we'll lose state
around reset. Solving that could be tricky. Finally,
dependence on PASID can not be removed apparently.
So maybe, people who want to track memory changes on the
device itself should just bite the bullet and use
admin vq in the PF.

Signature · 18 lines
MST


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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/
#9 lore raw

[virtio-comment] Re: [PATCH V2 1/6] virtio: introduce virtqueue state

In reply to Michael S. Tsirkin
Quoted 22 lines · Michael S. Tsirkin
Quoted 21 lines · Lingshan
Quoted 19 lines · Michael S. Tsirkin
Quoted 7 lines · Lingshan

+When SUSPEND is set, the device MUST record the Available State of every enabled splited virtqueue +in \field{Available State} field,
+and correspondingly restore the Available State of every enabled splited virtqueue +from \field{Available State} field when DRIVER_OK is set.
+
+The device SHOULD reset \field{Available State} field upon a device reset.

Quoted 8 lines

At this point I have no idea
- how can a state of a virtqueue at a random time be represented by a 16 bit integer

not sure what is a random time, this is to request the device to reset its avail state, for example, it is "le16 queue_avail_state" in virtio-pci common cfg. Resetting this so the device will not recover from a wrong value of the last run.

You simply never bother to say what is "Available State" and what does it mean to restore it. Not to mention words like "splited" which just adds to the confusion.

Quoted 7 lines
Quoted 6 lines

It says:

(quoted diff) +2 -0
+The available state field is two bytes of virtqueue state that is used by
+the device to read the next available buffer. It is presented in the

following format:

Do you want me to add more descriptions?

maybe start with an example

I think they are already in the spec, I can add:
see also "2.7.6 The Virtqueue Available Ring" and "2.7.13.1 Placing Buffers Into The Descriptor Table"

Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 6 lines

- if it's not at a random time then why do you even need an integer - synchronize queue to memory and then all state is in memory

Not sure what is a sync queue, but for example, "le16 queue_avail_state" for PCI transport exists in a cap.

I just point out that normally a lot of ring state is in memory. So you need to be much more specific about how you are augmenting that. For example, if buffers are used exactly in order for a split ring then used index seems to be exactly the same as last available index you describe - it's a free running counter. OTOH if they are not used in order then I don't see how is a single index sufficient to describe which ones have been used and which not.

Quoted 5 lines
Quoted 4 lines

I am not sure I get it.

Used idx(not like packed vq, no over-writing descriptors) and other states are in guest memory, so migrated with guest migration.

yes and so? why is that not enough and what is this available state then?

The spec has illustrated how available index work and has given an example(see above cited sections) And this patch even has given a more clear description for it.

Other states are in guest memory and migrated with guest memory.

Quoted 1 line

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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/

#20 lore raw

Re: [virtio-comment] RE: [PATCH V2 2/6] virtio: introduce SUSPEND bit in device status

In reply to Parav Pandit
Quoted 51 lines · Parav Pandit
Quoted 51 lines

From: Zhu, Lingshan <[email protected]>
Sent: Monday, November 6, 2023 2:51 PM

Quoted 47 lines · Parav Pandit
Quoted 47 lines

From: Zhu, Lingshan <[email protected]>
Sent: Monday, November 6, 2023 9:00 AM

Quoted 28 lines · Parav Pandit
Quoted 28 lines

From: Zhu, Lingshan <[email protected]>
Sent: Friday, November 3, 2023 8:25 PM

Quoted 5 lines · Parav Pandit
Quoted 5 lines

From: Zhu Lingshan <[email protected]>
Sent: Friday, November 3, 2023 4:05 PM

This patch introduces a new status bit in the device status: SUSPEND.

Quoted 8 lines
Quoted 7 lines

This SUSPEND bit can be used by the driver to suspend a device, in order to stabilize the device states and virtqueue states.

Its main use case is live migration.

You constantly complained that whatever was proposed using admin

commands method in [1] must work for passthrough and non-passthrough.

Quoted 2 lines

And halfway in the discussion you propose a method after learning all the

limitations of in-band, you propose a solution only works for non-passthrough mode.

Quoted 2 lines

You asked someone to have comprehensive proposal and when it comes to

you following it, you just don’t.
not sure what you are talking about.

Quoted 2 lines

And have most shallow commit message to not even mention it.

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

Please be consistent in design approach.
And if you don’t want to be, stop asking others.

this SUSPEND/RESUME doesn't change since the RFC series, how can it not be inconsistent???

Quoted 2 lines

This is not the way TC collaboration works.
I probably shouldn’t even expect this from you.

Your proposal does not cover both the use cases of passthrough and non-

passthrough.

Quoted 4 lines

Yet you kept demanding them for others.
This is just wrong.

I am aware that both models as technical pros and cons.

Why this doesn't work? the device status byte has been working for many years, and do you know when guest freeze, the hypervisor owns the

Quoted 8 lines
Quoted 5 lines

device????

Quoted 1 line

When the guest is not frozen and during the pre-copy phase, hypervisor needs

to access the device (context, dirty pages).

Quoted 1 line

How does it work if the guest owns the device?

Have you seen PASID there?

PASID does not help because as explained virtio common config space and device specific config space is owned by the guest driver.

Secondly PASID space is also owned by the guest driver.

hypervisor sets a PASID to isolate the cap.

Quoted 24 lines
Quoted 24 lines
Quoted 24 lines
Quoted 13 lines
Quoted 13 lines
Quoted 11 lines
Quoted 6 lines

[1]
https://lists.oasis-open.org/archives/virtio-comment/202310/msg004
72
.h
tml

Please don't be so emotional and please be professional.

Why this solution can not work for pass-through? Do you know the device ownership will be transferred to the hypervisor when guest suspended in live migration?

I explained 5 reasons why it does not work in previous reply.

Quoted 8 lines
Quoted 2 lines

As the word indicates "live migration", the hypervisor needs to access the

device when it is "live" (not just after).

Quoted 2 lines

Hence, passthrough mode must be able to capture the state of the device and

dirty pages database when its live.

Quoted 1 line

(and after the source is suspended).

No, the hypervisor should only collect dirty pages when the device alive.

It is needed during both the times.
When the device and guest is live during pre-copy phase. And after the device is frozen, to get the final round of pages.

Quoted 8 lines
Quoted 7 lines

With PASID, dirty page tracking facility can be isolated from the guest, means the hypervisor owns this facility. So the hypervisor can collect the dirty pages.

When the device suspended, it should report the last round of dirty pages through dirty page tracking facility as expected.

This can work, right?

Unfortunately no, as non atomic bitmap cannot reside in the host memory,

as explained before, PCI and CPU supports atomic read/write. Please refer to PCI spec and CPU ISA.

Quoted 2 lines

And whatever is in the device gets reset on device reset and/or FLR. So the dirty map detail is lost. Similarly the device context is also lost on these two events triggered by guest.

we explained before, when reset, the device should clear everything.

Quoted 10 lines
Quoted 8 lines
Quoted 6 lines
Quoted 5 lines

As you can see, the dirty page tracking facility has a PASID for isolation. But still, the question is, we should better use platform dirty page tracking

Nothing to do with PASID, as PASID is owned by the guest.

It looks you don't know how PASID work.
Host can setup PASID to isolate some facilities, right?

There are few limitations with PASID.
a. All platforms do not have PASID and

As we have explained for many times, this is a basic facility, and the implementation is transport-specific.

We given an example of PCI implementation, and PCI support PASID, right?

Quoted 1 line

b. I explained above PASID do not work always as PASID only bifurcates DMA not the device _functionality_.

With a PASID, a cap can be considered to be placed in another logical address space, which is not accessible to the guest.

Quoted 1 line

c. PASID to be available to guest as_is what is present on the device

host hypervisor sets the PASID, transparent to the guest.

Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
Quoted 5 lines

Then suspend the device after guest freeze, to stabilize the device status, then read the status.

How can you say this does not work???

I explained above.

see above

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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/

#10 lore raw

[virtio-comment] Re: [PATCH V2 1/6] virtio: introduce virtqueue state

In reply to Zhu, Lingshan
Quoted 50 lines · Lingshan
Quoted 22 lines · Michael S. Tsirkin
Quoted 21 lines · Lingshan
Quoted 19 lines · Michael S. Tsirkin
Quoted 7 lines · Lingshan

+When SUSPEND is set, the device MUST record the Available State of every enabled splited virtqueue +in \field{Available State} field,
+and correspondingly restore the Available State of every enabled splited virtqueue +from \field{Available State} field when DRIVER_OK is set.
+
+The device SHOULD reset \field{Available State} field upon a device reset.

Quoted 8 lines

At this point I have no idea
- how can a state of a virtqueue at a random time be represented by a 16 bit integer

not sure what is a random time, this is to request the device to reset its avail state, for example, it is "le16 queue_avail_state" in virtio-pci common cfg. Resetting this so the device will not recover from a wrong value of the last run.

You simply never bother to say what is "Available State" and what does it mean to restore it. Not to mention words like "splited" which just adds to the confusion.

Quoted 7 lines
Quoted 6 lines

It says:

(quoted diff) +2 -0
+The available state field is two bytes of virtqueue state that is used by
+the device to read the next available buffer. It is presented in the

following format:

Do you want me to add more descriptions?

maybe start with an example

I think they are already in the spec, I can add:
see also "2.7.6 The Virtqueue Available Ring" and "2.7.13.1 Placing Buffers Into The Descriptor Table"

Quoted 15 lines
Quoted 15 lines
Quoted 6 lines
Quoted 6 lines

- if it's not at a random time then why do you even need an integer - synchronize queue to memory and then all state is in memory

Not sure what is a sync queue, but for example, "le16 queue_avail_state" for PCI transport exists in a cap.

Quoted 7 lines

I just point out that normally a lot of ring state is in memory. So you need to be much more specific about how you are augmenting that. For example, if buffers are used exactly in order for a split ring then used index seems to be exactly the same as last available index you describe - it's a free running counter. OTOH if they are not used in order then I don't see how is a single index sufficient to describe which ones have been used and which not.

I am not sure I get it.

Quoted 8 lines
Quoted 3 lines
Quoted 2 lines

Used idx(not like packed vq, no over-writing descriptors) and other states are in guest memory, so migrated with guest migration.

yes and so? why is that not enough and what is this available state then?

The spec has illustrated how available index work and has given an example(see above cited sections)
And this patch even has given a more clear description for it.

Other states are in guest memory and migrated with guest memory.

Yea I wrote large parts of it and I know how the available index works.

And sorry no idea what you are talking about.

At any time, there can be up to 2^16 buffers that have been made available, and a random subset of these have been used. There is no chance in the world a single 16 bit index describes even that part of state, never mind device type specific processing that might be going on.

As a wild guest this proposal is making a bunch of unstated assumptions about device being in a very specific state where this *is* possible. For people to be able to implement devices and drivers these need to be spelled out.

Signature · 18 lines
MST


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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/
#21 lore raw

Re: [virtio-comment] RE: [PATCH V2 2/6] virtio: introduce SUSPEND bit in device status

In reply to Zhu, Lingshan
Quoted 4 lines · Lingshan
Quoted 2 lines
Quoted 1 line

This can work, right?

Unfortunately no, as non atomic bitmap cannot reside in the host memory,

as explained before, PCI and CPU supports atomic read/write. Please refer to PCI spec and CPU ISA.

I don't see how atomic read or write does anything useful here but maybe. You need to explain how you are using atomics in your proposal then.

Quoted 3 lines
Quoted 2 lines

And whatever is in the device gets reset on device reset and/or FLR. So the dirty map detail is lost. Similarly the device context is also lost on these two events triggered by guest.

we explained before, when reset, the device should clear everything.

then migration will corrupt memory. Not great.

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines

As you can see, the dirty page tracking facility has a PASID for isolation. But still, the question is, we should better use platform dirty page tracking

Nothing to do with PASID, as PASID is owned by the guest.

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

It looks you don't know how PASID work.
Host can setup PASID to isolate some facilities, right?

There are few limitations with PASID.
a. All platforms do not have PASID and

As we have explained for many times, this is a basic facility, and the implementation is transport-specific.

We given an example of PCI implementation, and PCI support PASID, right?

Yes it's a limitation but maybe one we can live with for this feature. It does mean that we might need solutions for systems without this support. virtio use is not limited to servers or high end systems.

Quoted 5 lines
Quoted 1 line

b. I explained above PASID do not work always as PASID only bifurcates DMA not the device _functionality_.

With a PASID, a cap can be considered to be placed in another logical address space, which is not accessible to the guest.

Quoted 1 line

c. PASID to be available to guest as_is what is present on the device

host hypervisor sets the PASID, transparent to the guest.

Lingshan whenever people ask you a ton of questions in response to your spec proposal then respose should not be to simply
answer on the mailing list and then repost without a lot of changes since spec readers will likely have questions exactly like these and we can not make them go and read this flame war.
And frankly, most of this TC stopped following this thread a while ago, it seems to be going nowhere.
The response should be to add the explanation in the spec.
Look at Parav's live migration proposals with "theory of operation" chapters for an example of how this can be done.

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
Quoted 5 lines

Then suspend the device after guest freeze, to stabilize the device status, then read the status.

How can you say this does not work???

I explained above.

see above

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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/

#25 lore raw

Re: [virtio-comment] Re: [PATCH V2 2/6] virtio: introduce SUSPEND bit in device status

In reply to Michael S. Tsirkin
Quoted 21 lines · Michael S. Tsirkin
Quoted 20 lines · Zhu Lingshan

This patch introduces a new status bit in the device status: SUSPEND.

This SUSPEND bit can be used by the driver to suspend a device, in order to stabilize the device states and virtqueue states.

Its main use case is live migration.

---
  content.tex | 36 ++++++++++++++++++++++++++++++++++--
  1 file changed, 34 insertions(+), 2 deletions(-)
content.tex +0 -0
index 76813b5..bcc9d4b 100644
@@ -49,6 +49,10 @@ \section{\field{Device Status} Field}\label{sec:Basic Facilities of a Virtio Dev
 
Quoted 7 lines

content.tex \section{\field{Device Status} Field}\label{sec:Basic Facilities of a Virtio Dev · line 55

Quoted 6 lines
content.tex +4 -0
  \item[DEVICE_NEEDS_RESET (64)] Indicates that the device has experienced
    an error from which it can't recover.
+
+\item[SUSPEND (16)] When VIRTIO_F_SUSPEND is negotiated, indicates that the
+  device has been suspended by the driver.
+

what does this mean?

When the driver sets SUSPEND and the device presents SUSPEND, means the device has been suspended by the driver.

Do you suggest to remove "When VIRTIO_F_SUSPEND is negotiated"

Quoted 8 lines
Quoted 8 lines
content.tex +0 -0
  \end{description}
 
  The \field{device status} field starts out as 0, and is reinitialized to 0 by
@@ -73,6 +77,10 @@ \section{\field{Device Status} Field}\label{sec:Basic Facilities of a Virtio Dev
  recover by issuing a reset.
  \end{note}
 
Quoted 5 lines

content.tex \section{\field{Device Status} Field}\label{sec:Basic Facilities of a Virtio Dev · line 83

Quoted 4 lines
content.tex +4 -0
+The driver SHOULD NOT set SUSPEND if FEATURES_OK is not set.
+
+When setting SUSPEND, the driver MUST re-read \field{device status} to ensure the SUSPEND bit is set.
+

and if it's not?

Then the device may run into errors or just need longer time to suspend.

This is how we handle features_OK: "Re-read device status to ensure the FEATURES_OK bit is still set"

Quoted 8 lines
Quoted 8 lines
content.tex +0 -0
  \devicenormative{\subsection}{Device Status Field}{Basic Facilities of a Virtio Device / Device Status Field}
 
  The device MUST NOT consume buffers or send any used buffer
@@ -82,6 +90,26 @@ \section{\field{Device Status} Field}\label{sec:Basic Facilities of a Virtio Dev
  that a reset is needed.  If DRIVER_OK is set, after it sets DEVICE_NEEDS_RESET, the device
  MUST send a device configuration change notification to the driver.
 
Quoted 6 lines

content.tex \section{\field{Device Status} Field}\label{sec:Basic Facilities of a Virtio Dev · line 97

Quoted 5 lines
content.tex +5 -0
+The device MUST ignore SUSPEND if FEATURES_OK is not set.
+
+The device MUST ignore SUSPEND if VIRTIO_F_SUSPEND is not negotiated.
+
+The device SHOULD allow settings to \field{device status} even when SUSPEND is set.

which settings?

any legit writing to the device status, like DRIVER_OK

Quoted 11 lines

content.tex \section{\field{Device Status} Field}\label{sec:Basic Facilities of a Virtio Dev · line 106

Quoted 10 lines
content.tex +9 -0
+
+If VIRTIO_F_SUSPEND is negotiated and SUSPEND is set, the device SHOULD clear SUSPEND
+and resumes operation upon DRIVER_OK.
+
+If VIRTIO_F_SUSPEND is negotiated, when the driver sets SUSPEND,
+the device SHOULD perform the following actions before presenting SUSPEND bit in the \field{device status}:
+
+\begin{itemize}
+\item Stop consuming buffers of any virtqueues and mark all finished descritors as used.

descritors? and what does finished mean?

Sorry my typo.

Finished means done processing it.

Like the spec words: When the device has finished a buffer, it writes the descriptor index into the used ring, and sends a used buffer notification.

Quoted 5 lines

content.tex \section{\field{Device Status} Field}\label{sec:Basic Facilities of a Virtio Dev · line 107

Quoted 2 lines
content.tex +1 -0
+\item Wait until all descriptors that being processed to finish and mark them as used.

descriptors are not marked used. buffers are.

that being -> that are being maybe?

Will fix

Quoted 3 lines

content.tex \section{\field{Device Status} Field}\label{sec:Basic Facilities of a Virtio Dev · line 108

Quoted 2 lines
content.tex +1 -0
+\item Flush all used buffer and send used buffer notifications to the driver.

used buffers?

Here it means the buffer marked as used. shall I use finished buffer or any other suggestions?

Quoted 1 line

what does Flush mean?

Flush means send all of them out. Like 5.19.7.1 Device Requirements: Device Operation: Virtqueue flush

Quoted 4 lines

content.tex \section{\field{Device Status} Field}\label{sec:Basic Facilities of a Virtio Dev · line 109

Quoted 2 lines
content.tex +1 -0
+\item Record Virtqueue State of each enabled virtqueue, see section \ref{sec:Virtqueues / Virtqueue State}

execpt that one unfortunately does not bother to say what does this mean :(

The virtqueue state has been defined in this series, in packed/split-ring.tex. And an PCI implementation of the interfaces is included.

Do you suggest any supplementary materials?

Quoted 3 lines

content.tex \section{\field{Device Status} Field}\label{sec:Basic Facilities of a Virtio Dev · line 110

Quoted 2 lines
content.tex +1 -0
+\item Pause its operation except \field{device status} and preserve configurations in its Device Configuration Space, see \ref{sec:Basic Facilities of a Virtio Device / Device Configuration Space}

How do you Pause? For example, consider a link state register. You set

The device pauses itself.

Quoted 1 line

SUSPEND, then link goes down. What is device supposed to do?

Once the device suspended, the device should not respond to the link_down until alive again. This is to preserve the device states, just record whatever it is when SUSPEND-ed. And process the signal when resume or alive at the destination side. At the destination it also needs a live announce which require an active link.

Quoted 3 lines

Record this somewhere internal but do not show it to driver? And how exactly will this hidden internal state be migrated since it is not visible?

May I know what kind of internal states?
This series migrates stateless devices, hard to define virtio-fs device context.

Quoted 19 lines
Quoted 19 lines
content.tex +4 -2
+\end{itemize}
+
  \section{Feature Bits}\label{sec:Basic Facilities of a Virtio Device / Feature Bits}
 
  Each virtio device offers all the features it understands.  During
@@ -99,10 +127,10 @@ \section{Feature Bits}\label{sec:Basic Facilities of a Virtio Device / Feature B
  \begin{description}
  \item[0 to 23, and 50 to 127] Feature bits for the specific device type
 
-\item[24 to 42] Feature bits reserved for extensions to the queue and
+\item[24 to 43] Feature bits reserved for extensions to the queue and
    feature negotiation mechanisms
 
-\item[43 to 49, and 128 and above] Feature bits reserved for future extensions.
+\item[44 to 49, and 128 and above] Feature bits reserved for future extensions.
  \end{description}
 
Quoted 8 lines

content.tex \chapter{Reserved Feature Bits}\label{sec:Reserved Feature Bits} · line 907

Quoted 7 lines
content.tex +2 -0
  \begin{note}
@@ -875,6 +903,10 @@ \chapter{Reserved Feature Bits}\label{sec:Reserved Feature Bits}
    \item[VIRTIO_F_QUEUE_STATE(42)] This feature indicates that the device allows the driver
    to access its internal virtqueue state.
 
+  \item[VIRTIO_F_SUSPEND(43)] This feature indicates that the driver can
+   SUSPEND the device.

why is SUSPEND upper-case here?

will be lower in V3.

Thanks

Quoted 25 lines
Quoted 8 lines
content.tex +2 -0
+   See \ref{sec:Basic Facilities of a Virtio Device / Device Status Field}.
+
  \end{description}
 
  \drivernormative{\section}{Reserved Feature Bits}{Reserved Feature Bits}
Signature · 1 line
2.35.3

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:[email protected] Unsubscribe:[email protected]
List help:[email protected]
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/

#22 lore raw

Re: [virtio-comment] RE: [PATCH V2 2/6] virtio: introduce SUSPEND bit in device status

In reply to Michael S. Tsirkin
Quoted 6 lines · Michael S. Tsirkin
Quoted 4 lines · Lingshan
Quoted 2 lines
Quoted 1 line

This can work, right?

Unfortunately no, as non atomic bitmap cannot reside in the host memory,

as explained before, PCI and CPU supports atomic read/write. Please refer to PCI spec and CPU ISA.

I don't see how atomic read or write does anything useful here but maybe.

Because the device writs the bitmap and the driver "read and clear" the bitmap, so the ops need to be atomic, or they can run into race.

Quoted 1 line

You need to explain how you are using atomics in your proposal then.

Not sure we should talk about much of how atomic works, as explained above the operations should be atomic to avoid race conditions or losing information. Like:

1) Device Read
2) Device Write
3) Device Clear

Here we lost the bitmap information.

Quoted 6 lines
Quoted 5 lines
Quoted 4 lines

And whatever is in the device gets reset on device reset and/or FLR. So the dirty map detail is lost. Similarly the device context is also lost on these two events triggered by guest.

we explained before, when reset, the device should clear everything.

then migration will corrupt memory. Not great.

I think when reset, the device should clear everything, therefore the driver should clear the legacy data as well, don't know how corrupt

Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 10 lines
Quoted 8 lines
Quoted 7 lines

As you can see, the dirty page tracking facility has a PASID for isolation. But still, the question is, we should better use platform dirty page tracking

Nothing to do with PASID, as PASID is owned by the guest.

It looks you don't know how PASID work.
Host can setup PASID to isolate some facilities, right?

There are few limitations with PASID.
a. All platforms do not have PASID and

Quoted 8 lines
Quoted 4 lines

As we have explained for many times, this is a basic facility, and the implementation is transport-specific.

We given an example of PCI implementation, and PCI support PASID, right?

Yes it's a limitation but maybe one we can live with for this feature. It does mean that we might need solutions for systems without this support. virtio use is not limited to servers or high end systems.

PASID has been introduced years ago and I know some vendors implemented onboard IOMMU can also do isolating.

And this is a basic facility, the implementation is transport specific.

Quoted 5 lines
Quoted 5 lines
Quoted 3 lines

b. I explained above PASID do not work always as PASID only bifurcates DMA not the device _functionality_.

With a PASID, a cap can be considered to be placed in another logical address space, which is not accessible to the guest.

Quoted 7 lines
Quoted 2 lines
Quoted 1 line

c. PASID to be available to guest as_is what is present on the device

host hypervisor sets the PASID, transparent to the guest.

Lingshan whenever people ask you a ton of questions in response to your spec proposal then respose should not be to simply answer on the mailing list and then repost without a lot of changes since spec readers will likely have questions exactly like these and we can not make them go and read this flame war.

Well, I should say, I have repeated the same answers for too many times.

Quoted 2 lines

And frankly, most of this TC stopped following this thread a while ago, it seems to be going nowhere.

I still believe we should release the best quality of spec as we can.

Quoted 3 lines

The response should be to add the explanation in the spec.
Look at Parav's live migration proposals with "theory of operation" chapters for an example of how this can be done.

I am not sure we should talk how PCI work in virtio spec. But I can add "pasid for isolation"

These facilities are not only used for live migration, can also work for debugging. Like suspend then read vq state.

I can add more explanation in the cover letter

Quoted 15 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
Quoted 5 lines

Then suspend the device after guest freeze, to stabilize the device status, then read the status.

How can you say this does not work???

I explained above.

see above

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.

Quoted 9 lines

Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/

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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/

#30 lore raw

[virtio-comment] Re: [PATCH V2 3/6] virtio: dont reset vqs when SUSPEND

In reply to Michael S. Tsirkin
Quoted 18 lines · Michael S. Tsirkin
Quoted 17 lines · Zhu Lingshan

When SUSPEND is set, device states and virtqueue states should be stablized, therefore the driver should not reset vqs when SUSPEND is set in device status.

---
  content.tex | 3 +++
  1 file changed, 3 insertions(+)
content.tex +0 -0
index bcc9d4b..060b5c2 100644
@@ -444,6 +444,9 @@ \subsubsection{Virtqueue Reset}\label{sec:Basic Facilities of a Virtio Device /
  The device MUST reset any state of a virtqueue to the default state,
  including the available state and the used state.
 
Quoted 8 lines

content.tex \subsubsection{Virtqueue Reset}\label{sec:Basic Facilities of a Virtio Device / · line 452

Quoted 6 lines
content.tex +3 -0
+If VIRTIO_F_SUSPEND is negotiated and SUSPEND is set in \field{device status},
+the driver SHOULD NOT reset any virtqueues.
+
  \drivernormative{\paragraph}{Virtqueue Reset}{Basic Facilities of a Virtio Device / Virtqueues / Virtqueue Reset / Virtqueue Reset}
 
  After the driver tells the device to reset a queue, the driver MUST verify that

Seems somewhat arbitrary and breaks the claim that the feature is orthogonal and can have uses besides migration.

when suspended, the device is frozen.
The driver is aware of this process and so should not reset the vqs I think.

Quoted 5 lines
Quoted 5 lines
Signature · 2 lines
-- 
2.35.3

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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/

#87 lore raw

Re: [virtio-comment] Re: [PATCH V2 4/6] virtio-pci: implement VIRTIO_F_QUEUE_STATE

In reply to Parav Pandit
Quoted 53 lines · Parav Pandit
Quoted 53 lines

From: Zhu, Lingshan <[email protected]>
Sent: Monday, November 6, 2023 2:57 PM

Quoted 49 lines · Parav Pandit
Quoted 49 lines

From: Zhu, Lingshan <[email protected]>
Sent: Monday, November 6, 2023 9:01 AM

Quoted 16 lines · Parav Pandit
Quoted 16 lines

From: [email protected] <[email protected] open.org> On Behalf Of Zhu, Lingshan
Sent: Friday, November 3, 2023 8:27 PM

Quoted 11 lines · Parav Pandit
Quoted 11 lines

From: Zhu Lingshan <[email protected]>
Sent: Friday, November 3, 2023 4:05 PM

This patch adds two new le16 fields to common configuration structure to support VIRTIO_F_QUEUE_STATE in PCI transport layer.

---
     transport-pci.tex | 18 ++++++++++++++++++
     1 file changed, 18 insertions(+)
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

transport-pci.tex \subsubsection{Common configuration

Quoted 5 lines
transport-pci.tex index renamed from transport-pci.tex +0 -0

a5c6719..3161519 100644

transport-pci.tex +0 -0
@@ -325,6 +325,10 @@ \subsubsection{Common configuration

structure

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

transport-pci.tex

Quoted 8 lines

layout}\label{sec:Virtio Transport
/* About the administration virtqueue. */
le16 admin_queue_index; /* read-only for driver */
le16 admin_queue_num; /* read-only for driver */

transport-pci.tex +4 -0
+
+	/* Virtqueue state */
+        le16 queue_avail_state;         /* read-write */
+        le16 queue_used_state;          /* read-write */

This tiny interface for 128 virtio net queues through register read writes, does

Quoted 8 lines
Quoted 5 lines

not work effectively.

Quoted 2 lines

There are inflight out of order descriptors for block also. Hence toy registers like this do not work.

Do you know there is a queue_select? Why this does not work? Do you know how other queue related fields work?

:)
Yes. If you notice queue_reset related critical spec bug fix was done when it

was introduced so that live migration can _actually_ work.

Quoted 2 lines

When queue_select is done for 128 queues serially, it take a lot of time to

read those slow register interface for this + inflight descriptors + more. interesting, virtio work in this pattern for many years, right?

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

All these years 400Gbps and 800Gbps virtio was not present, number of

queues were not in hw.
The registers are control path in config space, how 400G or 800G affect??

Because those are the one in practice requires large number of VQs.

You are asking per VQ register commands to modify things dynamically via this one vq at a time, serializing all the operations. It does not scale well with high q count.

This is not dynamically, it only happens when SUSPEND and RESUME.
This is the same mechanism how virtio initialize a virtqueue, working for many years.

Quoted 4 lines
Quoted 2 lines

See the virtio common cfg, you will find the max number of vqs is there, num_queues.

:)
Sure. those values at high q count affects.

the driver need to initialize them anyway.

Quoted 9 lines
Quoted 8 lines
Quoted 3 lines

Device didn’t support LM.
Many limitations existed all these years and TC is improving and expanding

them.

Quoted 1 line

So all these years do not matter.

Not sure what are you talking about, haven't we initialize the device and vqs in config space for years?????? What's wrong with this mechanism?
Are you questioning virito-pci fundamentals???

Don’t point to in-efficient past to establish similar in-efficient future.

interesting, you know this is a one-time thing, right? and you are aware of this has been there for years.

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Like how to set a queue size and enable it?

Those are meant to be used before DRIVER_OK stage as they are init time

registers.

Quoted 1 line

Not to keep abusing them..

don't you need to set queue_size at the destination side?

No.
But the src/dst does not matter.
Queue_size to be set before DRIVER_OK like rest of the registers, as all

Quoted 6 lines
Quoted 4 lines

queues must be created before the driver_ok phase.

Quoted 1 line

Queue_reset was last moment exception.

create a queue? Nvidia specific?

Huh. No.
Do git log and realize what happened with queue_reset.

You didn't answer the question, does the spec even has defined "create a vq"?

Quoted 4 lines
Quoted 3 lines

For standard virtio, you need to read the number of enabled vqs at the source side, then enable them at the dst, so queue_size matters, not to create.

All that happens in the pre-copy phase.

Yes and how your answer related to this discussion?

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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/

#131 lore raw

Re: [virtio-comment] Re: [PATCH V2 6/6] virtio-pci: implement dirty page tracking

In reply to Michael S. Tsirkin
Quoted 42 lines · Michael S. Tsirkin
Quoted 34 lines · Lingshan
Quoted 22 lines · Lingshan
Quoted 12 lines · Michael S. Tsirkin
Quoted 11 lines · Zhu Lingshan

+\begin{lstlisting}
+struct virtio_pci_dity_page_track {
+        u8 enable;               /* Read-Write */ +        u8 gra_power;            /* Read-Write */ +        u8 reserved[2];
+        le32 {
+            pasid: 20;           /* Read-Write */ +            reserved: 12;
+        };
+        le64 bitmap_addr;        /* Read-Write */ +        le64 bitmap_length;      /* Read-Write */

Quoted 8 lines
Quoted 2 lines

+};
+\end{lstlisting}

Okay, so it's a simple mailbox in config space.  Which by itself is probably a very reasonable idea - more or less what I suggested. However, using such a generic facility just for the dirty bitmap seems too limited.  Please make it accept arbitrary commands. Reusing admin command structure with a special "device itself" group sounds like one way to do it.

Quoted 7 lines

processing admin cmds in a cap may be too complex and overkill. we need to handle variable length of cmds, handle async returned results, and so on.

This struct seems easy and simple. And shall we use platform facilities like vt-d
to track dirty pages?

To demonstrate these issues, suppose we have a struct in a bar to process admin cmds:

Quoted 7 lines

struct virtio_admin_cmd {
        u64 in_data_length;
        u8 cmd_in_data[];
        u64 out_data_length;
        u8 cmd_out_data[];
        u8 ret;
};

Quoted 3 lines

An alternative is do same as you did here, e.g.:
struct virtio_admin_cmd {
        u64 admin_cmd_pa; /* an out descriptor followed by an in descriptor */

PA depends on IOMMU and ATS

Quoted 6 lines
          u32 pasid : 20;
	 u8 reserved : 11;
	 u8 hardware : 1;
};

or we can stick two lengths and addresses straight in the capability.

Still can only process only one cmd at a time and others are blocked.

Quoted 7 lines
Quoted 5 lines

The problems are:
1) command_in_data and command_out data have variable length, so how many HW resource should be reserved in the bar?

actually admin commands are truncated by device so just set to length that device understands.

How the framework know the length? How can the vendor know how many HW resource they should place here? I am not sure it is a good idea to guess.

Quoted 6 lines
Quoted 4 lines

2) To process the cmds in the bar, the device MAY need to read many registers in cmd_in_data[] and write many registers in cmd_out_data[], which can be ineffective, this is not DMA.

True. Again if you don't want to depend on pasid that's the only option.

Yes, this exactly shows how complex and overkill to use a cap to handle admin cmds. And maybe admin cmds is not a must.

Quoted 6 lines
Quoted 5 lines

3) a bar can only process one cmd at a time, and the driver can only issue another cmd after received an ret.
This process has to be synchronous IO, one cmd blocks another.

Exactly same as what you did though.

We have implemented a cap in PCI for dirty page tracking, there are no admin cmds.

And for dirty page tracking, we still believe it is better to use platform facilities, as Jason explained.

Quoted 4 lines
Quoted 2 lines

4) VF implementing a bar processing admin cmds conflicts with PF's admin vq.

So just don't create conflicts. It's same as multiple admin vqs really which we already support.

How to tell the SW don't create conflict?

Quoted 8 lines
Quoted 6 lines

So I think a bar or a cap processing admin cmds is way to complex and overkill.

Thanks

Sounds like a straw man argument.

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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/

#140 lore raw

Re: [virtio-comment] Re: [PATCH V2 6/6] virtio-pci: implement dirty page tracking

In reply to Michael S. Tsirkin
Quoted 11 lines · Michael S. Tsirkin
Quoted 10 lines · Lingshan
Quoted 8 lines · Michael S. Tsirkin
Quoted 7 lines · Parav Pandit
Quoted 4 lines
Quoted 3 lines

[1]
https://lists.oasis-open.org/archives/virtio-comment/202310/msg00475.h
tml

you still need to explain why this does not work for pass-through.

It does not work for following reasons.
1. Because all the fields that put on the member device are not in direct control of the hypervisor.
The device is directly controlled by the guest including the device status and when it resets the device all the things stored in the device are lost.

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

I think the idea is that when this gateway is in the device then device reset has to trap. At a high level, ok. But then what?

No, when device reset, the device is expected to forget everything and re-intialize.

That's a problem then - memory that was already written will not be detected as such.

Two cases:
1) memory written and has sent an interrupt. Then CPU has acknowledged the data, it should process the data
2) memory written but no interrupt, this should be lost as expected.

Quoted 4 lines
Quoted 3 lines
Quoted 2 lines

Is a full scan of all memory required until device reset is complete?

Who scan the memory? The device tracks its own dirty pages.

yes but reset erases this information.

should be, or the hypervisor will copy invalid information, cause a conflict.

I remember Jason as given an example on this.

Quoted 8 lines
Quoted 8 lines
Quoted 6 lines

Drivers currently tend to busy poll the reset register, if this takes very long we might start seeing soft lockup messages. What is the idea then? Maybe for this we need a separate weaker reset that does not touch this capability?

When reset, how can we expect the LM progress continue running.

Quoted 8 lines
Quoted 3 lines

For example, when the device DMA writes something, then reset before sending an interrupt,
the DMA-ed pages should be lost as expected, right?

interrupt is going to guest, has nothing to do with it.

device writes data into memory
device sends interrupt
driver sees data

At this point, the guest CPU owns the dirty pages, owns the data

Quoted 1 line

driver sends reset

At this point, the device should forget everything

Quoted 5 lines

meanwhile hypervisor did not see any dirty pages

now what? hypervisor must apparently retrieve all
dirty page data before it can reset the device.

It is not the hypervisor, once an interrupt has sent, the guest take over the pages.

Quoted 1 line

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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/

#155 lore raw

[virtio-comment] Re: [PATCH V2 6/6] virtio-pci: implement dirty page tracking

In reply to Parav Pandit
Quoted 154 lines · Parav Pandit
Quoted 72 lines

From: Zhu, Lingshan <[email protected]>
Sent: Monday, November 6, 2023 3:04 PM

Quoted 12 lines · Parav Pandit
Quoted 12 lines

From: Zhu, Lingshan <[email protected]>
Sent: Monday, November 6, 2023 9:22 AM

Quoted 7 lines · Parav Pandit
Quoted 7 lines

From: Zhu, Lingshan <[email protected]>
Sent: Friday, November 3, 2023 8:33 PM

Quoted 3 lines · Parav Pandit
Quoted 3 lines

From: Michael S. Tsirkin <[email protected]>
Sent: Friday, November 3, 2023 4:20 PM

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines · Zhu Lingshan

Review

Quoted 3 lines

+\item[\field{bitmap_addr}]

(quoted diff) +2 -0
+	The driver use this to set the address of the bitmap which
+records the

dirty pages

Review

Quoted 2 lines
(quoted diff) +2 -0
+	caused by the device.
+	Each bit in the bitmap represents one memory page, bit 0 in

the bitmap

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+	reprsents page 0 at address 0, bit 1 represents page 1, and so
+on in a

linear manner.

Review

Quoted 1 line
(quoted diff) +1 -0
+	When \field{enable} is set to 1 and the device writes to a

memory page,

Quoted 24 lines
Quoted 24 lines
Quoted 24 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+	the device MUST set the corresponding bit to 1 which
+indicating the

page is dirty.

Review

Quoted 10 lines

+\item[\field{bitmap_length}]

(quoted diff) +9 -0
+	The driver use this to set the length in bytes of the bitmap.
+\end{description}
+
+\devicenormative{\subsubsection}{Memory Dirty Pages Tracker
+Capability}{Virtio Transport Options / Virtio Over PCI Bus /
+Memory Dirty Pages Tracker Capability}
+
+The device MUST NOT set any bits beyond bitmap_length when
+reporting

dirty pages.

Quoted 8 lines
Quoted 4 lines
Quoted 3 lines

Review

Quoted 3 lines
(quoted diff) +3 -0
+
+To prevent a read-modify-write procedure, if a memory page is
+dirty,

It is not to prevent; it is just not possible to do racy RMW. 😊

if you understand what is a atomic routine, you will not call it racy.

Quoted 2 lines

Hence to work around you propose to mark all pages dirty. Too bad. This just does not work.

why? and this is optional.

Because device cannot set individual bits in atomic way for same byte read by

Quoted 8 lines
Quoted 8 lines

the cpu.

Quoted 6 lines

1. device read the byte that had bit 0 and 4 set.
2. cpu atomically clear these bits.
3. device wrote bits 0, 4, and new bits 2 and 3.
4. cpu now transferred page 0 and 4 again.

Optional thing also needs to work. :)

Do you know both CPU and device actually don't read bit, they read

bytes????

Quoted 10 lines

Yes. this is why atomic_OR is not possible on pcie.

Quoted 1 line

Do you know RC connected to memory controller????

Yes.

Quoted 1 line

Do you know there are locked transaction and atomic operations in PCI???

Can you explain how PCI does RMW locked transaction? Is it one TLP or multiple?

Quoted 2 lines

Do you know there are atomic read/write/clear even read and clear and so on in CPU ISA????

Quoted 7 lines
Quoted 2 lines

Read is always atomic from cpu.
I didn’t know about read_and_clear atomic ISA. This combined with pci future

support for atomic_or.

Quoted 1 line

If you already know a Linux kernel api for atomic_read_and_clear, please

share.
To answer all questions above, you should read PCI spec and CPU SDM, we don't copy and paste the content here, nobody develop their knowledge this way.

I read the pci spec and I see only 3 operations which does not have atomic or. I will try to find for the CPU instruction on read_and_clear that you suggested. Thanks for the suggestion.

Quoted 71 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines

Secondly the bitmap array is function is for full guest memory size, while

there is lot of sparce region now and also in future.

Quoted 1 line

This is the second problem.

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 1 line

did you see gra_power and its comments?

gra_power says the page size.
Not the sparce multiple ranges of the guest memory. Device endup tracking uninterested area as well.

increase gra_power can reduce bitmap size, right?
Totally up to the hypervisor, right?

Yes, and that can increase the amount of memory.
The way I understood is, if gra_power is 2MB, than whole 2MB page to be

considered dirty, even if 8KB was dirty.

Quoted 1 line

Did I understand it right?

Do you know DMA are very likely to write a neighbor page? Do you know why huge page is introduced?
Hint: not only for reduce TLB miss.

Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Quoted 2 lines

This is exactly why I asked you to review the page write recording series of

admin commands and comment.

Quoted 4 lines

And you never commented with sheer ignorance.

So clearly the start stop method for specific range and without bandwidth

explosion, admin commands of [1] stands better.

Quoted 2 lines

If you do [1] on the member device also using its AQ in future, it will work for

non-passthrough case.

Quoted 2 lines

If you build non-passthrough live migration using [1], also it will work. So I don’t see any point of this series anymore.

As Jason pointed out, there are many problems in your proposal, you should answer there. I don't need to repeat his words and duplicate the

Quoted 7 lines
Quoted 3 lines

discussions.

Quoted 1 line

Many are already addressed in v3.

interesting, does your V3 support nested?

Not directly.
Is it similar to cpu PML which does not supported nested.
One can always implement nested using some emulation.
The second option for high performance would be allow SR-IOV cap on the VF

and support true nesting using existing proposal of v3. If your proposal does not support nested, then it is incomplete.

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 6 lines
Quoted 5 lines

[1]
https://lists.oasis-open.org/archives/virtio-comment/202310/msg004
75
.h
tml

you still need to explain why this does not work for pass-through.

It does not work for following reasons.
1. Because all the fields that put on the member device are not in direct

Quoted 7 lines
Quoted 6 lines

control of the hypervisor.

Quoted 2 lines

The device is directly controlled by the guest including the device status and

when it resets the device all the things stored in the device are lost. have you seen PASID? and if the device reset, it has to forget everything as expected, right?

PASID does not help with the reset. Because as you told reset, resets

everything.

Quoted 1 line

PASID does not bifurcate the device common control which is not linked to any

PASID.
PASID means some facilities can be isolated. When reset, the device forget everything.

Quoted 8 lines
Quoted 8 lines
Quoted 1 line

2. the PCI FLR is clearing all the registers you exposed here.

see above

Quoted 2 lines

3. Endless expansion of config registers of dirty tracking is not scalable, as they

are not init time registers not following the Appendix B guidelines. endless expansion?? It is a complete set of dirty page tracking, right???? have you see this cap only controls? The device DMA writes the bitmap, not by registers.

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

Device dirty page tracking is start/stop command to be done by the

hypervisor.

Quoted 1 line

So when guest is resetting the device, it stopped the DMA initiated by the

hypervisor.

Quoted 1 line

This fundamentally breaks things.

Why? When device resets, do you want to keep tracking dirty pages????

Yes, when the device resets, before that event occurred, all the pages which were dirtied, must be migrated. And after reset also new page tracking to continue.

That depends on whether there is an interrupt for the dirty pages. If there is an interrupt, then the guest owns the pages

Quoted 63 lines
Quoted 63 lines
Quoted 13 lines
Quoted 13 lines

Again, if you want to fix Appendix B, OK.

Quoted 2 lines

4. bitmap based dirty tracking is not atomic between cpu and device. Hence, it is racy.

see above, the first reply.

Quoted 2 lines

5. All the device context needed for passthrough based hypervisor for a

device type specific is missing.

Quoted 5 lines

All of those can be used for non-passthrough as well.
[1]
https://lists.oasis-open.org/archives/virtio-comment/202311/msg00085
.h
tml

Quoted 4 lines
Quoted 2 lines

If you want to discuss this again, I don't want to wast time but only asking you whether you want to define virtio-fs device context

It will be defined in future.
And if virtio-fs was not written with migration in mind, may be one will invent

virtio-fs2.
don't say future, talk is cheap, show me the code.

Quoted 10 lines
Quoted 10 lines
Quoted 8 lines
Quoted 4 lines

And I
remember this is a point-less topic as MST ever wants to mute another
"pass- through" thread.

No. he did not say that.
He meant to not endlessly debate which one is better.
He clearly said, try to see if you can make multiple hypervisor model work. And your series shows a clear ignorance of his guidance.

Let me quote MST's reply here:
"I feel this discussion will keep meandering because the terminology is

vague.

Quoted 6 lines
Quoted 6 lines

There's no single thing that is called "passthrough" - vendors just build what is expedient with current hardware and software. Nvidia has a bunch of people working on vfio so they call that passthrough, Red Hat has people working on VDPA and they call that passthrough, etc.

Quoted 6 lines
Quoted 4 lines

Before I mute this discussion for good, does anyone here have any feeling progress is made? What kind of progress? "

So please don't discuss on pass-through anymore.

I don’t want to discuss the pros and cons of passthrough vs, vdpa, as usual. V3 covers broader use case of passthrough, hence once can always implement

trap+emulation instead of passthrough.

Quoted 1 line

V3 already indicates that other variants of the passthrough can be done as

well or can be extended.

Quoted 1 line

So please explore if that fits your vdpa need.

So, please no pass-through discussion anymore.

Quoted 16 lines
Quoted 16 lines

It seems only you need to develop the knowledge

Quoted 15 lines
Quoted 15 lines
Quoted 5 lines
Quoted 5 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+optionally the device is permitted to set the entire byte,
+which encompasses

the relevant bit, to 1.

Review

Quoted 2 lines
(quoted diff) +2 -0
+
+The device MAY increase \field{gra_power} to reduce

\field{bitmap_length}.

Quoted 9 lines
Quoted 9 lines

Review

Quoted 4 lines
(quoted diff) +4 -0
+
+The device must ignore any writes to \field{pasid} if PASID
+Extended Capability is absent or the PASID functionality is
+disabled in PASID Extended Capability

I have to say this is going to work very badly when the number of dirty pages is
small: you will end up scanning and re-scanning all of bitmap. And the resolution is apparently 8 pages? You have just multiplied the migration bandwidth by a factor of 8.

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
Quoted 5 lines
Quoted 3 lines

Yeah.
And device does not even know previously reported pages are read by driver

or not. All guess work game for driver and device. see my reply to him

Please see above reply.

see above

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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/

#161 lore raw

[virtio-comment] Re: [PATCH V2 6/6] virtio-pci: implement dirty page tracking

In reply to Parav Pandit
Quoted 7 lines · Parav Pandit
Quoted 3 lines

From: Zhu, Lingshan <[email protected]>
Sent: Monday, November 6, 2023 3:04 PM
So, please no pass-through discussion anymore.

If you comment like this, nothing can progress.

What you are implying with above language is:
"hey a virtio can do live migration ONLY by creating vdpa device on top of ALREADY virtio device, and you get another virtio device by running through 3 layers of stack you get virtio device on other side!".

I never say that right? I keep explaining how pass-through and "trap and emulate work", I even explained how PASID work.

Quoted 10 lines

Then for sure, I disagree to it for 100% for such a single-minded design.

At least I am trying to propose if a solution can work for generic passthrough where least amount of hypervisor mediation is done.

And an extension where hypervisor has choice to more medication layers as it finds suitable. And if there are technical issues, may be two different interfaces or more admin commands needed for two modes. The idea is to attempt to converge and discuss those details, not the opposite.

Your above comment shows a clear sign of non-collaboration to make both mode works.

Well, I see you are emotional, please take a deep breath and calm down, to be professional, give yourself a break, and really not necessary to be mad at me.

As you know I am just a Junior Engineer in Intel, not like you a Senior Principle Engineer who has spent many years and have developed knowledge in this area. So I am quite technical focusing, they are all technical discussions till now.

We always welcome collaboration, remember Jason has proposed a solution to build admin vq based on these basic facilities, and I am fully agree on his proposal.

Quoted 3 lines

At one point I may probably stop responding to your comments that repeatedly says:

"Go read QEMU code, Do you know what is PASID?, Do you know num_queues, Go read PCI spec"...

With all respect, you should do these because they are text book knowledge.

Quoted 2 lines

Taking deep breath now to do some productive work in TC...

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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/

#174 lore raw

[virtio-comment] Re: [PATCH V2 6/6] virtio-pci: implement dirty page tracking

In reply to Parav Pandit
Quoted 7 lines · Parav Pandit
Quoted 7 lines

From: Michael S. Tsirkin <[email protected]>
Sent: Monday, November 6, 2023 4:00 PM

Quoted 3 lines · Parav Pandit
Quoted 1 line

Do you know there are locked transaction and atomic operations in PCI???

Can you explain how PCI does RMW locked transaction? Is it one TLP or multiple?

Quoted 7 lines
Quoted 3 lines

Parav what are you asking about here?
pcie supports CAS and Swap which likely
can work for this use-case - these are non posted writes. It's in the pcie spec.

PCI spec do not have atomic OR operation.
Lingshan in above comment suggested some unknown locked transaction and atomic operation. So I was asking him which is that atomic operation and how PCI does it?
I don't know if any that can do PCI atomic OR without a workaround.

6.15 Atomic Operations (AtomicOps)

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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/

#162 lore raw

[virtio-comment] Re: [PATCH V2 6/6] virtio-pci: implement dirty page tracking

In reply to Zhu, Lingshan
Quoted 6 lines · Lingshan
Quoted 3 lines · Parav Pandit
Quoted 3 lines

From: Zhu, Lingshan <[email protected]>
Sent: Monday, November 6, 2023 3:04 PM
So, please no pass-through discussion anymore.

Quoted 6 lines
Quoted 4 lines

If you comment like this, nothing can progress.

What you are implying with above language is:
"hey a virtio can do live migration ONLY by creating vdpa device on top of ALREADY virtio device, and you get another virtio device by running through 3 layers of stack you get virtio device on other side!".

I never say that right? I keep explaining how pass-through and "trap and emulate work", I even explained how PASID work.

Parav, Lingshan can we please stop the "what is pass through" arguments?

I think thatthe term is vague, as
(almost?) no hypervisor passes all accesses without exemption through. And the fact you are speaking past enough other on this subject for how long now? seems to demonstrate I'm right.

Describing migration in the spec as opposed to leaving it up to hypervisors seems valuable at least to me since historically hypervisors did such a bad job of it. So I personally feel it's nice if it's there, and the SUSPEND bit only works after DRIVER_OK. So that's an example argument that makes sense to me. But number of layers involved in control path seems completely irrelevant to most people. *That* is an nvidia thing, something very specific about vfio and vdpa and whatnot. Nothing to do with the spec, wrong list for this.

Quoted 10 lines
Quoted 10 lines

Then for sure, I disagree to it for 100% for such a single-minded design.

At least I am trying to propose if a solution can work for generic passthrough where least amount of hypervisor mediation is done.

And an extension where hypervisor has choice to more medication layers as it finds suitable. And if there are technical issues, may be two different interfaces or more admin commands needed for two modes. The idea is to attempt to converge and discuss those details, not the opposite.

Your above comment shows a clear sign of non-collaboration to make both mode works.

Quoted 8 lines

Well, I see you are emotional, please take a deep breath and calm down, to be professional,
give yourself a break, and really not necessary to be mad at me.

As you know I am just a Junior Engineer in Intel, not like you a Senior Principle Engineer who has spent many years and
have developed knowledge in this area. So I am quite technical focusing, they are all technical discussions till now.

It looks more like a passive-agressive flamewar from the side. So maybe try to see other's point of view. I asked what's the advantage of admin vq thing for migration and you said "it's an nvidia thing". And when people try to point them out to you, you go well tough. Maybe but we are wasting time here.

Quoted 3 lines

We always welcome collaboration, remember Jason has proposed a solution to build admin vq based on these basic facilities,
and I am fully agree on his proposal.

I didn't see anything specific frankly, I can easily see how Parav could get mad if he posts a reasonably fleshed out patchset (which admittedly, needs work with wording etc) and instead of review gets back "rework this on top of these basic facilities which we don't yet know how they will work but maybe will". We'll be stuck in this loop for how long?

Quoted 6 lines
Quoted 3 lines

At one point I may probably stop responding to your comments that repeatedly says:

"Go read QEMU code, Do you know what is PASID?, Do you know num_queues, Go read PCI spec"...

With all respect, you should do these because they are text book knowledge.

Quoted 2 lines

Taking deep breath now to do some productive work in TC...

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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/

#132 lore raw

Re: [virtio-comment] Re: [PATCH V2 6/6] virtio-pci: implement dirty page tracking

In reply to Zhu, Lingshan
Quoted 45 lines · Lingshan
Quoted 42 lines · Michael S. Tsirkin
Quoted 41 lines · Lingshan
Quoted 22 lines · Lingshan
Quoted 12 lines · Michael S. Tsirkin
Quoted 11 lines · Zhu Lingshan

+\begin{lstlisting}
+struct virtio_pci_dity_page_track {
+        u8 enable;               /* Read-Write */ +        u8 gra_power;            /* Read-Write */ +        u8 reserved[2];
+        le32 {
+            pasid: 20;           /* Read-Write */ +            reserved: 12;
+        };
+        le64 bitmap_addr;        /* Read-Write */ +        le64 bitmap_length;      /* Read-Write */

Quoted 8 lines
Quoted 2 lines

+};
+\end{lstlisting}

Okay, so it's a simple mailbox in config space.  Which by itself is probably a very reasonable idea - more or less what I suggested. However, using such a generic facility just for the dirty bitmap seems too limited.  Please make it accept arbitrary commands. Reusing admin command structure with a special "device itself" group sounds like one way to do it.

Quoted 7 lines

processing admin cmds in a cap may be too complex and overkill. we need to handle variable length of cmds, handle async returned results, and so on.

This struct seems easy and simple. And shall we use platform facilities like vt-d
to track dirty pages?

To demonstrate these issues, suppose we have a struct in a bar to process admin cmds:

struct virtio_admin_cmd {
        u64 in_data_length;
        u8 cmd_in_data[];
        u64 out_data_length;
        u8 cmd_out_data[];
        u8 ret;
};

Quoted 4 lines
Quoted 3 lines

An alternative is do same as you did here, e.g.:
struct virtio_admin_cmd {
        u64 admin_cmd_pa; /* an out descriptor followed by an in descriptor */

PA depends on IOMMU and ATS

Not how virtio spec uses it. grep spec for physical address.

Quoted 7 lines
Quoted 6 lines
          u32 pasid : 20;
	 u8 reserved : 11;
	 u8 hardware : 1;
};

or we can stick two lengths and addresses straight in the capability.

Still can only process only one cmd at a time and others are blocked.

Point being? Your patch is the same - thought you wanted simplicity? We could stick a full queue there for sure - does this seem like a good idea to you?

Quoted 10 lines
Quoted 7 lines
Quoted 5 lines

The problems are:
1) command_in_data and command_out data have variable length, so how many HW resource should be reserved in the bar?

actually admin commands are truncated by device so just set to length that device understands.

How the framework know the length? How can the vendor know how many HW resource they should place here? I am not sure it is a good idea to guess.

I really don't want to repeat the whole admin command infrastructure explanation I thought it's pretty clear. device knows the length and truncates. Let's not get started on frameworks please.

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

2) To process the cmds in the bar, the device MAY need to read many registers in cmd_in_data[] and write many registers in cmd_out_data[], which can be ineffective, this is not DMA.

True. Again if you don't want to depend on pasid that's the only option.

Yes, this exactly shows how complex and overkill to use a cap to handle admin cmds. And maybe admin cmds is not a must.

I don't know. But this patch in question is really just impractical. We can't implement silly one-off gateways for each new random thing. You work on this thing so it looks like it's the most important feature to you maybe, but virtio works very well for most people than you very much.

Quoted 8 lines
Quoted 6 lines
Quoted 5 lines

3) a bar can only process one cmd at a time, and the driver can only issue another cmd after received an ret.
This process has to be synchronous IO, one cmd blocks another.

Exactly same as what you did though.

We have implemented a cap in PCI for dirty page tracking, there are no admin cmds.

"implemented" as in "posted v1 of a very rough draft". with tradeoffs like increasing migration payload by a factor of x8. Or try to use AtomicOps, if you try you will I believe see commands can actually fail and so you need to report errors.

So maybe it's great for CXL. Should we be able to use platform capabilities if there? Of course. This is right in the charter. Must we limit ourselves to specific platforms with specific capabilities? if there are tc members interested in supported limited platforms without said capabilities, I don't see why we must.

Quoted 3 lines

And for dirty page tracking, we still believe it is better to use platform facilities,
as Jason explained.

So pls don't waste everyone's time trying to review stuff you don't think can work.

Quoted 5 lines
Quoted 4 lines
Quoted 2 lines

4) VF implementing a bar processing admin cmds conflicts with PF's admin vq.

So just don't create conflicts. It's same as multiple admin vqs really which we already support.

How to tell the SW don't create conflict?

It's like a single mutex in software or something no? We already say
It is the responsibility of the driver to ensure strict request ordering for commands, because they will be consumed with no order constraints.
seems enough for me.

Quoted 8 lines
Quoted 8 lines
Quoted 6 lines

So I think a bar or a cap processing admin cmds is way to complex and overkill.

Thanks

Sounds like a straw man argument.

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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/

#182 lore raw

Re: [virtio-comment] Re: [PATCH V2 6/6] virtio-pci: implement dirty page tracking

In reply to Michael S. Tsirkin
Quoted 8 lines · Michael S. Tsirkin
Quoted 5 lines · Lingshan
Quoted 3 lines
Quoted 2 lines

Intel production work with similar bitmap
based dirty page tracking solution for years.

and then VMs became bigger and PML was introduced.

So you agree we should track dirty pages through the platform facilities? I am glad to hear that!

I just said that I thought there's no PML in platform facilities and that might be a problem. Am I wrong?

That's thru some platform may don't have PML.
The thing is most of platform have PML and this is a tradeoff:
1)don't implement dirty page tracking in virtio, but use platform. Then some platform can not track dirty pages by HW
2)implement dirty page tracking in virtio, but most platform don't use it.

As you see, I have post this virito dirty page tracking as a backup here, so this should be your call anyway.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Quoted 2 lines

Otherwise the device should report PFN which is not very practical.

Why not?

Really? the device report PFN?
What can happen if the device keep writing a small piece of memory???

then you just report the PFN once. Should work like PML really - IOW devices maintains a bit per page internally and reports PFN when bit is set.

Yes, it is a/d bit. by bitmap, when the device keep writing a small region of memory, only needs to mark the bits as dirty once.

when reporting PFN, the device need to repeating report the same bunch of PFNs(0x1234abcd..), which is not very efficient.

And we need to merge the device dirty page into QEMU dirty page bit map anyway.

Quoted 11 lines
Quoted 9 lines
Quoted 8 lines
Quoted 7 lines

And the resolution is apparently 8 pages? You have just multiplied the migration bandwidth by a factor of 8.

No, as described in the comments, the tacking granularity is controlled by \
field{gra_power}, one bit represents a page with page_size = 2^(12 + gra_power). This can also be used to reduce the size of the bitmap.

.. at the cost of increasing migration bandwidth.

The device is very likely to write a neighbor page,

how likely? and e.g. with slab randomization too? please collect some data and show it.

DMA writes continuous memory and take an example of DMA writing the ring buffer, it likely to write a neighbor page. This is called memory locality.

Quoted 5 lines
Quoted 3 lines

and this happens
everywhere for example CPU read 64 bytes aligned data.

CPUs don't need to send their cache across a bandwidth constrained shared network.

This is not about cacheline size, just saying it is 64bytes aligned.

Quoted 3 lines
Quoted 2 lines

This is a tradeoff

tradeoff between which two options?

1) small tracking granularity and big bitmap
2) big tracking granularity and smaller bitmap(with memory locality)

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

"To prevent a read-modify-write procedure, if a memory page is dirty,
optionally the device is permitted to set the entire byte, which encompasses the relevant bit, to 1."

This is optional and DMA is very likely to write a neighbor page, and the device transmit a whole byte anyway when a bit is dirty.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Quoted 2 lines

How about we use platform dirty page tracking facility then implement this in virtio, as Jason suggested?

Without something like PML it likely won't scale either.

So that would be platform issue which we don't need to take care of? Intel VT-d can do this for sure.

Intel VT-d supports PML from the IOMMU? I didn't realize. Could you help me find it in the doc please? Which hardware supports this in the field? What about other vendors?

Please refer to intel vt-d spec: https://cdrdv2-public.intel.com/774206/vt-directed-io-spec%20.pdf

As far as I know, AMD and ARM support this too.

Anyway, as said above, this should be your call whether implement dirty page tracking in virtio.

Quoted 1 line

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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/

#163 lore raw

[virtio-comment] RE: [PATCH V2 6/6] virtio-pci: implement dirty page tracking

In reply to Michael S. Tsirkin
Quoted 12 lines

From: Michael S. Tsirkin <[email protected]>
Sent: Tuesday, November 7, 2023 3:55 PM

Quoted 8 lines · Lingshan
Quoted 5 lines · Parav Pandit
Quoted 3 lines

From: Zhu, Lingshan <[email protected]>
Sent: Monday, November 6, 2023 3:04 PM So, please no pass-through discussion anymore.

If you comment like this, nothing can progress.

Quoted 9 lines
Quoted 2 lines
Quoted 2 lines

What you are implying with above language is:
"hey a virtio can do live migration ONLY by creating vdpa device on top of

ALREADY virtio device, and you get another virtio device by running through 3 layers of stack you get virtio device on other side!".

Quoted 2 lines

I never say that right? I keep explaining how pass-through and "trap and emulate work", I even explained how PASID work.

Parav, Lingshan can we please stop the "what is pass through" arguments?

I am not discussing it at all anymore.
The use case is well defined and seeing how we can/cannot have one proposal.

Quoted 5 lines

I think thatthe term is vague, as
(almost?) no hypervisor passes all accesses without exemption through. And the fact you are speaking past enough other on this subject for how long now? seems to demonstrate I'm right.

In v3 I acknowledged both the use cases in commit log unlike the other side.

Quoted 3 lines

Describing migration in the spec as opposed to leaving it up to hypervisors seems valuable at least to me since historically hypervisors did such a bad job of it.

It is done in v3.

Quoted 2 lines

So I personally feel it's nice if it's there, and the SUSPEND bit only works after DRIVER_OK. So that's an example argument that makes sense to me.

As talked suspend is useful and should be controlled by the guest anyway for power management. Hypervisor is not supposed to use it during LM.

Quoted 6 lines

But
number of layers involved in control path seems completely irrelevant to most people. *That* is an nvidia thing, something very specific about vfio and vdpa and whatnot.
Nothing to do with the spec, wrong list for this.

Certainly, it is not an Nvidia thing.
Multiple device vendors would like to do this and equally users too. So, I disagree.
I don't want to debate it.

Didn't you ask at start of this email to stop debating on what is passthrough?

Quoted 20 lines
Quoted 5 lines
Quoted 5 lines

Then for sure, I disagree to it for 100% for such a single-minded design.

At least I am trying to propose if a solution can work for generic

passthrough where least amount of hypervisor mediation is done.

Quoted 2 lines
Quoted 2 lines

And an extension where hypervisor has choice to more medication layers as

it finds suitable.

Quoted 1 line
Quoted 1 line

And if there are technical issues, may be two different interfaces or more

admin commands needed for two modes.

Quoted 1 line
Quoted 1 line

The idea is to attempt to converge and discuss those details, not the

opposite.

Quoted 2 lines
Quoted 2 lines

Your above comment shows a clear sign of non-collaboration to make both

mode works.

Quoted 4 lines

Well, I see you are emotional, please take a deep breath and calm down, to be professional, give yourself a break, and really not necessary to be mad at me.

Quoted 8 lines
Quoted 4 lines

As you know I am just a Junior Engineer in Intel, not like you a Senior Principle Engineer who has spent many years and have developed knowledge in this area. So I am quite technical focusing, they are all technical discussions till now.

It looks more like a passive-agressive flamewar from the side. So maybe try to see other's point of view. I asked what's the advantage of admin vq thing for migration and you said "it's an nvidia thing".

Huh, really you have to say this?
There are two TC sign-off on the patches.

Since I don't have the link to previously listed advantages I have to repeat here.

1. admin vq is must (it is not about an advantage) to support device passthrough to the guest.

Passthrough definition: following things are not trapped by hypervisor in one use case.
(a) virtio common and device config space
(b) cvqs for 6 and more device types
(c) hypervisor not involved in mixing PCI specific FLRs with virtio specific logic.

Quoted 2 lines

And when people try to point them out to you, you go well tough. Maybe but we are wasting time here.

Only thing Lingshan pointed out if some QoS on AQ.
He never responded on dirty page tracking, why he cannot use it. He never responded why device context cannot be used.

Quoted 11 lines
Quoted 4 lines

We always welcome collaboration, remember Jason has proposed a solution to build admin vq based on these basic facilities, and I am fully agree on his proposal.

I didn't see anything specific frankly, I can easily see how Parav could get mad if he posts a reasonably fleshed out patchset (which admittedly, needs work with wording etc) and instead of review gets back "rework this on top of these basic facilities which we don't yet know how they will work but maybe will". We'll be stuck in this loop for how long?

The series from Lingshan clearly does not address the requirements listed in v3. And he is not open to converge it either.

My humble input is:
1. Accept the two use cases listed of vfio and vdpa being practical to support existing stacks
2. Try to converge two cases; if there is common virtio spec framework it can use
3. If they can, great lets use it.
4. If not, both use cases need different infrastructure, so build two.

Do you have any better suggestions to support both use cases?

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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/

#142 lore raw

[virtio-comment] Re: [PATCH V2 6/6] virtio-pci: implement dirty page tracking

In reply to Parav Pandit
Quoted 24 lines · Parav Pandit
Quoted 15 lines

From: Michael S. Tsirkin <[email protected]>
Sent: Sunday, November 5, 2023 9:42 PM

Quoted 7 lines · Parav Pandit
Quoted 5 lines
Quoted 4 lines

[1]
https://lists.oasis-open.org/archives/virtio-comment/202310/msg004
75.h
tml

you still need to explain why this does not work for pass-through.

It does not work for following reasons.
1. Because all the fields that put on the member device are not in direct

control of the hypervisor.

Quoted 1 line

The device is directly controlled by the guest including the device status and

Quoted 9 lines

when it resets the device all the things stored in the device are lost.

I think the idea is that when this gateway is in the device then device reset has to trap. At a high level, ok. But then what?
Is a full scan of all memory required until device reset is complete? Drivers currently tend to busy poll the reset register, if this takes very long we might start seeing soft lockup messages. What is the idea then? Maybe for this we need a separate weaker reset that does not touch this capability?

Quoted 6 lines

You meant the gateway is not in the device, right?

I likely didn't understand. I don't see a relation to timing.

When the device reset is not trapped by the hypervisor, most things does not work, it requires trapping other things to like cvq, device registers and more. It may be fine for those use case, but it does not fullfill the requirement of passthrough mode of hw.

I wish we'd just stop using the term, it just confuses everyone.

I feel the point worth making is that currently, all this job is done by hypervisors. And they manage fine! vdpa really truly does not need the SUSPEND bit because it knows about devices and it
can just use whatever it wants in any vendor specific way it wants.

where all this migration work comes handy is if we say that we want our device to all just do what the
spec says. No vendor specific tricks. And I find it exciting that there are people who want to work on this instead of each vendor wasting man hours on their own almost the same but slightly different driver.

I personally think this patch is not great for the trap use-case either. Why? For example if device is somewhat slow then it will take it hundreds of milliseconds to synchronize the whole guest memory, and blocking reset means blocking e.g. guest boot. I was wrong about soft lockup btw - linux does msleep which I think means no soft lockups. But boot is blocked and modules are not loaded.

Signature · 18 lines
MST


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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/
#164 lore raw

[virtio-comment] RE: [PATCH V2 6/6] virtio-pci: implement dirty page tracking

In reply to Parav Pandit
Quoted 11 lines

From: [email protected] <[email protected] open.org> On Behalf Of Parav Pandit
Sent: Tuesday, November 7, 2023 4:43 PM

My humble input is:
1. Accept the two use cases listed of vfio and vdpa being practical to support existing stacks 2. Try to converge two cases; if there is common virtio spec framework it can use 3. If they can, great lets use it.
4. If not, both use cases need different infrastructure, so build two.

Do you have any better suggestions to support both use cases?

And both use cases can be serviced by proposed admin commands with different hypervisor layers to use them. If something is missing, we can extend these admin commands further.

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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/

#183 lore raw

Re: [virtio-comment] Re: [PATCH V2 6/6] virtio-pci: implement dirty page tracking

In reply to Zhu, Lingshan
Quoted 5 lines · Lingshan
Quoted 3 lines

Intel VT-d supports PML from the IOMMU? I didn't realize. Could you help me find it in the doc please? Which hardware supports this in the field? What about other vendors?

Please refer to intel vt-d spec:
https://cdrdv2-public.intel.com/774206/vt-directed-io-spec%20.pdf

Yes I know where the VTD doc is. But what chapter do you refer to when you say that VTD supports page modification log?

Signature · 18 lines
MST


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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/
#167 lore raw

[virtio-comment] Re: [PATCH V2 6/6] virtio-pci: implement dirty page tracking

In reply to Parav Pandit
Quoted 1 line · Parav Pandit

Didn't you ask at start of this email to stop debating on what is passthrough?

And I'm suggesting some other terms that hopefully will describe the use-case in a generic terms as opposed to whatever is in Linus' tree as of Nov 2023.

Signature · 18 lines
MST


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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/
#156 lore raw

[virtio-comment] Re: [PATCH V2 6/6] virtio-pci: implement dirty page tracking

In reply to Zhu, Lingshan
Quoted 10 lines · Lingshan
Quoted 10 lines
Quoted 10 lines
Quoted 9 lines
Quoted 8 lines
Quoted 1 line

2. the PCI FLR is clearing all the registers you exposed here.

see above

Quoted 2 lines

3. Endless expansion of config registers of dirty tracking is not scalable, as they

are not init time registers not following the Appendix B guidelines. endless expansion?? It is a complete set of dirty page tracking, right???? have you see this cap only controls? The device DMA writes the bitmap, not by registers.

Device dirty page tracking is start/stop command to be done by the

hypervisor.

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 1 line

So when guest is resetting the device, it stopped the DMA initiated by the

hypervisor.

Quoted 1 line

This fundamentally breaks things.

Why? When device resets, do you want to keep tracking dirty pages????

Yes, when the device resets, before that event occurred, all the pages which were dirtied, must be migrated. And after reset also new page tracking to continue.

That depends on whether there is an interrupt for the dirty pages. If there is an interrupt, then the guest owns the pages

Not in the virtio model, guest owns the memory once buffer has been used.

Signature · 18 lines
MST


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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/
#175 lore raw

[virtio-comment] Re: [PATCH V2 6/6] virtio-pci: implement dirty page tracking

In reply to Zhu, Lingshan
Quoted 10 lines · Lingshan
Quoted 7 lines · Parav Pandit
Quoted 7 lines

From: Michael S. Tsirkin <[email protected]>
Sent: Monday, November 6, 2023 4:00 PM

Quoted 3 lines · Parav Pandit
Quoted 1 line

Do you know there are locked transaction and atomic operations in PCI???

Can you explain how PCI does RMW locked transaction? Is it one TLP or multiple?

Quoted 8 lines
Quoted 7 lines
Quoted 3 lines

Parav what are you asking about here?
pcie supports CAS and Swap which likely
can work for this use-case - these are non posted writes. It's in the pcie spec.

PCI spec do not have atomic OR operation.
Lingshan in above comment suggested some unknown locked transaction and atomic operation. So I was asking him which is that atomic operation and how PCI does it?
I don't know if any that can do PCI atomic OR without a workaround.

6.15 Atomic Operations (AtomicOps)

There's no atomic or there. I guess you could use CAS. What are you going to do if CAS fails? Error out or retry? Retry can fail indefinitely and then what does the device do? Error out might be ok - have driver slow down. You need error reporting though which you have omitted because overkill.

Signature · 18 lines
MST


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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/
#169 lore raw

[virtio-comment] Re: [PATCH V2 6/6] virtio-pci: implement dirty page tracking

In reply to Zhu, Lingshan
Quoted 17 lines · Lingshan
Quoted 7 lines · Parav Pandit
Quoted 3 lines

From: Zhu, Lingshan <[email protected]>
Sent: Monday, November 6, 2023 3:04 PM
So, please no pass-through discussion anymore.

If you comment like this, nothing can progress.

What you are implying with above language is:
"hey a virtio can do live migration ONLY by creating vdpa device on top of ALREADY virtio device, and you get another virtio device by running through 3 layers of stack you get virtio device on other side!".

I never say that right? I keep explaining how pass-through and "trap and emulate work", I even explained how PASID work.

Quoted 5 lines

Then for sure, I disagree to it for 100% for such a single-minded design.

At least I am trying to propose if a solution can work for generic passthrough where least amount of hypervisor mediation is done.

Quoted 8 lines
Quoted 5 lines

And an extension where hypervisor has choice to more medication layers as it finds suitable. And if there are technical issues, may be two different interfaces or more admin commands needed for two modes. The idea is to attempt to converge and discuss those details, not the opposite.

Your above comment shows a clear sign of non-collaboration to make both mode works.

Well, I see you are emotional, please take a deep breath and calm down, to be professional,
give yourself a break, and really not necessary to be mad at me.

You aren't just going to stop people being mad by telling them not to. Try to figure out why did that happen.

Signature · 18 lines
MST


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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/
#11 lore raw

[virtio-comment] Re: [PATCH V2 1/6] virtio: introduce virtqueue state

In reply to Michael S. Tsirkin
Quoted 66 lines · Michael S. Tsirkin
Quoted 47 lines · Lingshan
Quoted 21 lines · Michael S. Tsirkin
Quoted 20 lines · Lingshan
Quoted 19 lines · Michael S. Tsirkin
Quoted 7 lines · Lingshan

+When SUSPEND is set, the device MUST record the Available State of every enabled splited virtqueue +in \field{Available State} field,
+and correspondingly restore the Available State of every enabled splited virtqueue +from \field{Available State} field when DRIVER_OK is set.
+
+The device SHOULD reset \field{Available State} field upon a device reset.

Quoted 8 lines

At this point I have no idea
- how can a state of a virtqueue at a random time be represented by a 16 bit integer

not sure what is a random time, this is to request the device to reset its avail state, for example, it is "le16 queue_avail_state" in virtio-pci common cfg. Resetting this so the device will not recover from a wrong value of the last run.

You simply never bother to say what is "Available State" and what does it mean to restore it. Not to mention words like "splited" which just adds to the confusion.

Quoted 7 lines
Quoted 6 lines

It says:

(quoted diff) +2 -0
+The available state field is two bytes of virtqueue state that is used by
+the device to read the next available buffer. It is presented in the

following format:

Do you want me to add more descriptions?

maybe start with an example

I think they are already in the spec, I can add:
see also "2.7.6 The Virtqueue Available Ring" and "2.7.13.1 Placing Buffers Into The Descriptor Table"

Quoted 14 lines
Quoted 14 lines
Quoted 5 lines
Quoted 5 lines

- if it's not at a random time then why do you even need an integer - synchronize queue to memory and then all state is in memory

Not sure what is a sync queue, but for example, "le16 queue_avail_state" for PCI transport exists in a cap.

Quoted 7 lines

I just point out that normally a lot of ring state is in memory. So you need to be much more specific about how you are augmenting that. For example, if buffers are used exactly in order for a split ring then used index seems to be exactly the same as last available index you describe - it's a free running counter. OTOH if they are not used in order then I don't see how is a single index sufficient to describe which ones have been used and which not.

I am not sure I get it.

Quoted 8 lines
Quoted 3 lines
Quoted 2 lines

Used idx(not like packed vq, no over-writing descriptors) and other states are in guest memory, so migrated with guest migration.

yes and so? why is that not enough and what is this available state then?

The spec has illustrated how available index work and has given an example(see above cited sections)
And this patch even has given a more clear description for it.

Other states are in guest memory and migrated with guest memory.

Yea I wrote large parts of it and I know how the available index works.

And sorry no idea what you are talking about.

At any time, there can be up to 2^16 buffers that have been made available, and a random subset of these have been used. There is no chance in the world a single 16 bit index describes even that part of state, never mind device type specific processing that might be going on.

Quoted 4 lines

As a wild guest this proposal is making a bunch of unstated assumptions about device being in a very specific state where this *is* possible. For people to be able to implement devices and drivers these need to be spelled out.

Thanks for your advice, I may need more hints to improve this patch.

If it is about when _F_IN_ORDER not negotiated, I found this section from the spec:

Some devices always use descriptors in the same order in which they have been made available. These devices can offer the VIRTIO_F_IN_ORDER feature. If negotiated, this knowledge allows devices to notify the use of a batch of buffers to the driver by only writing out a single used ring entry with the id corresponding to the head entry of the descriptor chain describing the last buffer in the batch.
The device then skips forward in the ring according to the size of the batch. Accordingly, it increments the used idx by the size of the batch.

This section implies that if _F_IN_ORDER is not negotiated, the device may not able to process the descriptors in order, thus may not write only one used_idx for a batch of buffers. This is about how to make buffer used and used_idx is in the guest memory. If the device selective done processing some descriptors, then maybe just mark them done one by one than batching.

Here I see there are two kind of vq states, on device or in guest memory. So this series migrate the on device state explicitly and others are migrating with guest memory.

Can you be more specific on what parameters of a vq that I should address in this patch?

Thanks

Quoted 2 lines

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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/

#165 lore raw

[virtio-comment] Re: [PATCH V2 6/6] virtio-pci: implement dirty page tracking

In reply to Parav Pandit
Quoted 9 lines · Parav Pandit
Quoted 9 lines

From: [email protected] <[email protected] open.org> On Behalf Of Parav Pandit
Sent: Tuesday, November 7, 2023 4:43 PM

My humble input is:
1. Accept the two use cases listed of vfio and vdpa being practical to support existing stacks 2. Try to converge two cases; if there is common virtio spec framework it can use 3. If they can, great lets use it.

That's my point as well.

Quoted 5 lines
Quoted 3 lines

4. If not, both use cases need different infrastructure, so build two.

Do you have any better suggestions to support both use cases?

And both use cases can be serviced by proposed admin commands with different hypervisor layers to use them.

I think it still has some open questions that need to be answered.

Quoted 2 lines

If something is missing, we can extend these admin commands further.

Thanks

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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/

#166 lore raw

[virtio-comment] RE: [PATCH V2 6/6] virtio-pci: implement dirty page tracking

Quoted 16 lines

From: Jason Wang <[email protected]>
Sent: Wednesday, November 8, 2023 12:42 PM

Quoted 9 lines · Parav Pandit
Quoted 9 lines

From: [email protected] <[email protected] open.org> On Behalf Of Parav Pandit
Sent: Tuesday, November 7, 2023 4:43 PM

My humble input is:
1. Accept the two use cases listed of vfio and vdpa being practical to support existing stacks 2. Try to converge two cases; if there is common virtio spec framework it can use 3. If they can, great lets use it.

That's my point as well.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

4. If not, both use cases need different infrastructure, so build two.

Do you have any better suggestions to support both use cases?

And both use cases can be serviced by proposed admin commands with

different hypervisor layers to use them.

I think it still has some open questions that need to be answered.

Yes. I will get to it tomorrow on 11/9 or today.

#23 lore raw

Re: [virtio-comment] RE: [PATCH V2 2/6] virtio: introduce SUSPEND bit in device status

In reply to Zhu, Lingshan
Quoted 17 lines · Lingshan
Quoted 6 lines · Michael S. Tsirkin
Quoted 4 lines · Lingshan
Quoted 2 lines
Quoted 1 line

This can work, right?

Unfortunately no, as non atomic bitmap cannot reside in the host memory,

as explained before, PCI and CPU supports atomic read/write. Please refer to PCI spec and CPU ISA.

I don't see how atomic read or write does anything useful here but maybe.

Because the device writs the bitmap and the driver "read and clear" the bitmap, so the ops need to be atomic, or they can run into race.

Quoted 1 line

You need to explain how you are using atomics in your proposal then.

Not sure we should talk about much of how atomic works, as explained above the operations should be atomic to avoid race conditions or losing information.
Like:

Quoted 5 lines

1) Device Read
2) Device Write
3) Device Clear

Here we lost the bitmap information.

That's an unusual use of the term "race condition". But yes, you need to spell out how do driver and device interact.

Quoted 8 lines
Quoted 6 lines
Quoted 5 lines
Quoted 4 lines

And whatever is in the device gets reset on device reset and/or FLR. So the dirty map detail is lost. Similarly the device context is also lost on these two events triggered by guest.

we explained before, when reset, the device should clear everything.

then migration will corrupt memory. Not great.

I think when reset, the device should clear everything, therefore the driver should clear the legacy data as well, don't know how corrupt

If you write data in memory CPU will observe it. If you then migrate the CPU but not the memory then CPU and memory state are inconsistent. I am surprised I need to say that, maybe I misunderstand the question.

Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

As you can see, the dirty page tracking facility has a PASID for isolation. But still, the question is, we should better use platform dirty page tracking

Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Nothing to do with PASID, as PASID is owned by the guest.

It looks you don't know how PASID work.
Host can setup PASID to isolate some facilities, right?

There are few limitations with PASID.
a. All platforms do not have PASID and

As we have explained for many times, this is a basic facility, and the implementation is transport-specific.

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

We given an example of PCI implementation, and PCI support PASID, right?

Yes it's a limitation but maybe one we can live with for this feature. It does mean that we might need solutions for systems without this support. virtio use is not limited to servers or high end systems.

PASID has been introduced years ago and I know some vendors implemented onboard IOMMU can also do isolating.

Introduced yes but when was it actually implemented? Do you know?

Quoted 2 lines

And this is a basic facility, the implementation is transport specific.

That's why if no one wants to support systems without PASID this is, maybe, ok. But we know there are people who want this.

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines

b. I explained above PASID do not work always as PASID only bifurcates DMA not the device _functionality_.

With a PASID, a cap can be considered to be placed in another logical address space, which is not accessible to the guest.

Quoted 8 lines
Quoted 7 lines
Quoted 2 lines
Quoted 1 line

c. PASID to be available to guest as_is what is present on the device

host hypervisor sets the PASID, transparent to the guest.

Lingshan whenever people ask you a ton of questions in response to your spec proposal then respose should not be to simply answer on the mailing list and then repost without a lot of changes since spec readers will likely have questions exactly like these and we can not make them go and read this flame war.

Well, I should say, I have repeated the same answers for too many times.

Don't. Amend the spec proposal instead so readers don't have these questions.

Quoted 4 lines
Quoted 2 lines

And frankly, most of this TC stopped following this thread a while ago, it seems to be going nowhere.

I still believe we should release the best quality of spec as we can.

Quoted 8 lines
Quoted 3 lines

The response should be to add the explanation in the spec.
Look at Parav's live migration proposals with "theory of operation" chapters for an example of how this can be done.

I am not sure we should talk how PCI work in virtio spec. But I can add "pasid for isolation"

These facilities are not only used for live migration, can also work for debugging. Like suspend then read vq state.

Maybe. Then you need to document what is this state.

Quoted 1 line

I can add more explanation in the cover letter

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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/

#143 lore raw

Re: [virtio-comment] Re: [PATCH V2 6/6] virtio-pci: implement dirty page tracking

In reply to Michael S. Tsirkin
Quoted 28 lines · Michael S. Tsirkin
Quoted 27 lines · Parav Pandit
Quoted 14 lines

From: Michael S. Tsirkin <[email protected]>
Sent: Sunday, November 5, 2023 9:42 PM

Quoted 7 lines · Parav Pandit
Quoted 5 lines
Quoted 4 lines

[1]
https://lists.oasis-open.org/archives/virtio-comment/202310/msg004
75.h
tml

you still need to explain why this does not work for pass-through.

It does not work for following reasons.
1. Because all the fields that put on the member device are not in direct

control of the hypervisor.

Quoted 1 line

The device is directly controlled by the guest including the device status and

Quoted 9 lines

when it resets the device all the things stored in the device are lost.

I think the idea is that when this gateway is in the device then device reset has to trap. At a high level, ok. But then what?
Is a full scan of all memory required until device reset is complete? Drivers currently tend to busy poll the reset register, if this takes very long we might start seeing soft lockup messages. What is the idea then? Maybe for this we need a separate weaker reset that does not touch this capability?

You meant the gateway is not in the device, right?

I likely didn't understand. I don't see a relation to timing.

Quoted 8 lines
Quoted 2 lines

When the device reset is not trapped by the hypervisor, most things does not work, it requires trapping other things to like cvq, device registers and more. It may be fine for those use case, but it does not fullfill the requirement of passthrough mode of hw.

I wish we'd just stop using the term, it just confuses everyone.

I feel the point worth making is that currently, all this job is done by hypervisors. And they manage fine! vdpa really truly does not need the SUSPEND bit because it knows about devices and it
can just use whatever it wants in any vendor specific way it wants.

So true, this is exact what Intel implements in some productions.

Quoted 7 lines

where all this migration work comes handy is if we say that we want our device to all just do what the
spec says. No vendor specific tricks. And I find it exciting that there are people who want to work on this instead of each vendor wasting man hours on their own almost the same but slightly different driver.

I agree

Quoted 7 lines

I personally think this patch is not great for the trap use-case either. Why? For example if device is somewhat slow then it will take it hundreds of milliseconds to synchronize the whole guest memory, and blocking reset means blocking e.g. guest boot. I was wrong about soft lockup btw - linux does msleep which I think means no soft lockups. But boot is blocked and modules are not loaded.

I am not sure SUSPEND can block RESET, I think reset can take immediate actions, because once reset, whether suspended does not matter.

Quoted 1 line

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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/

#157 lore raw

[virtio-comment] Re: [PATCH V2 6/6] virtio-pci: implement dirty page tracking

In reply to Michael S. Tsirkin
Quoted 12 lines · Michael S. Tsirkin
Quoted 11 lines · Lingshan
Quoted 11 lines
Quoted 11 lines
Quoted 9 lines
Quoted 8 lines
Quoted 1 line

2. the PCI FLR is clearing all the registers you exposed here.

see above

Quoted 2 lines

3. Endless expansion of config registers of dirty tracking is not scalable, as they

are not init time registers not following the Appendix B guidelines. endless expansion?? It is a complete set of dirty page tracking, right???? have you see this cap only controls? The device DMA writes the bitmap, not by registers.

Device dirty page tracking is start/stop command to be done by the

hypervisor.

Quoted 1 line

So when guest is resetting the device, it stopped the DMA initiated by the

Quoted 8 lines
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

hypervisor.

Quoted 1 line

This fundamentally breaks things.

Why? When device resets, do you want to keep tracking dirty pages????

Yes, when the device resets, before that event occurred, all the pages which were dirtied, must be migrated. And after reset also new page tracking to continue.

That depends on whether there is an interrupt for the dirty pages. If there is an interrupt, then the guest owns the pages

Not in the virtio model, guest owns the memory once buffer has been used.

Yes and even better, interrupt happens after buffers marked as used.

Quoted 1 line

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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/

#168 lore raw

Re: [virtio-comment] Re: [PATCH V2 6/6] virtio-pci: implement dirty page tracking

In reply to Michael S. Tsirkin
Quoted 19 lines · Michael S. Tsirkin
Quoted 11 lines · Lingshan
Quoted 7 lines · Parav Pandit
Quoted 3 lines

From: Zhu, Lingshan <[email protected]>
Sent: Monday, November 6, 2023 3:04 PM
So, please no pass-through discussion anymore.

If you comment like this, nothing can progress.

What you are implying with above language is:
"hey a virtio can do live migration ONLY by creating vdpa device on top of ALREADY virtio device, and you get another virtio device by running through 3 layers of stack you get virtio device on other side!".

I never say that right? I keep explaining how pass-through and "trap and emulate work", I even explained how PASID work.

Parav, Lingshan can we please stop the "what is pass through" arguments?

I think thatthe term is vague, as
(almost?) no hypervisor passes all accesses without exemption through. And the fact you are speaking past enough other on this subject for how long now? seems to demonstrate I'm right.

Quoted 8 lines

Describing migration in the spec as opposed to leaving it up to hypervisors seems valuable at least to me since historically hypervisors did such a bad job of it. So I personally feel it's nice if it's there, and the SUSPEND bit only works after DRIVER_OK. So that's an example argument that makes sense to me. But number of layers involved in control path seems completely irrelevant to most people. *That* is an nvidia thing, something very specific about vfio and vdpa and whatnot. Nothing to do with the spec, wrong list for this.

I agree and thanks Micheal for your help.
It's OK for me to let SUSPEND only work after DRIVER_OK.

Quoted 19 lines
Quoted 11 lines
Quoted 11 lines

Then for sure, I disagree to it for 100% for such a single-minded design.

At least I am trying to propose if a solution can work for generic passthrough where least amount of hypervisor mediation is done.

And an extension where hypervisor has choice to more medication layers as it finds suitable. And if there are technical issues, may be two different interfaces or more admin commands needed for two modes. The idea is to attempt to converge and discuss those details, not the opposite.

Your above comment shows a clear sign of non-collaboration to make both mode works.

Quoted 8 lines

Well, I see you are emotional, please take a deep breath and calm down, to be professional,
give yourself a break, and really not necessary to be mad at me.

As you know I am just a Junior Engineer in Intel, not like you a Senior Principle Engineer who has spent many years and
have developed knowledge in this area. So I am quite technical focusing, they are all technical discussions till now.

Quoted 5 lines

It looks more like a passive-agressive flamewar from the side. So maybe try to see other's point of view. I asked what's the advantage of admin vq thing for migration and you said "it's an nvidia thing". And when people try to point them out to you, you go well tough. Maybe but we are wasting time here.

yeah, sorry for that, lets focus on technical opens, get things done, release better quality of work as we try our best.

Quoted 10 lines
Quoted 4 lines

We always welcome collaboration, remember Jason has proposed a solution to build admin vq based on these basic facilities,
and I am fully agree on his proposal.

I didn't see anything specific frankly, I can easily see how Parav could get mad if he posts a reasonably fleshed out patchset (which admittedly, needs work with wording etc) and instead of review gets back "rework this on top of these basic facilities which we don't yet know how they will work but maybe will". We'll be stuck in this loop for how long?

OK, I did not copy-paste Jason's proposal there. Then if needed, lets try work out another approach.

Quoted 15 lines
Quoted 7 lines
Quoted 5 lines

At one point I may probably stop responding to your comments that repeatedly says:

"Go read QEMU code, Do you know what is PASID?, Do you know num_queues, Go read PCI spec"...

With all respect, you should do these because they are text book knowledge.

Quoted 1 line

Taking deep breath now to do some productive work in TC...

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.

Quoted 9 lines

Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/

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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/

#185 lore raw
In reply to Michael S. Tsirkin
Quoted 11 lines · Michael S. Tsirkin
Quoted 10 lines · Zhu Lingshan

This series introduces basic facilities to support virtio live migration, includes:

1)a new SUSPEND bit in the device status
Which is used to suspend the device, so that the device states and virtqueue states are stabilized.

2)virtqueue state and its accessor, to get and set last_avail_idx and last_used_idx of virtqueues.

Quoted 8 lines
Quoted 1 line

3)dirty page tracking

So looking at this from 100ft:
- SUSPEND bit looks like something that might have value as a generic component. For example, maybe for NUMA balancing we could suspend, quickly copy ring to a different node and resume. However current restrictions make it very limited, e.g. apparently you can't change config space while suspended.

Maybe don't need to change the source side config space. SUSPEND the device to stabilize the device config, so that the hypervisor can fetch reliable device states, then if any changes are required, just make modifications at the destination side before setting SUSPEND there.

Quoted 2 lines

As another example, changing config while suspended might be needed e.g. for net announcements.

I think link announce should happen after the device back alive, not before.

Quoted 6 lines

Also, do we want to suspend individual
queues then? what exactly happens with config changes while suspended that would happen otherwise is also unclear. Also as is, proposal is very light on detail. Other patches in the series make it look like there are more assumptions made about e.g. how vq enters the suspended state.

Not sure we need an interface to suspend a individual vq, it suspends all vqs.

I am not sure I totally get you, if you find anything I should add, and any suggestions, please let me know. I should provide more details in the cover letter for sure, I will add the live migration process in V3 cover letter.

Quoted 8 lines

- virtqueue state proposal looks very vague. A couple of 16 bit indices are insufficient to fully describe internal vq state at an arbitrary time. Some assumptions seem to be made that make this possible and yes, these would need to be stated and/or lifted. Preferably lifted since another use-case proposed was debugging - you do not, while debugging, want to depend on device following a complex set of assumptions.

I see there are two kinds of vq states:
1) on device, the device internal states.
I see they are avail idx, used idx and in-flight descriptors.
2) states in the guest memory. This part migrates with guest memory.

I may miss something, please let me what I should add in the vq states, and I can improve.

Quoted 20 lines

- dirty page tracking as described does not seem practical for
many systems. increasing page size x8 is just being nasty
towards other network users. CAS + retry could be a solution,
but this needs to be documented thoroughly then and it appears this is not what author expects to implement anyway - instead, there's an assumption that platform itself
will support dirty tracking. By itself, this is not
an impossible assumption - will possibly result in a cheaper,
slower device. why not have an option like this?
I would probably just drop it from this proposal completely.
Also, tracking memory on the device means we'll lose state
around reset. Solving that could be tricky. Finally,
dependence on PASID can not be removed apparently.
So maybe, people who want to track memory changes on the
device itself should just bite the bullet and use
admin vq in the PF.

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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/

#144 lore raw

Re: [virtio-comment] Re: [PATCH V2 6/6] virtio-pci: implement dirty page tracking

In reply to Zhu, Lingshan
Quoted 55 lines · Lingshan
Quoted 28 lines · Michael S. Tsirkin
Quoted 27 lines · Parav Pandit
Quoted 14 lines

From: Michael S. Tsirkin <[email protected]>
Sent: Sunday, November 5, 2023 9:42 PM

Quoted 7 lines · Parav Pandit
Quoted 5 lines
Quoted 4 lines

[1]
https://lists.oasis-open.org/archives/virtio-comment/202310/msg004
75.h
tml

you still need to explain why this does not work for pass-through.

It does not work for following reasons.
1. Because all the fields that put on the member device are not in direct

control of the hypervisor.

Quoted 1 line

The device is directly controlled by the guest including the device status and

Quoted 9 lines

when it resets the device all the things stored in the device are lost.

I think the idea is that when this gateway is in the device then device reset has to trap. At a high level, ok. But then what?
Is a full scan of all memory required until device reset is complete? Drivers currently tend to busy poll the reset register, if this takes very long we might start seeing soft lockup messages. What is the idea then? Maybe for this we need a separate weaker reset that does not touch this capability?

You meant the gateway is not in the device, right?

I likely didn't understand. I don't see a relation to timing.

Quoted 8 lines
Quoted 2 lines

When the device reset is not trapped by the hypervisor, most things does not work, it requires trapping other things to like cvq, device registers and more. It may be fine for those use case, but it does not fullfill the requirement of passthrough mode of hw.

I wish we'd just stop using the term, it just confuses everyone.

I feel the point worth making is that currently, all this job is done by hypervisors. And they manage fine! vdpa really truly does not need the SUSPEND bit because it knows about devices and it
can just use whatever it wants in any vendor specific way it wants.

So true, this is exact what Intel implements in some productions.

Quoted 7 lines

where all this migration work comes handy is if we say that we want our device to all just do what the
spec says. No vendor specific tricks. And I find it exciting that there are people who want to work on this instead of each vendor wasting man hours on their own almost the same but slightly different driver.

I agree

Quoted 7 lines

I personally think this patch is not great for the trap use-case either. Why? For example if device is somewhat slow then it will take it hundreds of milliseconds to synchronize the whole guest memory, and blocking reset means blocking e.g. guest boot. I was wrong about soft lockup btw - linux does msleep which I think means no soft lockups. But boot is blocked and modules are not loaded.

Quoted 3 lines

I am not sure SUSPEND can block RESET, I think reset can take immediate actions, because
once reset, whether suspended does not matter.

No, because if you don't suspend device will keep changing memory. You need to
1. suspend
2. get all dirty memory synced
3. reset

Reset earlier will corrupt guest memory.

Quoted 1 line
Quoted 1 line

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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/

#158 lore raw

[virtio-comment] Re: [PATCH V2 6/6] virtio-pci: implement dirty page tracking

In reply to Zhu, Lingshan
Quoted 16 lines · Lingshan
Quoted 13 lines · Michael S. Tsirkin
Quoted 12 lines · Lingshan
Quoted 12 lines
Quoted 12 lines
Quoted 9 lines
Quoted 8 lines
Quoted 1 line

2. the PCI FLR is clearing all the registers you exposed here.

see above

Quoted 2 lines

3. Endless expansion of config registers of dirty tracking is not scalable, as they

are not init time registers not following the Appendix B guidelines. endless expansion?? It is a complete set of dirty page tracking, right???? have you see this cap only controls? The device DMA writes the bitmap, not by registers.

Device dirty page tracking is start/stop command to be done by the

hypervisor.

Quoted 1 line

So when guest is resetting the device, it stopped the DMA initiated by the

hypervisor.

Quoted 8 lines
Quoted 7 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
Quoted 1 line

This fundamentally breaks things.

Why? When device resets, do you want to keep tracking dirty pages????

Yes, when the device resets, before that event occurred, all the pages which were dirtied, must be migrated. And after reset also new page tracking to continue.

That depends on whether there is an interrupt for the dirty pages. If there is an interrupt, then the guest owns the pages

Not in the virtio model, guest owns the memory once buffer has been used.

Yes and even better, interrupt happens after buffers marked as used.

But guest owns memory earlier and you can not change it after this point.

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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/

#88 lore raw

Re: [virtio-comment] Re: [PATCH V2 4/6] virtio-pci: implement VIRTIO_F_QUEUE_STATE

In reply to Zhu, Lingshan
Quoted 59 lines · Lingshan
Quoted 56 lines · Parav Pandit
Quoted 56 lines

From: Zhu, Lingshan <[email protected]>
Sent: Monday, November 6, 2023 2:57 PM

Quoted 44 lines · Parav Pandit
Quoted 44 lines

From: Zhu, Lingshan <[email protected]>
Sent: Monday, November 6, 2023 9:01 AM

Quoted 16 lines · Parav Pandit
Quoted 16 lines

From: [email protected] <[email protected] open.org> On Behalf Of Zhu, Lingshan
Sent: Friday, November 3, 2023 8:27 PM

Quoted 11 lines · Parav Pandit
Quoted 11 lines

From: Zhu Lingshan <[email protected]>
Sent: Friday, November 3, 2023 4:05 PM

This patch adds two new le16 fields to common configuration structure to support VIRTIO_F_QUEUE_STATE in PCI transport layer.

---
     transport-pci.tex | 18 ++++++++++++++++++
     1 file changed, 18 insertions(+)
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

transport-pci.tex \subsubsection{Common configuration

Quoted 5 lines
transport-pci.tex index renamed from transport-pci.tex +0 -0

a5c6719..3161519 100644

transport-pci.tex +0 -0
@@ -325,6 +325,10 @@ \subsubsection{Common configuration

structure

Quoted 18 lines
Quoted 10 lines
Quoted 10 lines

transport-pci.tex

Quoted 8 lines

layout}\label{sec:Virtio Transport
/* About the administration virtqueue. */
le16 admin_queue_index; /* read-only for driver */
le16 admin_queue_num; /* read-only for driver */

transport-pci.tex +4 -0
+
+	/* Virtqueue state */
+        le16 queue_avail_state;         /* read-write */
+        le16 queue_used_state;          /* read-write */

This tiny interface for 128 virtio net queues through register read writes, does

Quoted 5 lines

not work effectively.

Quoted 2 lines

There are inflight out of order descriptors for block also. Hence toy registers like this do not work.

Do you know there is a queue_select? Why this does not work? Do you know how other queue related fields work?

:)
Yes. If you notice queue_reset related critical spec bug fix was done when it

Quoted 6 lines
Quoted 5 lines

was introduced so that live migration can _actually_ work.

Quoted 2 lines

When queue_select is done for 128 queues serially, it take a lot of time to

read those slow register interface for this + inflight descriptors + more. interesting, virtio work in this pattern for many years, right?

All these years 400Gbps and 800Gbps virtio was not present, number of

queues were not in hw.
The registers are control path in config space, how 400G or 800G affect??

Quoted 7 lines
Quoted 4 lines

Because those are the one in practice requires large number of VQs.

You are asking per VQ register commands to modify things dynamically via this one vq at a time, serializing all the operations. It does not scale well with high q count.

This is not dynamically, it only happens when SUSPEND and RESUME. This is the same mechanism how virtio initialize a virtqueue, working for many years.

I wish we just had a transport vq already. That's the way to solve this not fighting individual bits.

Quoted 32 lines
Quoted 4 lines
Quoted 2 lines

See the virtio common cfg, you will find the max number of vqs is there, num_queues.

:)
Sure. those values at high q count affects.

the driver need to initialize them anyway.

Quoted 9 lines
Quoted 8 lines
Quoted 3 lines

Device didn’t support LM.
Many limitations existed all these years and TC is improving and expanding

them.

Quoted 1 line

So all these years do not matter.

Not sure what are you talking about, haven't we initialize the device and vqs in config space for years?????? What's wrong with this mechanism?
Are you questioning virito-pci fundamentals???

Don’t point to in-efficient past to establish similar in-efficient future.

interesting, you know this is a one-time thing, right? and you are aware of this has been there for years.

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Like how to set a queue size and enable it?

Those are meant to be used before DRIVER_OK stage as they are init time

registers.

Quoted 1 line

Not to keep abusing them..

don't you need to set queue_size at the destination side?

No.
But the src/dst does not matter.
Queue_size to be set before DRIVER_OK like rest of the registers, as all

Quoted 6 lines
Quoted 4 lines

queues must be created before the driver_ok phase.

Quoted 1 line

Queue_reset was last moment exception.

create a queue? Nvidia specific?

Huh. No.
Do git log and realize what happened with queue_reset.

Quoted 7 lines

You didn't answer the question, does the spec even has defined "create a vq"?

Quoted 4 lines
Quoted 3 lines

For standard virtio, you need to read the number of enabled vqs at the source side, then enable them at the dst, so queue_size matters, not to create.

All that happens in the pre-copy phase.

Yes and how your answer related to this discussion?

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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/

#31 lore raw

[virtio-comment] Re: [PATCH V2 3/6] virtio: dont reset vqs when SUSPEND

In reply to Zhu, Lingshan
Quoted 27 lines · Lingshan
Quoted 10 lines · Michael S. Tsirkin
Quoted 9 lines · Zhu Lingshan

When SUSPEND is set, device states and virtqueue states should be stablized, therefore the driver should not reset vqs when SUSPEND is set in device status.

---
  content.tex | 3 +++
  1 file changed, 3 insertions(+)
Quoted 14 lines

content.tex \subsubsection{Virtqueue Reset}\label{sec:Basic Facilities of a Virtio Device / · line 450

Quoted 12 lines
content.tex +3 -0
index bcc9d4b..060b5c2 100644
@@ -444,6 +444,9 @@ \subsubsection{Virtqueue Reset}\label{sec:Basic Facilities of a Virtio Device /
  The device MUST reset any state of a virtqueue to the default state,
  including the available state and the used state.
+If VIRTIO_F_SUSPEND is negotiated and SUSPEND is set in \field{device status},
+the driver SHOULD NOT reset any virtqueues.
+
  \drivernormative{\paragraph}{Virtqueue Reset}{Basic Facilities of a Virtio Device / Virtqueues / Virtqueue Reset / Virtqueue Reset}
  After the driver tells the device to reset a queue, the driver MUST verify that

Seems somewhat arbitrary and breaks the claim that the feature is orthogonal and can have uses besides migration.

Quoted 2 lines

when suspended, the device is frozen.
The driver is aware of this process and so should not reset the vqs I think.

Again that is only true because you want to use it for migration. But then you can't claim it's a generic facility.

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Signature · 2 lines
-- 
2.35.3

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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/

#26 lore raw

Re: [virtio-comment] Re: [PATCH V2 2/6] virtio: introduce SUSPEND bit in device status

In reply to Zhu, Lingshan
Quoted 33 lines · Lingshan

On 11/6/2023 5:43 PM, Michael S. Tsirkin wrote:

On Fri, Nov 03, 2023 at 06:34:33PM +0800, Zhu Lingshan wrote:

This patch introduces a new status bit in the device status: SUSPEND.

This SUSPEND bit can be used by the driver to suspend a device, in order to stabilize the device states and virtqueue states.

Its main use case is live migration.

---
content.tex | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-)

diff --git a/content.tex b/content.tex
index 76813b5..bcc9d4b 100644
--- a/content.tex
+++ b/content.tex
@@ -49,6 +49,10 @@ \section{\field{Device Status} Field}\label{sec:Basic Facilities of a Virtio Dev

\item[DEVICE_NEEDS_RESET (64)] Indicates that the device has experienced
an error from which it can't recover.
+
+\item[SUSPEND (16)] When VIRTIO_F_SUSPEND is negotiated, indicates that the
+ device has been suspended by the driver.
+

Quoted 7 lines

what does this mean?

When the driver sets SUSPEND and the device presents SUSPEND, means the device has been suspended by the driver.

Do you suggest to remove "When VIRTIO_F_SUSPEND is negotiated"

No I suggest explaining what does it mean that device has been suspended.

Quoted 8 lines

\end{description}

The \field{device status} field starts out as 0, and is reinitialized to 0 by
@@ -73,6 +77,10 @@ \section{\field{Device Status} Field}\label{sec:Basic Facilities of a Virtio Dev
recover by issuing a reset.
\end{note}

Quoted 8 lines

+The driver SHOULD NOT set SUSPEND if FEATURES_OK is not set.
+
+When setting SUSPEND, the driver MUST re-read \field{device status} to ensure the SUSPEND bit is set. +

and if it's not?

Then the device may run into errors or just need longer time to suspend.

and then what does driver do?

Quoted 2 lines

This is how we handle features_OK: "Re-read device status to ensure the FEATURES_OK bit is still set"

this is designed in case features are inconsistent. what kind of thing are you handling here?
Also and then we bail out and retry with other feature set if not. what do we do here?

Quoted 15 lines

\devicenormative{\subsection}{Device Status Field}{Basic Facilities of a Virtio Device / Device Status Field}

The device MUST NOT consume buffers or send any used buffer
@@ -82,6 +90,26 @@ \section{\field{Device Status} Field}\label{sec:Basic Facilities of a Virtio Dev
that a reset is needed. If DRIVER_OK is set, after it sets DEVICE_NEEDS_RESET, the device MUST send a device configuration change notification to the driver.

+The device MUST ignore SUSPEND if FEATURES_OK is not set.
+
+The device MUST ignore SUSPEND if VIRTIO_F_SUSPEND is not negotiated. +
+The device SHOULD allow settings to \field{device status} even when SUSPEND is set.

Quoted 4 lines

which settings?

any legit writing to the device status, like DRIVER_OK

that's not "settings" that's setting.

Quoted 11 lines

+
+If VIRTIO_F_SUSPEND is negotiated and SUSPEND is set, the device SHOULD clear SUSPEND +and resumes operation upon DRIVER_OK.
+
+If VIRTIO_F_SUSPEND is negotiated, when the driver sets SUSPEND,
+the device SHOULD perform the following actions before presenting SUSPEND bit in the \field{device status}:
+
+\begin{itemize}
+\item Stop consuming buffers of any virtqueues and mark all finished descritors as used.

Quoted 9 lines

descritors? and what does finished mean?

Sorry my typo.

Finished means done processing it.

Like the spec words: When the device has finished a buffer, it writes the descriptor index into the used ring, and sends a used buffer notification.

only good for internal ring documentation - we did not want to say used because it's not used until used entry written. here just say used.

Quoted 32 lines

+\item Wait until all descriptors that being processed to finish and mark them as used.

descriptors are not marked used. buffers are.

that being -> that are being maybe?

Will fix

+\item Flush all used buffer and send used buffer notifications to the driver.

used buffers?

Here it means the buffer marked as used. shall I use finished buffer or any other suggestions?

what does Flush mean?

Flush means send all of them out. Like 5.19.7.1 Device Requirements: Device
Operation: Virtqueue flush

        +\item Record Virtqueue State of each enabled virtqueue, see section \ref{sec:Virtqueues / Virtqueue State}

    execpt that one unfortunately does not bother to say what does this mean
    :(
Quoted 5 lines

The virtqueue state has been defined in this series, in packed/split-ring.tex. And an PCI implementation of the interfaces is included.

Do you suggest any supplementary materials?

I suggest something that documents what it means unlike what is in this series.

Quoted 11 lines

+\item Pause its operation except \field{device status} and preserve configurations in its Device Configuration Space, see \ref{sec:Basic Facilities of a Virtio Device / Device Configuration Space}

How do you Pause? For example, consider a link state register. You set

The device pauses itself.

SUSPEND, then link goes down. What is device supposed to do?

Once the device suspended, the device should not respond to the link_down until alive again.

what is link_down?
link goes down just by virtue of disconnecting it physically.

Quoted 5 lines

This is to preserve the device states, just record whatever it is when SUSPEND-ed. And process the signal when resume or alive at the destination side. At the destination it also needs a live announce which require an active link.

Quoted 8 lines

Record this somewhere internal but do not show it to driver? And how exactly will this hidden internal state be migrated since it is not visible?

May I know what kind of internal states?
This series migrates stateless devices, hard to define virtio-fs device context.

all devices have some state, none are completely stateless.

Quoted 51 lines

+\end{itemize}
+
\section{Feature Bits}\label{sec:Basic Facilities of a Virtio Device / Feature Bits}

Each virtio device offers all the features it understands. During
@@ -99,10 +127,10 @@ \section{Feature Bits}\label{sec:Basic Facilities of a Virtio Device / Feature B
\begin{description}
\item[0 to 23, and 50 to 127] Feature bits for the specific device type

-\item[24 to 42] Feature bits reserved for extensions to the queue and +\item[24 to 43] Feature bits reserved for extensions to the queue and
feature negotiation mechanisms

-\item[43 to 49, and 128 and above] Feature bits reserved for future extensions. +\item[44 to 49, and 128 and above] Feature bits reserved for future extensions.
\end{description}

\begin{note}
@@ -875,6 +903,10 @@ \chapter{Reserved Feature Bits}\label{sec:Reserved Feature Bits}
\item[VIRTIO_F_QUEUE_STATE(42)] This feature indicates that the device allows the driver to access its internal virtqueue state.

+ \item[VIRTIO_F_SUSPEND(43)] This feature indicates that the driver can
+ SUSPEND the device.

why is SUSPEND upper-case here?

will be lower in V3.

Thanks

+ See \ref{sec:Basic Facilities of a Virtio Device / Device Status Field}.
+
\end{description}

\drivernormative{\section}{Reserved Feature Bits}{Reserved Feature Bits}
--
2.35.3

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.

Quoted 11 lines

Subscribe: [email protected]
Unsubscribe: [email protected] List help: [email protected]
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/

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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/

#120 lore raw

[virtio-comment] Re: [PATCH V2 4/6] virtio-pci: implement VIRTIO_F_QUEUE_STATE

In reply to Zhu Lingshan
Quoted 31 lines · Zhu Lingshan

This patch adds two new le16 fields to common configuration structure to support VIRTIO_F_QUEUE_STATE in PCI transport layer.

---
 transport-pci.tex | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
transport-pci.tex +8 -0
index a5c6719..3161519 100644
@@ -325,6 +325,10 @@ \subsubsection{Common configuration structure layout}\label{sec:Virtio Transport
         /* About the administration virtqueue. */
         le16 admin_queue_index;         /* read-only for driver */
         le16 admin_queue_num;         /* read-only for driver */
+
+	/* Virtqueue state */
+        le16 queue_avail_state;         /* read-write */
+        le16 queue_used_state;          /* read-write */
 };
 \end{lstlisting}
 
@@ -428,6 +432,17 @@ \subsubsection{Common configuration structure layout}\label{sec:Virtio Transport
 	The value 0 indicates no supported administration virtqueues.
 	This field is valid only if VIRTIO_F_ADMIN_VQ has been
 	negotiated.
+
+\item[\field{queue_avail_state}]
+        This field is valid only if VIRTIO_F_QUEUE_STATE has been
+        negotiated. The driver sets and gets the available state of

transport-pci.tex \subsubsection{Common configuration structure layout}\label{sec:Virtio Transport · line 448

Quoted 10 lines
transport-pci.tex +7 -0
+        the virtqueue here (see \ref{sec:Virtqueues / Virtqueue State}).
+
+\item[\field{queue_used_state}]
+        This field is valid only if VIRTIO_F_QUEUE_STATE has been
+        negotiated. The driver sets and gets the used state of the
+        virtqueue here (see \ref{sec:Virtqueues / Virtqueue State}).
+
 \end{description}
 
 \devicenormative{\paragraph}{Common configuration structure layout}{Virtio Transport Options / Virtio Over PCI Bus / PCI Device Layout / Common configuration structure layout}

Two fields are pointless in the general case. Fix this to at least support out of order buffer use, then there's something to talk about. I suspect we'll be back to yet another bespoke mailbox and a bitmap for this.

Quoted 12 lines
transport-pci.tex +3 -0
@@ -488,6 +503,9 @@ \subsubsection{Common configuration structure layout}\label{sec:Virtio Transport
 present either a value of 0 or a power of 2 in
 \field{queue_size}.
 
+If VIRTIO_F_QUEUE_STATE has not been negotiated, the device MUST ignore
+any accesses to \field{queue_avail_state} and \field{queue_used_state}.
+
 If VIRTIO_F_ADMIN_VQ has been negotiated, the value
 \field{admin_queue_index} MUST be equal to, or bigger than
 \field{num_queues}; also, \field{admin_queue_num} MUST be
Signature · 1 line
2.35.3

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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/

#96 lore raw

RE: [virtio-comment] Re: [PATCH V2 4/6] virtio-pci: implement VIRTIO_F_QUEUE_STATE

In reply to Zhu, Lingshan
Quoted 62 lines

From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, November 7, 2023 3:02 PM

Quoted 57 lines · Parav Pandit
Quoted 57 lines

From: Zhu, Lingshan <[email protected]>
Sent: Monday, November 6, 2023 2:57 PM

Quoted 44 lines · Parav Pandit
Quoted 44 lines

From: Zhu, Lingshan <[email protected]>
Sent: Monday, November 6, 2023 9:01 AM

Quoted 16 lines · Parav Pandit
Quoted 16 lines

From: [email protected] <[email protected] open.org> On Behalf Of Zhu, Lingshan
Sent: Friday, November 3, 2023 8:27 PM

Quoted 11 lines · Parav Pandit
Quoted 11 lines

From: Zhu Lingshan <[email protected]>
Sent: Friday, November 3, 2023 4:05 PM

This patch adds two new le16 fields to common configuration structure to support VIRTIO_F_QUEUE_STATE in PCI transport layer.

---
     transport-pci.tex | 18 ++++++++++++++++++
     1 file changed, 18 insertions(+)
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

transport-pci.tex \subsubsection{Common configuration

Quoted 5 lines
transport-pci.tex index renamed from transport-pci.tex +0 -0

a5c6719..3161519 100644

transport-pci.tex +0 -0
@@ -325,6 +325,10 @@ \subsubsection{Common configuration

structure

Quoted 18 lines
Quoted 10 lines
Quoted 10 lines

transport-pci.tex

Quoted 8 lines

layout}\label{sec:Virtio Transport
/* About the administration virtqueue. */
le16 admin_queue_index; /* read-only for driver */
le16 admin_queue_num; /* read-only for driver */

transport-pci.tex +4 -0
+
+	/* Virtqueue state */
+        le16 queue_avail_state;         /* read-write */
+        le16 queue_used_state;          /* read-write */

This tiny interface for 128 virtio net queues through register read writes, does

Quoted 5 lines

not work effectively.

Quoted 2 lines

There are inflight out of order descriptors for block also. Hence toy registers like this do not work.

Do you know there is a queue_select? Why this does not work? Do you know how other queue related fields work?

:)
Yes. If you notice queue_reset related critical spec bug fix was done when it

Quoted 7 lines
Quoted 5 lines

was introduced so that live migration can _actually_ work.

Quoted 2 lines

When queue_select is done for 128 queues serially, it take a lot of time to

read those slow register interface for this + inflight descriptors + more. interesting, virtio work in this pattern for many years, right?

All these years 400Gbps and 800Gbps virtio was not present, number of

queues were not in hw.
The registers are control path in config space, how 400G or 800G affect??

Quoted 8 lines
Quoted 3 lines

Because those are the one in practice requires large number of VQs.

You are asking per VQ register commands to modify things dynamically via

this one vq at a time, serializing all the operations.

Quoted 1 line

It does not scale well with high q count.

This is not dynamically, it only happens when SUSPEND and RESUME. This is the same mechanism how virtio initialize a virtqueue, working for many years.

No. when virtio driver initializes it for the first time, there is no active traffic that gets lost. This is because the interface is not yet up and not part of the network yet.

The resume must be fast enough, because the remote node is sending packets. Hence it is different from driver init time queue enable.

Quoted 5 lines
Quoted 4 lines
Quoted 2 lines

See the virtio common cfg, you will find the max number of vqs is there, num_queues.

:)
Sure. those values at high q count affects.

the driver need to initialize them anyway.

That is before the traffic starts from remote end.

Quoted 23 lines
Quoted 10 lines
Quoted 9 lines
Quoted 4 lines

Device didn’t support LM.
Many limitations existed all these years and TC is improving and expanding

them.

Quoted 1 line

So all these years do not matter.

Not sure what are you talking about, haven't we initialize the device and vqs in config space for years?????? What's wrong with this mechanism? Are you questioning virito-pci fundamentals???

Don’t point to in-efficient past to establish similar in-efficient future.

interesting, you know this is a one-time thing, right? and you are aware of this has been there for years.

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Like how to set a queue size and enable it?

Those are meant to be used before DRIVER_OK stage as they are init time

registers.

Quoted 1 line

Not to keep abusing them..

don't you need to set queue_size at the destination side?

No.
But the src/dst does not matter.
Queue_size to be set before DRIVER_OK like rest of the registers, as all

Quoted 7 lines
Quoted 6 lines
Quoted 4 lines

queues must be created before the driver_ok phase.

Quoted 1 line

Queue_reset was last moment exception.

create a queue? Nvidia specific?

Huh. No.
Do git log and realize what happened with queue_reset.

You didn't answer the question, does the spec even has defined "create a vq"?

Enabled/created = tomato/tomato when discussing the spec in non-normative email conversation. It's irrelevant.

All I am saying is, when we know the limitations of the transport and when industry is forwarding to not introduced more and more on-die register for once in lifetime work of device migration, we just use the optimal command and queue interface that is native to virtio.

#97 lore raw

Re: [virtio-comment] Re: [PATCH V2 4/6] virtio-pci: implement VIRTIO_F_QUEUE_STATE

Quoted 6 lines · Parav Pandit
Quoted 6 lines
Quoted 4 lines
Quoted 1 line

The registers are control path in config space, how 400G or 800G affect??

Because those are the one in practice requires large number of VQs.

You are asking per VQ register commands to modify things dynamically via

this one vq at a time, serializing all the operations.

Quoted 1 line

It does not scale well with high q count.

Quoted 8 lines
Quoted 3 lines

This is not dynamically, it only happens when SUSPEND and RESUME. This is the same mechanism how virtio initialize a virtqueue, working for many years.

No. when virtio driver initializes it for the first time, there is no active traffic that gets lost. This is because the interface is not yet up and not part of the network yet.

The resume must be fast enough, because the remote node is sending packets. Hence it is different from driver init time queue enable.

Maybe but I think not qualitatively different.
If you care about these things please provide some estimates. I just don't see how queue resume writes even with 64k queues will saturate an express link.

Quoted 36 lines
Quoted 5 lines
Quoted 4 lines
Quoted 2 lines

See the virtio common cfg, you will find the max number of vqs is there, num_queues.

:)
Sure. those values at high q count affects.

the driver need to initialize them anyway.

That is before the traffic starts from remote end.

Quoted 29 lines
Quoted 10 lines
Quoted 9 lines
Quoted 4 lines

Device didn’t support LM.
Many limitations existed all these years and TC is improving and expanding

them.

Quoted 1 line

So all these years do not matter.

Not sure what are you talking about, haven't we initialize the device and vqs in config space for years?????? What's wrong with this mechanism? Are you questioning virito-pci fundamentals???

Don’t point to in-efficient past to establish similar in-efficient future.

interesting, you know this is a one-time thing, right? and you are aware of this has been there for years.

Quoted 17 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

Like how to set a queue size and enable it?

Those are meant to be used before DRIVER_OK stage as they are init time

registers.

Quoted 1 line

Not to keep abusing them..

Quoted 9 lines
Quoted 5 lines
Quoted 1 line

don't you need to set queue_size at the destination side?

No.
But the src/dst does not matter.
Queue_size to be set before DRIVER_OK like rest of the registers, as all

queues must be created before the driver_ok phase.

Quoted 1 line

Queue_reset was last moment exception.

create a queue? Nvidia specific?

Huh. No.
Do git log and realize what happened with queue_reset.

Quoted 7 lines
Quoted 1 line

You didn't answer the question, does the spec even has defined "create a vq"?

Enabled/created = tomato/tomato when discussing the spec in non-normative email conversation. It's irrelevant.

All I am saying is, when we know the limitations of the transport and when industry is forwarding to not introduced more and more on-die register for once in lifetime work of device migration, we just use the optimal command and queue interface that is native to virtio.

we really do not need to prematurely optimize all things. control path is control path it is going to be slow because virtio designed it to be slow and drivers don't optimize it. Shaving off a microsecond here or there is going to do nothing except increase maintainance costs.

Signature · 18 lines
MST


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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/
#98 lore raw

RE: [virtio-comment] Re: [PATCH V2 4/6] virtio-pci: implement VIRTIO_F_QUEUE_STATE

Quoted 19 lines

From: Michael S. Tsirkin <[email protected]>
Sent: Thursday, November 9, 2023 2:12 PM

Quoted 11 lines · Parav Pandit
Quoted 10 lines
Quoted 5 lines
Quoted 1 line

The registers are control path in config space, how 400G or 800G affect??

Because those are the one in practice requires large number of VQs.

You are asking per VQ register commands to modify things dynamically via

this one vq at a time, serializing all the operations.

Quoted 1 line

It does not scale well with high q count.

This is not dynamically, it only happens when SUSPEND and RESUME. This is the same mechanism how virtio initialize a virtqueue, working for many years.

No. when virtio driver initializes it for the first time, there is no active traffic

that gets lost.

Quoted 2 lines

This is because the interface is not yet up and not part of the network yet.

Quoted 9 lines
Quoted 1 line

The resume must be fast enough, because the remote node is sending

packets.

Quoted 1 line

Hence it is different from driver init time queue enable.

Maybe but I think not qualitatively different.
If you care about these things please provide some estimates.
I just don't see how queue resume writes even with 64k queues will saturate an express link.

It is not the bw of the link.
It is how the need for the device to be always read to suspend those many queues through register interface.

Quoted 47 lines
Quoted 16 lines
Quoted 6 lines
Quoted 5 lines
Quoted 3 lines

See the virtio common cfg, you will find the max number of vqs is there, num_queues.

:)
Sure. those values at high q count affects.

the driver need to initialize them anyway.

That is before the traffic starts from remote end.

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines

Device didn’t support LM.
Many limitations existed all these years and TC is improving and expanding

them.

Quoted 1 line

So all these years do not matter.

Not sure what are you talking about, haven't we initialize the device and vqs in config space for years?????? What's wrong with this

mechanism?

Quoted 15 lines
Quoted 15 lines
Quoted 2 lines
Quoted 1 line

Are you questioning virito-pci fundamentals???

Don’t point to in-efficient past to establish similar in-efficient future.

interesting, you know this is a one-time thing, right? and you are aware of this has been there for years.

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Like how to set a queue size and enable it?

Those are meant to be used before DRIVER_OK stage as they are init time

registers.

Quoted 1 line

Not to keep abusing them..

don't you need to set queue_size at the destination side?

No.
But the src/dst does not matter.
Queue_size to be set before DRIVER_OK like rest of the registers, as all

Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
Quoted 4 lines

queues must be created before the driver_ok phase.

Quoted 1 line

Queue_reset was last moment exception.

create a queue? Nvidia specific?

Huh. No.
Do git log and realize what happened with queue_reset.

You didn't answer the question, does the spec even has defined "create a

vq"?

Quoted 2 lines

Enabled/created = tomato/tomato when discussing the spec in non-normative

email conversation.

Quoted 4 lines

It's irrelevant.

All I am saying is, when we know the limitations of the transport and when industry is forwarding to not introduced more and more on-die register

Quoted 8 lines

for once in lifetime work of device migration, we just use the optimal command and queue interface that is native to virtio.

we really do not need to prematurely optimize all things.
control path is control path it is going to be slow because virtio designed it to be slow and drivers don't optimize it.
Shaving off a microsecond here or there is going to do nothing except increase maintainance costs.

Control path post device initialization for large part is through the cvq.

#99 lore raw

Re: [virtio-comment] Re: [PATCH V2 4/6] virtio-pci: implement VIRTIO_F_QUEUE_STATE

Quoted 23 lines · Parav Pandit
Quoted 23 lines

From: Michael S. Tsirkin <[email protected]>
Sent: Thursday, November 9, 2023 2:12 PM

Quoted 11 lines · Parav Pandit
Quoted 10 lines
Quoted 5 lines
Quoted 1 line

The registers are control path in config space, how 400G or 800G affect??

Because those are the one in practice requires large number of VQs.

You are asking per VQ register commands to modify things dynamically via

this one vq at a time, serializing all the operations.

Quoted 1 line

It does not scale well with high q count.

This is not dynamically, it only happens when SUSPEND and RESUME. This is the same mechanism how virtio initialize a virtqueue, working for many years.

No. when virtio driver initializes it for the first time, there is no active traffic

that gets lost.

Quoted 3 lines

This is because the interface is not yet up and not part of the network yet.

The resume must be fast enough, because the remote node is sending

packets.

Quoted 1 line

Hence it is different from driver init time queue enable.

Quoted 7 lines
Quoted 5 lines

Maybe but I think not qualitatively different.
If you care about these things please provide some estimates.
I just don't see how queue resume writes even with 64k queues will saturate an express link.

It is not the bw of the link.
It is how the need for the device to be always read to suspend those many queues through register interface.

read->ready?

If we want to we can solve it btw. Prohibit changing queue select while suspend is in progress.

But more importantly once Zhu Lingshan stops arguing about suspend bit he'll hopefully work on transport vq. Then we can have it in config space and at the same time not use up a register.

Quoted 50 lines
Quoted 50 lines
Quoted 16 lines
Quoted 6 lines
Quoted 5 lines
Quoted 3 lines

See the virtio common cfg, you will find the max number of vqs is there, num_queues.

:)
Sure. those values at high q count affects.

the driver need to initialize them anyway.

That is before the traffic starts from remote end.

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines

Device didn’t support LM.
Many limitations existed all these years and TC is improving and expanding

them.

Quoted 1 line

So all these years do not matter.

Not sure what are you talking about, haven't we initialize the device and vqs in config space for years?????? What's wrong with this

mechanism?

Quoted 15 lines
Quoted 15 lines
Quoted 2 lines
Quoted 1 line

Are you questioning virito-pci fundamentals???

Don’t point to in-efficient past to establish similar in-efficient future.

interesting, you know this is a one-time thing, right? and you are aware of this has been there for years.

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Like how to set a queue size and enable it?

Those are meant to be used before DRIVER_OK stage as they are init time

registers.

Quoted 1 line

Not to keep abusing them..

don't you need to set queue_size at the destination side?

No.
But the src/dst does not matter.
Queue_size to be set before DRIVER_OK like rest of the registers, as all

Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
Quoted 4 lines

queues must be created before the driver_ok phase.

Quoted 1 line

Queue_reset was last moment exception.

create a queue? Nvidia specific?

Huh. No.
Do git log and realize what happened with queue_reset.

You didn't answer the question, does the spec even has defined "create a

vq"?

Quoted 2 lines

Enabled/created = tomato/tomato when discussing the spec in non-normative

email conversation.

Quoted 4 lines

It's irrelevant.

All I am saying is, when we know the limitations of the transport and when industry is forwarding to not introduced more and more on-die register

for once in lifetime work of device migration, we just use the optimal command and queue interface that is native to virtio.

Quoted 7 lines
Quoted 5 lines

we really do not need to prematurely optimize all things.
control path is control path it is going to be slow because virtio designed it to be slow and drivers don't optimize it.
Shaving off a microsecond here or there is going to do nothing except increase maintainance costs.

Control path post device initialization for large part is through the cvq.

Really depends on the device. For virtio net most of the time is spent on filling up receive queues and sending network announcements and such.

Signature · 18 lines
MST


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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/
#27 lore raw

Re: [virtio-comment] Re: [PATCH V2 2/6] virtio: introduce SUSPEND bit in device status

In reply to Michael S. Tsirkin
Quoted 35 lines · Michael S. Tsirkin
Quoted 34 lines · Lingshan

On 11/6/2023 5:43 PM, Michael S. Tsirkin wrote:

On Fri, Nov 03, 2023 at 06:34:33PM +0800, Zhu Lingshan wrote:

This patch introduces a new status bit in the device status: SUSPEND.

This SUSPEND bit can be used by the driver to suspend a device, in order to stabilize the device states and virtqueue states.

Its main use case is live migration.

---
content.tex | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-)

diff --git a/content.tex b/content.tex
index 76813b5..bcc9d4b 100644
--- a/content.tex
+++ b/content.tex
@@ -49,6 +49,10 @@ \section{\field{Device Status} Field}\label{sec:Basic Facilities of a Virtio Dev

\item[DEVICE_NEEDS_RESET (64)] Indicates that the device has experienced
an error from which it can't recover.
+
+\item[SUSPEND (16)] When VIRTIO_F_SUSPEND is negotiated, indicates that the
+ device has been suspended by the driver.
+

what does this mean?

Quoted 8 lines
Quoted 5 lines

When the driver sets SUSPEND and the device presents SUSPEND, means the device has been suspended by the driver.

Do you suggest to remove "When VIRTIO_F_SUSPEND is negotiated"

No I suggest explaining what does it mean that device has been suspended.

I will add "to stabilize the device states", is that OK?

Quoted 13 lines
Quoted 13 lines

\end{description}

The \field{device status} field starts out as 0, and is reinitialized to 0 by
@@ -73,6 +77,10 @@ \section{\field{Device Status} Field}\label{sec:Basic Facilities of a Virtio Dev
recover by issuing a reset.
\end{note}

+The driver SHOULD NOT set SUSPEND if FEATURES_OK is not set.
+
+When setting SUSPEND, the driver MUST re-read \field{device status} to ensure the SUSPEND bit is set. +

Quoted 4 lines
Quoted 3 lines

and if it's not?

Then the device may run into errors or just need longer time to suspend.

and then what does driver do?

I assume the driver should reset the device or give up the device.

Re-read is how we handle other status, like features_ok.

Quoted 4 lines
Quoted 3 lines

This is how we handle features_OK: "Re-read device status to ensure the FEATURES_OK bit is still set"

this is designed in case features are inconsistent.

I think this is designed to: 1) flush the device status 2) make sure the features are set.

Quoted 1 line

what kind of thing are you handling here?

The same purpose, to flush the status and make sure suspend is set. Once we make sure the device has been suspended, we can fetch the device states.

Quoted 2 lines

Also and then we bail out and retry with other feature set if not. what do we do here?

same as above, if the device is not suspended, like vqs still running, we can not fetch stable vq states. So we need to make sure it is set.

Quoted 35 lines
Quoted 15 lines

\devicenormative{\subsection}{Device Status Field}{Basic Facilities of a Virtio Device / Device Status Field}

The device MUST NOT consume buffers or send any used buffer
@@ -82,6 +90,26 @@ \section{\field{Device Status} Field}\label{sec:Basic Facilities of a Virtio Dev
that a reset is needed. If DRIVER_OK is set, after it sets DEVICE_NEEDS_RESET, the device MUST send a device configuration change notification to the driver.

+The device MUST ignore SUSPEND if FEATURES_OK is not set.
+
+The device MUST ignore SUSPEND if VIRTIO_F_SUSPEND is not negotiated. +
+The device SHOULD allow settings to \field{device status} even when SUSPEND is set.

Quoted 4 lines

which settings?

any legit writing to the device status, like DRIVER_OK

that's not "settings" that's setting.

Quoted 14 lines

+
+If VIRTIO_F_SUSPEND is negotiated and SUSPEND is set, the device SHOULD clear SUSPEND +and resumes operation upon DRIVER_OK.
+
+If VIRTIO_F_SUSPEND is negotiated, when the driver sets SUSPEND,
+the device SHOULD perform the following actions before presenting SUSPEND bit in the \field{device status}:
+
+\begin{itemize}
+\item Stop consuming buffers of any virtqueues and mark all finished descritors as used.

descritors? and what does finished mean?

Sorry my typo.

Quoted 8 lines
Quoted 5 lines

Finished means done processing it.

Like the spec words: When the device has finished a buffer, it writes the descriptor index into the used ring, and sends a used buffer notification.

only good for internal ring documentation - we did not want to say used because it's not used until used entry written. here just say used.

I am confused, by "here just say used", do you suggest we say:
"Stop consuming buffers of any virtqueues and mark all used descriptors as used."?

I am not a native speaker, and I am not sure this is better than finished

Quoted 32 lines
Quoted 32 lines

+\item Wait until all descriptors that being processed to finish and mark them as used.

descriptors are not marked used. buffers are.

that being -> that are being maybe?

Will fix

+\item Flush all used buffer and send used buffer notifications to the driver.

used buffers?

Here it means the buffer marked as used. shall I use finished buffer or any other suggestions?

what does Flush mean?

Flush means send all of them out. Like 5.19.7.1 Device Requirements: Device
Operation: Virtqueue flush

         +\item Record Virtqueue State of each enabled virtqueue, see section \ref{sec:Virtqueues / Virtqueue State}

     execpt that one unfortunately does not bother to say what does this mean
     :(
Quoted 7 lines
Quoted 5 lines

The virtqueue state has been defined in this series, in packed/split-ring.tex. And an PCI implementation of the interfaces is included.

Do you suggest any supplementary materials?

I suggest something that documents what it means unlike what is in this series.

How about: "Record Virtqueue State of each enabled virtqueue by the transport specific interfaces"?

Quoted 6 lines
Quoted 6 lines

+\item Pause its operation except \field{device status} and preserve configurations in its Device Configuration Space, see \ref{sec:Basic Facilities of a Virtio Device / Device Configuration Space}

How do you Pause? For example, consider a link state register. You set

Quoted 8 lines
Quoted 6 lines

The device pauses itself.

SUSPEND, then link goes down. What is device supposed to do?

Once the device suspended, the device should not respond to the link_down until alive again.

what is link_down?
link goes down just by virtue of disconnecting it physically.

To stabilize the device states, once suspended, even link down,
the device should not respond to it, this means:
1) if link down happens before suspend, the device detect and send an config interrupt.
2) if link down happens after suspend, the device should not respond to it.
3) if the device resume running, then detect link down and send an config interrupt.

Quoted 10 lines
Quoted 10 lines

This is to preserve the device states, just record whatever it is when SUSPEND-ed. And process the signal when resume or alive at the destination side. At the destination it also needs a live announce which require an active link.

Record this somewhere internal but do not show it to driver? And how exactly will this hidden internal state be migrated since it is not visible?

Quoted 5 lines
Quoted 4 lines

May I know what kind of internal states?
This series migrates stateless devices, hard to define virtio-fs device context.

all devices have some state, none are completely stateless.

Some of the states can be read from config space, hypervisor can migrate them for sure. Others like virtio-fs are hard to define for now, but we still need to make progress in live migration.

Quoted 63 lines
Quoted 63 lines

+\end{itemize}
+
\section{Feature Bits}\label{sec:Basic Facilities of a Virtio Device / Feature Bits}

Each virtio device offers all the features it understands. During
@@ -99,10 +127,10 @@ \section{Feature Bits}\label{sec:Basic Facilities of a Virtio Device / Feature B
\begin{description}
\item[0 to 23, and 50 to 127] Feature bits for the specific device type

-\item[24 to 42] Feature bits reserved for extensions to the queue and +\item[24 to 43] Feature bits reserved for extensions to the queue and
feature negotiation mechanisms

-\item[43 to 49, and 128 and above] Feature bits reserved for future extensions. +\item[44 to 49, and 128 and above] Feature bits reserved for future extensions.
\end{description}

\begin{note}
@@ -875,6 +903,10 @@ \chapter{Reserved Feature Bits}\label{sec:Reserved Feature Bits}
\item[VIRTIO_F_QUEUE_STATE(42)] This feature indicates that the device allows the driver to access its internal virtqueue state.

+ \item[VIRTIO_F_SUSPEND(43)] This feature indicates that the driver can
+ SUSPEND the device.

why is SUSPEND upper-case here?

will be lower in V3.

Thanks

+ See \ref{sec:Basic Facilities of a Virtio Device / Device Status Field}.
+
\end{description}

\drivernormative{\section}{Reserved Feature Bits}{Reserved Feature Bits}
--
2.35.3

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:[email protected] Unsubscribe:[email protected] List help:[email protected]
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/

#32 lore raw

[virtio-comment] Re: [PATCH V2 3/6] virtio: dont reset vqs when SUSPEND

In reply to Michael S. Tsirkin
Quoted 27 lines · Michael S. Tsirkin
Quoted 26 lines · Lingshan
Quoted 24 lines · Michael S. Tsirkin
Quoted 14 lines · Zhu Lingshan

When SUSPEND is set, device states and virtqueue states should be stablized, therefore the driver should not reset vqs when SUSPEND is set in device status.

---
   content.tex | 3 +++
   1 file changed, 3 insertions(+)
content.tex +0 -0
index bcc9d4b..060b5c2 100644

content.tex \subsubsection{Virtqueue Reset}\label{sec:Basic Facilities of a Virtio Device / · line 450

Quoted 7 lines
content.tex +3 -0
@@ -444,6 +444,9 @@ \subsubsection{Virtqueue Reset}\label{sec:Basic Facilities of a Virtio Device /
   The device MUST reset any state of a virtqueue to the default state,
   including the available state and the used state.
+If VIRTIO_F_SUSPEND is negotiated and SUSPEND is set in \field{device status},
+the driver SHOULD NOT reset any virtqueues.
+
   \drivernormative{\paragraph}{Virtqueue Reset}{Basic Facilities of a Virtio Device / Virtqueues / Virtqueue Reset / Virtqueue Reset}
   After the driver tells the device to reset a queue, the driver MUST verify that

Seems somewhat arbitrary and breaks the claim that the feature is orthogonal and can have uses besides migration.

Quoted 4 lines
Quoted 2 lines

when suspended, the device is frozen.
The driver is aware of this process and so should not reset the vqs I think.

Again that is only true because you want to use it for migration. But then you can't claim it's a generic facility.

I don't get it. The device status is a basic facility.

We need to SUSPEND the device by setting SUSPEND bit, to stabilize the device states for migration. This can also be used for debugging I think.

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Signature · 2 lines
-- 
2.35.3

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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/

#89 lore raw

Re: [virtio-comment] Re: [PATCH V2 4/6] virtio-pci: implement VIRTIO_F_QUEUE_STATE

In reply to Michael S. Tsirkin
Quoted 61 lines · Michael S. Tsirkin
Quoted 60 lines · Lingshan
Quoted 58 lines · Parav Pandit
Quoted 48 lines

From: Zhu, Lingshan <[email protected]>
Sent: Monday, November 6, 2023 2:57 PM

Quoted 44 lines · Parav Pandit
Quoted 44 lines

From: Zhu, Lingshan <[email protected]>
Sent: Monday, November 6, 2023 9:01 AM

Quoted 16 lines · Parav Pandit
Quoted 16 lines

From: [email protected] <[email protected] open.org> On Behalf Of Zhu, Lingshan
Sent: Friday, November 3, 2023 8:27 PM

Quoted 11 lines · Parav Pandit
Quoted 11 lines

From: Zhu Lingshan <[email protected]>
Sent: Friday, November 3, 2023 4:05 PM

This patch adds two new le16 fields to common configuration structure to support VIRTIO_F_QUEUE_STATE in PCI transport layer.

---
      transport-pci.tex | 18 ++++++++++++++++++
      1 file changed, 18 insertions(+)
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

transport-pci.tex \subsubsection{Common configuration

Quoted 5 lines
transport-pci.tex index renamed from transport-pci.tex +0 -0

a5c6719..3161519 100644

transport-pci.tex +0 -0
@@ -325,6 +325,10 @@ \subsubsection{Common configuration

structure

Quoted 18 lines
Quoted 10 lines
Quoted 10 lines

transport-pci.tex

Quoted 8 lines

layout}\label{sec:Virtio Transport
/* About the administration virtqueue. */
le16 admin_queue_index; /* read-only for driver */
le16 admin_queue_num; /* read-only for driver */

transport-pci.tex +4 -0
+
+	/* Virtqueue state */
+        le16 queue_avail_state;         /* read-write */
+        le16 queue_used_state;          /* read-write */

This tiny interface for 128 virtio net queues through register read writes, does

Quoted 5 lines

not work effectively.

Quoted 2 lines

There are inflight out of order descriptors for block also. Hence toy registers like this do not work.

Do you know there is a queue_select? Why this does not work? Do you know how other queue related fields work?

:)
Yes. If you notice queue_reset related critical spec bug fix was done when it

Quoted 8 lines
Quoted 6 lines
Quoted 5 lines

was introduced so that live migration can _actually_ work.

Quoted 2 lines

When queue_select is done for 128 queues serially, it take a lot of time to

read those slow register interface for this + inflight descriptors + more. interesting, virtio work in this pattern for many years, right?

All these years 400Gbps and 800Gbps virtio was not present, number of

queues were not in hw.
The registers are control path in config space, how 400G or 800G affect??

Because those are the one in practice requires large number of VQs.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

You are asking per VQ register commands to modify things dynamically via this one vq at a time, serializing all the operations. It does not scale well with high q count.

This is not dynamically, it only happens when SUSPEND and RESUME. This is the same mechanism how virtio initialize a virtqueue, working for many years.

I wish we just had a transport vq already. That's the way to solve this not fighting individual bits.

Yeah, I agree, transport is a queued task(sent out V4 months ago...), one by one... hard and tough work...

Quoted 29 lines
Quoted 29 lines
Quoted 5 lines
Quoted 3 lines

See the virtio common cfg, you will find the max number of vqs is there, num_queues.

:)
Sure. those values at high q count affects.

the driver need to initialize them anyway.

Quoted 8 lines
Quoted 7 lines
Quoted 2 lines

Device didn’t support LM.
Many limitations existed all these years and TC is improving and expanding

them.

Quoted 1 line

So all these years do not matter.

Not sure what are you talking about, haven't we initialize the device and vqs in config space for years?????? What's wrong with this mechanism?
Are you questioning virito-pci fundamentals???

Don’t point to in-efficient past to establish similar in-efficient future.

interesting, you know this is a one-time thing, right? and you are aware of this has been there for years.

Quoted 13 lines
Quoted 13 lines
Quoted 9 lines
Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Like how to set a queue size and enable it?

Those are meant to be used before DRIVER_OK stage as they are init time

registers.

Quoted 1 line

Not to keep abusing them..

don't you need to set queue_size at the destination side?

No.
But the src/dst does not matter.
Queue_size to be set before DRIVER_OK like rest of the registers, as all

queues must be created before the driver_ok phase.

Quoted 1 line

Queue_reset was last moment exception.

create a queue? Nvidia specific?

Quoted 8 lines
Quoted 8 lines
Quoted 2 lines

Huh. No.
Do git log and realize what happened with queue_reset.

You didn't answer the question, does the spec even has defined "create a vq"?

Quoted 3 lines
Quoted 2 lines

For standard virtio, you need to read the number of enabled vqs at the source side, then enable them at the dst, so queue_size matters, not to create.

All that happens in the pre-copy phase.

Yes and how your answer related to this discussion?

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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/

#90 lore raw

Re: [virtio-comment] Re: [PATCH V2 4/6] virtio-pci: implement VIRTIO_F_QUEUE_STATE

Quoted 66 lines · Lingshan
Quoted 63 lines · Michael S. Tsirkin
Quoted 62 lines · Lingshan
Quoted 60 lines · Parav Pandit
Quoted 48 lines

From: Zhu, Lingshan <[email protected]>
Sent: Monday, November 6, 2023 2:57 PM

Quoted 44 lines · Parav Pandit
Quoted 44 lines

From: Zhu, Lingshan <[email protected]>
Sent: Monday, November 6, 2023 9:01 AM

Quoted 16 lines · Parav Pandit
Quoted 16 lines

From: [email protected] <[email protected] open.org> On Behalf Of Zhu, Lingshan
Sent: Friday, November 3, 2023 8:27 PM

Quoted 11 lines · Parav Pandit
Quoted 11 lines

From: Zhu Lingshan <[email protected]>
Sent: Friday, November 3, 2023 4:05 PM

This patch adds two new le16 fields to common configuration structure to support VIRTIO_F_QUEUE_STATE in PCI transport layer.

---
      transport-pci.tex | 18 ++++++++++++++++++
      1 file changed, 18 insertions(+)
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

transport-pci.tex \subsubsection{Common configuration

Quoted 5 lines
transport-pci.tex index renamed from transport-pci.tex +0 -0

a5c6719..3161519 100644

transport-pci.tex +0 -0
@@ -325,6 +325,10 @@ \subsubsection{Common configuration

structure

Quoted 18 lines
Quoted 10 lines
Quoted 10 lines

transport-pci.tex

Quoted 8 lines

layout}\label{sec:Virtio Transport
/* About the administration virtqueue. */
le16 admin_queue_index; /* read-only for driver */
le16 admin_queue_num; /* read-only for driver */

transport-pci.tex +4 -0
+
+	/* Virtqueue state */
+        le16 queue_avail_state;         /* read-write */
+        le16 queue_used_state;          /* read-write */

This tiny interface for 128 virtio net queues through register read writes, does

Quoted 5 lines

not work effectively.

Quoted 2 lines

There are inflight out of order descriptors for block also. Hence toy registers like this do not work.

Do you know there is a queue_select? Why this does not work? Do you know how other queue related fields work?

:)
Yes. If you notice queue_reset related critical spec bug fix was done when it

Quoted 8 lines
Quoted 6 lines
Quoted 5 lines

was introduced so that live migration can _actually_ work.

Quoted 2 lines

When queue_select is done for 128 queues serially, it take a lot of time to

read those slow register interface for this + inflight descriptors + more. interesting, virtio work in this pattern for many years, right?

All these years 400Gbps and 800Gbps virtio was not present, number of

queues were not in hw.
The registers are control path in config space, how 400G or 800G affect??

Because those are the one in practice requires large number of VQs.

You are asking per VQ register commands to modify things dynamically via this one vq at a time, serializing all the operations. It does not scale well with high q count.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

This is not dynamically, it only happens when SUSPEND and RESUME. This is the same mechanism how virtio initialize a virtqueue, working for many years.

I wish we just had a transport vq already. That's the way to solve this not fighting individual bits.

Yeah, I agree, transport is a queued task(sent out V4 months ago...), one by one... hard and tough work...

Frankly I think that should take precedence, then Parav will not get annoyed each time add a couple of registers.

Quoted 28 lines
Quoted 28 lines
Quoted 28 lines
Quoted 4 lines
Quoted 2 lines

See the virtio common cfg, you will find the max number of vqs is there, num_queues.

:)
Sure. those values at high q count affects.

the driver need to initialize them anyway.

Quoted 8 lines
Quoted 7 lines
Quoted 2 lines

Device didn’t support LM.
Many limitations existed all these years and TC is improving and expanding

them.

Quoted 1 line

So all these years do not matter.

Not sure what are you talking about, haven't we initialize the device and vqs in config space for years?????? What's wrong with this mechanism?
Are you questioning virito-pci fundamentals???

Don’t point to in-efficient past to establish similar in-efficient future.

interesting, you know this is a one-time thing, right? and you are aware of this has been there for years.

Quoted 13 lines
Quoted 13 lines
Quoted 9 lines
Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Like how to set a queue size and enable it?

Those are meant to be used before DRIVER_OK stage as they are init time

registers.

Quoted 1 line

Not to keep abusing them..

don't you need to set queue_size at the destination side?

No.
But the src/dst does not matter.
Queue_size to be set before DRIVER_OK like rest of the registers, as all

queues must be created before the driver_ok phase.

Quoted 1 line

Queue_reset was last moment exception.

create a queue? Nvidia specific?

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 2 lines

Huh. No.
Do git log and realize what happened with queue_reset.

You didn't answer the question, does the spec even has defined "create a vq"?

Quoted 3 lines
Quoted 2 lines

For standard virtio, you need to read the number of enabled vqs at the source side, then enable them at the dst, so queue_size matters, not to create.

All that happens in the pre-copy phase.

Yes and how your answer related to this discussion?

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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/

#101 lore raw

Re: [virtio-comment] Re: [PATCH V2 4/6] virtio-pci: implement VIRTIO_F_QUEUE_STATE

In reply to Parav Pandit
Quoted 66 lines · Parav Pandit
Quoted 66 lines

From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, November 7, 2023 3:02 PM

Quoted 53 lines · Parav Pandit
Quoted 53 lines

From: Zhu, Lingshan <[email protected]>
Sent: Monday, November 6, 2023 2:57 PM

Quoted 49 lines · Parav Pandit
Quoted 49 lines

From: Zhu, Lingshan <[email protected]>
Sent: Monday, November 6, 2023 9:01 AM

Quoted 16 lines · Parav Pandit
Quoted 16 lines

From: [email protected] <[email protected] open.org> On Behalf Of Zhu, Lingshan
Sent: Friday, November 3, 2023 8:27 PM

Quoted 11 lines · Parav Pandit
Quoted 11 lines

From: Zhu Lingshan <[email protected]>
Sent: Friday, November 3, 2023 4:05 PM

This patch adds two new le16 fields to common configuration structure to support VIRTIO_F_QUEUE_STATE in PCI transport layer.

---
      transport-pci.tex | 18 ++++++++++++++++++
      1 file changed, 18 insertions(+)
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

transport-pci.tex \subsubsection{Common configuration

Quoted 5 lines
transport-pci.tex index renamed from transport-pci.tex +0 -0

a5c6719..3161519 100644

transport-pci.tex +0 -0
@@ -325,6 +325,10 @@ \subsubsection{Common configuration

structure

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

transport-pci.tex

Quoted 8 lines

layout}\label{sec:Virtio Transport
/* About the administration virtqueue. */
le16 admin_queue_index; /* read-only for driver */
le16 admin_queue_num; /* read-only for driver */

transport-pci.tex +4 -0
+
+	/* Virtqueue state */
+        le16 queue_avail_state;         /* read-write */
+        le16 queue_used_state;          /* read-write */

This tiny interface for 128 virtio net queues through register read writes, does

Quoted 8 lines
Quoted 5 lines

not work effectively.

Quoted 2 lines

There are inflight out of order descriptors for block also. Hence toy registers like this do not work.

Do you know there is a queue_select? Why this does not work? Do you know how other queue related fields work?

:)
Yes. If you notice queue_reset related critical spec bug fix was done when it

was introduced so that live migration can _actually_ work.

Quoted 2 lines

When queue_select is done for 128 queues serially, it take a lot of time to

read those slow register interface for this + inflight descriptors + more. interesting, virtio work in this pattern for many years, right?

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

All these years 400Gbps and 800Gbps virtio was not present, number of

queues were not in hw.
The registers are control path in config space, how 400G or 800G affect??

Because those are the one in practice requires large number of VQs.

You are asking per VQ register commands to modify things dynamically via

this one vq at a time, serializing all the operations.

Quoted 1 line

It does not scale well with high q count.

Quoted 8 lines
Quoted 3 lines

This is not dynamically, it only happens when SUSPEND and RESUME. This is the same mechanism how virtio initialize a virtqueue, working for many years.

No. when virtio driver initializes it for the first time, there is no active traffic that gets lost. This is because the interface is not yet up and not part of the network yet.

The resume must be fast enough, because the remote node is sending packets. Hence it is different from driver init time queue enable.

I am not sure any packets arrive before a link announce at the destination side.

Quoted 7 lines
Quoted 6 lines
Quoted 5 lines
Quoted 3 lines

See the virtio common cfg, you will find the max number of vqs is there, num_queues.

:)
Sure. those values at high q count affects.

the driver need to initialize them anyway.

That is before the traffic starts from remote end.

see above, that needs a link announce and this is after re-initialization

Quoted 23 lines
Quoted 23 lines
Quoted 10 lines
Quoted 9 lines
Quoted 4 lines

Device didn’t support LM.
Many limitations existed all these years and TC is improving and expanding

them.

Quoted 1 line

So all these years do not matter.

Not sure what are you talking about, haven't we initialize the device and vqs in config space for years?????? What's wrong with this mechanism? Are you questioning virito-pci fundamentals???

Don’t point to in-efficient past to establish similar in-efficient future.

interesting, you know this is a one-time thing, right? and you are aware of this has been there for years.

Quoted 11 lines
Quoted 11 lines
Quoted 10 lines
Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Like how to set a queue size and enable it?

Those are meant to be used before DRIVER_OK stage as they are init time

registers.

Quoted 1 line

Not to keep abusing them..

don't you need to set queue_size at the destination side?

No.
But the src/dst does not matter.
Queue_size to be set before DRIVER_OK like rest of the registers, as all

queues must be created before the driver_ok phase.

Quoted 8 lines
Quoted 6 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Queue_reset was last moment exception.

create a queue? Nvidia specific?

Huh. No.
Do git log and realize what happened with queue_reset.

You didn't answer the question, does the spec even has defined "create a vq"?

Enabled/created = tomato/tomato when discussing the spec in non-normative email conversation. It's irrelevant.

Then lets not debate on this enable a vq or create a vq anymore

Quoted 2 lines

All I am saying is, when we know the limitations of the transport and when industry is forwarding to not introduced more and more on-die register for once in lifetime work of device migration, we just use the optimal command and queue interface that is native to virtio.

PCI config space has its own limitations, and admin vq has its advantages, but that does not apply to all use cases.

I don't want to repeat why I don't think admin vq is a good idea for migration again, we have already discussed on that.

Quoted 1 line

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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/

#100 lore raw

RE: [virtio-comment] Re: [PATCH V2 4/6] virtio-pci: implement VIRTIO_F_QUEUE_STATE

In reply to Michael S. Tsirkin
Quoted 45 lines

From: Michael S. Tsirkin <[email protected]>
Sent: Thursday, November 9, 2023 3:23 PM
To: Parav Pandit <[email protected]>
Cc: Zhu, Lingshan <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; virtio- [email protected]
Subject: Re: [virtio-comment] Re: [PATCH V2 4/6] virtio-pci: implement VIRTIO_F_QUEUE_STATE

Quoted 6 lines · Parav Pandit
Quoted 6 lines

From: Michael S. Tsirkin <[email protected]>
Sent: Thursday, November 9, 2023 2:12 PM

Quoted 1 line · Parav Pandit
Quoted 1 line
Quoted 1 line
Quoted 1 line

The registers are control path in config space, how 400G or 800G

affect??

Quoted 18 lines
Quoted 18 lines
Quoted 11 lines
Quoted 9 lines
Quoted 4 lines

Because those are the one in practice requires large number of VQs.

You are asking per VQ register commands to modify things dynamically via

this one vq at a time, serializing all the operations.

Quoted 1 line

It does not scale well with high q count.

This is not dynamically, it only happens when SUSPEND and RESUME. This is the same mechanism how virtio initialize a virtqueue, working for many years.

No. when virtio driver initializes it for the first time, there is no active traffic

that gets lost.

Quoted 3 lines

This is because the interface is not yet up and not part of the network yet.

The resume must be fast enough, because the remote node is sending

packets.

Quoted 1 line

Hence it is different from driver init time queue enable.

Quoted 7 lines
Quoted 5 lines

Maybe but I think not qualitatively different.
If you care about these things please provide some estimates. I just don't see how queue resume writes even with 64k queues will saturate an express link.

It is not the bw of the link.
It is how the need for the device to be always read to suspend those many

queues through register interface.

Quoted 8 lines

read->ready?

If we want to we can solve it btw. Prohibit changing queue select while suspend is in progress.

But more importantly once Zhu Lingshan stops arguing about suspend bit he'll hopefully work on transport vq. Then we can have it in config space and at the same time not use up a register.

Transport vq on the owner device for long term does not make sense as hypervisor should not be involved in viewing this content from TDISP time. So cvq of whatever vq we want to call from the member device will be just perfect.
And it will behave like any other queues.
This will be uniformly available for VF, SIOV, PF devices regardless of TDISP and with TDISP.
This solves both the scale issue and security issue.

Hence 3 solutions,
1. transport vq for VF using owner device for purpose of device migration
2. not using it and inventing another VQ for TDISP in future and for PF, VF, SIOV and TDISP is overkill.

All the operations of the live migration driver like suspend device or others, seems doable just fine using owner device. What is missing?

Quoted 62 lines
Quoted 62 lines
Quoted 61 lines
Quoted 19 lines
Quoted 8 lines
Quoted 7 lines
Quoted 5 lines

See the virtio common cfg, you will find the max number of vqs is there, num_queues.

:)
Sure. those values at high q count affects.

the driver need to initialize them anyway.

That is before the traffic starts from remote end.

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 4 lines

Device didn’t support LM.
Many limitations existed all these years and TC is improving and expanding

them.

Quoted 1 line

So all these years do not matter.

Not sure what are you talking about, haven't we initialize the device and vqs in config space for years?????? What's wrong with this

mechanism?

Quoted 15 lines
Quoted 15 lines
Quoted 2 lines
Quoted 1 line

Are you questioning virito-pci fundamentals???

Don’t point to in-efficient past to establish similar in-efficient future.

interesting, you know this is a one-time thing, right? and you are aware of this has been there for years.

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Like how to set a queue size and enable it?

Those are meant to be used before DRIVER_OK stage as they are init time

registers.

Quoted 1 line

Not to keep abusing them..

don't you need to set queue_size at the destination side?

No.
But the src/dst does not matter.
Queue_size to be set before DRIVER_OK like rest of the registers, as all

Quoted 8 lines
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

queues must be created before the driver_ok phase.

Quoted 1 line

Queue_reset was last moment exception.

create a queue? Nvidia specific?

Huh. No.
Do git log and realize what happened with queue_reset.

You didn't answer the question, does the spec even has defined "create a

vq"?

Quoted 3 lines

Enabled/created = tomato/tomato when discussing the spec in non-normative

email conversation.

Quoted 5 lines

It's irrelevant.

All I am saying is, when we know the limitations of the transport and when industry is forwarding to not introduced more and more on-die register

for once in lifetime work of device migration, we just use the optimal command and queue interface that is native to virtio.

we really do not need to prematurely optimize all things. control path is control path it is going to be slow because virtio designed it to be slow and drivers don't optimize it. Shaving off a microsecond here or there is going to do nothing except increase maintainance costs.

Quoted 4 lines
Quoted 1 line

Control path post device initialization for large part is through the cvq.

Really depends on the device. For virtio net most of the time is spent on filling up receive queues and sending network announcements and such.

Right for the time. But the issue is not about the time spent.
Issue is for the demand of those registers which are of no use when filling large part of filling receive queues.

#33 lore raw

[virtio-comment] RE: [PATCH V2 3/6] virtio: dont reset vqs when SUSPEND

In reply to Zhu, Lingshan
Quoted 35 lines

From: Zhu, Lingshan <[email protected]>
Sent: Thursday, November 9, 2023 3:28 PM

Quoted 13 lines · Michael S. Tsirkin
Quoted 12 lines · Lingshan
Quoted 10 lines · Michael S. Tsirkin
Quoted 9 lines · Zhu Lingshan

When SUSPEND is set, device states and virtqueue states should be stablized, therefore the driver should not reset vqs when SUSPEND is set in device status.

---
   content.tex | 3 +++
   1 file changed, 3 insertions(+)
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

content.tex \subsubsection{Virtqueue Reset}\label{sec:Basic

Quoted 5 lines
content.tex index bcc9d4b..060b5c2 renamed from content.tex +0 -0

100644

content.tex +0 -0
@@ -444,6 +444,9 @@ \subsubsection{Virtqueue Reset}\label{sec:Basic

Facilities of a Virtio Device /

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

content.tex \subsubsection{Virtqueue Reset}\label{sec:Basic Facilities of a Virtio Device /

Quoted 6 lines
content.tex +3 -0
   The device MUST reset any state of a virtqueue to the default state,
   including the available state and the used state.
+If VIRTIO_F_SUSPEND is negotiated and SUSPEND is set in
+\field{device status}, the driver SHOULD NOT reset any virtqueues.
+
   \drivernormative{\paragraph}{Virtqueue Reset}{Basic Facilities of a

Virtio Device / Virtqueues / Virtqueue Reset / Virtqueue Reset}

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines
content.tex +0 -0
   After the driver tells the device to reset a queue, the driver

MUST verify that

Seems somewhat arbitrary and breaks the claim that the feature is orthogonal and can have uses besides migration.

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

when suspended, the device is frozen.
The driver is aware of this process and so should not reset the vqs I think.

Again that is only true because you want to use it for migration. But then you can't claim it's a generic facility.

I don't get it. The device status is a basic facility.

We need to SUSPEND the device by setting SUSPEND bit, to stabilize the device states for migration.

Is the PCI's PM time not enough to suspend the device? For large device I could imagine it could be short.

In that case if there is suspend the device available, it will be used by the guest driver itself, hypervisor wouldn’t know about it when those registers are not trapped. So we need two ways to suspend.
One is guest visible, and guest controlled.
Second is hypervisor control to fulfill the device migration needs.

So if you can please take a look if the proposed admin command to freeze/stop mode can be used in the emulated register case or not. It helps to have the suspend bit in guest control as well with/without emulation mode.

Quoted 1 line

This can also be used for debugging I think.

As Michael listed, a dedicated debug interface is usually more useful instead of in-band.

#102 lore raw

RE: [virtio-comment] Re: [PATCH V2 4/6] virtio-pci: implement VIRTIO_F_QUEUE_STATE

In reply to Zhu, Lingshan
Quoted 76 lines

From: Zhu, Lingshan <[email protected]>
Sent: Thursday, November 9, 2023 3:39 PM

Quoted 71 lines · Parav Pandit
Quoted 71 lines

From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, November 7, 2023 3:02 PM

Quoted 54 lines · Parav Pandit
Quoted 54 lines

From: Zhu, Lingshan <[email protected]>
Sent: Monday, November 6, 2023 2:57 PM

Quoted 50 lines · Parav Pandit
Quoted 50 lines

From: Zhu, Lingshan <[email protected]>
Sent: Monday, November 6, 2023 9:01 AM

Quoted 17 lines · Parav Pandit
Quoted 17 lines

From: [email protected] <[email protected] open.org> On Behalf Of Zhu, Lingshan
Sent: Friday, November 3, 2023 8:27 PM

Quoted 11 lines · Parav Pandit
Quoted 11 lines

From: Zhu Lingshan <[email protected]>
Sent: Friday, November 3, 2023 4:05 PM

This patch adds two new le16 fields to common configuration structure to support VIRTIO_F_QUEUE_STATE in PCI transport layer.

---
      transport-pci.tex | 18 ++++++++++++++++++
      1 file changed, 18 insertions(+)
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

transport-pci.tex \subsubsection{Common configuration

Quoted 5 lines
transport-pci.tex index renamed from transport-pci.tex +0 -0

a5c6719..3161519 100644

transport-pci.tex +0 -0
@@ -325,6 +325,10 @@ \subsubsection{Common configuration

structure

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

transport-pci.tex

Quoted 8 lines

layout}\label{sec:Virtio Transport
/* About the administration virtqueue. */
le16 admin_queue_index; /* read-only for driver */
le16 admin_queue_num; /* read-only for driver */

transport-pci.tex +4 -0
+
+	/* Virtqueue state */
+        le16 queue_avail_state;         /* read-write */
+        le16 queue_used_state;          /* read-write */

This tiny interface for 128 virtio net queues through register read writes, does

Quoted 8 lines
Quoted 5 lines

not work effectively.

Quoted 2 lines

There are inflight out of order descriptors for block also. Hence toy registers like this do not work.

Do you know there is a queue_select? Why this does not work? Do you know how other queue related fields work?

:)
Yes. If you notice queue_reset related critical spec bug fix was done when it

was introduced so that live migration can _actually_ work.

Quoted 2 lines

When queue_select is done for 128 queues serially, it take a lot of time to

read those slow register interface for this + inflight descriptors + more. interesting, virtio work in this pattern for many years, right?

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

All these years 400Gbps and 800Gbps virtio was not present, number of

queues were not in hw.
The registers are control path in config space, how 400G or 800G affect??

Because those are the one in practice requires large number of VQs.

You are asking per VQ register commands to modify things dynamically via

this one vq at a time, serializing all the operations.

Quoted 1 line

It does not scale well with high q count.

This is not dynamically, it only happens when SUSPEND and RESUME. This is the same mechanism how virtio initialize a virtqueue, working for many years.

Quoted 8 lines
Quoted 1 line

No. when virtio driver initializes it for the first time, there is no active traffic

that gets lost.

Quoted 3 lines

This is because the interface is not yet up and not part of the network yet.

The resume must be fast enough, because the remote node is sending

packets.

Quoted 1 line

Hence it is different from driver init time queue enable.

I am not sure any packets arrive before a link announce at the destination side.

I think it can.
Because there is no notification of member device link down intimation to remote side.
The L4 and L5 protocols have no knowledge that node which they are interacting is behind some layers of switches.

So keeping this time low is desired.

Quoted 41 lines
Quoted 7 lines
Quoted 6 lines
Quoted 5 lines
Quoted 3 lines

See the virtio common cfg, you will find the max number of vqs is there, num_queues.

:)
Sure. those values at high q count affects.

the driver need to initialize them anyway.

That is before the traffic starts from remote end.

see above, that needs a link announce and this is after re-initialization

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines

Device didn’t support LM.
Many limitations existed all these years and TC is improving and expanding

them.

Quoted 1 line

So all these years do not matter.

Not sure what are you talking about, haven't we initialize the device and vqs in config space for years?????? What's wrong with this

mechanism?

Quoted 14 lines
Quoted 14 lines
Quoted 2 lines
Quoted 1 line

Are you questioning virito-pci fundamentals???

Don’t point to in-efficient past to establish similar in-efficient future.

interesting, you know this is a one-time thing, right? and you are aware of this has been there for years.

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Like how to set a queue size and enable it?

Those are meant to be used before DRIVER_OK stage as they are init time

registers.

Quoted 1 line

Not to keep abusing them..

don't you need to set queue_size at the destination side?

No.
But the src/dst does not matter.
Queue_size to be set before DRIVER_OK like rest of the registers, as all

Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
Quoted 4 lines

queues must be created before the driver_ok phase.

Quoted 1 line

Queue_reset was last moment exception.

create a queue? Nvidia specific?

Huh. No.
Do git log and realize what happened with queue_reset.

You didn't answer the question, does the spec even has defined "create a

vq"?

Quoted 1 line

Enabled/created = tomato/tomato when discussing the spec in non-normative

email conversation.

Quoted 9 lines
Quoted 1 line

It's irrelevant.

Then lets not debate on this enable a vq or create a vq anymore

Quoted 2 lines

All I am saying is, when we know the limitations of the transport and when industry is forwarding to not introduced more and more on-die register

for once in lifetime work of device migration, we just use the optimal command and queue interface that is native to virtio.
PCI config space has its own limitations, and admin vq has its advantages, but that does not apply to all use cases.

There was a recent work done emulating the SR-IOV cap and allowing VM to enable SR-IOV in [1]. This is the option I mentioned few weeks ago.

So with admin commands and admin virtqueues, even nested model will work using [1].

[1] https://netdevconf.info/0x17/sessions/talk/unleashing-sr-iov-offload-on-virtual-machines.html

Quoted 3 lines

I don't want to repeat why I don't think admin vq is a good idea for migration again, we have already discussed on that.

Quoted 1 line
#145 lore raw

Re: [virtio-comment] Re: [PATCH V2 6/6] virtio-pci: implement dirty page tracking

In reply to Michael S. Tsirkin
Quoted 55 lines · Michael S. Tsirkin
Quoted 51 lines · Lingshan
Quoted 27 lines · Michael S. Tsirkin
Quoted 26 lines · Parav Pandit
Quoted 13 lines

From: Michael S. Tsirkin <[email protected]>
Sent: Sunday, November 5, 2023 9:42 PM

Quoted 7 lines · Parav Pandit
Quoted 5 lines
Quoted 4 lines

[1]
https://lists.oasis-open.org/archives/virtio-comment/202310/msg004
75.h
tml

you still need to explain why this does not work for pass-through.

It does not work for following reasons.
1. Because all the fields that put on the member device are not in direct

control of the hypervisor.

Quoted 1 line

The device is directly controlled by the guest including the device status and

Quoted 9 lines

when it resets the device all the things stored in the device are lost.

I think the idea is that when this gateway is in the device then device reset has to trap. At a high level, ok. But then what?
Is a full scan of all memory required until device reset is complete? Drivers currently tend to busy poll the reset register, if this takes very long we might start seeing soft lockup messages. What is the idea then? Maybe for this we need a separate weaker reset that does not touch this capability?

You meant the gateway is not in the device, right?

I likely didn't understand. I don't see a relation to timing.

Quoted 8 lines
Quoted 2 lines

When the device reset is not trapped by the hypervisor, most things does not work, it requires trapping other things to like cvq, device registers and more. It may be fine for those use case, but it does not fullfill the requirement of passthrough mode of hw.

I wish we'd just stop using the term, it just confuses everyone.

I feel the point worth making is that currently, all this job is done by hypervisors. And they manage fine! vdpa really truly does not need the SUSPEND bit because it knows about devices and it
can just use whatever it wants in any vendor specific way it wants.

So true, this is exact what Intel implements in some productions.

Quoted 6 lines

where all this migration work comes handy is if we say that we want our device to all just do what the
spec says. No vendor specific tricks. And I find it exciting that there are people who want to work on this instead of each vendor wasting man hours on their own almost the same but slightly different driver.

I agree

Quoted 6 lines

I personally think this patch is not great for the trap use-case either. Why? For example if device is somewhat slow then it will take it hundreds of milliseconds to synchronize the whole guest memory, and blocking reset means blocking e.g. guest boot. I was wrong about soft lockup btw - linux does msleep which I think means no soft lockups. But boot is blocked and modules are not loaded.

Quoted 3 lines

I am not sure SUSPEND can block RESET, I think reset can take immediate actions, because
once reset, whether suspended does not matter.

Quoted 8 lines

No, because if you don't suspend device will keep changing memory. You need to
1. suspend
2. get all dirty memory synced
3. reset

Reset earlier will corrupt guest memory.

IMHO, it may be fine to lose the dirty pages during reset, because without an interrupt, the driver won't process the dirty pages, they are still considered as unused(even not all zero pages) by CPU, so nothing corrupted.

And if the driver resets the device, it will reinitialize the device and re-config the virtqueue including the ring buffer.

Quoted 2 lines

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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/

#159 lore raw

[virtio-comment] Re: [PATCH V2 6/6] virtio-pci: implement dirty page tracking

In reply to Michael S. Tsirkin
Quoted 18 lines · Michael S. Tsirkin
Quoted 17 lines · Lingshan
Quoted 15 lines · Michael S. Tsirkin
Quoted 14 lines · Lingshan
Quoted 14 lines
Quoted 14 lines
Quoted 9 lines
Quoted 8 lines
Quoted 1 line

2. the PCI FLR is clearing all the registers you exposed here.

see above

Quoted 2 lines

3. Endless expansion of config registers of dirty tracking is not scalable, as they

are not init time registers not following the Appendix B guidelines. endless expansion?? It is a complete set of dirty page tracking, right???? have you see this cap only controls? The device DMA writes the bitmap, not by registers.

Device dirty page tracking is start/stop command to be done by the

hypervisor.

Quoted 1 line

So when guest is resetting the device, it stopped the DMA initiated by the

hypervisor.

Quoted 1 line

This fundamentally breaks things.

Why? When device resets, do you want to keep tracking dirty pages????

Quoted 8 lines
Quoted 6 lines
Quoted 5 lines
Quoted 4 lines
Quoted 2 lines

Yes, when the device resets, before that event occurred, all the pages which were dirtied, must be migrated. And after reset also new page tracking to continue.

That depends on whether there is an interrupt for the dirty pages. If there is an interrupt, then the guest owns the pages

Not in the virtio model, guest owns the memory once buffer has been used.

Yes and even better, interrupt happens after buffers marked as used.

But guest owns memory earlier and you can not change it after this point.

If you mean the guest polls the used_idx, yes that can happen, if so the guest owns the pages even earlier, and I am not sure whether we need to change anything.

Maybe we don't need to argue on this, because we MAY don't need this dirty page tracking facility. Platform PML or shadow virtqueue can work.

Quoted 1 line

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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/

#146 lore raw

Re: [virtio-comment] Re: [PATCH V2 6/6] virtio-pci: implement dirty page tracking

In reply to Zhu, Lingshan
Quoted 65 lines · Lingshan
Quoted 62 lines · Michael S. Tsirkin
Quoted 51 lines · Lingshan
Quoted 27 lines · Michael S. Tsirkin
Quoted 26 lines · Parav Pandit
Quoted 13 lines

From: Michael S. Tsirkin <[email protected]>
Sent: Sunday, November 5, 2023 9:42 PM

Quoted 7 lines · Parav Pandit
Quoted 5 lines
Quoted 4 lines

[1]
https://lists.oasis-open.org/archives/virtio-comment/202310/msg004
75.h
tml

you still need to explain why this does not work for pass-through.

It does not work for following reasons.
1. Because all the fields that put on the member device are not in direct

control of the hypervisor.

Quoted 1 line

The device is directly controlled by the guest including the device status and

Quoted 9 lines

when it resets the device all the things stored in the device are lost.

I think the idea is that when this gateway is in the device then device reset has to trap. At a high level, ok. But then what?
Is a full scan of all memory required until device reset is complete? Drivers currently tend to busy poll the reset register, if this takes very long we might start seeing soft lockup messages. What is the idea then? Maybe for this we need a separate weaker reset that does not touch this capability?

You meant the gateway is not in the device, right?

I likely didn't understand. I don't see a relation to timing.

Quoted 8 lines
Quoted 2 lines

When the device reset is not trapped by the hypervisor, most things does not work, it requires trapping other things to like cvq, device registers and more. It may be fine for those use case, but it does not fullfill the requirement of passthrough mode of hw.

I wish we'd just stop using the term, it just confuses everyone.

I feel the point worth making is that currently, all this job is done by hypervisors. And they manage fine! vdpa really truly does not need the SUSPEND bit because it knows about devices and it
can just use whatever it wants in any vendor specific way it wants.

So true, this is exact what Intel implements in some productions.

Quoted 6 lines

where all this migration work comes handy is if we say that we want our device to all just do what the
spec says. No vendor specific tricks. And I find it exciting that there are people who want to work on this instead of each vendor wasting man hours on their own almost the same but slightly different driver.

I agree

Quoted 6 lines

I personally think this patch is not great for the trap use-case either. Why? For example if device is somewhat slow then it will take it hundreds of milliseconds to synchronize the whole guest memory, and blocking reset means blocking e.g. guest boot. I was wrong about soft lockup btw - linux does msleep which I think means no soft lockups. But boot is blocked and modules are not loaded.

Quoted 3 lines

I am not sure SUSPEND can block RESET, I think reset can take immediate actions, because
once reset, whether suspended does not matter.

No, because if you don't suspend device will keep changing memory. You need to
1. suspend
2. get all dirty memory synced
3. reset

Quoted 8 lines
Quoted 1 line

Reset earlier will corrupt guest memory.

IMHO, it may be fine to lose the dirty pages during reset, because without an interrupt, the driver won't process the dirty pages, they are still considered as unused(even not all zero pages) by CPU, so nothing corrupted.

And if the driver resets the device, it will reinitialize the device and re-config the virtqueue including the ring buffer.

It's too late to invent new consistency semantics for virtio.

Signature · 18 lines
MST


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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/
#34 lore raw

[virtio-comment] Re: [PATCH V2 3/6] virtio: dont reset vqs when SUSPEND

In reply to Parav Pandit
Quoted 35 lines · Parav Pandit
Quoted 35 lines

From: Zhu, Lingshan <[email protected]>
Sent: Thursday, November 9, 2023 3:28 PM

Quoted 12 lines · Michael S. Tsirkin
Quoted 11 lines · Lingshan
Quoted 10 lines · Michael S. Tsirkin
Quoted 9 lines · Zhu Lingshan

When SUSPEND is set, device states and virtqueue states should be stablized, therefore the driver should not reset vqs when SUSPEND is set in device status.

---
    content.tex | 3 +++
    1 file changed, 3 insertions(+)
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

content.tex \subsubsection{Virtqueue Reset}\label{sec:Basic

Quoted 5 lines
content.tex index bcc9d4b..060b5c2 renamed from content.tex +0 -0

100644

content.tex +0 -0
@@ -444,6 +444,9 @@ \subsubsection{Virtqueue Reset}\label{sec:Basic

Facilities of a Virtio Device /

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

content.tex \subsubsection{Virtqueue Reset}\label{sec:Basic Facilities of a Virtio Device /

Quoted 6 lines
content.tex +3 -0
    The device MUST reset any state of a virtqueue to the default state,
    including the available state and the used state.
+If VIRTIO_F_SUSPEND is negotiated and SUSPEND is set in
+\field{device status}, the driver SHOULD NOT reset any virtqueues.
+
    \drivernormative{\paragraph}{Virtqueue Reset}{Basic Facilities of a

Virtio Device / Virtqueues / Virtqueue Reset / Virtqueue Reset}

Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
content.tex +0 -0
    After the driver tells the device to reset a queue, the driver

MUST verify that

Seems somewhat arbitrary and breaks the claim that the feature is orthogonal and can have uses besides migration.

when suspended, the device is frozen.
The driver is aware of this process and so should not reset the vqs I think.

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

Again that is only true because you want to use it for migration. But then you can't claim it's a generic facility.

I don't get it. The device status is a basic facility.

We need to SUSPEND the device by setting SUSPEND bit, to stabilize the device states for migration.

Is the PCI's PM time not enough to suspend the device? For large device I could imagine it could be short.

As you see, PCI PM, so this is a layer violation, virtio should be self contained, and what about MMIO and CCW? This should be a basic facility.

Quoted 5 lines

In that case if there is suspend the device available, it will be used by the guest driver itself, hypervisor wouldn’t know about it when those registers are not trapped. So we need two ways to suspend.
One is guest visible, and guest controlled.
Second is hypervisor control to fulfill the device migration needs.

The guest can eve reset the device.

Quoted 3 lines

So if you can please take a look if the proposed admin command to freeze/stop mode can be used in the emulated register case or not. It helps to have the suspend bit in guest control as well with/without emulation mode.

Parav, please believe I have read your series, I didn't comment there because I want to avoid further conflicts/debating, we have done these enough.

As explained before, freeze/stop the device by PCI is a layer violation.

And device status can be pass-through(without emulation, just map it to guest) to the guest or trapped(trap and emulate by the hypervisor, for example set_status in vDPA).

Quoted 3 lines
Quoted 2 lines

This can also be used for debugging I think.

As Michael listed, a dedicated debug interface is usually more useful instead of in-band.

re-using another facility without extra efforts is not a bad thing anyway.

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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/

#35 lore raw

[virtio-comment] RE: [PATCH V2 3/6] virtio: dont reset vqs when SUSPEND

Quoted 44 lines

From: Zhu, Lingshan <[email protected]>
Sent: Friday, November 10, 2023 11:52 AM

Quoted 39 lines · Parav Pandit
Quoted 39 lines

From: Zhu, Lingshan <[email protected]>
Sent: Thursday, November 9, 2023 3:28 PM

Quoted 12 lines · Michael S. Tsirkin
Quoted 11 lines · Lingshan
Quoted 10 lines · Michael S. Tsirkin
Quoted 9 lines · Zhu Lingshan

When SUSPEND is set, device states and virtqueue states should be stablized, therefore the driver should not reset vqs when SUSPEND is set in device status.

---
    content.tex | 3 +++
    1 file changed, 3 insertions(+)
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
content.tex index bcc9d4b..060b5c2 renamed from content.tex +0 -0

100644

content.tex +0 -0
@@ -444,6 +444,9 @@ \subsubsection{Virtqueue

Reset}\label{sec:Basic

Facilities of a Virtio Device /

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

The device MUST reset any state of a virtqueue to the default state, including the available state and the used state.

content.tex +3 -0
+If VIRTIO_F_SUSPEND is negotiated and SUSPEND is set in
+\field{device status}, the driver SHOULD NOT reset any virtqueues.
+
    \drivernormative{\paragraph}{Virtqueue Reset}{Basic

Facilities of a

Virtio Device / Virtqueues / Virtqueue Reset / Virtqueue Reset}

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

After the driver tells the device to reset a queue, the
driver MUST verify that

Seems somewhat arbitrary and breaks the claim that the feature is orthogonal and can have uses besides migration.

when suspended, the device is frozen.
The driver is aware of this process and so should not reset the vqs I think.

Again that is only true because you want to use it for migration. But then you can't claim it's a generic facility.

Quoted 7 lines
Quoted 6 lines
Quoted 4 lines

I don't get it. The device status is a basic facility.

We need to SUSPEND the device by setting SUSPEND bit, to stabilize the device states for migration.

Is the PCI's PM time not enough to suspend the device? For large device I could imagine it could be short.

As you see, PCI PM, so this is a layer violation, virtio should be self contained,

If you think it is layer violation, than suspend bit for sure is not needed. PCI PM interface should suspend/resume the device on D0<->D3 state transitions.

Quoted 1 line

and what about MMIO and CCW?

They have largely lacked the richness of PCI transport. So those transport needs to evolve. Otherwise, PCI offers rich transport facilities compared to MMIO, hence, it will continue wider use.

Quoted 1 line

This should be a basic facility.

Other transport can also offer like PCI.

Quoted 7 lines
Quoted 2 lines

In that case if there is suspend the device available, it will be used by the

guest driver itself, hypervisor wouldn’t know about it when those registers are not trapped.

Quoted 3 lines

So we need two ways to suspend.
One is guest visible, and guest controlled.
Second is hypervisor control to fulfill the device migration needs.

Quoted 9 lines

The guest can eve reset the device.

Quoted 2 lines

So if you can please take a look if the proposed admin command to

freeze/stop mode can be used in the emulated register case or not.

Quoted 1 line

It helps to have the suspend bit in guest control as well with/without

emulation mode.
Parav, please believe I have read your series, I didn't comment there because I want to avoid further conflicts/debating, we have done these enough.

I believe the series posted in v3 can support vdpa use case as well. So I will progress to post v4.

Quoted 1 line

As explained before, freeze/stop the device by PCI is a layer violation.

I am afraid, we have different vision.
I don’t see any layer violation.
Suspend is enough in the PCI PM.
Our vision is more aligned with rest of the hypervisor knobs that owns the migration framework.

Quoted 4 lines

And device status can be pass-through(without emulation, just map it to guest) to the guest or trapped(trap and emulate by the hypervisor, for example set_status in vDPA).

When it is pass-through, it is controlled by the guest, so for example, if the guest resets the device, hypervisor has lost the control of migration context etc. Hence, hypervisor needs a channel which is not guest owned.

Same channel can work when trap+emulation is done.

Quoted 5 lines
Quoted 3 lines
Quoted 2 lines

This can also be used for debugging I think.

As Michael listed, a dedicated debug interface is usually more useful instead

of in-band.
re-using another facility without extra efforts is not a bad thing anyway.

I just don’t see how a suspend bit some debug feature. Almost everything with that regard is a debug feature to me.

#91 lore raw

Re: [virtio-comment] Re: [PATCH V2 4/6] virtio-pci: implement VIRTIO_F_QUEUE_STATE

In reply to Michael S. Tsirkin
Quoted 68 lines · Michael S. Tsirkin
Quoted 67 lines · Lingshan
Quoted 65 lines · Michael S. Tsirkin
Quoted 64 lines · Lingshan
Quoted 53 lines · Parav Pandit
Quoted 53 lines

From: Zhu, Lingshan <[email protected]>
Sent: Monday, November 6, 2023 2:57 PM

Quoted 49 lines · Parav Pandit
Quoted 49 lines

From: Zhu, Lingshan <[email protected]>
Sent: Monday, November 6, 2023 9:01 AM

Quoted 16 lines · Parav Pandit
Quoted 16 lines

From: [email protected] <[email protected] open.org> On Behalf Of Zhu, Lingshan
Sent: Friday, November 3, 2023 8:27 PM

Quoted 11 lines · Parav Pandit
Quoted 11 lines

From: Zhu Lingshan <[email protected]>
Sent: Friday, November 3, 2023 4:05 PM

This patch adds two new le16 fields to common configuration structure to support VIRTIO_F_QUEUE_STATE in PCI transport layer.

---
       transport-pci.tex | 18 ++++++++++++++++++
       1 file changed, 18 insertions(+)
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

transport-pci.tex \subsubsection{Common configuration

Quoted 5 lines
transport-pci.tex index renamed from transport-pci.tex +0 -0

a5c6719..3161519 100644

transport-pci.tex +0 -0
@@ -325,6 +325,10 @@ \subsubsection{Common configuration

structure

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

transport-pci.tex

Quoted 8 lines

layout}\label{sec:Virtio Transport
/* About the administration virtqueue. */
le16 admin_queue_index; /* read-only for driver */
le16 admin_queue_num; /* read-only for driver */

transport-pci.tex +4 -0
+
+	/* Virtqueue state */
+        le16 queue_avail_state;         /* read-write */
+        le16 queue_used_state;          /* read-write */

This tiny interface for 128 virtio net queues through register read writes, does

Quoted 8 lines
Quoted 5 lines

not work effectively.

Quoted 2 lines

There are inflight out of order descriptors for block also. Hence toy registers like this do not work.

Do you know there is a queue_select? Why this does not work? Do you know how other queue related fields work?

:)
Yes. If you notice queue_reset related critical spec bug fix was done when it

was introduced so that live migration can _actually_ work.

Quoted 2 lines

When queue_select is done for 128 queues serially, it take a lot of time to

read those slow register interface for this + inflight descriptors + more. interesting, virtio work in this pattern for many years, right?

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

All these years 400Gbps and 800Gbps virtio was not present, number of

queues were not in hw.
The registers are control path in config space, how 400G or 800G affect??

Because those are the one in practice requires large number of VQs.

You are asking per VQ register commands to modify things dynamically via this one vq at a time, serializing all the operations. It does not scale well with high q count.

This is not dynamically, it only happens when SUSPEND and RESUME. This is the same mechanism how virtio initialize a virtqueue, working for many years.

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

I wish we just had a transport vq already. That's the way to solve this not fighting individual bits.

Yeah, I agree, transport is a queued task(sent out V4 months ago...), one by one... hard and tough work...

Frankly I think that should take precedence, then Parav will not get annoyed each time add a couple of registers.

I agree, things can happen and we are already here..

Quoted 29 lines
Quoted 29 lines
Quoted 29 lines
Quoted 29 lines
Quoted 5 lines
Quoted 3 lines

See the virtio common cfg, you will find the max number of vqs is there, num_queues.

:)
Sure. those values at high q count affects.

the driver need to initialize them anyway.

Quoted 8 lines
Quoted 7 lines
Quoted 2 lines

Device didn’t support LM.
Many limitations existed all these years and TC is improving and expanding

them.

Quoted 1 line

So all these years do not matter.

Not sure what are you talking about, haven't we initialize the device and vqs in config space for years?????? What's wrong with this mechanism?
Are you questioning virito-pci fundamentals???

Don’t point to in-efficient past to establish similar in-efficient future.

interesting, you know this is a one-time thing, right? and you are aware of this has been there for years.

Quoted 13 lines
Quoted 13 lines
Quoted 9 lines
Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Like how to set a queue size and enable it?

Those are meant to be used before DRIVER_OK stage as they are init time

registers.

Quoted 1 line

Not to keep abusing them..

don't you need to set queue_size at the destination side?

No.
But the src/dst does not matter.
Queue_size to be set before DRIVER_OK like rest of the registers, as all

queues must be created before the driver_ok phase.

Quoted 1 line

Queue_reset was last moment exception.

create a queue? Nvidia specific?

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 2 lines

Huh. No.
Do git log and realize what happened with queue_reset.

You didn't answer the question, does the spec even has defined "create a vq"?

Quoted 3 lines
Quoted 2 lines

For standard virtio, you need to read the number of enabled vqs at the source side, then enable them at the dst, so queue_size matters, not to create.

All that happens in the pre-copy phase.

Yes and how your answer related to this discussion?

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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/

#147 lore raw

Re: [virtio-comment] Re: [PATCH V2 6/6] virtio-pci: implement dirty page tracking

In reply to Michael S. Tsirkin
Quoted 65 lines · Michael S. Tsirkin
Quoted 64 lines · Lingshan
Quoted 62 lines · Michael S. Tsirkin
Quoted 50 lines · Lingshan
Quoted 27 lines · Michael S. Tsirkin
Quoted 26 lines · Parav Pandit
Quoted 13 lines

From: Michael S. Tsirkin <[email protected]>
Sent: Sunday, November 5, 2023 9:42 PM

Quoted 7 lines · Parav Pandit
Quoted 5 lines
Quoted 4 lines

[1]
https://lists.oasis-open.org/archives/virtio-comment/202310/msg004
75.h
tml

you still need to explain why this does not work for pass-through.

It does not work for following reasons.
1. Because all the fields that put on the member device are not in direct

control of the hypervisor.

Quoted 1 line

The device is directly controlled by the guest including the device status and

Quoted 9 lines

when it resets the device all the things stored in the device are lost.

I think the idea is that when this gateway is in the device then device reset has to trap. At a high level, ok. But then what?
Is a full scan of all memory required until device reset is complete? Drivers currently tend to busy poll the reset register, if this takes very long we might start seeing soft lockup messages. What is the idea then? Maybe for this we need a separate weaker reset that does not touch this capability?

You meant the gateway is not in the device, right?

I likely didn't understand. I don't see a relation to timing.

Quoted 8 lines
Quoted 2 lines

When the device reset is not trapped by the hypervisor, most things does not work, it requires trapping other things to like cvq, device registers and more. It may be fine for those use case, but it does not fullfill the requirement of passthrough mode of hw.

I wish we'd just stop using the term, it just confuses everyone.

I feel the point worth making is that currently, all this job is done by hypervisors. And they manage fine! vdpa really truly does not need the SUSPEND bit because it knows about devices and it
can just use whatever it wants in any vendor specific way it wants.

So true, this is exact what Intel implements in some productions.

Quoted 6 lines

where all this migration work comes handy is if we say that we want our device to all just do what the
spec says. No vendor specific tricks. And I find it exciting that there are people who want to work on this instead of each vendor wasting man hours on their own almost the same but slightly different driver.

I agree

Quoted 6 lines

I personally think this patch is not great for the trap use-case either. Why? For example if device is somewhat slow then it will take it hundreds of milliseconds to synchronize the whole guest memory, and blocking reset means blocking e.g. guest boot. I was wrong about soft lockup btw - linux does msleep which I think means no soft lockups. But boot is blocked and modules are not loaded.

Quoted 3 lines

I am not sure SUSPEND can block RESET, I think reset can take immediate actions, because
once reset, whether suspended does not matter.

No, because if you don't suspend device will keep changing memory. You need to
1. suspend
2. get all dirty memory synced
3. reset

Reset earlier will corrupt guest memory.

Quoted 8 lines
Quoted 7 lines

IMHO, it may be fine to lose the dirty pages during reset, because without an interrupt, the driver won't process the dirty pages, they are still considered as unused(even not all zero pages) by CPU, so nothing corrupted.

And if the driver resets the device, it will reinitialize the device and re-config the virtqueue including the ring buffer.

It's too late to invent new consistency semantics for virtio.

I think when reset, the legacy vring buffer can be considered as invalid.

Quoted 1 line

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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/

#103 lore raw

Re: [virtio-comment] Re: [PATCH V2 4/6] virtio-pci: implement VIRTIO_F_QUEUE_STATE

In reply to Parav Pandit
Quoted 81 lines · Parav Pandit
Quoted 81 lines

From: Zhu, Lingshan <[email protected]>
Sent: Thursday, November 9, 2023 3:39 PM

Quoted 64 lines · Parav Pandit
Quoted 64 lines

From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, November 7, 2023 3:02 PM

Quoted 60 lines · Parav Pandit
Quoted 50 lines

From: Zhu, Lingshan <[email protected]>
Sent: Monday, November 6, 2023 2:57 PM

Quoted 46 lines · Parav Pandit
Quoted 46 lines

From: Zhu, Lingshan <[email protected]>
Sent: Monday, November 6, 2023 9:01 AM

Quoted 17 lines · Parav Pandit
Quoted 17 lines

From: [email protected] <[email protected] open.org> On Behalf Of Zhu, Lingshan
Sent: Friday, November 3, 2023 8:27 PM

Quoted 11 lines · Parav Pandit
Quoted 11 lines

From: Zhu Lingshan <[email protected]>
Sent: Friday, November 3, 2023 4:05 PM

This patch adds two new le16 fields to common configuration structure to support VIRTIO_F_QUEUE_STATE in PCI transport layer.

---
       transport-pci.tex | 18 ++++++++++++++++++
       1 file changed, 18 insertions(+)
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

transport-pci.tex \subsubsection{Common configuration

Quoted 5 lines
transport-pci.tex index renamed from transport-pci.tex +0 -0

a5c6719..3161519 100644

transport-pci.tex +0 -0
@@ -325,6 +325,10 @@ \subsubsection{Common configuration

structure

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

transport-pci.tex

Quoted 8 lines

layout}\label{sec:Virtio Transport
/* About the administration virtqueue. */
le16 admin_queue_index; /* read-only for driver */
le16 admin_queue_num; /* read-only for driver */

transport-pci.tex +4 -0
+
+	/* Virtqueue state */
+        le16 queue_avail_state;         /* read-write */
+        le16 queue_used_state;          /* read-write */

This tiny interface for 128 virtio net queues through register read writes, does

Quoted 8 lines
Quoted 5 lines

not work effectively.

Quoted 2 lines

There are inflight out of order descriptors for block also. Hence toy registers like this do not work.

Do you know there is a queue_select? Why this does not work? Do you know how other queue related fields work?

:)
Yes. If you notice queue_reset related critical spec bug fix was done when it

was introduced so that live migration can _actually_ work.

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

When queue_select is done for 128 queues serially, it take a lot of time to

read those slow register interface for this + inflight descriptors + more. interesting, virtio work in this pattern for many years, right?

All these years 400Gbps and 800Gbps virtio was not present, number of

queues were not in hw.
The registers are control path in config space, how 400G or 800G affect??

Because those are the one in practice requires large number of VQs.

Quoted 8 lines
Quoted 7 lines
Quoted 2 lines

You are asking per VQ register commands to modify things dynamically via

this one vq at a time, serializing all the operations.

Quoted 1 line

It does not scale well with high q count.

This is not dynamically, it only happens when SUSPEND and RESUME. This is the same mechanism how virtio initialize a virtqueue, working for many years.

No. when virtio driver initializes it for the first time, there is no active traffic

that gets lost.

Quoted 3 lines

This is because the interface is not yet up and not part of the network yet.

The resume must be fast enough, because the remote node is sending

Quoted 8 lines
Quoted 3 lines

packets.

Quoted 1 line

Hence it is different from driver init time queue enable.

I am not sure any packets arrive before a link announce at the destination side.

I think it can.
Because there is no notification of member device link down intimation to remote side.
The L4 and L5 protocols have no knowledge that node which they are interacting is behind some layers of switches.

So keeping this time low is desired.

The NIC should broad cast itself first, so that other peers in the network know(for example its mac to route it) how to send a message to it.

This is necessary, for example VIRTIO_NET_F_GUEST_ANNOUNCE, similar mechanism work for in-marketing productions for years.

This is out of the topic anyway.

Quoted 49 lines
Quoted 40 lines
Quoted 7 lines
Quoted 6 lines
Quoted 5 lines
Quoted 3 lines

See the virtio common cfg, you will find the max number of vqs is there, num_queues.

:)
Sure. those values at high q count affects.

the driver need to initialize them anyway.

That is before the traffic starts from remote end.

see above, that needs a link announce and this is after re-initialization

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines

Device didn’t support LM.
Many limitations existed all these years and TC is improving and expanding

them.

Quoted 1 line

So all these years do not matter.

Not sure what are you talking about, haven't we initialize the device and vqs in config space for years?????? What's wrong with this

mechanism?

Quoted 14 lines
Quoted 14 lines
Quoted 2 lines
Quoted 1 line

Are you questioning virito-pci fundamentals???

Don’t point to in-efficient past to establish similar in-efficient future.

interesting, you know this is a one-time thing, right? and you are aware of this has been there for years.

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Like how to set a queue size and enable it?

Those are meant to be used before DRIVER_OK stage as they are init time

registers.

Quoted 1 line

Not to keep abusing them..

don't you need to set queue_size at the destination side?

No.
But the src/dst does not matter.
Queue_size to be set before DRIVER_OK like rest of the registers, as all

Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
Quoted 4 lines

queues must be created before the driver_ok phase.

Quoted 1 line

Queue_reset was last moment exception.

create a queue? Nvidia specific?

Huh. No.
Do git log and realize what happened with queue_reset.

You didn't answer the question, does the spec even has defined "create a

vq"?

Quoted 1 line

Enabled/created = tomato/tomato when discussing the spec in non-normative

email conversation.

Quoted 9 lines
Quoted 1 line

It's irrelevant.

Then lets not debate on this enable a vq or create a vq anymore

Quoted 2 lines

All I am saying is, when we know the limitations of the transport and when industry is forwarding to not introduced more and more on-die register

for once in lifetime work of device migration, we just use the optimal command and queue interface that is native to virtio.
PCI config space has its own limitations, and admin vq has its advantages, but that does not apply to all use cases.

Quoted 6 lines

There was a recent work done emulating the SR-IOV cap and allowing VM to enable SR-IOV in [1]. This is the option I mentioned few weeks ago.

So with admin commands and admin virtqueues, even nested model will work using [1].

[1] https://netdevconf.info/0x17/sessions/talk/unleashing-sr-iov-offload-on-virtual-machines.html

We should take this into consideration once it is standardized in the spec, maybe not now, there can always be many workarounds to solve one problem.

Quoted 3 lines
Quoted 3 lines

I don't want to repeat why I don't think admin vq is a good idea for migration again, we have already discussed on that.

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: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
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/

#104 lore raw

RE: [virtio-comment] Re: [PATCH V2 4/6] virtio-pci: implement VIRTIO_F_QUEUE_STATE

Quoted 169 lines

From: Zhu, Lingshan <[email protected]>
Sent: Friday, November 10, 2023 1:22 PM

Quoted 22 lines · Parav Pandit
Quoted 22 lines

From: Zhu, Lingshan <[email protected]>
Sent: Thursday, November 9, 2023 3:39 PM

Quoted 17 lines · Parav Pandit
Quoted 17 lines

From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, November 7, 2023 3:02 PM

Quoted 13 lines · Parav Pandit
Quoted 13 lines

From: Zhu, Lingshan <[email protected]>
Sent: Monday, November 6, 2023 2:57 PM

Quoted 9 lines · Parav Pandit
Quoted 9 lines

From: Zhu, Lingshan <[email protected]>
Sent: Monday, November 6, 2023 9:01 AM

Quoted 5 lines · Parav Pandit
Quoted 5 lines

From: [email protected] <[email protected] open.org> On Behalf Of Zhu, Lingshan
Sent: Friday, November 3, 2023 8:27 PM

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines · Parav Pandit
Quoted 5 lines
Quoted 5 lines

From: Zhu Lingshan <[email protected]>
Sent: Friday, November 3, 2023 4:05 PM

This patch adds two new le16 fields to common configuration
structure to support VIRTIO_F_QUEUE_STATE in PCI transport

layer.

Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines

Signed-off-by: Zhu Lingshan <[email protected]>
---
transport-pci.tex | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)

diff --git a/transport-pci.tex b/transport-pci.tex index
a5c6719..3161519 100644
--- a/transport-pci.tex
+++ b/transport-pci.tex
@@ -325,6 +325,10 @@ \subsubsection{Common configuration

structure

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

layout}\label{sec:Virtio Transport
/* About the administration virtqueue. */
le16 admin_queue_index; /* read-only for driver

*/

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

le16 admin_queue_num; /* read-only for driver

*/

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 6 lines
Quoted 4 lines

+
+ /* Virtqueue state */
+ le16 queue_avail_state; /* read-write */
+ le16 queue_used_state; /* read-write */

This tiny interface for 128 virtio net queues through register read writes, does

not work effectively.

Quoted 2 lines

There are inflight out of order descriptors for block also. Hence toy registers like this do not work.

Do you know there is a queue_select? Why this does not work? Do you know how other queue related fields work?

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines

:)
Yes. If you notice queue_reset related critical spec bug fix was done when it

was introduced so that live migration can _actually_ work.

Quoted 2 lines

When queue_select is done for 128 queues serially, it take a lot of time to

read those slow register interface for this + inflight descriptors +

more.

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

interesting, virtio work in this pattern for many years, right?

All these years 400Gbps and 800Gbps virtio was not present, number of

queues were not in hw.
The registers are control path in config space, how 400G or 800G

affect??

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 9 lines
Quoted 4 lines

Because those are the one in practice requires large number of VQs.

You are asking per VQ register commands to modify things dynamically via

this one vq at a time, serializing all the operations.

Quoted 1 line

It does not scale well with high q count.

This is not dynamically, it only happens when SUSPEND and RESUME. This is the same mechanism how virtio initialize a virtqueue, working for many years.

No. when virtio driver initializes it for the first time, there is no active traffic

Quoted 7 lines
Quoted 7 lines

that gets lost.

Quoted 3 lines

This is because the interface is not yet up and not part of the network yet.

The resume must be fast enough, because the remote node is sending

packets.

Quoted 1 line

Hence it is different from driver init time queue enable.

I am not sure any packets arrive before a link announce at the destination

side.

Quoted 2 lines

I think it can.
Because there is no notification of member device link down intimation to

remote side.

Quoted 1 line

The L4 and L5 protocols have no knowledge that node which they are

interacting is behind some layers of switches.

Quoted 2 lines

So keeping this time low is desired.

The NIC should broad cast itself first, so that other peers in the network know(for example its mac to route it) how to send a message to it.

This is necessary, for example VIRTIO_NET_F_GUEST_ANNOUNCE, similar mechanism work for in-marketing productions for years.

This is out of the topic anyway.

Quoted 49 lines
Quoted 49 lines
Quoted 7 lines
Quoted 6 lines
Quoted 5 lines
Quoted 3 lines

See the virtio common cfg, you will find the max number of vqs is there, num_queues.

:)
Sure. those values at high q count affects.

the driver need to initialize them anyway.

That is before the traffic starts from remote end.

see above, that needs a link announce and this is after re-initialization

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 3 lines

Device didn’t support LM.
Many limitations existed all these years and TC is improving and expanding

them.

Quoted 1 line

So all these years do not matter.

Not sure what are you talking about, haven't we initialize the device and vqs in config space for years?????? What's wrong with this

mechanism?

Quoted 14 lines
Quoted 14 lines
Quoted 2 lines
Quoted 1 line

Are you questioning virito-pci fundamentals???

Don’t point to in-efficient past to establish similar in-efficient future.

interesting, you know this is a one-time thing, right? and you are aware of this has been there for years.

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Like how to set a queue size and enable it?

Those are meant to be used before DRIVER_OK stage as they are init time

registers.

Quoted 1 line

Not to keep abusing them..

don't you need to set queue_size at the destination side?

No.
But the src/dst does not matter.
Queue_size to be set before DRIVER_OK like rest of the registers, as all

Quoted 8 lines
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

queues must be created before the driver_ok phase.

Quoted 1 line

Queue_reset was last moment exception.

create a queue? Nvidia specific?

Huh. No.
Do git log and realize what happened with queue_reset.

You didn't answer the question, does the spec even has defined "create a

vq"?

Quoted 2 lines

Enabled/created = tomato/tomato when discussing the spec in non-normative

email conversation.

Quoted 1 line

It's irrelevant.

Then lets not debate on this enable a vq or create a vq anymore

Quoted 3 lines

All I am saying is, when we know the limitations of the transport and when industry is forwarding to not introduced more and more on-die register

Quoted 6 lines
Quoted 5 lines

for once in lifetime work of device migration, we just use the optimal command and queue interface that is native to virtio. PCI config space has its own limitations, and admin vq has its advantages, but that does not apply to all use cases.

There was a recent work done emulating the SR-IOV cap and allowing VM to

enable SR-IOV in [1].

Quoted 2 lines

This is the option I mentioned few weeks ago.

Quoted 8 lines
Quoted 1 line

So with admin commands and admin virtqueues, even nested model will work

using [1].

Quoted 4 lines

[1]
https://netdevconf.info/0x17/sessions/talk/unleashing-sr-iov-offload-o
n-virtual-machines.html

We should take this into consideration once it is standardized in the spec, maybe not now, there can always be many workarounds to solve one problem.

Sure, until that point the admin commands are able to suffice the need well.
And when the spec changes in transport occurs (if needed), current admin command and admin vq also fits very well that will follow above [1].

Thanks.

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

I don't want to repeat why I don't think admin vq is a good idea for migration again, we have already discussed on that.

#92 lore raw

RE: [virtio-comment] Re: [PATCH V2 4/6] virtio-pci: implement VIRTIO_F_QUEUE_STATE

In reply to Zhu, Lingshan
Quoted 82 lines

From: Zhu, Lingshan <[email protected]>
Sent: Friday, November 10, 2023 12:23 PM

Quoted 18 lines · Michael S. Tsirkin
Quoted 17 lines · Lingshan
Quoted 15 lines · Michael S. Tsirkin
Quoted 14 lines · Lingshan
Quoted 13 lines · Parav Pandit
Quoted 13 lines

From: Zhu, Lingshan <[email protected]>
Sent: Monday, November 6, 2023 2:57 PM

Quoted 9 lines · Parav Pandit
Quoted 9 lines

From: Zhu, Lingshan <[email protected]>
Sent: Monday, November 6, 2023 9:01 AM

Quoted 5 lines · Parav Pandit
Quoted 5 lines

From: [email protected] <[email protected] open.org> On Behalf Of Zhu, Lingshan
Sent: Friday, November 3, 2023 8:27 PM

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines · Parav Pandit
Quoted 5 lines
Quoted 5 lines

From: Zhu Lingshan <[email protected]>
Sent: Friday, November 3, 2023 4:05 PM

This patch adds two new le16 fields to common configuration
structure to support VIRTIO_F_QUEUE_STATE in PCI transport

layer.

Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines

Signed-off-by: Zhu Lingshan <[email protected]>
---
transport-pci.tex | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)

diff --git a/transport-pci.tex b/transport-pci.tex index
a5c6719..3161519 100644
--- a/transport-pci.tex
+++ b/transport-pci.tex
@@ -325,6 +325,10 @@ \subsubsection{Common configuration

structure

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

layout}\label{sec:Virtio Transport
/* About the administration virtqueue. */
le16 admin_queue_index; /* read-only for driver

*/

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

le16 admin_queue_num; /* read-only for driver

*/

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 6 lines
Quoted 4 lines

+
+ /* Virtqueue state */
+ le16 queue_avail_state; /* read-write */
+ le16 queue_used_state; /* read-write */

This tiny interface for 128 virtio net queues through register read writes, does

not work effectively.

Quoted 2 lines

There are inflight out of order descriptors for block also. Hence toy registers like this do not work.

Do you know there is a queue_select? Why this does not work? Do you know how other queue related fields work?

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines

:)
Yes. If you notice queue_reset related critical spec bug fix was done when it

was introduced so that live migration can _actually_ work.

Quoted 2 lines

When queue_select is done for 128 queues serially, it take a lot of time to

read those slow register interface for this + inflight descriptors +

more.

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

interesting, virtio work in this pattern for many years, right?

All these years 400Gbps and 800Gbps virtio was not present, number of

queues were not in hw.
The registers are control path in config space, how 400G or 800G

affect??

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

Because those are the one in practice requires large number of VQs.

You are asking per VQ register commands to modify things dynamically

via this one vq at a time, serializing all the operations.

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 1 line

It does not scale well with high q count.

This is not dynamically, it only happens when SUSPEND and RESUME. This is the same mechanism how virtio initialize a virtqueue, working for many years.

Quoted 7 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

I wish we just had a transport vq already. That's the way to solve this not fighting individual bits.

Yeah, I agree, transport is a queued task(sent out V4 months ago...), one by one... hard and tough work...

Frankly I think that should take precedence, then Parav will not get annoyed each time add a couple of registers.

I agree, things can happen and we are already here..

Unfortunately transport vq is of not much help for below fundamental reasons.

1.1 as it involves many VMEXITS of accessing runtime config spaced on slow registers.
1.2 or alternatively hypervisor end up polling may thousands of registers wasting cpu resources.
2. It does not help of future CC use case where hypervisor must not be involved in dynamic config
3. Complex device like vnet has already stopped using every growing config space and using cvq, large part of work in 1.3 has shown that already
4. PFs also cannot infinitely grow registers, they also need less on-die registers.

And who knows the backward compatible SIOV devices may offer same bar as VFs.

virto spec has already outlined this efficient concept in the spec and TC members are already following it.

SIOV for non-backward compatible mode, anyway, need new interface and vq is inherently already there which fulfilling the needs.

Quoted 41 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines

See the virtio common cfg, you will find the max number of vqs is there, num_queues.

:)
Sure. those values at high q count affects.

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

the driver need to initialize them anyway.

Quoted 7 lines
Quoted 7 lines
Quoted 3 lines

Device didn’t support LM.
Many limitations existed all these years and TC is improving and expanding

them.

Quoted 1 line

So all these years do not matter.

Not sure what are you talking about, haven't we initialize the device and vqs in config space for years?????? What's wrong with this

mechanism?

Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Quoted 2 lines
Quoted 1 line

Are you questioning virito-pci fundamentals???

Don’t point to in-efficient past to establish similar in-efficient future.

interesting, you know this is a one-time thing, right? and you are aware of this has been there for years.

Quoted 12 lines
Quoted 12 lines
Quoted 10 lines
Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Like how to set a queue size and enable it?

Those are meant to be used before DRIVER_OK stage as they are init time

registers.

Quoted 1 line

Not to keep abusing them..

don't you need to set queue_size at the destination side?

No.
But the src/dst does not matter.
Queue_size to be set before DRIVER_OK like rest of the registers, as all

queues must be created before the driver_ok phase.

Quoted 1 line

Queue_reset was last moment exception.

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

create a queue? Nvidia specific?

Huh. No.
Do git log and realize what happened with queue_reset.

You didn't answer the question, does the spec even has defined "create a vq"?

Quoted 2 lines
Quoted 2 lines

For standard virtio, you need to read the number of enabled vqs at the source side, then enable them at the dst, so queue_size matters,

not to create.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 1 line

All that happens in the pre-copy phase.

Yes and how your answer related to this discussion?