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 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
signature.asc
Description: OpenPGP digital signature