Skip to contentSkip to conversation

vnuma_nodes missing pnode 0

DISCUSSION Jim Fehlig 4 participants 8 messages Nov 11, 2022 – Nov 14, 2022

lore
Share & tools
lore

Jim Fehlig

author
#0 lore raw

Hi All,

While fixing [1] a recent downstream libvirt build failure against 4.17 rc3, I noticed the json representation of libxl_vnode_info omits pnode when value is 0. The problem can be seen by starting a VM containing the following vnuma config

vnuma = [ [ "pnode=0", "size=2048", "vcpus=0", "vdistances=10,20" ], [ "pnode=1", "size=2048", "vcpus=1", "vdistances=20,10" ] ]

The json representation for this config does not contain pnode 0

               "vnuma_nodes": [
                    {
                        "memkb": 2097152,
                        "distances": [
                            10,
                            20
                        ],
                        "vcpus": [
                            0
                        ]
                    },
                    {
                        "memkb": 2097152,
                        "distances": [
                            20,
                            10
                        ],
                        "pnode": 1,
                        "vcpus": [
                            1
                        ]
                    }
                ],

I'm not familiar with the code generator for the *_to_json functions, but with a hint I can probably cook up a patch :-).

Regards,
Jim

[1] https://listman.redhat.com/archives/libvir-list/2022-November/235745.html

#1 lore raw

(Add x86 maintainers for more visibility)

Hi x86 maintainers,

Since this report might be related with the release, if you have time, please have a look. Thank you very much.

Kind regards,
Henry

Quoted 49 lines

-----Original Message-----
Subject: vnuma_nodes missing pnode 0

Hi All,

While fixing [1] a recent downstream libvirt build failure against 4.17 rc3, I noticed the json representation of libxl_vnode_info omits pnode when value is 0.
The problem can be seen by starting a VM containing the following vnuma config

vnuma = [ [ "pnode=0", "size=2048", "vcpus=0", "vdistances=10,20" ], [ "pnode=1", "size=2048", "vcpus=1", "vdistances=20,10" ] ]

The json representation for this config does not contain pnode 0

                "vnuma_nodes": [
                     {
                         "memkb": 2097152,
                         "distances": [
                             10,
                             20
                         ],
                         "vcpus": [
                             0
                         ]
                     },
                     {
                         "memkb": 2097152,
                         "distances": [
                             20,
                             10
                         ],
                         "pnode": 1,
                         "vcpus": [
                             1
                         ]
                     }
                 ],

I'm not familiar with the code generator for the *_to_json functions, but with a
hint I can probably cook up a patch :-).

Regards,
Jim

[1] https://listman.redhat.com/archives/libvir-list/2022-
November/235745.html

#2 lore raw

Sorry, missed Anthony (The toolstack maintainer). Also added him to this thread.

Quoted 9 lines

(Add x86 maintainers for more visibility)

Hi x86 maintainers,

Since this report might be related with the release, if you have time, please have a look. Thank you very much.

Kind regards,
Henry

#3 lore raw
Quoted 2 lines · Henry Wang

Sorry, missed Anthony (The toolstack maintainer). Also added him to this thread.

Indeed there's nothing x86-ish in here, it's all about data representation. It merely happens to be (for now) x86-specific data which is being dealt with.

Internally I indicated to Jim that the way the code presently is generated it looks to me as if 0 was simply taken as the default for "pnode". What I don't know at all is whether the concept of any kind of default is actually valid in json representation of guest configs.

Jan

Quoted 9 lines
Quoted 9 lines

(Add x86 maintainers for more visibility)

Hi x86 maintainers,

Since this report might be related with the release, if you have time, please have a look. Thank you very much.

Kind regards,
Henry

#4 lore raw

Hi Jan,

Quoted 11 lines

-----Original Message-----
From: Jan Beulich <[email protected]>
Subject: Re: vnuma_nodes missing pnode 0

Quoted 2 lines · Henry Wang

Sorry, missed Anthony (The toolstack maintainer). Also added him to this thread.

Indeed there's nothing x86-ish in here, it's all about data representation. It merely happens to be (for now) x86-specific data which is being dealt with.

Thank you for looking into this issue :)

Quoted 3 lines

Internally I indicated to Jim that the way the code presently is generated it looks to me as if 0 was simply taken as the default for "pnode".

Yeah this also matches my first thought. I also did a git blame and didn't really see some recent commits that change this part of logic.

Quoted 3 lines

What I
don't know at all is whether the concept of any kind of default is actually valid in json representation of guest configs.

Let's see if Anthony has some ideas :)

Kind regards,
Henry

Quoted 12 lines

Jan

Quoted 9 lines
Quoted 9 lines

(Add x86 maintainers for more visibility)

Hi x86 maintainers,

Since this report might be related with the release, if you have time, please have a look. Thank you very much.

Kind regards,
Henry

author
#5 lore raw
In reply to Jan Beulich
Quoted 4 lines · Jan Beulich
Quoted 2 lines · Henry Wang

Sorry, missed Anthony (The toolstack maintainer). Also added him to this thread.

Quoted 8 lines

Indeed there's nothing x86-ish in here, it's all about data representation. It merely happens to be (for now) x86-specific data which is being dealt with.

Internally I indicated to Jim that the way the code presently is generated it looks to me as if 0 was simply taken as the default for "pnode". What I don't know at all is whether the concept of any kind of default is actually valid in json representation of guest configs.

0 is definitely ignored in the generated libxl_vnode_info_gen_json() function, which essentially has

if (p->pnode)
format-json

I took a quick peek at the generator, but being totally unfamiliar could not spot a fix. I'm also not sure how such a fix could be detected for testing purposes by libxl users like libvirt. I.e. how to detect a libxl that emits "pnode:" 0 in the json representation of libxl_domain_config object and one that does not.

Jim

#6 lore raw
Quoted 17 lines · Jim Fehlig
Quoted 4 lines · Jan Beulich
Quoted 2 lines · Henry Wang

Sorry, missed Anthony (The toolstack maintainer). Also added him to this thread.

Quoted 8 lines

Indeed there's nothing x86-ish in here, it's all about data representation. It merely happens to be (for now) x86-specific data which is being dealt with.

Internally I indicated to Jim that the way the code presently is generated it looks to me as if 0 was simply taken as the default for "pnode". What I don't know at all is whether the concept of any kind of default is actually valid in json representation of guest configs.

0 is definitely ignored in the generated libxl_vnode_info_gen_json() function, which essentially has

Quoted 8 lines

if (p->pnode)
format-json

I took a quick peek at the generator, but being totally unfamiliar could not spot a fix. I'm also not sure how such a fix could be detected for testing purposes by libxl users like libvirt. I.e. how to detect a libxl that emits "pnode:" 0 in the json representation of libxl_domain_config object and one that does not.

Well, the missing "pnode: 0' in json isn't exactly a bug, it's been done
on purpose, see https://xenbits.xen.org/gitweb/?p=xen.git;h=731233d64f6a7602c1ca297f7b67ec254

When the JSON is been reloaded into it's original struct, libxl_vnode_info, pnode will have the expected value, that is 0, because libxl_vnode_info_init() would have reset this field to 0.

I don't think it's possible to change the generator to just have it generate '"pnode": 0', as if we make a change, it would have to be for all unsigned it, I think.

Is it actually wanted to have all those in json, or is it just a case of looking like there's missing part?

Also, I don't know if any part of libxl rely of this behavior, that is where default values are omitted from json output.

Thanks,

Signature · 1 line
Anthony PERARD
author
#7 lore raw
Quoted 30 lines · Anthony PERARD
Quoted 17 lines · Jim Fehlig
Quoted 4 lines · Jan Beulich
Quoted 2 lines · Henry Wang

Sorry, missed Anthony (The toolstack maintainer). Also added him to this thread.

Quoted 8 lines

Indeed there's nothing x86-ish in here, it's all about data representation. It merely happens to be (for now) x86-specific data which is being dealt with.

Internally I indicated to Jim that the way the code presently is generated it looks to me as if 0 was simply taken as the default for "pnode". What I don't know at all is whether the concept of any kind of default is actually valid in json representation of guest configs.

0 is definitely ignored in the generated libxl_vnode_info_gen_json() function, which essentially has

Quoted 8 lines

if (p->pnode)
format-json

I took a quick peek at the generator, but being totally unfamiliar could not spot a fix. I'm also not sure how such a fix could be detected for testing purposes by libxl users like libvirt. I.e. how to detect a libxl that emits "pnode:" 0 in the json representation of libxl_domain_config object and one that does not.

Well, the missing "pnode: 0' in json isn't exactly a bug, it's been done
on purpose, see https://xenbits.xen.org/gitweb/?p=xen.git;h=731233d64f6a7602c1ca297f7b67ec254

Quoted 7 lines

When the JSON is been reloaded into it's original struct, libxl_vnode_info, pnode will have the expected value, that is 0, because libxl_vnode_info_init() would have reset this field to 0.

I don't think it's possible to change the generator to just have it generate '"pnode": 0', as if we make a change, it would have to be for all unsigned it, I think.

Which would likely cause lots of libvirt libxlxml2domconfig test failures.

Quoted 2 lines

Is it actually wanted to have all those in json, or is it just a case of looking like there's missing part?

The latter. ATM, libvirt only uses the json in its unit tests. No functionality is affected. I'm fine with the status quo if you are :-).

Thanks,
Jim