[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v3 3/6] libxl: introduce MSR data in libxl_cpuid_policy


  • To: Anthony PERARD <anthony.perard@xxxxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Tue, 25 Jul 2023 10:55:01 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=6VHiboYJH7PGBirLkgaxzMQSUIp5GNznCnvhD78UPtU=; b=cHS6DBZ4mVGVOe4DTzXZapO4DhdtcrhXQOPUPfEfiwvBZRcit9SRUuPOtDOjAFJt7/KZETGZLZfavrqlRoRyhLEopXOGRdIoqWbGkLykiOmsmCfKKIHH/RktaCp0ZlLuHQG6fMvSxzrEFNjJTKfAQBkJUjcKWUVRjst4zhOfYoJYuV6q0ZIWpb6LR5wezylz/DcL3X6VgfVgqU25HwsBSot89/fBNJlj1DBNasyHCAXvMjt+M0gm8SKjEpH0X/Ggr7qbtqGVh5qqyxOc82aDmNrFSpY3CCsY8kPy6ZpTdgaJmilYLXnaIOjIfEMTzYg6m1Z3qI10biQoDKDIFTjagw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RUfEWuStQz0E5f0BvUI+JdYdmpQ6ijfkLzj7XflszIB01f0z7QDBFibt3GbPe+tlCYdnAwEMsLf8N5wZqZBurX9yr6OsS3T2RHtKglQwEwbqM09yjtcNidnGN5ULpKa0mhHHy09kLVqwz2r2qerO1U1GdzQ0pZic5UEdABvquMVbjr3ajZTebS9sN0GNhACri8S5KAp9RTqoSUQUpLNQPaaew7raPlaDVIXBmKLXvuCP0T/aeNeIARbJ4Hkvitg1KIuhqNLqYVxn6fR6G3qiFWDZX/vdhxi7kOs0lrKm+e34l5t4z2U0KMk5oZc6QTjeZKFp3Uc7FXef6v8+ybSClQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: xen-devel@xxxxxxxxxxxxxxxxxxxx, Wei Liu <wl@xxxxxxx>, Juergen Gross <jgross@xxxxxxxx>
  • Delivery-date: Tue, 25 Jul 2023 08:55:21 +0000
  • Ironport-data: A9a23:Ox9926JeRjYbbDYxFE+R9ZQlxSXFcZb7ZxGr2PjKsXjdYENShjdTn WJOW2jTM6qKMTDxe9h/PIi0oUtS7MXTmNdmGQZlqX01Q3x08seUXt7xwmUcnc+xBpaaEB84t ZV2hv3odp1coqr0/0/1WlTZhSAgk/rOHvykU7Ss1hlZHWdMUD0mhQ9oh9k3i4tphcnRKw6Ws Jb5rta31GWNglaYCUpKrfrawP9TlK6q4mhA4QZjPakjUGL2zBH5MrpOfcldEFOgKmVkNrbSb /rOyri/4lTY838FYj9yuu+mGqGiaue60Tmm0hK6aYD76vRxjnVaPpIAHOgdcS9qZwChxLid/ jnvWauYEm/FNoWU8AgUvoIx/ytWZcWq85efSZSzXFD6I+QrvBIAzt03ZHzaM7H09c5eJ0hC8 +YjOAsqSU+GuMec0Oq4d8lz05FLwMnDZOvzu1lG5BSAVbMMZ8+GRK/Ho9hFwD03m8ZCW+7EY NYUYiZuaxKGZABTPlAQC9Q1m+LAanvXKmUE7g7K4/VvpTGLlmSd05C0WDbRUsaNSshP2F6Ru 0rN/njjAwFcP9uaodaA2iv12bWXzHurBer+EpWGqq5vn2aC/lc8SzgMXHGXmP2V1VSXDoc3x 0s8v3BGQbIJ3FymSJzxUgO1pFaAvwUAQJxAHusi8gaPx6HIpQGDCQAsUTppeNEg8sgsSlQC1 FCTmMjyLSdyq7DTQnWYnop4thu3MCkRaGUEOikNSFJd58G5+dlpyBXSUtxkDai5yMXvHi39y CyLqy54gKgPickM1OOw+lWvby+Qm6UlhzUdvm3/Nl9JJCsiDGJ5T+REMWTm0Ms=
  • Ironport-hdrordr: A9a23:jk/K66HePF/WM3rZpLqFiZLXdLJyesId70hD6qkvc3Fom52j/f xGws5x6faVslkssb8b6LW90Y27MAvhHP9OkPAs1NKZMDUO11HJEGgP1/qA/9SkIVyEygc/79 YdT0EdMqyWMbESt6+TjmiF+pQbsb+6GciT9JrjJhxWPGVXgs9bnmVE4lHxKDwNeOAKP+tOKH LajfA31waISDAyVICWF3MFV+/Mq5nik4/nWwcPA1oK+RSDljSh7Z/9Cly90g0FWz1C7L8++S yd+jaJrJmLgrWe8FvxxmXT55NZlJ/IzcZCPtWFjow4OyjhkQGhYaVmQvmnsCouqO+ixV42mJ 3nogsmPe5093TNF1vF6ifF6k3F6nID+nXiwViXjT/KptH4fiszD45kiZhCehXUxkI8tJUkuZ g7l16xht5yN1ftjS7979/HW1VDkVe1m2Mrlao2g2ZEWYUTRbdNpcg0/V9TEr0HACXmgbpXWd VGPYX53rJ7YFmaZ3fWsi1Gx8GtZG06GlO8Tk0LqqWuok1rtUE863Fd6N0Un38G+p54YYJD/f 74PqNhk6wLZtMKbIpmbd1xD/efOyjoe1bhIWiSKVPoGOUsIHTWsaP6570z+aWDZIEI9p0vg5 7MOWko+lLaQ3ieSfFm4ac7sSwkGA6GLHbQI4BlltREU4THNfvW2XbpciFqryOiy89vcPEzFc zDfK6+OMWTXFcGKbw5oDEWZKMiV0X2cPdlzurTCGj+1f7jG8nNitHxVsr1Cf7ELQsEM1mPcU frGgKDafl90g==
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Mon, Jul 24, 2023 at 06:26:42PM +0100, Anthony PERARD wrote:
> On Thu, Jul 20, 2023 at 10:25:37AM +0200, Roger Pau Monne wrote:
> > ---
> > It would be nice to rename the json output field to 'cpu_policy'
> > instead of 'cpuid', so that it looks like:
> > 
> > "cpu_policy": {
> >     "cpuid": [
> >         {
> >             "leaf": 7,
> >             "subleaf": 0,
> >             "edx": "xx1xxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
> >         },
> >         {
> >             "leaf": 1,
> >             "ebx": "xxxxxxxxxxxxxxxx00010000xxxxxxxx"
> >         }
> >         }
> >         }
> >     ],
> >     "msr": [
> >         {
> >             "index": 266,
> >             "policy": 
> > "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx1xx1x1"
> >         }
> >     ]
> > },
> > 
> > Sadly I have no idea how to do that, and can be done in a followup
> > change anyway.
> 
> I don't think that would be possible. I think that would mean renaming
> the field in "struct libxl_domain_build_info", and changing a fields
> name seems complicated.

I did wonder whether it would be possible to change the json field
name without changing the libxl_domain_build_info field name, but that
would need a lot of special casing AFAICT.

> > diff --git a/tools/libs/light/libxl_cpuid.c b/tools/libs/light/libxl_cpuid.c
> > index 3c8b2a72c0b8..68b797886642 100644
> > --- a/tools/libs/light/libxl_cpuid.c
> > +++ b/tools/libs/light/libxl_cpuid.c
> > @@ -592,17 +641,24 @@ int libxl__cpuid_policy_list_parse_json(libxl__gc *gc,
> >  {
> >      int i, size;
> >      struct xc_xend_cpuid *l;
> > +    struct xc_msr *msr;
> > +    const libxl__json_object *co;
> >      flexarray_t *array;
> >  
> > -    if (!libxl__json_object_is_array(o))
> > +    if (!libxl__json_object_is_map(o))
> >          return ERROR_FAIL;
> 
> We still need to be able to migrate a VM from a previous release of Xen,
> and we are going to have an array instead of a map. Could you try to
> handle both the old and new format of "cpuid"? If we don't then the
> scenario "migrate then reboot" is going to fail to use the expected cpu
> policy.
> 
> > diff --git a/tools/libs/light/libxl_types.idl 
> > b/tools/libs/light/libxl_types.idl
> > index 9e48bb772646..887824fdd828 100644
> > --- a/tools/libs/light/libxl_types.idl
> > +++ b/tools/libs/light/libxl_types.idl
> > @@ -19,7 +19,7 @@ libxl_mac = Builtin("mac", json_parse_type="JSON_STRING", 
> > passby=PASS_BY_REFEREN
> >  libxl_bitmap = Builtin("bitmap", json_parse_type="JSON_ARRAY", 
> > dispose_fn="libxl_bitmap_dispose", passby=PASS_BY_REFERENCE,
> >                         check_default_fn="libxl_bitmap_is_empty", 
> > copy_fn="libxl_bitmap_copy_alloc")
> >  libxl_cpuid_policy_list = Builtin("cpuid_policy_list", 
> > dispose_fn="libxl_cpuid_dispose", passby=PASS_BY_REFERENCE,
> > -                                  json_parse_type="JSON_ARRAY", 
> > check_default_fn="libxl__cpuid_policy_is_empty",
> > +                                  json_parse_type="JSON_MAP", 
> > check_default_fn="libxl__cpuid_policy_is_empty",
> 
> Maybe we should have json_parse_type as either "JSON_ARRAY | JSON_MAP"
> or just "JSON_ANY" since nothing beside libxl is supposed to do
> something with it, and when migrating from a previous version, we are
> going to have an array.

Yeah, we need to use JSON_ANY and then guess the version by whether
the object is an array or a map.

That should be easy to arrange, let me prepare v4.

Thanks, Roger.



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.