Skip to contentSkip to conversation

libxl: Add missing libxl__virtio_devtype to device_type_tbl array

PATCH In review Oleksandr Tyshchenko 5 participants 10 messages Jul 26, 2023 – Jul 27, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libxl: Add missing libxl__virtio_devtype to device_type_tbl array

From: Oleksandr Tyshchenko <[email protected]>

Without it being present it won't be possible to use some libxl__device_type's callbacks for virtio devices as the common code can only invoke these callbacks (by dereferencing a pointer) for valid libxl__device_type's elements when iterating over device_type_tbl[].

---
 tools/libs/light/libxl_create.c | 1 +
 1 file changed, 1 insertion(+)
tools/libs/light/libxl_create.c +1 -0
index 393c535579..c91059d713 100644
@@ -1887,6 +1887,7 @@ const libxl__device_type *device_type_tbl[] = {
     &libxl__dtdev_devtype,
     &libxl__vdispl_devtype,
     &libxl__vsnd_devtype,
+    &libxl__virtio_devtype,
     NULL
 };
 
Signature · 1 line
2.34.1
#1 lore raw
Quoted 17 lines · Oleksandr Tyshchenko

From: Oleksandr Tyshchenko <[email protected]>

Without it being present it won't be possible to use some libxl__device_type's callbacks for virtio devices as the common code can only invoke these callbacks (by dereferencing a pointer) for valid libxl__device_type's elements when iterating over device_type_tbl[].

---
 tools/libs/light/libxl_create.c | 1 +
 1 file changed, 1 insertion(+)
tools/libs/light/libxl_create.c +0 -0
index 393c535579..c91059d713 100644

tools/libs/light/libxl_create.c const libxl__device_type *device_type_tbl[] = { · line 1892

Quoted 6 lines
tools/libs/light/libxl_create.c +1 -0
@@ -1887,6 +1887,7 @@ const libxl__device_type *device_type_tbl[] = {
     &libxl__dtdev_devtype,
     &libxl__vdispl_devtype,
     &libxl__vsnd_devtype,
+    &libxl__virtio_devtype,
     NULL
 };

From description and nature of the change this looks like a Fixes:
tag would be warranted.

Jan

#2 lore raw

On 26.07.23 17:50, Jan Beulich wrote:

Hello Jan

Quoted 13 lines · Oleksandr Tyshchenko
Quoted 12 lines

From: Oleksandr Tyshchenko <[email protected]>

Without it being present it won't be possible to use some libxl__device_type's callbacks for virtio devices as the common code can only invoke these callbacks (by dereferencing a pointer) for valid libxl__device_type's elements when iterating over device_type_tbl[].

---
  tools/libs/light/libxl_create.c | 1 +
  1 file changed, 1 insertion(+)
Quoted 14 lines

tools/libs/light/libxl_create.c const libxl__device_type *device_type_tbl[] = { · line 1892

Quoted 11 lines
tools/libs/light/libxl_create.c +1 -0
index 393c535579..c91059d713 100644
@@ -1887,6 +1887,7 @@ const libxl__device_type *device_type_tbl[] = {
      &libxl__dtdev_devtype,
      &libxl__vdispl_devtype,
      &libxl__vsnd_devtype,
+    &libxl__virtio_devtype,
      NULL
  };

From description and nature of the change this looks like a Fixes:
tag would be warranted.

Looks like, yes. Thanks.

I guess, this should point to the commit that introduced libxl__virtio_devtype

Fixes 43ba5202e2ee ('libxl: add support for generic virtio device')
Quoted 2 lines

Jan

#3 lore raw
Quoted 29 lines · Oleksandr Tyshchenko
Quoted 13 lines · Jan Beulich
Quoted 12 lines · Oleksandr Tyshchenko

From: Oleksandr Tyshchenko <[email protected]>

Without it being present it won't be possible to use some libxl__device_type's callbacks for virtio devices as the common code can only invoke these callbacks (by dereferencing a pointer) for valid libxl__device_type's elements when iterating over device_type_tbl[].

---
  tools/libs/light/libxl_create.c | 1 +
  1 file changed, 1 insertion(+)
Quoted 14 lines

tools/libs/light/libxl_create.c const libxl__device_type *device_type_tbl[] = { · line 1892

Quoted 11 lines
tools/libs/light/libxl_create.c +1 -0
index 393c535579..c91059d713 100644
@@ -1887,6 +1887,7 @@ const libxl__device_type *device_type_tbl[] = {
      &libxl__dtdev_devtype,
      &libxl__vdispl_devtype,
      &libxl__vsnd_devtype,
+    &libxl__virtio_devtype,
      NULL
  };

From description and nature of the change this looks like a Fixes:
tag would be warranted.

Quoted 6 lines

Looks like, yes. Thanks.

I guess, this should point to the commit that introduced libxl__virtio_devtype

Fixes 43ba5202e2ee ('libxl: add support for generic virtio device')

In light of Anthony's feedback I'm now thinking that no Fixes: tag should be here, as is being clarified by the addition to the description (which I guess can be folded in while committing).

Jan

#4 lore raw

On 27.07.23 17:33, Jan Beulich wrote:

Hello Jan

Quoted 32 lines · Oleksandr Tyshchenko
Quoted 31 lines · Jan Beulich
Quoted 13 lines · Oleksandr Tyshchenko
Quoted 12 lines

From: Oleksandr Tyshchenko <[email protected]>

Without it being present it won't be possible to use some libxl__device_type's callbacks for virtio devices as the common code can only invoke these callbacks (by dereferencing a pointer) for valid libxl__device_type's elements when iterating over device_type_tbl[].

---
   tools/libs/light/libxl_create.c | 1 +
   1 file changed, 1 insertion(+)
Quoted 14 lines

tools/libs/light/libxl_create.c const libxl__device_type *device_type_tbl[] = { · line 1892

Quoted 11 lines
tools/libs/light/libxl_create.c +1 -0
index 393c535579..c91059d713 100644
@@ -1887,6 +1887,7 @@ const libxl__device_type *device_type_tbl[] = {
       &libxl__dtdev_devtype,
       &libxl__vdispl_devtype,
       &libxl__vsnd_devtype,
+    &libxl__virtio_devtype,
       NULL
   };

From description and nature of the change this looks like a Fixes:
tag would be warranted.

Looks like, yes. Thanks.

Quoted 8 lines
Quoted 4 lines

I guess, this should point to the commit that introduced libxl__virtio_devtype

Fixes 43ba5202e2ee ('libxl: add support for generic virtio device')

In light of Anthony's feedback I'm now thinking that no Fixes: tag should be here, as is being clarified by the addition to the description

I was about to send V2 with the addition + Fixes tag and noticed your reply.

Basically, I agree to not append Fixes tag, there is nothing broken within current code base regarding that, an addition clarifies the state and describes what/how may be broken.

I should have mentioned that from the very beginning.

(which I guess can be folded in while committing).

It would be really good.

Quoted 2 lines

Jan

Reviewed-by on v1 1/1
#5 lore raw
In reply to Oleksandr Tyshchenko
Quoted 17 lines · Oleksandr Tyshchenko

From: Oleksandr Tyshchenko <[email protected]>

Without it being present it won't be possible to use some libxl__device_type's callbacks for virtio devices as the common code can only invoke these callbacks (by dereferencing a pointer) for valid libxl__device_type's elements when iterating over device_type_tbl[].

---
 tools/libs/light/libxl_create.c | 1 +
 1 file changed, 1 insertion(+)
tools/libs/light/libxl_create.c +0 -0
index 393c535579..c91059d713 100644

tools/libs/light/libxl_create.c const libxl__device_type *device_type_tbl[] = { · line 1892

Quoted 6 lines
tools/libs/light/libxl_create.c +1 -0
@@ -1887,6 +1887,7 @@ const libxl__device_type *device_type_tbl[] = {
     &libxl__dtdev_devtype,
     &libxl__vdispl_devtype,
     &libxl__vsnd_devtype,
+    &libxl__virtio_devtype,
     NULL
 };
Signature · 1 line
viresh
#6 lore raw
In reply to Oleksandr Tyshchenko
Quoted 6 lines · Oleksandr Tyshchenko

From: Oleksandr Tyshchenko <[email protected]>

Without it being present it won't be possible to use some libxl__device_type's callbacks for virtio devices as the common code can only invoke these callbacks (by dereferencing a pointer) for valid libxl__device_type's elements when iterating over device_type_tbl[].

Did you notice an issue with it been missing from device_type_tbl[] ? Because to me it looks like all the functions that are using device_type_tbl will just skip over virtio devtype.

domcreate_attach_devices:
skip virtio because ".skip_attach = 1"

libxl__need_xenpv_qemu:
skip virtio because "dm_needed" is NULL

retrieve_domain_configuration_end:
skip because "compare" is "libxl_device_virtio_compare" which is NULL

libxl__update_domain_configuration:
skip because "update_config" is NULL.

So, I think the patch is fine, adding virtio to the device_type_tbl array is good for completeness, but the patch description may be misleading.

Did I miss something?

Thanks,

Signature · 1 line
Anthony PERARD
#7 lore raw

On 27.07.23 12:50, Anthony PERARD wrote:

Hello Anthony

Quoted 21 lines · Oleksandr Tyshchenko
Quoted 6 lines

From: Oleksandr Tyshchenko <[email protected]>

Without it being present it won't be possible to use some libxl__device_type's callbacks for virtio devices as the common code can only invoke these callbacks (by dereferencing a pointer) for valid libxl__device_type's elements when iterating over device_type_tbl[].

Did you notice an issue with it been missing from device_type_tbl[] ? Because to me it looks like all the functions that are using device_type_tbl will just skip over virtio devtype.

domcreate_attach_devices:
skip virtio because ".skip_attach = 1"

libxl__need_xenpv_qemu:
skip virtio because "dm_needed" is NULL

retrieve_domain_configuration_end:
skip because "compare" is "libxl_device_virtio_compare" which is NULL

Quoted 8 lines

libxl__update_domain_configuration:
skip because "update_config" is NULL.

So, I think the patch is fine, adding virtio to the device_type_tbl array is good for completeness, but the patch description may be misleading.

Did I miss something?

No, you didn't.

Just to be clear, there is no issue within *current* the code base, I am experimenting with using device-model bits, so I implemented libxl__device_virtio_dm_needed() locally and noticed that it didn't get called at all, the reason was in absence of libxl__virtio_devtype in the said array.

Do you agree with the following addition to the commit description?

"Please note, there is no issue within current the code base as virtio devices don't use callbacks that depend on libxl__virtio_devtype presence in device_type_tbl[]. The issue will appear as soon as we start using these callbacks (for example, dm_needed)."

Quoted 3 lines

Thanks,

#8 lore raw
Quoted 44 lines · Oleksandr Tyshchenko

On 27.07.23 12:50, Anthony PERARD wrote:

Hello Anthony

Quoted 21 lines · Oleksandr Tyshchenko
Quoted 6 lines

From: Oleksandr Tyshchenko <[email protected]>

Without it being present it won't be possible to use some libxl__device_type's callbacks for virtio devices as the common code can only invoke these callbacks (by dereferencing a pointer) for valid libxl__device_type's elements when iterating over device_type_tbl[].

Did you notice an issue with it been missing from device_type_tbl[] ? Because to me it looks like all the functions that are using device_type_tbl will just skip over virtio devtype.

domcreate_attach_devices:
skip virtio because ".skip_attach = 1"

libxl__need_xenpv_qemu:
skip virtio because "dm_needed" is NULL

retrieve_domain_configuration_end:
skip because "compare" is "libxl_device_virtio_compare" which is NULL

Quoted 8 lines

libxl__update_domain_configuration:
skip because "update_config" is NULL.

So, I think the patch is fine, adding virtio to the device_type_tbl array is good for completeness, but the patch description may be misleading.

Did I miss something?

No, you didn't.

Just to be clear, there is no issue within *current* the code base, I am experimenting with using device-model bits, so I implemented libxl__device_virtio_dm_needed() locally and noticed that it didn't get called at all, the reason was in absence of libxl__virtio_devtype in the said array.

Quoted 6 lines

Do you agree with the following addition to the commit description?

"Please note, there is no issue within current the code base as virtio devices don't use callbacks that depend on libxl__virtio_devtype presence in device_type_tbl[]. The issue will appear as soon as we start using these callbacks (for example, dm_needed)."

Yes, that would be fine. With that addition:

Thanks,

Signature · 1 line
Anthony PERARD
#9 lore raw

On 27.07.23 16:45, Anthony PERARD wrote:

Hello Anthony

Quoted 47 lines · Oleksandr Tyshchenko
Quoted 46 lines · Anthony PERARD

Hello Anthony

Quoted 21 lines · Oleksandr Tyshchenko
Quoted 6 lines

From: Oleksandr Tyshchenko <[email protected]>

Without it being present it won't be possible to use some libxl__device_type's callbacks for virtio devices as the common code can only invoke these callbacks (by dereferencing a pointer) for valid libxl__device_type's elements when iterating over device_type_tbl[].

Did you notice an issue with it been missing from device_type_tbl[] ? Because to me it looks like all the functions that are using device_type_tbl will just skip over virtio devtype.

domcreate_attach_devices:
skip virtio because ".skip_attach = 1"

libxl__need_xenpv_qemu:
skip virtio because "dm_needed" is NULL

retrieve_domain_configuration_end:
skip because "compare" is "libxl_device_virtio_compare" which is NULL

Quoted 8 lines

libxl__update_domain_configuration:
skip because "update_config" is NULL.

So, I think the patch is fine, adding virtio to the device_type_tbl array is good for completeness, but the patch description may be misleading.

Did I miss something?

No, you didn't.

Just to be clear, there is no issue within *current* the code base, I am experimenting with using device-model bits, so I implemented libxl__device_virtio_dm_needed() locally and noticed that it didn't get called at all, the reason was in absence of libxl__virtio_devtype in the said array.

Do you agree with the following addition to the commit description?

Quoted 7 lines
Quoted 4 lines

"Please note, there is no issue within current the code base as virtio devices don't use callbacks that depend on libxl__virtio_devtype presence in device_type_tbl[]. The issue will appear as soon as we start using these callbacks (for example, dm_needed)."

Yes, that would be fine. With that addition:

Thanks for the clarification and A-b.

Quoted 3 lines

Thanks,