ArchipelProject / Archipel

XMPP Based Orchestrator
http://archipelproject.org
GNU Affero General Public License v3.0
803 stars 127 forks source link

Additional CPU flags + Copy host CPU configuration #188

Open AmrnotAmr opened 13 years ago

AmrnotAmr commented 13 years ago

Hello, I really want to thank you for this excellent piece of software with all the innovation it has. Virt-manager now has an option to declare the extra cpu flags so as you can share the cpu capabilities with the disks. It gets the CPU type and the extra flags from "virsh capabilities" cpu section. So the kvm process looks like this; /usr/bin/kvm -S -M pc-0.14 -cpu core2duo,+lahf_lm,+rdtscp,+popcnt,+sse4.2,+sse4.1,+xtpr,+cx16,+tm2,+est,+vmx,+ds_cpl,+pbe,+tm,+ht,+ss,+acpi,+ds

virt-manager allows you to type the CPU info you want, or you can "Copy host CPU configuration" so it detects and adds it automatically as shown. I hope you can implement the "Copy host CPU configuration" feature in archipel.

JordanP commented 13 years ago

Hi, This sounds good. But does setting extra CPU flags improve VM performance ? It would be great if you could make a benchmark.

And this seems KVM-specific.

AmrnotAmr commented 13 years ago

Yes It does. I've run some media benchmarks on Scientific Linux 6 guest running on RHEL6 host with "Intel(R) Xeon(R) CPU X3470 @ 2.93GHz" .... The guest has 4 virtual CPUs. I ran the benchmarks with no "-cpu" at all, with "-cpu host" and with "-cpu Nehalem,+rdtscp,+xtpr,+tm2,+est,+vmx,+ds_cpl,+monitor,+pbe,+tm,+ht,+ss,+acpi,+ds,+vme", the extra flags are generated by virt-manager "Copy Host CPU". The time is estimated using time command.

The results is as follows;

++ nginx compilation with "make -j4" -- No performance gain/loss at all.

++ x264 media encoding - I've used the latest x264 compiled from source code with yasm - ; Converting y4m file to flv. 1- With no "-cpu" the jop timing as follows; real 0m25.778s user 1m7.216s sys 0m1.213s 2- With "-cpu host" and "-cpu Nehalem+....etc" results are almost the same as follows; real 0m20.356s user 0m53.403s sys 0m1.210s

So for media processing it helps for sure.

By the way, it's recommended as of official KVM docs; http://www.linux-kvm.org/page/Tuning_KVM

JordanP commented 13 years ago

Thanks

@primalmotion : this can potentialy clash with the "arch" parameter in VM definition. Ie : you want an i686 VM but your (physical) server is amd64, passing "-cpu host" could be weird

primalmotion commented 13 years ago

so you would like to be able to pick from caps:

<cpu>
      <arch>x86_64</arch>
      <model>core2duo</model>
      <vendor>Intel</vendor>
      <topology cores='2' threads='1' sockets='1'/>
      <feature name='lahf_lm'/>
      <feature name='xtpr'/>
      <feature name='cx16'/>
      <feature name='tm2'/>
      <feature name='est'/>
      <feature name='vmx'/>
      <feature name='ds_cpl'/>
      <feature name='pbe'/>
      <feature name='tm'/>
      <feature name='ht'/>
      <feature name='ss'/>
      <feature name='acpi'/>
      <feature name='ds'/>
    </cpu>

and make definition looking like this?

  <cpu match='exact'>
    <model>core2duo</model>
    <feature policy='require' name='lahf_lm'/>
    ...
    <feature name='est'/>
  </cpu>
nikdoof commented 13 years ago

Also a thing to note, in Migration scenarios if you migrate a VM using the cx16 flag onto a non-cx16 box it'll die horribly in a fire. The low defaults (Pentium 2, small flag subset) is the standard to avoid these situations. It may be worth noting this in the documentation if this feature goes ahead.

guilhem commented 12 years ago

In libvirt 0.9.10, we can use mode=host-model :

<cpu mode='host-model'/>

http://www.redhat.com/archives/libvir-list/2012-January/msg00232.html

yhaenggi commented 9 years ago

What is the current status of this and/or #962 ? Will this be implemented? At least the possibility to set host-model is often necessary.

CyrilPeponnet commented 9 years ago

You can do it by editing the definition through the xml editor. There is no plan for now to add these features.

On Dec 27, 2014, at 10:46 AM, K1773R notifications@github.com wrote:

What is the current status of this and/or #962 ? Will this be implemented? Atleast the possibility to set host-model.

— Reply to this email directly or view it on GitHub.

yhaenggi commented 9 years ago

it works if i set <cpu mode='host-model'/>, tough everytime i "validate" the config, it will be removed. can i tell archipel to ignore this section, or just stick to manually doing it everytime. As its possible to set it, im happy with it already ;)