Skip to contentSkip to conversation

virtio ring layout changes for optimal single-stream performance

DISCUSSION Michael S. Tsirkin 2 participants 4 messages Jan 21, 2016

Subsystems (2)
lore
Share & tools
lore

Michael S. Tsirkin

author maintainer
#0 lore raw

Hi all!
I have been experimenting with alternative virtio ring layouts, in order to speed up single stream performance.

I have just posted a benchmark I wrote for the purpose, and a (partial) alternative layout implementation. This achieves 20-40% reduction in virtio overhead in the (default) polling mode.

http://article.gmane.org/gmane.linux.kernel.virtualization/26889

The layout is trying to be as simple as possible, to reduce the number of cache lines bouncing between CPUs.

For benchmarking, the idea is to emulate virtio in user-space, artificially adding overhead for e.g. signalling to match what happens in case of a VM.

I'd be very curious to get feedback on this, in particular, some people discussed using vectored operations to format virtio ring - would it conflict with this work?

You are all welcome to post enhancements or more layout alternatives as patches.

TODO:
- documentation+discussion of interaction with CPU caching
- thorough benchmarking of different configurations/hosts
- experiment with event index replacements
- better emulate vmexit/vmentry cost overhead
- virtio spec proposal

Thanks!

Signature · 1 line
MST
#1 lore raw
Quoted 4 lines · On Thu, 21 Jan 2016 15:39:26 +0200 "Michael S. Tsirkin" <[email protected]> wrote:

Hi all!
I have been experimenting with alternative virtio ring layouts, in order to speed up single stream performance.

Quoted 8 lines

I have just posted a benchmark I wrote for the purpose, and a (partial) alternative layout implementation. This achieves 20-40% reduction in virtio overhead in the (default) polling mode.

http://article.gmane.org/gmane.linux.kernel.virtualization/26889

The layout is trying to be as simple as possible, to reduce the number of cache lines bouncing between CPUs.

Some kind of diagram or textual description would really help to review this.

Quoted 4 lines

For benchmarking, the idea is to emulate virtio in user-space, artificially adding overhead for e.g. signalling to match what happens in case of a VM.

Hm... is this overhead comparable enough between different platform so that you can get a halfway realistic scenario? What about things like endianness conversions?

Quoted 7 lines

I'd be very curious to get feedback on this, in particular, some people discussed using vectored operations to format virtio ring - would it conflict with this work?

You are all welcome to post enhancements or more layout alternatives as patches.

Let me see if I can find time to experiment a bit.

author maintainer
#2 lore raw
Quoted 20 lines · Cornelia Huck
Quoted 4 lines · On Thu, 21 Jan 2016 15:39:26 +0200 "Michael S. Tsirkin" <[email protected]> wrote:

Hi all!
I have been experimenting with alternative virtio ring layouts, in order to speed up single stream performance.

Quoted 8 lines

I have just posted a benchmark I wrote for the purpose, and a (partial) alternative layout implementation. This achieves 20-40% reduction in virtio overhead in the (default) polling mode.

http://article.gmane.org/gmane.linux.kernel.virtualization/26889

The layout is trying to be as simple as possible, to reduce the number of cache lines bouncing between CPUs.

Some kind of diagram or textual description would really help to review this.

Quoted 1 line
Quoted 6 lines
Quoted 3 lines

For benchmarking, the idea is to emulate virtio in user-space, artificially adding overhead for e.g. signalling to match what happens in case of a VM.

Hm... is this overhead comparable enough between different platform so that you can get a halfway realistic scenario?

On x86 is seems pretty stable.
It's a question of setting VMEXIT_CYCLES and VMENTRY_CYCLES correctly.

Quoted 2 lines

What about things like
endianness conversions?

I didn't bother with them yet.

Quoted 9 lines
Quoted 7 lines

I'd be very curious to get feedback on this, in particular, some people discussed using vectored operations to format virtio ring - would it conflict with this work?

You are all welcome to post enhancements or more layout alternatives as patches.

Let me see if I can find time to experiment a bit.

author maintainer
#3 lore raw
In reply to Cornelia Huck
Quoted 20 lines · Cornelia Huck
Quoted 4 lines · On Thu, 21 Jan 2016 15:39:26 +0200 "Michael S. Tsirkin" <[email protected]> wrote:

Hi all!
I have been experimenting with alternative virtio ring layouts, in order to speed up single stream performance.

Quoted 8 lines

I have just posted a benchmark I wrote for the purpose, and a (partial) alternative layout implementation. This achieves 20-40% reduction in virtio overhead in the (default) polling mode.

http://article.gmane.org/gmane.linux.kernel.virtualization/26889

The layout is trying to be as simple as possible, to reduce the number of cache lines bouncing between CPUs.

Some kind of diagram or textual description would really help to review this.

Quoted 1 line
Quoted 6 lines
Quoted 3 lines

For benchmarking, the idea is to emulate virtio in user-space, artificially adding overhead for e.g. signalling to match what happens in case of a VM.

Hm... is this overhead comparable enough between different platform so that you can get a halfway realistic scenario?

On x86 is seems pretty stable.
It's a question of setting VMEXIT_CYCLES and VMENTRY_CYCLES correctly.

Quoted 2 lines

What about things like
endianness conversions?

I didn't bother with them yet.

Quoted 9 lines
Quoted 7 lines

I'd be very curious to get feedback on this, in particular, some people discussed using vectored operations to format virtio ring - would it conflict with this work?

You are all welcome to post enhancements or more layout alternatives as patches.

Let me see if I can find time to experiment a bit.