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

Re: [Xen-devel] [v5][PATCH 11/16] tools/libxl: detect and avoid conflicts with RDM



Tiejun Chen writes ("[v5][PATCH 11/16] tools/libxl: detect and avoid conflicts 
with RDM"):
> While building a VM, HVM domain builder provides struct hvm_info_table{}
> to help hvmloader. Currently it includes two fields to construct guest
> e820 table by hvmloader, low_mem_pgend and high_mem_pgend. So we should
> check them to fix any conflict with RDM.
...
> +    *nr_entries = 0;
> +    rc = xc_reserved_device_memory_map(CTX->xch, flag, seg, bus, devfn,
> +                                       NULL, nr_entries);
> +    assert(rc <= 0);
> +    /* "0" means we have no any rdm entry. */
> +    if (!rc)
> +        goto out;

I think the error handling here is wrong.  Certainly `rc' should not
be used for a libxc return.

See tools/libxl/CODING_STYLE.  I know that much of the existing code
uses rc for libxc returns but this is deprecated, and please don't
make more of it.

> +    if (errno == ENOBUFS) {
> +        *xrdm = libxl__malloc(gc,
> +                              *nr_entries *
> +                              sizeof(xen_reserved_device_memory_t));
> +        rc = xc_reserved_device_memory_map(CTX->xch, flag, seg, bus, devfn,
> +                                           *xrdm, nr_entries);

This might be less code, and a bit clearer, if it were a loop rather
than two calls with the second in an if.

...
> +        if(d_config->rdms[i].flag == LIBXL_RDM_RESERVE_FLAG_STRICT) {
             ^
Missing space.

Thanks,
Ian.

_______________________________________________
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®.