Skip to contentSkip to conversation

Fix fallout from DOMID_ANY ABI breakage

PATCH Superseded Andrew Cooper 2 participants 3 messages May 27 Arm/actions semi architecture

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 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 for decades) and DOMID_INVALID (a recently introduced wildcard sentinel) 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, which covers init-xenstore-domain and the python bindings. The Ocaml bindings, like libxc itself, expose this ABI detail to their caller, so need fixing individually.

Leave a very clear message in CHANGELOG.md that all external callers need altering.

Fixes 23e2479ff9de ("xen/domain: introduce DOMID_ANY")

---
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]>

Both Roger and I said no to the DOMID_ANY change. We both think that there is still insufficient justification to be adding it as a new constant. Next time it's going to be a straight nack.

---
 CHANGELOG.md                         | 4 ++++
 tools/helpers/init-xenstore-domain.c | 2 +-
 tools/python/xen/lowlevel/xc/xc.c    | 2 +-
 3 files changed, 6 insertions(+), 2 deletions(-)
CHANGELOG.md +4 -0
index 25f5a192ed48..1b54acf912a5 100644
@@ -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 xc_domain_create() must now pass DOMID_ANY to obtain an
+   automatically allocated domid.  The prior sentinel values (0 since the
+   birth 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
index 01ca667d25d1..2be5831a578d 100644
@@ -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/python/xen/lowlevel/xc/xc.c +1 -1
index 9feb12ae2b16..a94f01d40b58 100644
@@ -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
Acked-by on v1 1/1
#1 lore raw
Quoted 10 lines · Andrew Cooper

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 for decades) and DOMID_INVALID (a recently introduced wildcard sentinel) without adjusting the callers of xc_domain_create().

Quoted 6 lines

Under other circumstances I'd revert, but xenstored has gained a dependent use of DOMID_ANY.

Fix up the remaining in-tree callers, which covers init-xenstore-domain and the python bindings. The Ocaml bindings, like libxc itself, expose this ABI detail to their caller, so need fixing individually.

I think this will also affect the rust crate(s), even when those don't use the libxc bindings.

Quoted 6 lines

Leave a very clear message in CHANGELOG.md that all external callers need altering.

Fixes 23e2479ff9de ("xen/domain: introduce DOMID_ANY")
Quoted 25 lines

---
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]>

Both Roger and I said no to the DOMID_ANY change. We both think that there is still insufficient justification to be adding it as a new constant. Next time it's going to be a straight nack.

---
 CHANGELOG.md                         | 4 ++++
 tools/helpers/init-xenstore-domain.c | 2 +-
 tools/python/xen/lowlevel/xc/xc.c    | 2 +-
 3 files changed, 6 insertions(+), 2 deletions(-)
CHANGELOG.md +0 -0
index 25f5a192ed48..1b54acf912a5 100644

CHANGELOG.md The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) · line 13

Quoted 7 lines
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 xc_domain_create() must now pass DOMID_ANY to obtain an
+   automatically allocated domid.  The prior sentinel values (0 since the
+   birth of Xen, and DOMID_INVALID since Xen 4.21) now no longer represent a
+   wildcard input.

Maybe also mention XEN_DOMCTL_createdomain explicitly, to notice is not only the callers of libxc that needs adjustment, but also users of the hypercall itself not going through libxc.

Thanks, Roger.

#2 lore raw
Quoted 20 lines · Roger Pau Monné
Quoted 10 lines · Andrew Cooper

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 for decades) and DOMID_INVALID (a recently introduced wildcard sentinel) without adjusting the callers of xc_domain_create().

Quoted 6 lines

Under other circumstances I'd revert, but xenstored has gained a dependent use of DOMID_ANY.

Fix up the remaining in-tree callers, which covers init-xenstore-domain and the python bindings. The Ocaml bindings, like libxc itself, expose this ABI detail to their caller, so need fixing individually.

I think this will also affect the rust crate(s), even when those don't use the libxc bindings.

Quoted 6 lines
Quoted 5 lines

Leave a very clear message in CHANGELOG.md that all external callers need altering.

Fixes 23e2479ff9de ("xen/domain: introduce DOMID_ANY")

Thanks.

Quoted 28 lines
Quoted 28 lines

---
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]>

Both Roger and I said no to the DOMID_ANY change. We both think that there is still insufficient justification to be adding it as a new constant. Next time it's going to be a straight nack.

---
 CHANGELOG.md                         | 4 ++++
 tools/helpers/init-xenstore-domain.c | 2 +-
 tools/python/xen/lowlevel/xc/xc.c    | 2 +-
 3 files changed, 6 insertions(+), 2 deletions(-)
CHANGELOG.md +0 -0
index 25f5a192ed48..1b54acf912a5 100644
@@ -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
 
Quoted 8 lines

CHANGELOG.md The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) · line 13

Quoted 5 lines
CHANGELOG.md +4 -0
 ### Changed
+ - Users of xc_domain_create() must now pass DOMID_ANY to obtain an
+   automatically allocated domid.  The prior sentinel values (0 since the
+   birth of Xen, and DOMID_INVALID since Xen 4.21) now no longer represent a
+   wildcard input.

Maybe also mention XEN_DOMCTL_createdomain explicitly, to notice is not only the callers of libxc that needs adjustment, but also users of the hypercall itself not going through libxc.

Good point.  I'll adjust to XEN_DOMCTL_createdomain/xc_domain_create() locally.

~Andrew