Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
For bugs related to Red Hat Enterprise Linux 5 product line. The current stable release is 5.10. For Red Hat Enterprise Linux 6 and above, please visit Red Hat JIRA https://issues.redhat.com/secure/CreateIssue!default.jspa?pid=12332745 to report new issues.

Bug 469153

Summary: RHEL 5.4: Improve virtio_net external->guest performance
Product: Red Hat Enterprise Linux 5 Reporter: Mark McLoughlin <markmc>
Component: kernelAssignee: Mark McLoughlin <markmc>
Status: CLOSED DUPLICATE QA Contact: Martin Jenner <mjenner>
Severity: medium Docs Contact:
Priority: high    
Version: 5.4CC: kernel-mgr, ovirt-maint, riek
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-02-10 07:52:27 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
virtio-net-mergeable-rx-buffers.patch none

Description Mark McLoughlin 2008-10-30 10:10:05 UTC
RHEL 5.3 virtio_net uses a receive buffer allocation scheme where it supplies the host with max-sized packets. This in contrast with the xen scheme where the guest supplies page-sized packets and the host can merge those buffers to form a larger buffer for GSO packets if needed.

This is an issue in the case of external->guest where the host is transferring lots of MTU sized packets to the guest. In this case bandwidth is constrained by the number of packets the ring can hold - 12 packets with a 256 entry ring.

A new receive buffer allocation is queued upstream for 2.6.29 and we should include this in 5.4

Roughly speaking, this improves external->guest bandwidth from 1Gb/s to 2Gb/s over a 10Gb/s link

Links:

  http://marc.info/?l=linux-kernel&m=122349465913313
  http://kerneltrap.org/mailarchive/linux-kvm/2008/10/8/3554774

changelog:

If segmentation offload is enabled by the host, we currently allocate
maximum sized packet buffers and pass them to the host. This uses up
20 ring entries, allowing us to supply only 20 packet buffers to the
host with a 256 entry ring. This is a huge overhead when receiving
small packets, and is most keenly felt when receiving MTU sized
packets from off-host.

The VIRTIO_NET_F_MRG_RXBUF feature flag is set by hosts which support
using receive buffers which are smaller than the maximum packet size.
In order to transfer large packets to the guest, the host merges
together multiple receive buffers to form a larger logical buffer.
The number of merged buffers is returned to the guest via a field in
the virtio_net_hdr.

Make use of this support by supplying single page receive buffers to
the host. On receive, we extract the virtio_net_hdr, copy 128 bytes of
the payload to the skb's linear data buffer and adjust the fragment
offset to point to the remaining data. This ensures proper alignment
and allows us to not use any paged data for small packets. If the
payload occupies multiple pages, we simply append those pages as
fragments and free the associated skbs.

This scheme allows us to be efficient in our use of ring entries
while still supporting large packets. Benchmarking using netperf from
an external machine to a guest over a 10Gb/s network shows a 100%
improvement from ~1Gb/s to ~2Gb/s. With a local host->guest benchmark
with GSO disabled on the host side, throughput was seen to increase
from 700Mb/s to 1.7Gb/s.

Comment 1 Mark McLoughlin 2008-10-30 10:11:31 UTC
Created attachment 321905 [details]
virtio-net-mergeable-rx-buffers.patch

Comment 2 Mark McLoughlin 2009-02-10 07:52:27 UTC
How bizarre; after filing this bug, I later filed bug #473120 and got the patch into 5.3 (merged in 2.6.18-126.el5)

*** This bug has been marked as a duplicate of bug 473120 ***