CSE Roadmap

Core tier · about 3 hours · 6 parts

Part 6 of 6 · 2 min read

Exercises

Easy

Easy 1: Which model (20 minutes)

A guest uses a driver for an Intel e1000 card on a virtual card. Which model is it, and why is it slow?

Done when: emulation, with an exit on each register access.

Hint

the e1000 is a real card that was imitated.

Easy 2: Exits (20 minutes)

A device model needs 4 exits per request. How many exits for 25,000 requests?

Done when: 100,000.

Hint

multiply.

Easy 3: Type numbers (20 minutes)

Name the device for virtio types 1, 2 and 5.

Done when: network, block, memory balloon.

Hint

see the program's kind function.

Medium

Medium 1: Batching (45 minutes)

A guest sends 64,000 requests per second with a batch of 16 per kick. How many kicks per second, and the exit time at 4 microseconds each?

Done when: 4,000 kicks, 16 ms per second (1.6 per cent).

Hint

64,000 / 16.

Medium 2: Run it (45 minutes)

Compile and run the program of section 3. Report the devices found, or say why none were found.

Done when: a table of devices with types and drivers, or a message that no virtio devices exist on this machine.

Hint

no virtio devices means a laptop or a physical machine.

Medium 3: Latency of a batch (45 minutes)

Requests arrive every 100 microseconds, and the guest kicks after 8 requests. What is the longest a request waits for the kick, and how does that compare with a kick for each request?

Done when: 7 x 100 = 700 us for the first in a batch; 0 with a kick per request, at 8 times as many exits.

Hint

the first request waits for seven more.

Hard

Hard 1: Pick a model (90 minutes)

Choose emulation, virtio or passthrough for: (a) an old operating system with no virtio driver, (b) a web server guest, (c) a machine-learning guest with a GPU. Give a reason for each.

Done when: (a) emulation, no driver to change; (b) virtio, fast enough and flexible; (c) passthrough, the highest speed and direct access.

Hint

think about driver, speed and sharing.

Hard 2: Why the IOMMU (90 minutes)

Explain with an example how a guest with a passed-through device and no IOMMU could read another guest's memory, and how the IOMMU stops it.

Done when: the guest driver programs a DMA to a physical address of another guest's page, which the device performs; the IOMMU has no mapping for it and blocks it.

Hint

a device does not know about guest boundaries.

Hard 3: Migration (90 minutes)

Explain why live migration (moving a running guest to another host) is easier with virtio than with SR-IOV, and what a design can do to allow both.

Done when: virtio state lives in the hypervisor and guest memory and moves with the guest; an SR-IOV function's state lives in the card; a fix is to switch the guest to a virtio device during the move.

Hint

where is the device state kept?