[libvirt] [PATCH 1/1][RESEND]Remove contiguous CPU indexes assumption

Daniel P. Berrange berrange at redhat.com
Thu Mar 14 11:14:45 UTC 2013


On Thu, Mar 14, 2013 at 02:54:22PM +0800, Li Zhang wrote:
> From: Li Zhang <zhlcindy at linux.vnet.ibm.com>
> 
> When getting CPUs' information, it assumes that CPU indexes
> are not contiguous. But for ppc64 platform, CPU indexes are not
> contiguous because SMT is needed to be disabled, so CPU information
> is not right on ppc64 and vpuinfo, vcpupin can't work corretly.
> 
> This patch is to remove the assumption to be compatible with ppc64.
> 
> Test:
>    4 vcpus are assigned to one VM and execute vcpuinfo command.
> 
>    Without patch: There is only one vcpu informaion can be listed.
>    With patch: All vcpus' information can be listed correctly.
> 
> Signed-off-by: Li Zhang <zhlcindy at linux.vnet.ibm.com>
> ---
>  src/qemu/qemu_monitor_json.c |    7 -------
>  1 file changed, 7 deletions(-)
> 
> diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
> index 9991a0a..e130f8c 100644
> --- a/src/qemu/qemu_monitor_json.c
> +++ b/src/qemu/qemu_monitor_json.c
> @@ -1230,13 +1230,6 @@ qemuMonitorJSONExtractCPUInfo(virJSONValuePtr reply,
>              goto cleanup;
>          }
>  
> -        if (cpu != i) {
> -            virReportError(VIR_ERR_INTERNAL_ERROR,
> -                           _("unexpected cpu index %d expecting %d"),
> -                           i, cpu);
> -            goto cleanup;
> -        }
> -

Since you removed this, the 'cpu' variable is completely unused, so
you should also remove earlier logic which populates it

>          threads[i] = thread;
>      }
>  


There is similar code to this in qemu_monitor_text.c which needs to
be removed too

        if (vcpu != (lastVcpu + 1))
            goto error;

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list