Prevent VTune from clearing CR4.PCE?

Prevent VTune from clearing CR4.PCE?

As of RedHat 6.4, the default setting for the kernel is to set the CR4.PCE bit, which enables user-mode code to execute the RDPMC instruction.  This allows access to the core hardware performance counters at about 1% of the overhead of going through a kernel driver.

Unfortunately VTune seems to think that this is a bad idea, since it clears CR4.PCE on exit.  This is a serious problem, as it requires executing kernel code to fix.

Is there any way to prevent VTune from clearing CR4.PCE on exit?   Ideally it should read the value of CR4.PCE on startup and restore that value on exit...

Version info:

Intel(R) VTune(TM) Amplifier XE 2013 Update 17 (build 353306) Command Line Tool
Copyright (C) 2009-2014 Intel Corporation. All rights reserved.

 

John D. McCalpin, PhD
"Dr. Bandwidth"
5 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

With software, anything is possible. ;)

Of course, this is not something that a user can change and it wouldn't happen until there is a new release.  Ideally, this sort of thing should be reported via Intel® Premier Support so that we can properly track it.  But I will let the dev team know and see what they say.

Regards,
MrAnderson

Fortunately the VTune package on the host comes with source code so that the "sep" module can be recompiled if a user is running a kernel without a pre-compiled binary.   Commenting out one line suffices to correct the offending behavior, but I have not figured out exactly what sequence of steps I need to go through to trigger a recompilation of the "sep" module.

I expect this will not be so straightforward on the Xeon Phi Coprocessor....

John D. McCalpin, PhD
"Dr. Bandwidth"

There is a 'build-driver' script in teh sepdk/src directory.  If the kernel sources are correctly configured, you can just execute this script and press Return for all prompts and it should be (well, you need to kernel-devel* packages, as well as the C/C++ development packages installed).

Once successfully completed, execute the 'insmod-sep3' script.  Probably use the '-r' option to reload all the drivers.  Also, if you are using group access to control access to the drivers, use the '-g' option to provide the group name.  Use './insmod-sep3 -h' for a help message.

Regards,
MrAnderson

Just for the record, this has been resolved on the host side in Amplifier XE 2015 and on the MIC side in Amplifier XE 2015 Update 1.

Regards,
MrAnderson

Leave a Comment

Please sign in to add a comment. Not a member? Join today