|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH v2 7/7] xen: New API to claim memory for a domain using XEN_DOMCTL_claim_memory
Acked-by: Christian Lindig <christian.lindig@xxxxxxxxx>
> On 16 Aug 2025, at 12:19, Bernhard Kaindl <bernhard.kaindl@xxxxxxxxx> wrote:
>
> Add the new hypercall requested during the review of the v1 series
> do not require changing the API for multi-node claims.
>
> The hypercall receives a number of claims, intented to be one claim per
> NUMA node, and limited to one claim for now. The changes to update the
> NUMA claims management to handle updating the claims for multiple
> NUMA nodes of a domain at once are deferred to the next series.
>
> Signed-off-by: Bernhard Kaindl <bernhard.kaindl@xxxxxxxxx>
> Cc: Alejandro Vallejo <alejandro.garciavallejo@xxxxxxx>
> ---
> tools/flask/policy/modules/dom0.te | 1 +
> tools/flask/policy/modules/xen.if | 1 +
> tools/include/xenctrl.h | 4 +++
> tools/libs/ctrl/xc_domain.c | 42 +++++++++++++++++++++++++++++
> tools/ocaml/libs/xc/xenctrl.ml | 9 +++++++
> tools/ocaml/libs/xc/xenctrl.mli | 9 +++++++
> tools/ocaml/libs/xc/xenctrl_stubs.c | 21 +++++++++++++++
> xen/common/domain.c | 30 +++++++++++++++++++++
> xen/common/domctl.c | 8 ++++++
> xen/include/public/domctl.h | 17 ++++++++++++
> xen/include/xen/domain.h | 2 ++
> xen/xsm/flask/hooks.c | 3 +++
> xen/xsm/flask/policy/access_vectors | 2 ++
> 13 files changed, 149 insertions(+)
> +
> + /* Use an array to not need changes for multi-node claims in the future
> */
> + if ( nr_claims )
> + {
> + size_t bytes = sizeof(memory_claim_t) * nr_claims;
> +
> + buffer = xc_hypercall_buffer_alloc(xch, buffer, bytes);
> + if ( buffer == NULL )
> + {
> + PERROR("Could not allocate memory for xc_domain_claim_memory");
> + return -1;
> + }
> + memcpy(buffer, claims, bytes);
> + set_xen_guest_handle(domctl.u.claim_memory.claims, buffer);
> + }
> +
> + ret = do_domctl(xch, &domctl);
> + xc_hypercall_buffer_free(xch, buffer);
> + return ret;
> +}
Should this be "if (nr_claims > 0)” or have an assertion against negative
values?
— C
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |