qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 2/3] qga: implement qmp_guest_get_vcpus() for Li


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH 2/3] qga: implement qmp_guest_get_vcpus() for Linux with sysfs
Date: Tue, 05 Mar 2013 13:25:23 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130219 Thunderbird/17.0.3

On 03/04/2013 03:19 PM, Laszlo Ersek wrote:
> Signed-off-by: Laszlo Ersek <address@hidden>
> ---
>  GuestLogicalProcessorList *qmp_guest_get_vcpus(Error **errp)
>  {
> +#if defined(__linux__)

> +
> +        buf = g_strdup_printf("/sys/devices/system/cpu/cpu%ld/online",
> +                              current);
> +        f = fopen(buf, "r");
> +        if (f == NULL) {
> +            error_setg_errno(&local_err, errno, "fopen(\"%s\", \"r\")", buf);

NACK to this portion.  If the file doesn't exist, but the
/sys/devices/system/cpu/cpu%ld/ directory exists, then the cpu should be
treated as always online, and not an error.  In fact, on many machines,
cpu0 does not have an online file precisely because it cannot be taken
offline, even if the rest of the cpus can.  It is also the case that on
older kernels that did not support offline cpus (such as RHEL 5), there
will be no per-cpu online file; but again, such kernels cannot support
hot unplug, so all per-cpu directories imply which cpus are online.  In
other words, you need a sane fallback if the online file does not exist
but the per-cpu directory does exist.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]