Joined: 10 Feb 2016
|Posted: Thu Feb 11, 2016 5:53 am Post subject: Compile binaries in GUEST for HOST machine?
I am very new to Gentoo, and I have actually posted this issue in another forum (more on that later), but I wanted to hear from people at his forum. I hope it is OK.
I have been playing around with Gentoo_x64 in VirtualBox (in Debian_x64) for the last couple of days. Here is my scenario....
I have a dual boot desktop (Win10 & Debian_x64)
CPU: AMD Athlon(tm) II X2 250 (has support for AMD-V)
RAM: 8 GB
MB: MSI 880GMA E35(FX)
I have read the following wiki
I have the following line in my /etc/portage/make.conf
CFLAGS="-march=native -O2 -pipe"
I have been building binaries by including the following with every emerge
--buildpkg --buildpkg-exclude "virtual/* sys-kernel/*-sources"
Now I plan to upgrade my Host-OS to Gentoo by transferring '/user/portage' from the Guest-Machine to the Host-Machine. But I don't know how the binaries will perform, in the other forum a member pointed out that he is building binaries on a Core-2-Duo and installing them on a Core-i5 with no problems. Off the top of my head all I can think is that Core-2Duo CPU capabilities are a subset (reduced version) of the Corei-5 CPU capabilities, (Just like my GUEST "CPU" is a subset of my HOST CPU) so I guess things worked out fine for him (and will for me too).
But what I was wondering is that, will the binaries compiled in Core-2-Duo be able to take advantage all the features in Core-i5? Or, as in my case, will the GUEST binaries be able to take advantages of all the Physical CPU features when installed on the actual machine?
I ask this cause I ran the following commands on both the Host & Guest machines and did a diff; found significant differences, especially in the flags. (diff at the end of post)
1. cat /proc/cpuinfo
2. gcc -c -Q -march=native --help=targetgcc -c -Q -march=native –help=target
I understand that VirtualBox is a “level-2” hypervisor and not all features of the Host CPU will be exposed to the Guest OS and thus some difference should be expected; but will the binaries of the GUEST be able to take full advantage of the physical (HOST) CPU when actually installed on it?
--Case in point---
The 'svm' (AMD vitualization) flag is there in the HOST but not in the GUEST for /proc/cpuinfo (which is normal).
'-mcx16' is enabled for HOST but disabled for GUEST (in GCC)
diff Guest.txt Host.txt (/proc/cpuinfo....)
< microcode : 0x10000bf
< cpu MHz : 3001.474
> microcode : 0x10000c7
> cpu MHz : 800.000
< flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx fxsr_opt rdtscp lm 3dnowext 3dnow rep_good nopl extd_apicid pni lahf_lm cmp_legacy cr8_legacy 3dnowprefetch vmmcall
< bugs : tlb_mmatch apic_c1e fxsave_leak sysret_ss_attrs
< bogomips : 6002.94
> flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm 3dnowext 3dnow constant_tsc rep_good nopl nonstop_tsc extd_apicid pni monitor cx16 popcnt lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt nodeid_msr hw_pstate npt lbrv svm_lock nrip_save vmmcall
> bogomips : 6000.19
< power management:
> power management: ts ttp tm stc 100mhzsteps hwpstate
diff Guest.txt Host.txt (for gcc)
< -mabm [disabled]
> -mabm [enabled]
< -march= k8-sse3
> -march= amdfam10
< -mcx16 [disabled]
> -mcx16 [enabled]
< -mlzcnt [disabled]
> -mlzcnt [enabled]
< -mpopcnt [disabled]
> -mpopcnt [enabled]
< -mprfchw [disabled]
> -mprfchw [enabled]
< -msse4a [disabled]
> -msse4a [enabled]
< -mtune= k8
> -mtune= amdfam10