Skip to contentSkip to conversation

virtio 1 issues

Qemu-devel Michael S. Tsirkin 3 participants 5 messages Aug 6, 2015 – Aug 10, 2015

lore
Share & tools
lore
#0 lore raw

Going over the code, I found a couple of issues. Recording them here since I won't be able to work on them until after the forum.

1. I realized we don't save/restore
serialize the following fields in virtio pci:

    uint32_t dfselect;
    uint32_t gfselect;
    uint32_t guest_features[2];
    struct {
        uint16_t num;
        bool enabled;
        uint32_t desc[2];
        uint32_t avail[2];
        uint32_t used[2];
    } vqs[VIRTIO_QUEUE_MAX];

This isn't an issue unless VM is migrated during driver initialization.

2. ring resizing is broken - it actually has a comment:

        /* TODO: need a way to put num back on reset. */

guest that runs out of memory might down-size the ring. Afterwards, ring size won't come back up after reset - not nice.

Given that the modern layout is disabled by default, I don't think these are release blockers.

Signature · 1 line
MST
#1 lore raw
Quoted 8 lines · Michael S. Tsirkin

Going over the code, I found a couple of issues. Recording them here since I won't be able to work on them until after the forum.

1. I realized we don't save/restore
serialize the following fields in virtio pci:

Quoted 9 lines
    uint32_t dfselect;
    uint32_t gfselect;
    uint32_t guest_features[2];
    struct {
        uint16_t num;
        bool enabled;
        uint32_t desc[2];
        uint32_t avail[2];
        uint32_t used[2];

desc, avail, used could be inferred from vring.desc, vring.avail and vring.used

Quoted 9 lines
    } vqs[VIRTIO_QUEUE_MAX];

This isn't an issue unless VM is migrated during driver initialization.

2. ring resizing is broken - it actually has a comment:

        /* TODO: need a way to put num back on reset. */

guest that runs out of memory might down-size the ring. Afterwards, ring size won't come back up after reset - not nice.

Then we need a new field to keep track the original queue size and migrate this.

Quoted 4 lines

Given that the modern layout is disabled by default, I don't think these are release blockers.

Yes and looks like we need a new subsection and transport specific callbacks to fix above?

#2 lore raw
Quoted 8 lines · On Fri, 07 Aug 2015 13:07:35 +0800 Jason Wang <[email protected]> wrote:
Quoted 5 lines

2. ring resizing is broken - it actually has a comment:

        /* TODO: need a way to put num back on reset. */

guest that runs out of memory might down-size the ring. Afterwards, ring size won't come back up after reset - not nice.

Then we need a new field to keep track the original queue size and migrate this.

virtio-ccw neatly sidesteps it by not implementing ring size changes at all :)

But it isn't really all good, see

/* TODO: Add interface to handle vring.num changing */

We either need to implement this or fence off changing the ring size, I guess.

Quoted 8 lines
Quoted 5 lines

Given that the modern layout is disabled by default, I don't think these are release blockers.

Yes and looks like we need a new subsection and transport specific callbacks to fix above?

Agreed, it's not urgent as virtio-1 is not yet the default (and not even enabled for ccw).

I'm not sure we need transport-specific callbacks. Shouldn't the core be able to track initial and actual size (and migrate in an optional subsection), as long as the transports use defined interfaces to interact with it?

#3 lore raw
Quoted 13 lines · Cornelia Huck
Quoted 7 lines · On Fri, 07 Aug 2015 13:07:35 +0800 Jason Wang <[email protected]> wrote:
Quoted 5 lines

2. ring resizing is broken - it actually has a comment:

        /* TODO: need a way to put num back on reset. */

guest that runs out of memory might down-size the ring. Afterwards, ring size won't come back up after reset - not nice.

Then we need a new field to keep track the original queue size and migrate this.

virtio-ccw neatly sidesteps it by not implementing ring size changes at all :)

Quoted 6 lines

But it isn't really all good, see

/* TODO: Add interface to handle vring.num changing */

We either need to implement this or fence off changing the ring size, I guess.

Yes.

Quoted 5 lines
Quoted 5 lines
Quoted 3 lines

Given that the modern layout is disabled by default, I don't think these are release blockers.

Yes and looks like we need a new subsection and transport specific callbacks to fix above?

Quoted 8 lines

Agreed, it's not urgent as virtio-1 is not yet the default (and not even enabled for ccw).

I'm not sure we need transport-specific callbacks. Shouldn't the core be able to track initial and actual size (and migrate in an optional subsection), as long as the transports use defined interfaces to interact with it?

For size, I agree it should be tracked by core. But we need also track transport specific data like dfselect/gfselect for pci.

#4 lore raw
Quoted 33 lines · On Mon, 10 Aug 2015 14:22:07 +0800 Jason Wang <[email protected]> wrote:
Quoted 13 lines · Cornelia Huck
Quoted 7 lines · On Fri, 07 Aug 2015 13:07:35 +0800 Jason Wang <[email protected]> wrote:
Quoted 5 lines

2. ring resizing is broken - it actually has a comment:

        /* TODO: need a way to put num back on reset. */

guest that runs out of memory might down-size the ring. Afterwards, ring size won't come back up after reset - not nice.

Then we need a new field to keep track the original queue size and migrate this.

virtio-ccw neatly sidesteps it by not implementing ring size changes at all :)

Quoted 6 lines

But it isn't really all good, see

/* TODO: Add interface to handle vring.num changing */

We either need to implement this or fence off changing the ring size, I guess.

Yes.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

Given that the modern layout is disabled by default, I don't think these are release blockers.

Yes and looks like we need a new subsection and transport specific callbacks to fix above?

Agreed, it's not urgent as virtio-1 is not yet the default (and not even enabled for ccw).

Quoted 8 lines
Quoted 5 lines

I'm not sure we need transport-specific callbacks. Shouldn't the core be able to track initial and actual size (and migrate in an optional subsection), as long as the transports use defined interfaces to interact with it?

For size, I agree it should be tracked by core. But we need also track transport specific data like dfselect/gfselect for pci.

Yup. I'll leave pci data to the pci folks :) I have a patch for handling the size; I'll post it after I've tested it a bit.