mbox series

[v20210616,00/36] leftover from 2020

Message ID 20210616125129.26563-1-olaf@aepfle.de (mailing list archive)
Headers show
Series leftover from 2020 | expand

Message

Olaf Hering June 16, 2021, 12:50 p.m. UTC
Various unreviewed changes, rebase to 4bcf6433ee.

Olaf Hering (36):
  hotplug/Linux: fix starting of xenstored with restarting systemd
  tools: add API to work with sevaral bits at once
  xl: fix description of migrate --debug
  tools: create libxensaverestore
  MAINTAINERS: add myself as saverestore maintainer
  tools: add readv_exact to libxenctrl
  tools: add sr_is_known_page_type to libsaverestore
  tools: use sr_is_known_page_type
  tools: unify type checking for data pfns in migration stream
  tools: show migration transfer rate in send_dirty_pages
  tools: prepare to allocate saverestore arrays once
  tools: save: move mfns array
  tools: save: move types array
  tools: save: move errors array
  tools: save: move iov array
  tools: save: move rec_pfns array
  tools: save: move guest_data array
  tools: save: move local_pages array
  tools: restore: move types array
  tools: restore: move mfns array
  tools: restore: move map_errs array
  tools: restore: move mfns array in populate_pfns
  tools: restore: move pfns array in populate_pfns
  tools: restore: split record processing
  tools: restore: split handle_page_data
  tools: restore: write data directly into guest
  tools: recognize LIBXL_API_VERSION for 4.16
  tools: adjust libxl_domain_suspend to receive a struct props
  tools: change struct precopy_stats to precopy_stats_t
  tools: add callback to libxl for precopy_policy and precopy_stats_t
  tools: add --max_iters to libxl_domain_suspend
  tools: add --min_remaining to libxl_domain_suspend
  tools: add --abort_if_busy to libxl_domain_suspend
  tools: add API for expandable bitmaps
  tools: use sr_bitmap for populated_pfns
  tools: use superpages during restore of HVM guest

 .gitignore                                    |   2 +
 MAINTAINERS                                   |   6 +
 docs/man/xl.1.pod.in                          |  22 +-
 tools/hotplug/Linux/init.d/xencommons.in      |   2 +-
 tools/hotplug/Linux/launch-xenstore.in        |  40 +-
 .../Linux/systemd/xenstored.service.in        |   2 +-
 tools/include/libxl.h                         |  32 +-
 tools/include/xenguest.h                      | 186 -----
 tools/include/xensaverestore.h                | 207 ++++++
 tools/libs/Makefile                           |   1 +
 tools/libs/ctrl/xc_bitops.h                   |  28 +
 tools/libs/ctrl/xc_private.c                  |  57 +-
 tools/libs/ctrl/xc_private.h                  |   1 +
 tools/libs/guest/Makefile                     |  11 -
 tools/libs/guest/xg_dom_x86.c                 |   5 -
 tools/libs/guest/xg_offline_page.c            |   1 -
 tools/libs/guest/xg_private.h                 |   5 +
 tools/libs/guest/xg_sr_restore_x86_hvm.c      | 274 --------
 tools/libs/light/Makefile                     |   4 +-
 tools/libs/light/libxl_dom_save.c             |  24 +
 tools/libs/light/libxl_domain.c               |  10 +-
 tools/libs/light/libxl_internal.h             |   7 +
 tools/libs/light/libxl_save_helper.c          |   1 +
 tools/libs/light/libxl_save_msgs_gen.pl       |   5 +-
 tools/libs/light/libxl_stream_write.c         |   9 +-
 tools/libs/light/libxl_types.idl              |   1 +
 tools/libs/saverestore/Makefile               |  38 ++
 .../xg_sr_common.c => saverestore/common.c}   |  76 ++-
 .../xg_sr_common.h => saverestore/common.h}   | 253 ++++++-
 .../common_x86.c}                             |   2 +-
 .../common_x86.h}                             |   2 +-
 .../common_x86_pv.c}                          |   2 +-
 .../common_x86_pv.h}                          |   2 +-
 .../nomigrate.c}                              |   0
 .../xg_sr_restore.c => saverestore/restore.c} | 617 +++++++++--------
 tools/libs/saverestore/restore_x86_hvm.c      | 645 ++++++++++++++++++
 .../restore_x86_pv.c}                         |  70 +-
 .../xg_sr_save.c => saverestore/save.c}       | 165 ++---
 .../save_restore.h}                           |   2 -
 .../save_x86_hvm.c}                           |   7 +-
 .../save_x86_pv.c}                            |  33 +-
 .../stream_format.h}                          |   0
 tools/libs/uselibs.mk                         |   4 +-
 tools/ocaml/libs/xl/xenlight_stubs.c          |   3 +-
 tools/xl/xl_cmdtable.c                        |  26 +-
 tools/xl/xl_migrate.c                         |  54 +-
 tools/xl/xl_saverestore.c                     |   3 +-
 47 files changed, 2006 insertions(+), 941 deletions(-)
 create mode 100644 tools/include/xensaverestore.h
 delete mode 100644 tools/libs/guest/xg_sr_restore_x86_hvm.c
 create mode 100644 tools/libs/saverestore/Makefile
 rename tools/libs/{guest/xg_sr_common.c => saverestore/common.c} (72%)
 rename tools/libs/{guest/xg_sr_common.h => saverestore/common.h} (68%)
 rename tools/libs/{guest/xg_sr_common_x86.c => saverestore/common_x86.c} (99%)
 rename tools/libs/{guest/xg_sr_common_x86.h => saverestore/common_x86.h} (98%)
 rename tools/libs/{guest/xg_sr_common_x86_pv.c => saverestore/common_x86_pv.c} (99%)
 rename tools/libs/{guest/xg_sr_common_x86_pv.h => saverestore/common_x86_pv.h} (98%)
 rename tools/libs/{guest/xg_nomigrate.c => saverestore/nomigrate.c} (100%)
 rename tools/libs/{guest/xg_sr_restore.c => saverestore/restore.c} (66%)
 create mode 100644 tools/libs/saverestore/restore_x86_hvm.c
 rename tools/libs/{guest/xg_sr_restore_x86_pv.c => saverestore/restore_x86_pv.c} (94%)
 rename tools/libs/{guest/xg_sr_save.c => saverestore/save.c} (88%)
 rename tools/libs/{guest/xg_save_restore.h => saverestore/save_restore.h} (98%)
 rename tools/libs/{guest/xg_sr_save_x86_hvm.c => saverestore/save_x86_hvm.c} (96%)
 rename tools/libs/{guest/xg_sr_save_x86_pv.c => saverestore/save_x86_pv.c} (97%)
 rename tools/libs/{guest/xg_sr_stream_format.h => saverestore/stream_format.h} (100%)

Comments

Andrew Cooper June 16, 2021, 2:50 p.m. UTC | #1
On 16/06/2021 13:50, Olaf Hering wrote:
> Various unreviewed changes, rebase to 4bcf6433ee.

General CI run:
https://gitlab.com/xen-project/patchew/xen/-/pipelines/322032419

Some specific failures.
https://gitlab.com/xen-project/patchew/xen/-/jobs/1351977567 (32bit
toolstack build):

common.c: In function '_sr_bitmap_expand':
common.c:187:9: error: right shift count >= width of type [-Werror]
         new_max |= new_max >> 32;
         ^


https://gitlab.com/xen-project/patchew/xen/-/jobs/1351977708 (arm64)

nomigrate.c:25:20: error: unknown type name 'xc_stream_type_t'
   25 |                    xc_stream_type_t stream_type, int recv_fd)
      |                    ^~~~~~~~~~~~~~~~


I haven't looked through all the failures in the general run, but be
aware that there might still be some clang fallout in dom0_build.c in
Xen, and PV32 fallout for the smoke tests, which won't be from your series.

~Andrew
Olaf Hering June 16, 2021, 3:02 p.m. UTC | #2
Am Wed, 16 Jun 2021 15:50:24 +0100
schrieb Andrew Cooper <andrew.cooper3@citrix.com>:

>          new_max |= new_max >> 32;

Lazy compiler? I hoped this is a compile-time constant, which evaluates to zero in 32bit builds.

    if ( sizeof(unsigned long) > 4 )                                            

I guess a #ifdef as it is done in old code must be done.

Olaf
Olaf Hering June 16, 2021, 3:38 p.m. UTC | #3
Am Wed, 16 Jun 2021 15:50:24 +0100
schrieb Andrew Cooper <andrew.cooper3@citrix.com>:

> 32bit toolstack build

as in i386?
How is this used in practice?
I guess such build should be marked as CONFIG_MIGRATE=n in config/x86_32.mk?

Olaf
Julien Grall June 17, 2021, 11:02 a.m. UTC | #4
Hi Olaf,

On 16/06/2021 17:02, Olaf Hering wrote:
> Am Wed, 16 Jun 2021 15:50:24 +0100
> schrieb Andrew Cooper <andrew.cooper3@citrix.com>:
> 
>>           new_max |= new_max >> 32;
> 
> Lazy compiler? I hoped this is a compile-time constant, which evaluates to zero in 32bit builds.

See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=4210, this seems to be 
a known issue on GCC.

> 
>      if ( sizeof(unsigned long) > 4 )
> 
> I guess a #ifdef as it is done in old code must be done.
> 
> Olaf
> 

Cheers,
Andrew Cooper June 17, 2021, 11:24 a.m. UTC | #5
On 16/06/2021 16:38, Olaf Hering wrote:
> Am Wed, 16 Jun 2021 15:50:24 +0100
> schrieb Andrew Cooper <andrew.cooper3@citrix.com>:
>
>> 32bit toolstack build
> as in i386?
> How is this used in practice?

Every OSSTest run.  Also, arm32 is absolutely a thing (the only reason
ARM can't migrate right now is because there is no logdirty support in
Xen yet).

> I guess such build should be marked as CONFIG_MIGRATE=n in config/x86_32.mk?

Migration (v2) very definitely works for i386 toolstacks. Part of the
testing process during development was migrating a VM between a 32bit
and 64bit dom0's, specifically to check that we'd got rid of all of the
bitness problems in the stream format.

~Andrew
Olaf Hering June 17, 2021, 2:55 p.m. UTC | #6
Am Thu, 17 Jun 2021 12:24:22 +0100
schrieb Andrew Cooper <andrew.cooper3@citrix.com>:

> On 16/06/2021 16:38, Olaf Hering wrote:
> > Am Wed, 16 Jun 2021 15:50:24 +0100
> > schrieb Andrew Cooper <andrew.cooper3@citrix.com>:
> >  
> >> 32bit toolstack build  
> > as in i386?
> > How is this used in practice?  
> Every OSSTest run.

This is not what I mean.
I think there is a 32bit xen-tools, a 32bit dom0 kernel and a 64bit Xen?
Is 32bit xen-tools, 64bit dom0 kernel and 64bit Xen expected to work?

Olaf
Andrew Cooper June 17, 2021, 3:05 p.m. UTC | #7
On 17/06/2021 15:55, Olaf Hering wrote:
> Am Thu, 17 Jun 2021 12:24:22 +0100
> schrieb Andrew Cooper <andrew.cooper3@citrix.com>:
>
>> On 16/06/2021 16:38, Olaf Hering wrote:
>>> Am Wed, 16 Jun 2021 15:50:24 +0100
>>> schrieb Andrew Cooper <andrew.cooper3@citrix.com>:
>>>  
>>>> 32bit toolstack build  
>>> as in i386?
>>> How is this used in practice?  
>> Every OSSTest run.
> This is not what I mean.
> I think there is a 32bit xen-tools, a 32bit dom0 kernel and a 64bit Xen?

Yes - this exists.

> Is 32bit xen-tools, 64bit dom0 kernel and 64bit Xen expected to work?

In an ideal world, yes.  In reality, no.

Lots of hypercalls have embedded pointers (every GUEST_HANDLE(), to a
first approximation), and dom0's ABI with Xen is 64bit, which is not the
ABI that 32bit userspace speaks.

This is one of many errors in the hypercall design intending to be
addressed by the ABIv2 plans.

~Andrew
Olaf Hering June 17, 2021, 5:40 p.m. UTC | #8
Am Thu, 17 Jun 2021 13:02:39 +0200
schrieb Julien Grall <julien@xen.org>:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=4210

Thanks, comments in this bug suggest a workaround like this:

    new_max |= sizeof(unsigned long) > 4 ? new_max >> 32 : 0;

This triggers no warning.

Olaf