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: mdroth
Subject: Re: [Qemu-devel] [PATCH 2/3] qga: implement qmp_guest_get_vcpus() for Linux with sysfs
Date: Tue, 5 Mar 2013 14:45:13 -0600
User-agent: Mutt/1.5.21 (2010-09-15)

On Tue, Mar 05, 2013 at 01:22:03PM -0700, Eric Blake wrote:
> On 03/05/2013 01:03 PM, mdroth wrote:
> 
> >> +        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);
> >> +        } else {
> >> +            unsigned online;
> >> +
> >> +            if (fscanf(f, "%u", &online) != 1) {
> > 
> > On Fedora 18 and Ubuntu 12.04 at least there doesn't seem to be per-cpu
> > values for online/offline/etc, but instead just a 'global' entry at
> > /sys/devices/system/cpu/{online,offline} that provides a range. This is
> > what's currently described in
> > linux/Documentation/ABI/testing/sysfs-devices-system-cpu as well.
> 
> Actually, there is both.  Here's what I have on my 2-cpu laptop, running
> Fedora 18:
> 
> # find /sys/devices/system/cpu/ -name online
> /sys/devices/system/cpu/cpu1/online
> /sys/devices/system/cpu/online
> 
> Notice that there is NO /sys/devices/system/cpu/cpu0/online, because

Ahh, didn't think to check the others. This seems to be the case for me
as well. I agree on your later note about special casing this though.

> this particular laptop's chipset requires that cpu0 ALWAYS be online.
> The per-cpu online file exists only for cpus that can safely be
> offlined; if it does not exist, then you must leave that cpu on.
> 
> > 
> > Is that file also available on the distro you're testing with? Hopefully
> > there's a single interfaces we can rely on.
> 
> Libvirt also relies on the per-cpu online files, and hasn't had any
> complaints across the distros.
> 
> -- 
> Eric Blake   eblake redhat com    +1-919-301-3266
> Libvirt virtualization library http://libvirt.org
> 





reply via email to

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