Skip to contentSkip to conversation

virtio-balloon: Fix page-poison subsection name

PATCH In review Dr. David Alan Gilbert (git) 4 participants 9 messages Sep 14, 2021 – Sep 15, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 virtio-balloon: Fix page-poison subsection name

From: "Dr. David Alan Gilbert" <[email protected]>

The subsection name for page-poison was typo'd as:

vitio-balloon-device/page-poison

Note the missing 'r' in virtio.

When we have a machine type that enables page poison, and the guest enables it (which needs a new kernel), things fail rather unpredictably.

The fallout from this is that most of the other subsections fail to load, including things like the feature bits in the device, one possible fallout is that the physical addresses of the queues then get aligned differently and we fail with an error about last_avail_idx being wrong.
It's not obvious to me why this doesn't produce a more obvious failure, but virtio's vmstate loading is a bit open-coded.

Fixes 7483cbbaf82 ("virtio-balloon: Implement support for page poison reporting feature")

bz: https://bugzilla.redhat.com/show_bug.cgi?id=1984401

---
 hw/virtio/virtio-balloon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/virtio/virtio-balloon.c +1 -1
index 5a69dce35d..c6962fcbfe 100644
@@ -852,7 +852,7 @@ static const VMStateDescription vmstate_virtio_balloon_free_page_hint = {
 };
 
 static const VMStateDescription vmstate_virtio_balloon_page_poison = {
-    .name = "vitio-balloon-device/page-poison",
+    .name = "virtio-balloon-device/page-poison",
     .version_id = 1,
     .minimum_version_id = 1,
     .needed = virtio_balloon_page_poison_support,
Signature · 1 line
2.31.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 32 lines · Dr. David Alan Gilbert (git)

From: "Dr. David Alan Gilbert" <[email protected]>

The subsection name for page-poison was typo'd as:

vitio-balloon-device/page-poison

Note the missing 'r' in virtio.

When we have a machine type that enables page poison, and the guest enables it (which needs a new kernel), things fail rather unpredictably.

The fallout from this is that most of the other subsections fail to load, including things like the feature bits in the device, one possible fallout is that the physical addresses of the queues then get aligned differently and we fail with an error about last_avail_idx being wrong.
It's not obvious to me why this doesn't produce a more obvious failure, but virtio's vmstate loading is a bit open-coded.

Fixes 7483cbbaf82 ("virtio-balloon: Implement support for page poison reporting feature")

bz: https://bugzilla.redhat.com/show_bug.cgi?id=1984401

---
  hw/virtio/virtio-balloon.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
hw/virtio/virtio-balloon.c +0 -0
index 5a69dce35d..c6962fcbfe 100644

hw/virtio/virtio-balloon.c static const VMStateDescription vmstate_virtio_balloon_free_page_hint = { · line 858

Quoted 8 lines
hw/virtio/virtio-balloon.c +1 -1
@@ -852,7 +852,7 @@ static const VMStateDescription vmstate_virtio_balloon_free_page_hint = {
  };
 
  static const VMStateDescription vmstate_virtio_balloon_page_poison = {
-    .name = "vitio-balloon-device/page-poison",
+    .name = "virtio-balloon-device/page-poison",
      .version_id = 1,
      .minimum_version_id = 1,
      .needed = virtio_balloon_page_poison_support,

Oh, that's very subtle. I wasn't even aware that the prefix really has to match the actual device ... I thought the whole idea of the prefix here was just to make the string unique ...

Thanks!

Signature · 3 lines
Thanks,

David / dhildenb
#2 lore raw
Quoted 36 lines · * David Hildenbrand ([email protected]) wrote:
Quoted 35 lines · Dr. David Alan Gilbert (git)

From: "Dr. David Alan Gilbert" <[email protected]>

The subsection name for page-poison was typo'd as:

vitio-balloon-device/page-poison

Note the missing 'r' in virtio.

When we have a machine type that enables page poison, and the guest enables it (which needs a new kernel), things fail rather unpredictably.

The fallout from this is that most of the other subsections fail to load, including things like the feature bits in the device, one possible fallout is that the physical addresses of the queues then get aligned differently and we fail with an error about last_avail_idx being wrong.
It's not obvious to me why this doesn't produce a more obvious failure, but virtio's vmstate loading is a bit open-coded.

Fixes 7483cbbaf82 ("virtio-balloon: Implement support for page poison reporting feature")

bz: https://bugzilla.redhat.com/show_bug.cgi?id=1984401

---
  hw/virtio/virtio-balloon.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
hw/virtio/virtio-balloon.c +1 -1
index 5a69dce35d..c6962fcbfe 100644
@@ -852,7 +852,7 @@ static const VMStateDescription vmstate_virtio_balloon_free_page_hint = {
  };
  static const VMStateDescription vmstate_virtio_balloon_page_poison = {
-    .name = "vitio-balloon-device/page-poison",
+    .name = "virtio-balloon-device/page-poison",
Quoted 8 lines

hw/virtio/virtio-balloon.c static const VMStateDescription vmstate_virtio_balloon_free_page_hint = {

Quoted 4 lines
hw/virtio/virtio-balloon.c +0 -0
      .version_id = 1,
      .minimum_version_id = 1,
      .needed = virtio_balloon_page_poison_support,
 

Oh, that's very subtle. I wasn't even aware that the prefix really has to match the actual device ... I thought the whole idea of the prefix here was just to make the string unique ...

Subsection naming is *very* critical; the logic is something like:
'we're loading the X device'
a subsection arrives for 'N/P'
if 'X==N' then it looks in X for subsection P.
If 'X!=N' then it assumes we've finished loading X
and P is really for an outer device that X is part of. This is horrible.

Dave

Quoted 9 lines

Thanks!

Signature · 3 lines
Thanks,

David / dhildenb
Signature · 1 line
Dr. David Alan Gilbert / [email protected] / Manchester, UK
#3 lore raw
Quoted 46 lines · Dr. David Alan Gilbert
Quoted 36 lines · * David Hildenbrand ([email protected]) wrote:
Quoted 35 lines · Dr. David Alan Gilbert (git)

From: "Dr. David Alan Gilbert" <[email protected]>

The subsection name for page-poison was typo'd as:

vitio-balloon-device/page-poison

Note the missing 'r' in virtio.

When we have a machine type that enables page poison, and the guest enables it (which needs a new kernel), things fail rather unpredictably.

The fallout from this is that most of the other subsections fail to load, including things like the feature bits in the device, one possible fallout is that the physical addresses of the queues then get aligned differently and we fail with an error about last_avail_idx being wrong.
It's not obvious to me why this doesn't produce a more obvious failure, but virtio's vmstate loading is a bit open-coded.

Fixes 7483cbbaf82 ("virtio-balloon: Implement support for page poison reporting feature")

bz: https://bugzilla.redhat.com/show_bug.cgi?id=1984401

---
  hw/virtio/virtio-balloon.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
hw/virtio/virtio-balloon.c +1 -1
index 5a69dce35d..c6962fcbfe 100644
@@ -852,7 +852,7 @@ static const VMStateDescription vmstate_virtio_balloon_free_page_hint = {
  };
  static const VMStateDescription vmstate_virtio_balloon_page_poison = {
-    .name = "vitio-balloon-device/page-poison",
+    .name = "virtio-balloon-device/page-poison",
Quoted 8 lines

hw/virtio/virtio-balloon.c static const VMStateDescription vmstate_virtio_balloon_free_page_hint = {

Quoted 4 lines
hw/virtio/virtio-balloon.c +0 -0
      .version_id = 1,
      .minimum_version_id = 1,
      .needed = virtio_balloon_page_poison_support,
 

Oh, that's very subtle. I wasn't even aware that the prefix really has to match the actual device ... I thought the whole idea of the prefix here was just to make the string unique ...

Quoted 7 lines

Subsection naming is *very* critical; the logic is something like:
'we're loading the X device'
a subsection arrives for 'N/P'
if 'X==N' then it looks in X for subsection P.
If 'X!=N' then it assumes we've finished loading X
and P is really for an outer device that X is part of. This is horrible.

Is there value in making this more explicit via a code convention for .name field initializers. eg instead of

.name = "virtio-balloon-device/page-poison",

Prefer

.name = TYPE_VIRTIO_BALLOON "/page-poison"

?

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#4 lore raw
Quoted 58 lines · * Daniel P. Berrangé ([email protected]) wrote:
Quoted 46 lines · Dr. David Alan Gilbert
Quoted 36 lines · * David Hildenbrand ([email protected]) wrote:
Quoted 35 lines · Dr. David Alan Gilbert (git)

From: "Dr. David Alan Gilbert" <[email protected]>

The subsection name for page-poison was typo'd as:

vitio-balloon-device/page-poison

Note the missing 'r' in virtio.

When we have a machine type that enables page poison, and the guest enables it (which needs a new kernel), things fail rather unpredictably.

The fallout from this is that most of the other subsections fail to load, including things like the feature bits in the device, one possible fallout is that the physical addresses of the queues then get aligned differently and we fail with an error about last_avail_idx being wrong.
It's not obvious to me why this doesn't produce a more obvious failure, but virtio's vmstate loading is a bit open-coded.

Fixes 7483cbbaf82 ("virtio-balloon: Implement support for page poison reporting feature")

bz: https://bugzilla.redhat.com/show_bug.cgi?id=1984401

---
  hw/virtio/virtio-balloon.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
hw/virtio/virtio-balloon.c +1 -1
index 5a69dce35d..c6962fcbfe 100644
@@ -852,7 +852,7 @@ static const VMStateDescription vmstate_virtio_balloon_free_page_hint = {
  };
  static const VMStateDescription vmstate_virtio_balloon_page_poison = {
-    .name = "vitio-balloon-device/page-poison",
+    .name = "virtio-balloon-device/page-poison",
Quoted 8 lines

hw/virtio/virtio-balloon.c static const VMStateDescription vmstate_virtio_balloon_free_page_hint = {

Quoted 4 lines
hw/virtio/virtio-balloon.c +0 -0
      .version_id = 1,
      .minimum_version_id = 1,
      .needed = virtio_balloon_page_poison_support,
 

Oh, that's very subtle. I wasn't even aware that the prefix really has to match the actual device ... I thought the whole idea of the prefix here was just to make the string unique ...

Quoted 7 lines

Subsection naming is *very* critical; the logic is something like:
'we're loading the X device'
a subsection arrives for 'N/P'
if 'X==N' then it looks in X for subsection P.
If 'X!=N' then it assumes we've finished loading X
and P is really for an outer device that X is part of. This is horrible.

Is there value in making this more explicit via a code convention for .name field initializers. eg instead of

Quoted 7 lines

.name = "virtio-balloon-device/page-poison",

Prefer

.name = TYPE_VIRTIO_BALLOON "/page-poison"

?

I think it might be better to see if the vmstate code can check it and error during saving; certainly this case feels detectable, but I need to keep an eye open for all the other weird cases.

Dave

Quoted 8 lines

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
Signature · 1 line
Dr. David Alan Gilbert / [email protected] / Manchester, UK
#5 lore raw
In reply to Daniel P. Berrangé
Quoted 58 lines · Daniel P. Berrangé
Quoted 46 lines · Dr. David Alan Gilbert
Quoted 36 lines · * David Hildenbrand ([email protected]) wrote:
Quoted 35 lines · Dr. David Alan Gilbert (git)

From: "Dr. David Alan Gilbert" <[email protected]>

The subsection name for page-poison was typo'd as:

vitio-balloon-device/page-poison

Note the missing 'r' in virtio.

When we have a machine type that enables page poison, and the guest enables it (which needs a new kernel), things fail rather unpredictably.

The fallout from this is that most of the other subsections fail to load, including things like the feature bits in the device, one possible fallout is that the physical addresses of the queues then get aligned differently and we fail with an error about last_avail_idx being wrong.
It's not obvious to me why this doesn't produce a more obvious failure, but virtio's vmstate loading is a bit open-coded.

Fixes 7483cbbaf82 ("virtio-balloon: Implement support for page poison reporting feature")

bz: https://bugzilla.redhat.com/show_bug.cgi?id=1984401

---
  hw/virtio/virtio-balloon.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
hw/virtio/virtio-balloon.c +1 -1
index 5a69dce35d..c6962fcbfe 100644
@@ -852,7 +852,7 @@ static const VMStateDescription vmstate_virtio_balloon_free_page_hint = {
  };
  static const VMStateDescription vmstate_virtio_balloon_page_poison = {
-    .name = "vitio-balloon-device/page-poison",
+    .name = "virtio-balloon-device/page-poison",
Quoted 8 lines

hw/virtio/virtio-balloon.c static const VMStateDescription vmstate_virtio_balloon_free_page_hint = {

Quoted 4 lines
hw/virtio/virtio-balloon.c +0 -0
      .version_id = 1,
      .minimum_version_id = 1,
      .needed = virtio_balloon_page_poison_support,
 

Oh, that's very subtle. I wasn't even aware that the prefix really has to match the actual device ... I thought the whole idea of the prefix here was just to make the string unique ...

Quoted 7 lines

Subsection naming is *very* critical; the logic is something like:
'we're loading the X device'
a subsection arrives for 'N/P'
if 'X==N' then it looks in X for subsection P.
If 'X!=N' then it assumes we've finished loading X
and P is really for an outer device that X is part of. This is horrible.

Is there value in making this more explicit via a code convention for .name field initializers. eg instead of

Quoted 7 lines

.name = "virtio-balloon-device/page-poison",

Prefer

.name = TYPE_VIRTIO_BALLOON "/page-poison"

?

IIUC so far only user-creatable devices are required to have a stable name in the TYPE definition (because CLI must stay stable). Which is why this type is not recommended for migration section names.

#7 lore raw
In reply to Dr. David Alan Gilbert (git)
Quoted 10 lines · Dr. David Alan Gilbert (git)

From: "Dr. David Alan Gilbert" <[email protected]>

The subsection name for page-poison was typo'd as:

vitio-balloon-device/page-poison

Note the missing 'r' in virtio.

When we have a machine type that enables page poison, and the guest enables it (which needs a new kernel), things fail rather unpredictably.

IIUC since v5.1 guests have 'page-poison'=true but once migrated they become 'page-poison'=unset=false?

Quoted 7 lines

The fallout from this is that most of the other subsections fail to load, including things like the feature bits in the device, one possible fallout is that the physical addresses of the queues then get aligned differently and we fail with an error about last_avail_idx being wrong.
It's not obvious to me why this doesn't produce a more obvious failure, but virtio's vmstate loading is a bit open-coded.

:/

Quoted 21 lines
Fixes 7483cbbaf82 ("virtio-balloon: Implement support for page poison reporting feature")

bz: https://bugzilla.redhat.com/show_bug.cgi?id=1984401

---
 hw/virtio/virtio-balloon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/virtio/virtio-balloon.c +1 -1
index 5a69dce35d..c6962fcbfe 100644
@@ -852,7 +852,7 @@ static const VMStateDescription vmstate_virtio_balloon_free_page_hint = {
 };
 
 static const VMStateDescription vmstate_virtio_balloon_page_poison = {
-    .name = "vitio-balloon-device/page-poison",
+    .name = "virtio-balloon-device/page-poison",
     .version_id = 1,
     .minimum_version_id = 1,
     .needed = virtio_balloon_page_poison_support,
#8 lore raw
Quoted 7 lines · Philippe Mathieu-Daudé
Quoted 6 lines · Dr. David Alan Gilbert (git)

From: "Dr. David Alan Gilbert" <[email protected]>

The subsection name for page-poison was typo'd as:

vitio-balloon-device/page-poison

Quoted 7 lines
Quoted 4 lines

Note the missing 'r' in virtio.

When we have a machine type that enables page poison, and the guest enables it (which needs a new kernel), things fail rather unpredictably.

IIUC since v5.1 guests have 'page-poison'=true but once migrated they become 'page-poison'=unset=false?

We only migrate the subsection if the guest supports the feature (-> newer guest kernel).

If we migrate, it's a broken migration stream. If we don't migrate, everything is fine.

Signature · 3 lines
Thanks,

David / dhildenb