Re: [PATCH v2] Edit test capabilities to contain different cell pagesizes.

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

 



On 05/23/2018 02:40 PM, Roland Schulz wrote:
> Signed-off-by: Roland Schulz <schullzroll@xxxxxxxxx>
> ---
>  src/test/test_driver.c | 18 +++++++++++-------
>  1 file changed, 11 insertions(+), 7 deletions(-)

In the $SUBJ I'd add the prefix "test driver:" to tell explicitly what
part of code this commit touches.

> 
> diff --git a/src/test/test_driver.c b/src/test/test_driver.c
> index 467587b19..3fe0c2831 100644
> --- a/src/test/test_driver.c
> +++ b/src/test/test_driver.c
> @@ -322,30 +322,34 @@ testBuildCapabilities(virConnectPtr conn)
>      if (virCapabilitiesAddHostFeature(caps, "nonpae") < 0)
>          goto error;
>  
> -    if (VIR_ALLOC_N(caps->host.pagesSize, 2) < 0)
> +    if (VIR_ALLOC_N(caps->host.pagesSize, 4) < 0)
>          goto error;
>  
>      caps->host.pagesSize[caps->host.nPagesSize++] = 4;
> +    caps->host.pagesSize[caps->host.nPagesSize++] = 8;
>      caps->host.pagesSize[caps->host.nPagesSize++] = 2048;
> +    caps->host.pagesSize[caps->host.nPagesSize++] = 1024 * 1024;
>  
>      for (i = 0; i < privconn->numCells; i++) {
>          virCapsHostNUMACellCPUPtr cpu_cells;
>          virCapsHostNUMACellPageInfoPtr pages;
> -        size_t nPages;
> +        size_t nPages = caps->host.nPagesSize - 1;
>  
>          if (VIR_ALLOC_N(cpu_cells, privconn->cells[i].numCpus) < 0 ||
> -            VIR_ALLOC_N(pages, caps->host.nPagesSize) < 0) {
> +            VIR_ALLOC_N(pages, caps->host.nPagesSize - 1) < 0) {

or s/caps->host.nPagesSize - 1/nPages/ since they will always have the
same value.

>                  VIR_FREE(cpu_cells);
>                  goto error;
>              }
> -
> -        nPages = caps->host.nPagesSize;
> +        if (i == 1)
> +            pages[0].size = caps->host.pagesSize[0];
> +        else
> +            pages[0].size = caps->host.pagesSize[1];

I'd move this after the memcpy so that pages[] initialization is kept
together with the for() loop below the memcpy(). IOW, memcpy should be
moved before this if() statement.

>  
>          memcpy(cpu_cells, privconn->cells[i].cpus,
>                 sizeof(*cpu_cells) * privconn->cells[i].numCpus);
>  
> -        for (j = 0; j < nPages; j++)
> -            pages[j].size = caps->host.pagesSize[j];
> +        for (j = 1; j < nPages; j++)
> +                pages[j].size = caps->host.pagesSize[j+1];

Too much spaces ;-) Also, "j + 1" instead of "j+1".

Fixing all the issues, ACKing and pushing.

Michal

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux