Intel PCM - errors while using PCM.exe

Intel PCM - errors while using PCM.exe

pranith's picture

Hi,

I am getting the following error when trying to use Intel PCM. This is in a program where I am trying to use the API in cpucounters.h to measure bandwidth.

PS C:\\Users\\pdenthum\\Documents\\Visual Studio 2010\\Projects\\testBw\\x64\\Release> .\\testBW.exe Num cores: 4 Num sockets: 1 Threads per core: 2 Core PMU (perfmon) version: 3 Number of core PMU generic (programmable) counters: 4 Width of generic (programmable) counters: 48 bits Number of core PMU fixed counters: 3 Width of fixed counters: 48 bits Can not access CPUs Model Specific Registers (MSRs). You must have signed msr.sys driver in your current directory and have administrator rights to run this program. Access to Intel Performance Counter Monitor has denied (no MSR or PCI CFG space access). PS C:\\Users\\pdenthum\\Documents\\Visual Studio 2010\\Projects\\testBw\\x64\\Release>

Also I am encountering the following error:

I could compile and run PCM.exe earlier. When I tried it again today, I am getting the following errors: PS C:\\Users\\pdenthum\\Documents\\Visual Studio 2010\\Projects\\IntelPerformanceCounterMonitorV1.7\\pranith> .\\pcm.exe 1 -nc -ns Intel Performance Counter Monitor Copyright (c) 2009-2011 Intel Corporation Starting MSR service failed with error 2 Trying to load winring0.dll/winring0.sys driver... Using winring0.dll/winring0.sys driver. Num cores: 4 Num sockets: 1 Threads per core: 2 Core PMU (perfmon) version: 3 Number of core PMU generic (programmable) counters: 4 Width of generic (programmable) counters: 48 bits Number of core PMU fixed counters: 3 Width of fixed counters: 48 bits Nominal core frequency: 2500000000 Hz Error in Windows function 'CreateSemaphore': 5 Access to Intel Performance Counter Monitor has denied (Unknown error).

I could see that the error code 5 isERROR_ACCESS_DENIED. I think this error is caused by an orphan semaphore. If I change the name of the semaphore, I am able to access the performance counters again.
Please help me resolve these errors.
Thanks,
Pranith

14 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.
pranith's picture

I have the WinRing0.dll and WinRing0.sys in the same folder as testBw.exe. Any help is appreciated. Thanks,
pranith

Roman Dementiev (Intel)'s picture
Best Reply

Hi Pranith,

do you run also the PCMService for the Windows graphical perfmon plugin in parallel to the pcm.exe? If so you might have permission access errors as it seem that this semaphore is created from the PCMService under a different (system) account.

To resolve the issue you might try to stop the pcmservice: "net stop pcmservice" and then try to run pcm.exe again.

Let us please know if it helped or not.

Thanks,
Roman

pranith's picture

Ok, I think I was not trying to load the proper driver earlier. I had Winring0.dll and Winring0.sys earlier. When I copy the Winring0x64.dll and Winring0x64.sys I get a different error msg as follows:

PS C:\Users\pdenthum\Documents\Visual Studio 2010\Projects\testBw\Release> .\testBW.exe Num cores: 4 Num sockets: 1 Threads per core: 2 Core PMU (perfmon) version: 3 Number of core PMU generic (programmable) counters: 4 Width of generic (programmable) counters: 48 bits Number of core PMU fixed counters: 3 Width of fixed counters: 48 bits Can not access CPUs Model Specific Registers (MSRs). You must have signed msr.sys driver in your current directory and have administrator rights to run this program. Starting MSR service failed with error 2 Trying to load winring0.dll/winring0.sys driver... Using winring0.dll/winring0.sys driver. Access to Intel Performance Counter Monitor has denied (no MSR or PCI CFG space access). PS C:\Users\pdenthum\Documents\Visual Studio 2010\Projects\testBw\Release>

PS C:\Users\pdenthum\Documents\Visual Studio 2010\Projects\testBw\Release> .\testBW.exeNum cores: 4Num sockets: 1Threads per core: 2Core PMU (perfmon) version: 3Number of core PMU generic (programmable) counters: 4Width of generic (programmable) counters: 48 bitsNumber of core PMU fixed counters: 3Width of fixed counters: 48 bitsCan not access CPUs Model Specific Registers (MSRs).You must have signed msr.sys driver in your current directory and have administrator rights to run this program.Starting MSR service failed with error 2Trying to load winring0.dll/winring0.sys driver...Using winring0.dll/winring0.sys driver.
Access to Intel Performance Counter Monitor has denied (no MSR or PCI CFG space access).PS C:\Users\pdenthum\Documents\Visual Studio 2010\Projects\testBw\Release>

Thanks.
pranith's picture

Thanks Roman. That indeed fixed the error with pcm.exe. But the remaining error is still present.

What does this error mean:

"Access to Intel Performance Counter Monitor has denied (no MSR or PCI CFG space access)."

Roman Dementiev (Intel)'s picture

Pranith,

are yourunning the command line shell with the testBW.exe "as administrator"?Please see the special directions with a menu screenshot for that in the WINDOWS_HOWTO.rtf file in the PCM zip archive.

Thanks,
Roman

pranith's picture

yes, I am running it from an administrator power shell. I also tried running only the testBw.exe as an administrator by right-clicking it and selecting "Run as administrator". It still gives me the same error.

Roman Dementiev (Intel)'s picture

Pranith,

from the order of the error messages it become apparent to me that you should check the order of the calls:
First you should load the Ring0/MSRdriver using the Driver class and only then call PCM::getInstance and program(). You can see the correct order in the cpucounterstest.cpp .

Could you please check the order of the calls in your testBw program? Is it correct or are you calling PCM::getInstance&program before the Driver routines?

Thanks,
Roman

pranith's picture

I believe I am calling them in the right order. Here is my code snippet:

http://pastebin.com/2NZmHX5b
pranith's picture

Ah, you seem to be right! I was instantiating "SystemCounterState" which was in turn calling PCM::getInstance(). Thanks a lot for all the help!

Roman Dementiev (Intel)'s picture

Pranith,

you are welcome.

Roman

alextui's picture

It seems like a problem in theinstantiation of PCM.

Acoolme :Anybody Can Be Your Marketer
pengfei w.'s picture

hi pranith

could you give me some detail infomation about how to build msr.sys&PCM.exe&intelpcm.dll ?

thanks a lot

Patrick Fay (Intel)'s picture

Hello Pengfei,

Please don't post the same question to multiple threads. This is what, question #4 or 6?

Pat

Login to leave a comment.