On Aug 16, 2013 12:26 AM, "Kerin Millar" <kerfra...@fastmail.co.uk> wrote: > > On 14/08/2013 13:15, Bruce Hill wrote: >> >> On Wed, Aug 14, 2013 at 12:18:41PM +0700, Pandu Poluan wrote: >>> >>> Hello list! >>> >>> My company has 2 HP DL585 G5 servers and 5 Dell R... something servers. All >>> using AMD processors. They currently are acting as XenServer hosts. >>> >>> How do I determine the 'least common denominator' for Gentoo VMs (running >>> as XenServer guests), especially for gcc flags? >>> >>> I know that the (theoretical) best performance is to use -march=native , >>> but since the processors of the HP servers are not exactly the same as the >>> Dell's, I'm concerned that compiling with -march=native will render the VMs >>> unable to migrate between the different hosts. > > > A couple of points: > > * The effect of setting -march=native depends on the characteristics of > the CPU (be it virtual or otherwise) > * The characteristics of the vCPU are defined by qemu's -cpu parameter > * qemu can emulate features not implemented by the host CPU (at a cost) > > One way to go about it is to start qemu with a -cpu model that exposes features that all of your host CPUs have in common (or a subset thereof). In that case, -march=native is fine because all of the features that it detects as being available will be supported in hardware on the host side. > > Another way is to expose the host CPU fully with "-cpu host" and to define your guest CFLAGS according to the most optimal subset. If you are looking for a 'perfect' configuration then this this would be the most effective method, if applied correctly. >
AFAIK, that's how XenServer configured its hosts. There's "CPU Masking" option when a heterogeneous pool of hosts were created, but I have the impression that "CPU Masking" is only being employed by the 'xe toolstack' (CloudStack) layer to determine to which host a VM can be migrated. > Irrespective of the method, by examining /proc/cpuinfo and using the diff technique mentioned by Bruce, you should be able to determine the optimal configuration. > > Finally, in cases where the host CPUs differ significantly - in that native would imply a different -march value - you may choose to augment your CFLAGS with -mtune=generic to even out performance across the board. I don't think this would apply to you though. > Certainly doesn't apply to me. Based on tech spec I have on the servers, the processors are very similar... I just want to be doubly sure :-) Thanks for the explanation (including the difference between 'march' and 'mtune' in your other email)! Rgds, --