[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [RFC][PATCH 10/13] tools: extend XENMEM_set_memory_map



>>> On 10.04.15 at 11:22, <tiejun.chen@xxxxxxxxx> wrote:
> --- a/tools/libxl/libxl_dom.c
> +++ b/tools/libxl/libxl_dom.c
> @@ -787,6 +787,70 @@ out:
>      return rc;
>  }
>  
> +static int libxl__domain_construct_memmap(libxl_ctx *ctx,
> +                                          libxl_domain_config *d_config,
> +                                          uint32_t domid,
> +                                          struct xc_hvm_build_args *args,
> +                                          int num_pcidevs,
> +                                          libxl_device_pci *pcidevs)
> +{
> +    unsigned int nr = 0, i;
> +    /* We always own at least one lowmem entry. */
> +    unsigned int e820_entries = 1;
> +    uint64_t highmem_end = 0, highmem_size = args->mem_size - 
> args->lowmem_size;
> +    struct e820entry *e820 = NULL;
> +
> +    /* Add all rdm entries. */
> +    e820_entries += d_config->num_rdms;
> +
> +    /* If we should have a highmem range. */
> +    if (highmem_size)
> +    {
> +        highmem_end = (1ull<<32) + highmem_size;
> +        e820_entries++;
> +    }
> +
> +    e820 = malloc(sizeof(struct e820entry) * e820_entries);
> +    if (!e820) {
> +        return -1;
> +    }
> +
> +    /* Low memory */
> +    e820[nr].addr = 0x100000;
> +    e820[nr].size = args->lowmem_size - 0x100000;
> +    e820[nr].type = E820_RAM;

If you really mean it to be this lax (not covering the low 1Mb), then
you need to explain why in a comment (and the consuming side
should also have a similar explanation then).

> +    nr++;
> +
> +    /* RDM mapping */
> +    for (i = 0; i < d_config->num_rdms; i++) {
> +        /*
> +         * We should drop this kind of rdm entry.
> +         */
> +        if (d_config->rdms[i].flag == LIBXL_RDM_RESERVE_FLAG_INVALID)
> +            continue;
> +
> +        e820[nr].addr = d_config->rdms[i].start;
> +        e820[nr].size = d_config->rdms[i].size;
> +        e820[nr].type = E820_RESERVED;
> +        nr++;
> +    }

Is this guaranteed not to produce overlapping entries?

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.