Re: [PATCHv2 1/3] qemu, lxc: Change host CPU detection logic.

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

 



On 10/31/2012 11:20 AM, Viktor Mihajlovski wrote:
> The drivers for QEMU and LXC use virNodeGetInfo to determine the
> number of host CPUs. This approach can lead to a wrong (too small)
> number if one or more CPUs are offline.
> It is better to use nodeGetCPUCount on Linux hosts.
> ---
> V2 Changes:
> Use nodeGetCPUCount as suggested by Eric, nodeGetCPUMap is too
> "heavyweight".

Hmm, while reading this patch series, I realized that my initial RPC
implementation always requests the number of online processors over the
wire, even though you've now proven that calling virNodeGetCPUMap(conn,
NULL, NULL, 0) is useful.  I'll see about getting in a followup patch to
optimize the on-the-wire call to avoid wasted effort of collecting a
bitmap just to determine the number of online CPUs when we really only
care about the max cpu number.

Meanwhile, on to this patch:

> @@ -492,17 +492,15 @@ static int virLXCControllerSetupNUMAPolicy(virLXCControllerPtr ctrl)
>  static int virLXCControllerSetupCpuAffinity(virLXCControllerPtr ctrl)
>  {
>      int hostcpus, maxcpu = CPU_SETSIZE;
> -    virNodeInfo nodeinfo;
>      virBitmapPtr cpumap, cpumapToSet;
>  
>      VIR_DEBUG("Setting CPU affinity");
>  
> -    if (nodeGetInfo(NULL, &nodeinfo) < 0)
> -        return -1;
> -
>      /* setaffinity fails if you set bits for CPUs which
>       * aren't present, so we have to limit ourselves */

Question - does setaffinity fail if you request setting a CPU that is
present but offline?  In that case, we would need the CPU map instead of
just the count of max cpus.  But in the meantime, I'm okay with your patch.

ACK, and will push shortly.

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

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]