It's not acceptable to hide this from the caller; the effect of doing so is to
break an atomicity expectation.

Only the caller can know what the appropriate safety action is in the case
that the claim hypercall isn't available.

Fixes: fc67e9dc0c1f ("xc: use XENMEM_claim_pages hypercall during guest 
creation.")
Signed-off-by: Andrew Cooper <[email protected]>
---
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]>
---
 tools/libs/ctrl/xc_domain.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/tools/libs/ctrl/xc_domain.c b/tools/libs/ctrl/xc_domain.c
index 2ddc3f4f426d..01c0669c8863 100644
--- a/tools/libs/ctrl/xc_domain.c
+++ b/tools/libs/ctrl/xc_domain.c
@@ -1074,7 +1074,6 @@ int xc_domain_claim_pages(xc_interface *xch,
                                uint32_t domid,
                                unsigned long nr_pages)
 {
-    int err;
     struct xen_memory_reservation reservation = {
         .nr_extents   = nr_pages,
         .extent_order = 0,
@@ -1082,13 +1081,7 @@ int xc_domain_claim_pages(xc_interface *xch,
         .domid        = domid
     };
 
-    set_xen_guest_handle(reservation.extent_start, HYPERCALL_BUFFER_NULL);
-
-    err = xc_memory_op(xch, XENMEM_claim_pages, &reservation, 
sizeof(reservation));
-    /* Ignore it if the hypervisor does not support the call. */
-    if (err == -1 && errno == ENOSYS)
-        err = errno = 0;
-    return err;
+    return xc_memory_op(xch, XENMEM_claim_pages, &reservation, 
sizeof(reservation));
 }
 
 int xc_domain_populate_physmap(xc_interface *xch,
-- 
2.39.5


Reply via email to