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

Set size of perf_attr_struct prior to getting pfm encoding #88

Merged
merged 1 commit into from
Nov 8, 2023

Conversation

jishminor
Copy link
Contributor

@jishminor jishminor commented Sep 13, 2023

Pull Request Description

Simple fix to ensure correct size of struct gets mem copied in pfm_lib_perf_event_encode in libpfm4.

Events from pfm4 which contain values in the config2 field of the perf_event_attr struct seem to not get copied in pfm_lib_perf_event_encode when opening up a PAPI event.

The general trace of this issue is:

  1. ntv_evt->attr is zeroed out here
  2. attr.size is 0 here, resulting in PERF_ATTR_SIZE_VER0 being used as the default size used to memcpy the perf_event_attr which the user gets back from the function here.
  3. This results in additional fields required to open some events in perf such as config2 not being set when requested.

@gcongiu gcongiu force-pushed the fix/perf_struct_size branch from f2e5239 to a2dff10 Compare October 2, 2023 14:37
@gcongiu gcongiu added this to the PAPI 7.1.0 release milestone Nov 7, 2023
@gcongiu gcongiu force-pushed the fix/perf_struct_size branch from ec1d58e to b514860 Compare November 8, 2023 10:58
@gcongiu gcongiu merged commit 57f70bb into icl-utk-edu:master Nov 8, 2023
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants