Fix fallout from DOMID_ANY ABI breakage
PATCH v2 1/1 Fix fallout from DOMID_ANY ABI breakage
Commit 23e2479ff9de ("xen/domain: introduce DOMID_ANY") broke at least:
* xenstored domains
* The Python bindings
* The Ocaml bindings (i.e XAPI, and therefore XenServer/XCP-ng)
by causing Xen to reject 0 (the wildcard sentinel since the start of Xen) and DOMID_INVALID (since 4.21) without adjusting the callers of xc_domain_create().
Under other circumstances I'd revert, but xenstored has gained a dependent use of DOMID_ANY.
Fix up the remaining in-tree callers of xc_domain_create(), which covers init-xenstore-domain and the python bindings.
The Ocaml C bindings, like libxc itself, expose this ABI detail to their caller, but in this case the caller is still internal to the bindings as a whole. Adjust the default value in the internal transformation, adding domid_any for legibility.
Leave a very clear message in CHANGELOG.md that all external callers need altering.
---
CC: Anthony PERARD <[email protected]>
CC: Michal Orzel <[email protected]>
CC: Jan Beulich <[email protected]>
CC: Julien Grall <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Juergen Gross <[email protected]>
CC: Denis Mukhin <[email protected]>
CC: Oleksii Kurochko <[email protected]>
CC: Marek Marczykowski-Górecki <[email protected]>
CC: Pau Ruiz Safont <[email protected]>
CC: Colin James <[email protected]>
v2:
* Include XEN_DOMCTL_createdomain in CHANGELOG message too
* Fix the Ocaml stubs too.
There are now 0 Ocaml maintainers. Pau and Colin reviewed my suggestion on the Xapi Matrix channel.
--- CHANGELOG.md | 4 ++++ tools/helpers/init-xenstore-domain.c | 2 +- tools/ocaml/libs/xc/xenctrl.ml | 4 +++- tools/python/xen/lowlevel/xc/xc.c | 2 +- 4 files changed, 9 insertions(+), 3 deletions(-)
CHANGELOG.md +4 -0
@@ -7,6 +7,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) ## [4.22.0 UNRELEASED](https://xenbits.xenproject.org/gitweb/?p=xen.git;a=shortlog;h=staging) - TBD ### Changed + - Users of XEN_DOMCTL_createdomain/xc_domain_create() must now pass DOMID_ANY + to obtain an automatically allocated domid. The prior sentinel values (0 + since the start of Xen, and DOMID_INVALID since Xen 4.21) now no longer + represent a wildcard input. - On x86: - Enable pf-fixup option by default for PVH dom0.
tools/helpers/init-xenstore-domain.c +1 -1
@@ -21,7 +21,7 @@#define LAPIC_BASE_ADDRESS 0xfee00000UL -static uint32_t domid = ~0 ; +static uint32_t domid =DOMID_ANY ;static char *kernel;static char *ramdisk;static char *flask;
tools/ocaml/libs/xc/xenctrl.ml +3 -1
@@ -208,7 +208,9 @@ let with_intf f = external domain_create_stub: handle -> domid -> domctl_create_config -> domid = "stub_xc_domain_create" -let domain_create handle ?(domid=0) config = +let domid_any = 0x7ff5 (* DOMID_ANY from public/xen.h *) + +let domain_create handle ?(domid=domid_any) config = domain_create_stub handle domid config external domain_sethandle: handle -> domid -> string -> unit
tools/python/xen/lowlevel/xc/xc.c +1 -1
@@ -118,7 +118,7 @@ static PyObject *pyxc_domain_create(XcObject *self, PyObject *args, PyObject *kwds) { -uint32_t dom =0 , target =0 , max_grant_version =2 ; +uint32_t dom =DOMID_ANY , target =0 , max_grant_version =2 ;int ret;size_t i;PyObject *pyhandle =NULL ;
base-commit: e63ba93511b33c0d3bb8cc5870f946f41e1d2655
Signature · 1 line
2.39.5
Quoted 37 lines · Andrew Cooper
--- CHANGELOG.md | 4 ++++ tools/helpers/init-xenstore-domain.c | 2 +- tools/ocaml/libs/xc/xenctrl.ml | 4 +++- tools/python/xen/lowlevel/xc/xc.c | 2 +- 4 files changed, 9 insertions(+), 3 deletions(-)CHANGELOG.md +4
-0@@ -7,6 +7,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) ## [4.22.0 UNRELEASED](https://xenbits.xenproject.org/gitweb/?p=xen.git;a=shortlog;h=staging) - TBD ### Changed + - Users of XEN_DOMCTL_createdomain/xc_domain_create() must now pass DOMID_ANY + to obtain an automatically allocated domid. The prior sentinel values (0 + since the start of Xen, and DOMID_INVALID since Xen 4.21) now no longer + represent a wildcard input. - On x86: - Enable pf-fixup option by default for PVH dom0.tools/ocaml/libs/xc/xenctrl.ml +3
-1@@ -208,7 +208,9 @@ let with_intf f = external domain_create_stub: handle -> domid -> domctl_create_config -> domid = "stub_xc_domain_create" -let domain_create handle ?(domid=0) config = +let domid_any = 0x7ff5 (* DOMID_ANY from public/xen.h *) + +let domain_create handle ?(domid=domid_any) config = domain_create_stub handle domid config external domain_sethandle: handle -> domid -> string -> unit
Quoted 1 line
base-commit:
e63ba93511b33c0d3bb8cc5870f946f41e1d2655
Regards,
Pau
--
Pau Ruiz Safont | Vates XAPI Developer
XCP-ng & Xen Orchestra - Vates solutions
web: https://vates.tech
Quoted 37 lines · Pau Ruiz Safont
Quoted 36 lines · Andrew Cooper
--- CHANGELOG.md | 4 ++++ tools/helpers/init-xenstore-domain.c | 2 +- tools/ocaml/libs/xc/xenctrl.ml | 4 +++- tools/python/xen/lowlevel/xc/xc.c | 2 +- 4 files changed, 9 insertions(+), 3 deletions(-)CHANGELOG.md +4
-0@@ -7,6 +7,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) ## [4.22.0 UNRELEASED](https://xenbits.xenproject.org/gitweb/?p=xen.git;a=shortlog;h=staging) - TBD ### Changed + - Users of XEN_DOMCTL_createdomain/xc_domain_create() must now pass DOMID_ANY + to obtain an automatically allocated domid. The prior sentinel values (0 + since the start of Xen, and DOMID_INVALID since Xen 4.21) now no longer + represent a wildcard input. - On x86: - Enable pf-fixup option by default for PVH dom0.tools/ocaml/libs/xc/xenctrl.ml +3
-1@@ -208,7 +208,9 @@ let with_intf f = external domain_create_stub: handle -> domid -> domctl_create_config -> domid = "stub_xc_domain_create" -let domain_create handle ?(domid=0) config = +let domid_any = 0x7ff5 (* DOMID_ANY from public/xen.h *) + +let domain_create handle ?(domid=domid_any) config = domain_create_stub handle domid config
Quoted 4 lines
Quoted 2 lines
tools/ocaml/libs/xc/xenctrl.ml +0
-0external domain_sethandle: handle -> domid -> string -> unitbase-commit:
e63ba93511b33c0d3bb8cc5870f946f41e1d2655Acked-by Pau Ruiz Safont <[email protected]>
Just FYI: While of course you're free to offer such ack-s, they're largely meaningless unless they come from a maintainer. Non-maintainers can offer (meaningful) Reviewed-by: tags (assuming they indeed did a proper review).
That said, I think I saw in passing that somewhere you were mentioned as a possible future maintainer of the OCaml bindings, yet that still needs formalizing then.
Jan