[libvirt] [PATCH] qemu: Warn when using vhost-user without shared memory

John Ferlan jferlan at redhat.com
Tue Dec 15 14:17:41 UTC 2015


[...]

>>> +        bool shmem = vm->def->nshmems;
>>> +
>>> +        /*
>>> +         * This check is by no means complete.  We merely check
>>> +         * whetere there are *some* hugepages enabled and *some* NUMA
>>> +         * nodes with shared memory access.
>>> +         */
>>> +        if (!shmem && vm->def->mem.nhugepages) {
>>> +            for (i = 0; i <
>>> virDomainNumaGetNodeCount(vm->def->numa); i++) {
>>> +                if
>>> (virDomainNumaGetNodeMemoryAccessMode(vm->def->numa, i) ==
>>> +                    VIR_NUMA_MEM_ACCESS_SHARED)
>>> +                    shmem = true;
>>> +                break;
>>
>> Coverity complains here that i++ is not reachable.  I think you meant to
>> put the break; inside the if, right?
>>
>> John
> 
> Yes, exactly, thanks for noticing, this should be the diff:
> 
> diff --git i/src/qemu/qemu_process.c w/src/qemu/qemu_process.c
> index ba8dfebd1357..f2740687f655 100644
> --- i/src/qemu/qemu_process.c
> +++ w/src/qemu/qemu_process.c
> @@ -4781,9 +4781,10 @@ qemuProcessLaunch(virConnectPtr conn,
>         if (!shmem && vm->def->mem.nhugepages) {
>             for (i = 0; i < virDomainNumaGetNodeCount(vm->def->numa);
> i++) {
>                 if (virDomainNumaGetNodeMemoryAccessMode(vm->def->numa,
> i) ==
> -                    VIR_NUMA_MEM_ACCESS_SHARED)
> +                    VIR_NUMA_MEM_ACCESS_SHARED) {
>                     shmem = true;
> -                break;
> +                    break;
> +                }
>             }
>         }
> 
> -- 
> 
> I will push it later on if you agree.
> 
> Martin

Looks OK to me

ACK

John




More information about the libvir-list mailing list