qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: mdroth <mdroth@linux.vnet.ibm.com>
To: Eric Blake <eblake@redhat.com>
Cc: pbonzini@redhat.com, Laszlo Ersek <lersek@redhat.com>,
	qemu-devel@nongnu.org, lcapitulino@redhat.com
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	[thread overview]
Message-ID: <20130305204513.GH21850@vm> (raw)
In-Reply-To: <513653EB.8000204@redhat.com>

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	other threads:[~2013-03-05 20:49 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-04 22:19 [Qemu-devel] [PATCH 0/3] qga/Linux: online/offline/query VCPUs via guest sysfs Laszlo Ersek
2013-03-04 22:19 ` [Qemu-devel] [PATCH 1/3] qga: introduce guest-get-vcpus / guest-set-vcpus with stubs Laszlo Ersek
2013-03-05 21:08   ` Eric Blake
2013-03-05 23:05     ` Laszlo Ersek
2013-03-05 23:12       ` Eric Blake
2013-03-05 23:32         ` Laszlo Ersek
2013-03-06  7:40       ` Andrew Jones
2013-03-06 13:49       ` Eric Blake
2013-03-06 16:37         ` Laszlo Ersek
2013-03-04 22:19 ` [Qemu-devel] [PATCH 2/3] qga: implement qmp_guest_get_vcpus() for Linux with sysfs Laszlo Ersek
2013-03-05 20:03   ` mdroth
2013-03-05 20:22     ` Eric Blake
2013-03-05 20:45       ` mdroth [this message]
2013-03-05 21:05     ` Laszlo Ersek
2013-03-05 20:25   ` Eric Blake
2013-03-05 21:34     ` Laszlo Ersek
2013-03-05 22:06       ` mdroth
2013-03-04 22:19 ` [Qemu-devel] [PATCH 3/3] qga: implement qmp_guest_set_vcpus() " Laszlo Ersek
2013-03-05 20:09   ` mdroth
2013-03-05 21:09     ` Laszlo Ersek
2013-03-05 21:19   ` Eric Blake
2013-03-05 23:23     ` Laszlo Ersek
2013-03-05 23:37       ` Eric Blake
2013-03-06  0:44         ` Laszlo Ersek
2013-03-06  9:57           ` Paolo Bonzini
2013-03-06 13:46           ` Eric Blake

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130305204513.GH21850@vm \
    --to=mdroth@linux.vnet.ibm.com \
    --cc=eblake@redhat.com \
    --cc=lcapitulino@redhat.com \
    --cc=lersek@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).