Re: Issue with oprofile and Virtual Machines?
William Cohen <[email protected]>
| Newsgroups | gmane.linux.oprofile |
|---|---|
| Message-ID | <[email protected]> |
On 12/30/2015 02:20 PM, Brad Litterell wrote:
> I built oprofile 1.1.0 from source on Ubuntu 12.04 (32-bit), but I’m getting the unsupported processor error:
>
>
>
> Here are some details:
>
> $ uname -a
>
> Linux Ub32 3.5.0-36-generic #57~precise1-Ubuntu SMP Thu Jun 20 15:22:35 UTC 2013 i686 i686 i386 GNU/Linux
>
>
>
> $ operf
>
> Your kernel's Performance Events Subsystem does not support your processor type.
>
>
>
> My underlying hardware is an Intel i7, therefore I’m suspicious that the problem is running Ubuntu inside a virtual machine – in this case Parallels on OSX.
>
>
>
> Is there any guidance or documentation on how to run operf under VMs?
>
>
>
> I read one suggestion to switch back to 0.9.9, but I have a couple of questions.
>
>
>
> 1. Will I need to rebuild my kernel to include a kernel driver for the older format?
>
> 2. How do I uninstall the existing 1.1.0 build that is now in my /usr folder?
>
> 3. Am I likely to have issues with 0.9.9 on a VM?
>
>
>
>
>
> Thanks,
>
> Brad
Hi Brad,
There are cases where oprofile and perf do work in a virtual machine. However, it depends greatly on what support the virtual machine provides. The first hurdle is that the virtual machine needs to correctly identify the processor. The second hurdle is that the virtual machine needs to allow the guest access to the performance monitoring MSR. I know with RHEL6 acting as a host it didn't allow access to the performance monitoring hardware.
What does the guest machine identify the hardware as? What is the output of the following on guest:
cat /proc/cpuinfo
Does that match up with what the host processor actually is? It is quite possible that Parallels is setting the cpu id to something bogus (not recognized AMD or Intel processors).
operf does work on guest VMs for recent versions of Fedora. Below is a guest fedora rawhide on a fedora 23 host:
[wcohen@localhost ~]$ uname -a
Linux localhost.localdomain 4.4.0-0.rc6.git1.1.fc24.x86_64 #1 SMP Wed Dec 23 19:06:10 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
[wcohen@localhost ~]$ cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 42
model name : Intel Xeon E312xx (Sandy Bridge)
stepping : 1
microcode : 0x1
cpu MHz : 2294.792
cache size : 4096 KB
physical id : 0
siblings : 1
core id : 0
cpu cores : 1
apicid : 0
initial apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss syscall nx rdtscp lm constant_tsc arch_perfmon rep_good nopl eagerfpu pni pclmulqdq ssse3 cx16 pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm fsgsbase smep erms xsaveopt
bugs :
bogomips : 4589.58
clflush size : 64
cache_alignment : 64
address sizes : 40 bits physical, 48 bits virtual
power management:
[wcohen@localhost ~]$ operf ls
operf: Profiler started
Desktop Downloads oprofile_data Public systemtap_write Videos
Documents Music Pictures rpmbuild Templates
WARNING: Lost samples detected! See /home/wcohen/oprofile_data/samples/operf.log for details.
Lowering the sampling rate may reduce or eliminate lost samples.
See the '--events' option description in the operf man page for help.
Profiling done.
[wcohen@localhost ~]$ opreport
Using /home/wcohen/oprofile_data/samples/ for samples directory.
WARNING: Lost samples detected! See /home/wcohen/oprofile_data/samples/operf.log for details.
CPU: Intel Sandy Bridge microarchitecture, speed 2294.79 MHz (estimated)
Counted CPU_CLK_UNHALTED events (Clock cycles when not halted) with a unit mask of 0x00 (No unit mask) count 100000
CPU_CLK_UNHALT...|
samples| %|
------------------
58 100.000 ls
CPU_CLK_UNHALT...|
samples| %|
------------------
51 87.9310 kallsyms
4 6.8966 ld-2.22.90.so
3 5.1724 ls
-Will
------------------------------------------------------------------------------