Software Tuning, Performance Optimization & Platform Monitoring
Discussion regarding monitoring and software tuning methodologies, Performance Monitoring Unit (PMU) of Intel microprocessors, and platform updating.

Intel PCM - errors while using PCM.exe

pranith
Beginner
2,537 Views
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
0 Kudos
1 Solution
Roman_D_Intel
Employee
2,537 Views
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

View solution in original post

0 Kudos
13 Replies
pranith
Beginner
2,537 Views
I have the WinRing0.dll and WinRing0.sys in the same folder as testBw.exe.
Any help is appreciated.
Thanks,
pranith
0 Kudos
Roman_D_Intel
Employee
2,538 Views
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
0 Kudos
pranith
Beginner
2,537 Views
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.
0 Kudos
pranith
Beginner
2,537 Views
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)."
0 Kudos
Roman_D_Intel
Employee
2,537 Views
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
0 Kudos
pranith
Beginner
2,537 Views
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.
0 Kudos
Roman_D_Intel
Employee
2,537 Views
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
0 Kudos
pranith
Beginner
2,537 Views
I believe I am calling them in the right order. Here is my code snippet:

0 Kudos
pranith
Beginner
2,537 Views
Ah, you seem to be right! I was instantiating "SystemCounterState" which was in turn calling PCM::getInstance(). Thanks a lot for all the help!
0 Kudos
Roman_D_Intel
Employee
2,537 Views
Pranith,

you are welcome.

Roman
0 Kudos
alextui
Beginner
2,536 Views
It seems like a problem in theinstantiation of PCM.
0 Kudos
pengfei_w_Intel
Employee
2,536 Views

hi pranith

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

thanks a lot

0 Kudos
Patrick_F_Intel1
Employee
2,536 Views

Hello Pengfei,

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

Pat

0 Kudos
Reply