From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:55810) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UCySa-00040L-QP for qemu-devel@nongnu.org; Tue, 05 Mar 2013 15:27:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UCySZ-00084v-Ha for qemu-devel@nongnu.org; Tue, 05 Mar 2013 15:27:40 -0500 Received: from mx1.redhat.com ([209.132.183.28]:18636) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UCySZ-00084k-8d for qemu-devel@nongnu.org; Tue, 05 Mar 2013 15:27:39 -0500 Message-ID: <513654B3.6060200@redhat.com> Date: Tue, 05 Mar 2013 13:25:23 -0700 From: Eric Blake MIME-Version: 1.0 References: <1362435597-20018-1-git-send-email-lersek@redhat.com> <1362435597-20018-3-git-send-email-lersek@redhat.com> In-Reply-To: <1362435597-20018-3-git-send-email-lersek@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="----enig2MLRMLTNNSEUXWQSHWPPH" Subject: Re: [Qemu-devel] [PATCH 2/3] qga: implement qmp_guest_get_vcpus() for Linux with sysfs List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Laszlo Ersek Cc: qemu-devel@nongnu.org, pbonzini@redhat.com, mdroth@linux.vnet.ibm.com, lcapitulino@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) ------enig2MLRMLTNNSEUXWQSHWPPH Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 03/04/2013 03:19 PM, Laszlo Ersek wrote: > Signed-off-by: Laszlo Ersek > --- > GuestLogicalProcessorList *qmp_guest_get_vcpus(Error **errp) > { > +#if defined(__linux__) > + > + buf =3D g_strdup_printf("/sys/devices/system/cpu/cpu%ld/online= ", > + current); > + f =3D fopen(buf, "r"); > + if (f =3D=3D 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. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org ------enig2MLRMLTNNSEUXWQSHWPPH Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.13 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEbBAEBCAAGBQJRNlSzAAoJEKeha0olJ0NqwKUH+MyUDVB9V1jc+o659ShBkUZ/ JjEx9ode3/O+1bqotlNZ9QdUCwkTZ14WsFdSNLQVtDlD3j9mJzNc04AsBMkz5qxc KQvtqytyeVQDf7nE1hPD1JeHfhWztNQcScCTqSP9By1FAXDdK1yjKuNv+QBAr3E4 hZf1Ft9DTETni+FOkPc+Kp0Pl3RxCa1U9P7t3hDWl91shkTDnLPWfcWcmuvuLLfz /MZZ1Y+2yJHwPjZEpazJuWo3d3VjTVTRASvg5uuENQYH46eBP7oKjq7G0LCL9ulh f3hktfSMqQBU6ELcelQLa+lC4RcDMv8V8sEQnE5OfGMzsYPuGS4XHDGgdylwqQ== =HCRA -----END PGP SIGNATURE----- ------enig2MLRMLTNNSEUXWQSHWPPH--