Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid using the hard-coded /usr/share/pcm/ path #480

Open
amosawi9999 opened this issue Dec 16, 2022 · 9 comments
Open

Avoid using the hard-coded /usr/share/pcm/ path #480

amosawi9999 opened this issue Dec 16, 2022 · 9 comments

Comments

@amosawi9999
Copy link

amosawi9999 commented Dec 16, 2022

When running pcm-iio for monitoring PCIe bandwidth, tool says that detected IceLake-SP processors but doesn't have proper event file :

Detected Intel(R) Xeon(R) Silver 4310 CPU @ 2.10GHz "Intel(r) microarchitecture codename Icelake-SP" stepping 6 microcode level 0xd000375
Error info:event file opCode-106.txt or /usr/share/pcm/opCode-106.txt is not available. Copy it from PCM build directory.
Event configure file have the problem and cause the program exit, please double check it!

building from master branch, also copied opCode-106 to /usr/local/share/pcm but problem still exists.

some basic tools such pcm, pcm-memory, pcm-numa, pcm-pcie are working, but pcm-iio doesn't work.

@rdementi
Copy link
Contributor

thanks for reporting this issue. We had seen a similar one (introduced in the recent version) and which will be fixed in the next release. Could you please try the previous release: https://github.com/intel/pcm/releases/tag/202210

@amosawi9999
Copy link
Author

It works fine, thanks for quick reply

@amosawi9999
Copy link
Author

amosawi9999 commented Dec 16, 2022

another problem, pcm-iio running fine when executed from the build directory, but not when running from /usr/share/sbin/, seems that install script dont copy the opCode-* to /usr/share/pcm/, they're present in /usr/local/share/pcm but pcm-iio only looks for /usr/share/pcm.
PS: is there any option to only show counters for specific socket/device not all of them?!

@ogbrugge
Copy link
Contributor

std::ifstream in(fn);
std::string line, item;
if (!in.is_open())
{
    const auto alt_fn = std::string("/usr/share/pcm/") + fn;
    in.open(alt_fn);
    if (!in.is_open())

The code looks in the current directory first, fn is only a file name, then in /usr/share/pcm/. This should be made configurable based on cmake parameters or enforced by the cmake magic to always install in this /usr/share/pcm directory. User should have last say so I think it should become configurable. Perhaps @markovamaria can make this change?

@rdementi
Copy link
Contributor

This might be tricky because of rpm build process that need a custom ${CMAKE_INSTALL_PREFIX} during the rpm build process. For example: https://build.opensuse.org/package/live_build_log/home:opcm/OPCM/openSUSE_Leap_15.1/x86_64

When the rpm is installed pcm files should end up in /usr/share/pcm . For rpm the ${CMAKE_INSTALL_PREFIX} and the final location differ...

@ogbrugge
Copy link
Contributor

Yes for this there is BUILDROOT, cmake has support for this and the rpm need to mention that it want to use BUILDROOT during building.

@rdementi
Copy link
Contributor

Yes for this there is BUILDROOT, cmake has support for this and the rpm need to mention that it want to use BUILDROOT during building.

good to know. I would like to see how this works.

@ogbrugge
Copy link
Contributor

ogbrugge commented Dec 19, 2022

https://stackoverflow.com/questions/8084796/what-actually-is-rpm-build-root The first answer explains it pretty well what the purpose of the rpm build root is.

cmake also supports DESTDIR
With this you can retarget the installation path during building for packaging

make install DESTDIR=/my/special/buildroot/

and now everything will be installed using that as base root. The opCodeXYZ.txt fille will end up under /my/special/buildroot/usr/share/pcm/opCodeXYZ.txt. Buildroot set to this path in the SPEC file will cause this path to be added as base path for all files directives.

A normal installation can use / for DESTDIR and it all ends up where it was meant to go.

A BuildRoot like this "BuildRoot: %{_tmppath}/%{name}-buildroot-%{version}-%{release}" as proposed by MarkHu is good practise. It might be that SUSE, RedHat or Fedora defines its own BuildRoot in the default rpmrc file but the SPEC file overrides it anyway and does no harm, iirc it is cleaned up anyway after building.

@rdementi
Copy link
Contributor

rdementi commented Dec 19, 2022

ok. Then we could pass ${CMAKE_INSTALL_PREFIX} to cpp with -D parameter and use it instead of the hard-coded path prefix and use make install DESTDIR during the rpm build.

@rdementi rdementi changed the title No support for IceLake-SP CPU Avoid using the hard-coded /usr/share/pcm/ path Jan 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants