Skip to contentSkip to conversation

qdev property listing broken

Qemu-devel Jan Kiszka 4 participants 14 messages Apr 2, 2012 – Apr 3, 2012

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

Hi Anthony,

I noticed that only properties with legacy names are printed via info qtree. After digging through the qdev and qom property maze, it turned out the property registration in qdev_property_add_legacy and qdev_property_add_static is not consistent with the access in qdev_print_props. The latter assumes all properties are strings, the former generate the full set of types - and add_legacy obviously an inconsistent one, dependent on the existence of print/parse handlers. I fail to see the right direction, ie. where to fix this. Can you provide a hint?

Jan

PS: It's really no fun to understand and debug this code anymore. Hopefully, the removal of the qdev layer can improve this again.

#1 lore raw

Il 02/04/2012 21:33, Jan Kiszka ha scritto:

Quoted 11 lines

Hi Anthony,

I noticed that only properties with legacy names are printed via info qtree. After digging through the qdev and qom property maze, it turned out the property registration in qdev_property_add_legacy and qdev_property_add_static is not consistent with the access in qdev_print_props. The latter assumes all properties are strings, the former generate the full set of types - and add_legacy obviously an inconsistent one, dependent on the existence of print/parse handlers. I fail to see the right direction, ie. where to fix this. Can you provide a hint?

Actually the patch is trivial. Pardon the likely whitespace damage, I'll send it properly tomorrow morning (it was ready but today I didn't have the time to test the whole series properly).

hw/qdev-monitor.c +2 -2
index a310cc7..923519c 100644
@@ -157,7 +157,7 @@ int qdev_device_help(QemuOpts *opts)
          * for removal.  This conditional should be removed along with
          * it.
          */
-        if (!prop->info->parse) {
+        if (!prop->info->get) {
             continue;           /* no way to set it, don't show */
         }
         error_printf("%s.%s=%s\n", driver, prop->name,
@@ -165,7 +165,7 @@ int qdev_device_help(QemuOpts *opts)
     }
     if (info->bus_info) {
         for (prop = info->bus_info->props; prop && prop->name; prop++) {
-            if (!prop->info->parse) {
+            if (!prop->info->get) {
                 continue;           /* no way to set it, don't show */
             }
             error_printf("%s.%s=%s\n", driver, prop->name,

Paolo

#8 lore raw
In reply to Jan Kiszka
Quoted 4 lines · Jan Kiszka

Hi Anthony,

I noticed that only properties with legacy names are printed via info qtree.

Yes. Is that not what you expect?

The qom properties and model is not stable for 1.1 so I was very careful in making sure they didn't leak into info qtree.

Quoted 4 lines

After digging through the qdev and qom property maze, it turned out the property registration in qdev_property_add_legacy and qdev_property_add_static is not consistent with the access in qdev_print_props.

qdev_print_props will completely die for 1.2 as will almost everything related to the human monitor in qdev-monitor.c.

I just wanted to give us a full release to make sure we were happy with the various interfaces.

Quoted 5 lines

The latter assumes all properties are strings, the
former generate the full set of types - and add_legacy obviously an inconsistent one, dependent on the existence of print/parse handlers. I fail to see the right direction, ie. where to fix this. Can you provide a hint?

Is there a reason you're using info qtree instead of qom-list? qom-list gives you much more info than info qtree.

Regards,

Anthony Liguori

Quoted 4 lines

Jan

PS: It's really no fun to understand and debug this code anymore. Hopefully, the removal of the qdev layer can improve this again.

#2 lore raw
In reply to Paolo Bonzini
Quoted 22 lines · Paolo Bonzini

Il 02/04/2012 21:33, Jan Kiszka ha scritto:

Quoted 11 lines

Hi Anthony,

I noticed that only properties with legacy names are printed via info qtree. After digging through the qdev and qom property maze, it turned out the property registration in qdev_property_add_legacy and qdev_property_add_static is not consistent with the access in qdev_print_props. The latter assumes all properties are strings, the former generate the full set of types - and add_legacy obviously an inconsistent one, dependent on the existence of print/parse handlers. I fail to see the right direction, ie. where to fix this. Can you provide a hint?

Actually the patch is trivial. Pardon the likely whitespace damage, I'll send it properly tomorrow morning (it was ready but today I didn't have the time to test the whole series properly).

hw/qdev-monitor.c +0 -0
index a310cc7..923519c 100644

hw/qdev-monitor.c int qdev_device_help(QemuOpts *opts) · line 163

Quoted 8 lines
hw/qdev-monitor.c +1 -1
@@ -157,7 +157,7 @@ int qdev_device_help(QemuOpts *opts)
           * for removal.  This conditional should be removed along with
           * it.
           */
-        if (!prop->info->parse) {
+        if (!prop->info->get) {
              continue;           /* no way to set it, don't show */
          }
          error_printf("%s.%s=%s\n", driver, prop->name,

Oh, I misunderstood but I understand now. This is a regression. Thanks Paolo.

Regards,

Anthony Liguori

Quoted 13 lines
hw/qdev-monitor.c +1 -1
@@ -165,7 +165,7 @@ int qdev_device_help(QemuOpts *opts)
      }
      if (info->bus_info) {
          for (prop = info->bus_info->props; prop&&  prop->name; prop++) {
-            if (!prop->info->parse) {
+            if (!prop->info->get) {
                  continue;           /* no way to set it, don't show */
              }
              error_printf("%s.%s=%s\n", driver, prop->name,

Paolo

author
#9 lore raw
In reply to Anthony Liguori
Quoted 16 lines · Anthony Liguori
Quoted 4 lines · Jan Kiszka

Hi Anthony,

I noticed that only properties with legacy names are printed via info qtree.

Yes. Is that not what you expect?

The qom properties and model is not stable for 1.1 so I was very careful in making sure they didn't leak into info qtree.

Quoted 4 lines

After digging through the qdev and qom property maze, it turned out the property registration in qdev_property_add_legacy and qdev_property_add_static is not consistent with the access in qdev_print_props.

Quoted 5 lines

qdev_print_props will completely die for 1.2 as will almost everything related to the human monitor in qdev-monitor.c.

I just wanted to give us a full release to make sure we were happy with the various interfaces.

This is broken as previously listed qdev properties disappeared.

Quoted 9 lines
Quoted 6 lines

The latter assumes all properties are strings, the
former generate the full set of types - and add_legacy obviously an inconsistent one, dependent on the existence of print/parse handlers. I fail to see the right direction, ie. where to fix this. Can you provide a hint?

Is there a reason you're using info qtree instead of qom-list? qom-list gives you much more info than info qtree.

I'm using the monitor.

Jan

#10 lore raw
Quoted 17 lines · Jan Kiszka
Quoted 16 lines · Anthony Liguori
Quoted 4 lines · Jan Kiszka

Hi Anthony,

I noticed that only properties with legacy names are printed via info qtree.

Yes. Is that not what you expect?

The qom properties and model is not stable for 1.1 so I was very careful in making sure they didn't leak into info qtree.

Quoted 4 lines

After digging through the qdev and qom property maze, it turned out the property registration in qdev_property_add_legacy and qdev_property_add_static is not consistent with the access in qdev_print_props.

Quoted 7 lines
Quoted 5 lines

qdev_print_props will completely die for 1.2 as will almost everything related to the human monitor in qdev-monitor.c.

I just wanted to give us a full release to make sure we were happy with the various interfaces.

This is broken as previously listed qdev properties disappeared.

Yes, I misunderstood "legacy" names to include static properties too. You meant non-legacy static properties are broken.

Pure qom properties are not displayed and never were displayed.

Regards,

Anthony Liguori

Quoted 14 lines
Quoted 10 lines
Quoted 7 lines

The latter assumes all properties are strings, the
former generate the full set of types - and add_legacy obviously an inconsistent one, dependent on the existence of print/parse handlers. I fail to see the right direction, ie. where to fix this. Can you provide a hint?

Is there a reason you're using info qtree instead of qom-list? qom-list gives you much more info than info qtree.

I'm using the monitor.

Jan

author
#11 lore raw
Quoted 21 lines · Anthony Liguori
Quoted 20 lines · Jan Kiszka
Quoted 19 lines · Anthony Liguori
Quoted 4 lines · Jan Kiszka

Hi Anthony,

I noticed that only properties with legacy names are printed via info qtree.

Yes. Is that not what you expect?

The qom properties and model is not stable for 1.1 so I was very careful in making sure they didn't leak into info qtree.

Quoted 4 lines

After digging through the qdev and qom property maze, it turned out the property registration in qdev_property_add_legacy and qdev_property_add_static is not consistent with the access in qdev_print_props.

qdev_print_props will completely die for 1.2 as will almost everything related to the human monitor in qdev-monitor.c.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

I just wanted to give us a full release to make sure we were happy with the various interfaces.

This is broken as previously listed qdev properties disappeared.

Yes, I misunderstood "legacy" names to include static properties too. You meant non-legacy static properties are broken.

Precisely. They are no longer listed.

Quoted 2 lines

Pure qom properties are not displayed and never were displayed.

Yes, I'm interested in those properties I can set on VM creation.

Jan

author
#12 lore raw
In reply to Anthony Liguori
Quoted 2 lines · Anthony Liguori

Is there a reason you're using info qtree instead of qom-list? qom-list gives you much more info than info qtree.

BTW, the qom-list output is still, well, sparsely populated. Also, there is a "-r" (for recursive) switch missing to make it similar useful one day. And we will likely need a few pretty-printing controls.

Jan

#3 lore raw
In reply to Paolo Bonzini
Quoted 10 lines · Paolo Bonzini
hw/qdev-monitor.c +1 -1
index a310cc7..923519c 100644
@@ -157,7 +157,7 @@ int qdev_device_help(QemuOpts *opts)
          * for removal.  This conditional should be removed along with
          * it.
          */
-        if (!prop->info->parse) {
+        if (!prop->info->get) {
Quoted 2 lines

            continue;           /* no way to set it, don't show */ }

This looks really weird: there's no "get" method so we conclude "no way to *set* it" ?? Is the comment wrong?

-- PMM

#13 lore raw
In reply to Jan Kiszka
Quoted 7 lines · Jan Kiszka
Quoted 2 lines · Anthony Liguori

Is there a reason you're using info qtree instead of qom-list? qom-list gives you much more info than info qtree.

BTW, the qom-list output is still, well, sparsely populated. Also, there is a "-r" (for recursive) switch missing to make it similar useful one day. And we will likely need a few pretty-printing controls.

Yes, I'd like to move this all into the monitor too FWIW for 1.2.

Regards,

Anthony Liguori

Quoted 3 lines

Jan

#4 lore raw
In reply to Peter Maydell

Il 02/04/2012 22:07, Peter Maydell ha scritto:

Quoted 8 lines · Paolo Bonzini
Quoted 7 lines
hw/qdev-monitor.c +0 -0
index a310cc7..923519c 100644
@@ -157,7 +157,7 @@ int qdev_device_help(QemuOpts *opts)
         * for removal.  This conditional should be removed along with
         * it.
Quoted 8 lines

hw/qdev-monitor.c int qdev_device_help(QemuOpts *opts) · line 162

Quoted 5 lines
hw/qdev-monitor.c +1 -1
         */
-        if (!prop->info->parse) {
+        if (!prop->info->get) {
            continue;           /* no way to set it, don't show */
        }

This looks really weird: there's no "get" method so we conclude "no way to *set* it" ?? Is the comment wrong?

See the comment above.

Paolo

#5 lore raw
Quoted 18 lines · Paolo Bonzini

Il 02/04/2012 22:07, Peter Maydell ha scritto:

Quoted 8 lines · Paolo Bonzini
Quoted 7 lines
hw/qdev-monitor.c +0 -0
index a310cc7..923519c 100644
@@ -157,7 +157,7 @@ int qdev_device_help(QemuOpts *opts)
          * for removal.  This conditional should be removed along with
          * it.
Quoted 8 lines
Quoted 5 lines
hw/qdev-monitor.c +1 -1
          */
-        if (!prop->info->parse) {
+        if (!prop->info->get) {

            continue;           /* no way to set it, don't show */ }

This looks really weird: there's no "get" method so we conclude "no way to *set* it" ?? Is the comment wrong?

Quoted 1 line

See the comment above.

You mean
/*
* TODO Properties without a parser are just for dirty hacks.
* qdev_prop_ptr is the only such PropertyInfo. It's marked
* for removal. This conditional should be removed along with
* it.
*/
?

That also looks odd now because we're no longer testing whether the property has a parser... (plus doesn't qdev_prop_vlan also have no parser ?)

-- PMM

author
#7 lore raw
In reply to Paolo Bonzini
Quoted 14 lines · Paolo Bonzini
hw/qdev-monitor.c +1 -1
index a310cc7..923519c 100644
@@ -157,7 +157,7 @@ int qdev_device_help(QemuOpts *opts)
          * for removal.  This conditional should be removed along with
          * it.
          */
-        if (!prop->info->parse) {
+        if (!prop->info->get) {
             continue;           /* no way to set it, don't show */
         }
         error_printf("%s.%s=%s\n", driver, prop->name,

hw/qdev-monitor.c int qdev_device_help(QemuOpts *opts) · line 171

Quoted 8 lines
hw/qdev-monitor.c +1 -1
@@ -165,7 +165,7 @@ int qdev_device_help(QemuOpts *opts)
     }
     if (info->bus_info) {
         for (prop = info->bus_info->props; prop && prop->name; prop++) {
-            if (!prop->info->parse) {
+            if (!prop->info->get) {
                 continue;           /* no way to set it, don't show */
             }
             error_printf("%s.%s=%s\n", driver, prop->name,

[ missed this as CCs were dropped ]

This fixes the -device foo,?, but not the issue I'm seeing. Non-legacy properties are still not printed in info qtree - which is no surprise given the inconsistency I pointed out.

Jan

#6 lore raw
In reply to Peter Maydell

Il 03/04/2012 00:27, Peter Maydell ha scritto:

Quoted 30 lines · Paolo Bonzini
Quoted 18 lines

Il 02/04/2012 22:07, Peter Maydell ha scritto:

Quoted 8 lines · Paolo Bonzini
Quoted 7 lines
hw/qdev-monitor.c +0 -0
index a310cc7..923519c 100644
@@ -157,7 +157,7 @@ int qdev_device_help(QemuOpts *opts)
         * for removal.  This conditional should be removed along with
         * it.
Quoted 8 lines

hw/qdev-monitor.c int qdev_device_help(QemuOpts *opts) · line 162

Quoted 5 lines
hw/qdev-monitor.c +1 -1
         */
-        if (!prop->info->parse) {
+        if (!prop->info->get) {
            continue;           /* no way to set it, don't show */
        }

This looks really weird: there's no "get" method so we conclude "no way to *set* it" ?? Is the comment wrong?

Quoted 1 line

See the comment above.

You mean
/*
* TODO Properties without a parser are just for dirty hacks.
* qdev_prop_ptr is the only such PropertyInfo. It's marked
* for removal. This conditional should be removed along with
* it.
*/
?

Quoted 3 lines

That also looks odd now because we're no longer testing whether the property has a parser... (plus doesn't qdev_prop_vlan also have no parser ?)

Oops... parse is set, print is get. It was too late...

Paolo