×
Community Blog Virtio 1.2 is Coming!

Virtio 1.2 is Coming!

This article discusses the history of Virtio Spec and the release of Virtio 1.2.

By SIG for High-Performance Network

1

1. What Is Virtio Spec?

Today's cloud computing is in full swing. We often see the word virtio on cloud computing platforms, which appears on various devices of cloud computers.

2

What role does it play in the virtualization technology field?

Virtio is an I/O semi-virtualization solution, a set of general-purpose I/O device virtualization programs, and an abstraction of a set of general-purpose I/O devices in the semi-virtualization Hypervisor.

Generally speaking, virtio consists of three parts:

  1. Virtio Driver in a Virtual Machine
  2. Implementation of the Virtio Device on the Host or CIPU
  3. Virtio Spec

The first two parts are the driver and device implemented by virtio in different operating systems and computer simulators. There are no strict regulations on how to implement the driver and device, which are different based on different environments. However, the interaction between driver and device must strictly abide by the definition of virtio spec. Then, it can be guaranteed that all OS functions properly in simulators on different hosts.

Virtio Spec is the Essence of Virtio.

Virto spec defines a set of virtqueue mechanisms to enable communication between guest and host. This mechanism can be applied to various devices (network device, block device, etc.). Therefore, virtio spec developed a variety of devices that mostly covered virtualization scenarios.

1.1 Why Do We Choose It?

Virtio is a semi-virtualized technology. If the device is fully virtualized, the hypervisor must intercept all hardware request instructions, which has a huge impact on performance. The guest is essentially a process on a host, which is simple to interact with a hypervisor. It can interact based on the communication mode between processes. This requires the guest to cooperate. Virtio implementation based on it can achieve higher performance. That is why virtio is widely supported.

1.2 History of Virtio Spec

3

The very first specification Rusty Russell drafted in 2012 was informal. After that, the Virtio Technical Committee was responsible for virtio spec and released several versions. Under the auspices of the committee and with the extensive participation of the community, new features and capabilities have been added to virtio spec. Virtio Spec has been updated to v1.2.

4

1.3 Key Time Points of Virtio Spec 1.2

  • 25 January 2022 Virtio Spec Freeze
  • 10 May 2022-08 June 2022 Public Review
  • 01 July 2022 Virtio 1.2 Official Version Completed html
  • 15 July 2022 Official Release of Virtio 1.2

After more than half a year's efforts, Virtio 1.2 was officially released.

1.4 New Features of Virtio Spec 1.2

First, Virtio Spec 1.2 is fully compatible with earlier versions. All features defined by virtio spec are negotiated through features, so the implementation can be smoothly transitioned. There is no incompatibility between different versions after the upgrade. In terms of devices, Virtio Spec 1.2 supports some new devices: virtio-pmem, virtio-fs, and virtio-rpmb. Some mainstream devices also support new features. For example, virtio-net added these new features:

  • UDP segmentation offload
  • Receive Side Scaling
  • Per-packet hash reporting
  • Guest hdrlen optimization
  • Link speed and duplex reporting

In addition, virtio core added some new basic features:

  • Per-virtqueue reset
  • Shared memory resources
  • Object resources for inter-device sharing
  • Virtio-pci vendor-specific capabilities
  • Virtio-pci queue_notify_data optimization

Overall, the release of Virtio Spec 1.2 has brought many exciting new features. I believe that after these functions are officially implemented, we will get a more modernized virtio. This is also an opportunity to drive manufacturers to improve their virtio implementation.

2. Per-Virtqueue Reset

The Per-virtqueue reset in Virtio Spec 1.2 was drafted by Xuan Zhuo of Alibaba Cloud. Introducing this feature solves the problem that virtio-net does not support queue-level reset operations. This is a common function in many modernized network interface controllers and is the basic capability to realize many functions. It is necessary to introduce this feature to make virtio-net support more capabilities. However, Per-virtqueue reset is not limited to the virtio-net device, which is the basic capability of virtio. I believe other virtio devices will support this feature gradually.

2.1 Implementation Process of Per-Virtqueue Reset

The per-virtqueue reset is initiated by the driver for a queue and notifies the device based on transport (such as PCIe). The device stops using the queue, and the driver can re-enable the queue after resetting. Virtio spec defines the detailed interaction process and information in this procedure. The following is the detailed process defined in virtio spec:

  • The driver notifies the device that a specified queue is to be reset based on transport.
  • After the device receives the request, it sets the reset state to 1, stops all operations on this queue, including interrupts, and sets all states of the queue to the initial value. Before the device completes the reset operation, the reset state returned to the driver is 1 until the reset operation is completed. After the reset is completed, the values of reset and enable should be set to 0.
  • When the driver checks that the reset state of the queue becomes 0, the device reset operation has been completed. At this time, the driver can safely reclaim the relevant resources occupied by the queue.

The reset operation of the driver for the queue has been completed.

  • Then, the virtio driver can perform the re-enable operation. During the operation, the driver can give the device a new parameter to re-enable this queue (such as a new queue size).

This is a complete reset and re-enable procedure. Theoretically, re-enable is optional.

2.2 The Meaning of Per-Virtqueue Reset

Resetting queues is a common function for many modernized hardware devices, so its introduction makes virtio devices more modernized. The emergence of virtio in the early days came with the demand for high performance. We paid more attention to its basic functions in performance and ignored some advanced functions. Per-virtqueue reset makes virtio flexible in the use of queues. For example, we can implement the following two functions based on Per-vertqueue reset:

  1. Adjust the ring size of the virtio-net network interface controller queue. In the scenario of virtio-net, based on Per-virtqueue reset, we can implement the adjustment to the ring size of the network interface controller queue. Currently, the common network interface controller supports the use of ethtool -G eth0 rx <new size> tx <new size> to adjust the size of the queue, but the original virtio-net did not support such a simple function. Now, based on the Per-virtqueue reset, we will be able to use this command under Linux to adjust the size of the queue soon.
  2. Support AF_XDP to extend the boundaries of applications on the cloud. In addition to the preceding simple scenarios, we can apply this feature in more advanced scenarios. Per-virtqueue reset can be regarded as a rapid resource recovery mechanism. For example, in the case of virtio-net, we must first wait for new data packets or hardware to complete the transmission of data packets. Then, we can complete the recycling of buffer resources. Now, based on Per-virtqueue reset, the driver can call reset to quickly release the buffer resources occupied by a device on a queue instead of waiting passively, thus realizing rapid resource recycling. This allows virtio-net to support advanced functions (such as AF_XDP) and achieve high-performance packet forwarding under the Linux kernel framework.

More application scenarios are waiting for you to explore.

2.3 Achievement and Progress

The preceding contents are the definition of virtio spec. As the drafter of this feature, Xuan Zhuo moved to open-source-related implementations in the Linux kernel community after this feature officially entered virtio spec. Other device backend implementations are also in progress.

  • The patch set that supports the per-virtqueue reset function in the virtio core should be able to enter the Linux kernel mainline soon. This patch set contains a virtio-net implementation that supports ring size.
  • We will open-source the virtio-net implementations that support AF_XDP to the community soon.
  • The backend implementation of the qemu/vhost-user(DPDK)/vhost-kernel is in progress.

You will be able to experience this function on the new version of Qemu and Linux kernel soon.

3. High-Performance Network Virtio SIG

3.1 Background

As a large-scale cloud computing technology, Virtio is a basic technology used by major domestic cloud manufacturers. However, we have received little feedback and had rare participation over the years. Recently, we noticed that Alibaba and other domestic cloud manufacturers began to actively participate in it, including fixing bugs, setting standards, and promoting implementation. It is a good thing for the long-term development of domestic cloud technology. We hope there will be more participation to jointly promote the development of virtio.

We set up a virtio interest group under the high-performance network SIG in the community to support more features and optimize the landing of the OpenAnolis operating system better. We can enhance mutual communication and understanding in this area by strengthening the cooperation between various virtio-related teams and companies in the community, thus promoting virtio and its better development in OpenAnolis. I hope that more community partners can participate in the future. You are welcome to participate in the discussion and ask questions or propose needs. We can build the virtio SIG in the community together equally. This is a win-win.

3.2 Principles

Win-win, Equality, and Open-Source

3.3 Vision

  • Explore more possibilities of virtio standard and promote the implementation and landing of virtio standard
  • Promote technical exchange
  • Provide technical assistance
  • Provide requirements input for each partner
  • Synchronize the development progress of various partners
  • Promote cooperation among partners

4. SIG Members

Ding Xuefeng (Alibaba), Heng Qi (Alibaba), Xu Kangjie (Alibaba), Ma Jiangying (Intel CNDP), Gu Zhengguo (Jaguar Microsystems), Zhang Mingli (Jaguar Microsystems), Yang Tao (Jaguar Microsystems), Sun Chuanming (Jaguar Microsystems), Gong Youhua (YunSilicon), Meng Xianghong (YunSilicon), Chen Yang (YunSilicon), and Qian Rong (YunSilicon)

Join Us

You are welcome to join the Virtio SIG High-Performance Network.

SIG Address Link: https://openanolis.cn/sig/high-perf-network

0 1 0
Share on

OpenAnolis

85 posts | 5 followers

You may also like

Comments

OpenAnolis

85 posts | 5 followers

Related Products